Page 1 of 1

Bran's Kernel Development

Posted: Sun Sep 14, 2008 8:10 am
by andypatterson
I've been working my way through Bran's Kernel Development Tutorial, something i'm sure many of you are familiar with (if not, it can be found here.. http://osdever.net/bkerndev/Docs/basickernel.htm).

I dont have a problem until I try to link a c file that contains an .rodata section (i.e. I have passed a string literal as a parameter). If I do this, the final binary which is outputted by the linker contains only the rodata section and seemingly nothing else except a load of nulls. There is no code whatsoever.

Could someone please take a look at the linker script and help me work out why this is happening?

Thanks in advance.

PS. (Apologies if I put this thread in the wrong section, I'm new here.)

Re: Bran's Kernel Development

Posted: Sun Sep 14, 2008 11:10 am
by suthers
The answer to this is very simple, because the linker script doesn't amount for a .rodata section..
try adding this between the end of the .bss section and the end symbol:

Code: Select all

  .rodata : AT(phys + (rodata - code))
  {
    rodata = .;
    *(.rodata)
    . = ALIGN(4096);
  }
I'm not sure this will work (never used C++ in kernel dev before....), but it should...
Oh and welcome, hope you have a good time here... :D
Jules

edit: spellings..

Re: Bran's Kernel Development

Posted: Thu Sep 18, 2008 11:18 pm
by sweetgum
Ive compiled this example, and Im wondering. How can I turn it into something I can use with VMWare to test the kernel? All I have is a .o file! Any ideas?

Re: Bran's Kernel Development

Posted: Fri Sep 19, 2008 12:39 am
by Combuster
VMWare needs the same thing as a real computer to boot from. That means you will have to create a bootable medium - Bran's tutorial comes with a floppy image containing GRUB which is the bootloader you'll want to use.