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.)
Bran's Kernel Development
Re: Bran's Kernel Development
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:
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...
Jules
edit: spellings..
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);
}
Oh and welcome, hope you have a good time here...
Jules
edit: spellings..
Re: Bran's Kernel Development
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?
- Combuster
- 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
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.