elf file format
Posted: Wed Jun 26, 2002 11:00 pm
Hi, i've been trying to create a simple exec file for grub to load to get some idea that at least something can run when grub loads. then build on from it.
So, there's two questions here.
First, i've been told in the past (on this board in fact) that grub does the switch to pmode. If what is the state of the machine when it jumps to the os. Grub manuals, as far as i can tell, don't say anything about pmode or what the machine is like at os loading.
Secondly, i get the error message in ld:
kernel.o: In function `_start':
kernel.o(.text+0x8): relocation truncated to fit: R_386_16 .text
What does this mean? Currently my kernel, if you could call it that, looks like this:
[BITS 32]
[GLOBAL _start]
[SECTION .text]
dw 0x1BADB002
dw 0x000000000
dw 0x1BADB002
_start:
mov si, msg
call displaystring
mov ah, 0
int 016h
db 0EAh
dw 0000h
dw 0FFFFh
displaystring:
lodsb
or al,al
jz short finish
mov ah,0x0E
mov bx,0x0007
int 0x10
jmp displaystring
finish:
retn
msg db 'Press Any Key ...', 13, 10, 0
Basically, this code runs start and displays some text, waits for keyboard activity and then reboots. (i got it from something else).
Is the correct layout for an elf file to work which is why i get the above ld linker error, also, is the multiboot header right? I think it is, as far as some multiboot spec that i found goes, bit 16 doesn't need to be set in the flags cos im using the elf file format but when i load a similar version of the above code (a bit cut down to just display some messaging and no reboot or keyboard business grub says the file format is not supported.
^ a bit long but hopefully someone will be kind enough to allow me to even start some kind of kernel. Thanks
Regards Brill.
So, there's two questions here.
First, i've been told in the past (on this board in fact) that grub does the switch to pmode. If what is the state of the machine when it jumps to the os. Grub manuals, as far as i can tell, don't say anything about pmode or what the machine is like at os loading.
Secondly, i get the error message in ld:
kernel.o: In function `_start':
kernel.o(.text+0x8): relocation truncated to fit: R_386_16 .text
What does this mean? Currently my kernel, if you could call it that, looks like this:
[BITS 32]
[GLOBAL _start]
[SECTION .text]
dw 0x1BADB002
dw 0x000000000
dw 0x1BADB002
_start:
mov si, msg
call displaystring
mov ah, 0
int 016h
db 0EAh
dw 0000h
dw 0FFFFh
displaystring:
lodsb
or al,al
jz short finish
mov ah,0x0E
mov bx,0x0007
int 0x10
jmp displaystring
finish:
retn
msg db 'Press Any Key ...', 13, 10, 0
Basically, this code runs start and displays some text, waits for keyboard activity and then reboots. (i got it from something else).
Is the correct layout for an elf file to work which is why i get the above ld linker error, also, is the multiboot header right? I think it is, as far as some multiboot spec that i found goes, bit 16 doesn't need to be set in the flags cos im using the elf file format but when i load a similar version of the above code (a bit cut down to just display some messaging and no reboot or keyboard business grub says the file format is not supported.
^ a bit long but hopefully someone will be kind enough to allow me to even start some kind of kernel. Thanks
Regards Brill.