Bran's Kernel Development

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.
Post Reply
andypatterson
Posts: 2
Joined: Sun Sep 14, 2008 8:05 am

Bran's Kernel Development

Post 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.)
User avatar
suthers
Member
Member
Posts: 672
Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:

Re: Bran's Kernel Development

Post 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..
sweetgum
Member
Member
Posts: 37
Joined: Thu Sep 18, 2008 11:17 pm

Re: Bran's Kernel Development

Post 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?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Bran's Kernel Development

Post 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.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply