Bran's kernel dev tutorial problem
-
deficite
Bran's kernel dev tutorial problem
I'm getting an error 13, and rightly so, my multiboot header keeps getting put near the end of my binary. I don't know a whole lot about ASM and linker scripts, but it looks like it should work to me (and I followed Bran's tutorial to the T on these two things)
Here's a post about this I made on OSDev's message board: http://www.osdev.org/phpBB2/viewtopic.php?t=2662
Here's a post about this I made on OSDev's message board: http://www.osdev.org/phpBB2/viewtopic.php?t=2662
-
LongHorn
Re:Bran's kernel dev tutorial problem
May be it's because there are some additional sections. You should compile sources with some options and try to use someother format instead of binary format.
-
Bob the Avenger
Re:Bran's kernel dev tutorial problem
try:
This should ensure the mboot label should be the first thing in your binary
Code: Select all
OUTPUT_FORMAT("binary")
ENTRY(start)
phys = 0x00100000;
SECTIONS
{
.text phys : AT(phys) {
*(mboot)
code = .;
*(.text)
. = ALIGN(4096);
}
.data : AT(phys + (data - code))
{
data = .;
*(.data)
. = ALIGN(4096);
}
.bss : AT(phys + (bss - code))
{
bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .;
}
-
deficite
Re:Bran's kernel dev tutorial problem
Bah...it's still not working even after using your linker script. Thanks anyway. I think I'm just going to try using elf instead of binary and see if it works out.
edit: I switched over to ELF and now everything works.
edit: I switched over to ELF and now everything works.
- Colonel Kernel
- Member

- Posts: 1437
- Joined: Tue Oct 17, 2006 6:06 pm
- Location: Vancouver, BC, Canada
- Contact:
Re:Bran's kernel dev tutorial problem
My kernel is just a flat binary, and it works for me. I just make sure that the .o file containing my multiboot header is the very first input file listed in the command line parameters sent to ld.
Hope this helps.
Hope this helps.
Top three reasons why my OS project died:
- Too much overtime at work
- Got married
- My brain got stuck in an infinite loop while trying to design the memory manager
- Pype.Clicker
- Member

- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Bran's kernel dev tutorial problem
when creating a multiboot binary (i mean, flat), you're really suggested to ask the linker for a symbol map, and check things are in place.
you may have it with "ld --print-map" (on stdout) or "ld -M -Map kernel.map", for instance.
you may have it with "ld --print-map" (on stdout) or "ld -M -Map kernel.map", for instance.
-
astrocrep
Re:Bran's kernel dev tutorial problem
I am getting stuck on this problem...
I tried your linker script and also tried output "elf32-i386"
Neither worked...
Grub gives the error 13.
Thanks,
Rich
I tried your linker script and also tried output "elf32-i386"
Neither worked...
Grub gives the error 13.
Thanks,
Rich
- Pype.Clicker
- Member

- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Bran's kernel dev tutorial problem
make sure you've read the "BareBones" and "HigherHalfBareBones" pages of the FAQ, then.
And if you could also post what "objdump -x YourKernel.elf" (the first lines: i don't care of symbols or cross-references), that may explain what's wrong.
And if you could also post what "objdump -x YourKernel.elf" (the first lines: i don't care of symbols or cross-references), that may explain what's wrong.
-
astrocrep
Re:Bran's kernel dev tutorial problem
Nevermind...
I just got it WORKING!!
Thanks all!
-Rich
I just got it WORKING!!
Thanks all!
-Rich
Re:Bran's kernel dev tutorial problem
And what, pray, was your solution? It might help others, you know...astrocrep wrote: Nevermind...
I just got it WORKING!!
Every good solution is obvious once you've found it.