Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
uglyoldbob
Member
Posts: 62 Joined: Tue Feb 13, 2007 10:46 am
Post
by uglyoldbob » Thu Aug 07, 2008 1:29 pm
I recently discovered a rather easy to make sure that a compiled kernel image is multiboot compliant.
Code: Select all
/* Link.ld */
OUTPUT_FORMAT("elf32-i386")
ENTRY(start)
SECTIONS
{
.text 0x0100000 :
{
. = ALIGN(4);
LONG(0x1BADB002)
LONG(0x00000003)
LONG(0xE4524FFB)
code = .; _code = .; __code = .;
*(.text)
*(.rodata)
. = ALIGN(4096);
}
.data :
{
data = .; _data = .; __data = .;
*(.data)
. = ALIGN(4096);
}
.rodata :
{
*(.rodata)
}
.bss :
{
bss = .; _bss = .; __bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .; _end = .; __end = .;
kernel_end = .;
}
I don't know if this is the best way to do it, but it did work for me.
I have an 80386SX 20MHz 2MB RAM.
It is my testbed platform. Only has the 3.5" and 5.25" floppy drives.
xyzzy
Member
Posts: 391 Joined: Wed Jul 25, 2007 8:45 am
Libera.chat IRC: aejsmith
Location: London, UK
Contact:
Post
by xyzzy » Thu Aug 07, 2008 1:32 pm
I define the Multiboot header to be in a seperate section, then link that section at the start of .text in the linker script.
sawdust
Member
Posts: 51 Joined: Thu Dec 20, 2007 4:04 pm
Post
by sawdust » Tue Aug 12, 2008 2:04 pm
AlexExtreme wrote: I define the Multiboot header to be in a seperate section, then link that section at the start of .text in the linker script.
I agree.