Page 2 of 2

Posted: Wed May 09, 2007 6:59 am
by urxae
Combuster wrote:GRUB may support both ELF and Multiboot, but other loaders may not necessarily do so (and support only one, or even neither).
From the spec:
Multiboot specification wrote:Compliant boot loaders must be able to load images that either are in elf format or contain the load address information embedded in the Multiboot header
So any compliant multiboot loader must support loading ELF images without the kludge.
Hence choosing multiboot is a perfectly valid decision. Besides, many tutorials target multiboot rather than elf.
I never said multiboot wasn't a valid option. I was just remarking that ELF support is a required part of the multiboot standard, so if you've got an ELF toolchain you might as well use multiboot+ELF.
Changing targets now will only cause more problems rather than solving any.
Unless the problem is in the "kludge" part of the multiboot header, which to me seems quite likely at this point. Using ELF allows removal of that part of the header, so the multiboot loader can use the data provided by the linker. Since the linker script looks reasonable (other than missing sections like .ctors and such) that might work.
And if it doesn't (because the unspecified sections are put in weird places by the linker?) at least objdump will be able to make sense of the image, perhaps allowing us to diagnose the real problem...

Posted: Fri May 11, 2007 5:04 am
by supagu
okay i might try converting to elf format, how do i do this, i've pretty much built the super low level stuff like this link script and batch file from some os tutorial.

Posted: Sat May 12, 2007 4:14 am
by urxae
supagu wrote:okay i might try converting to elf format, how do i do this, i've pretty much built the super low level stuff like this link script and batch file from some os tutorial.
My second-to-last post explained how to do that:
urxae wrote:Try changing the OUTPUT_FORMAT to an ELF variant (possibly most easily done by just omitting it, as it's probably the default for that toolchain) and disabling the "kludge" flag in the multiboot header.
So disable the kludge flag from your multiboot header, and remove the first line of your linker script (i.e. remove the OUTPUT_FORMAT line from link.ld).
If that doesn't work, try something like OUTPUT_FORMAT("i586-elf") as the first line instead. If that's not a supported output format, run "ld --help" and look for a line starting with "ld: supported targets:". Pick one that includes i?86 and elf.
Optionally, rename your kernel from kernel.bin to kernel.elf ;).

Posted: Sat May 12, 2007 8:43 pm
by supagu
i managed to get the problem solved by changing the link ld file to match the one from the c++ kernel tut.