Page 1 of 1

loading elf and grub

Posted: Fri Jul 13, 2007 6:50 am
by AndrewAPrice
I'm using grub and an elf kernel and elf modules, and I have some questions.

From what I've read so far and when I experimented, it seems grub copies the contents of the the module straight from the disk into memory after where it loaded the kernel. I can the address of the module information from the multiboot header.

I'm guessing grub doesn't do anything (like aligning it to 2kb boundary for paging) so I'll have to move it around in memory.

How do I parse a elf file and prepare it to I can jump to it? Do I have to do anything special besides copy from the data section onward into a page? How do I find out where the data section starts? What do I do with the other sections?

I've only worked with flat binaries before.

Re: loading elf and grub

Posted: Fri Jul 13, 2007 8:58 am
by bluecode
You can force grub to align the modules to a 4kb boundary (it's somewhere in the multiboot header in your kernel) and grub can ungzip the kernel and the modules for you (transparent to the kernel).

All your questions regarding elf are answered in the Tool Interface Standard.