loading an ELF kernel
Posted: Sun Oct 03, 2004 12:15 pm
I'm using a plain binary kernel, end now I want to use an elf kernel.
I replaced this line in my makefile
by this one
and the content of kernel.ld file is
I'm using a bootloader that loads both kernel and setup codes then jump to setup code
the setup code do some tests switch to pmode, move the kernel to 0x100000 then do a far jump to 0x8:0x100000 where a plain binary copy of the kernel is
supposed to be.
but with the elf kernel (without modifing setup code) the system crash after loading doing the jump,
soafter reading some elf documentations I found where is the entry point (in my case its at offset 0x1000) so I did a far jump to 0x8:0x101000, now the kernel seems to run correctly but it dont print what it must print to the screen, it seems that data are in an incorrect place
so what is the solution tomake all this working correctly ?
must I dosome changes on loaded file (elf kernel) befor the far jump ?
I replaced this line in my makefile
Code: Select all
kernel:$(KERNOBJS)
ld --oformat binary -Ttext 100000 $^ -o xosker32.xss
by this one
Code: Select all
kernel:$(KERNOBJS)
ld $^ -T kernel.ld -o xosker32.xss
Code: Select all
OUTPUT_FORMAT("elf32-i386")
ENTRY(start)
SECTIONS {
.text 0x100000 : {
*(.text)
_etext = .;
etext = _etext;
}
.data : {
*(.data)
_edata = .;
edata = _edata;
}
.bss : {
*(.bss)
*(COMMON)
_end = .;
end = _end;
}
}
I'm using a bootloader that loads both kernel and setup codes then jump to setup code
the setup code do some tests switch to pmode, move the kernel to 0x100000 then do a far jump to 0x8:0x100000 where a plain binary copy of the kernel is
supposed to be.
but with the elf kernel (without modifing setup code) the system crash after loading doing the jump,
soafter reading some elf documentations I found where is the entry point (in my case its at offset 0x1000) so I did a far jump to 0x8:0x101000, now the kernel seems to run correctly but it dont print what it must print to the screen, it seems that data are in an incorrect place
so what is the solution tomake all this working correctly ?
must I dosome changes on loaded file (elf kernel) befor the far jump ?