GRUB and Char*

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
Phibred
Member
Member
Posts: 31
Joined: Sun Jun 26, 2005 11:00 pm
Location: Toronto, Ontario, Canada
Contact:

GRUB and Char*

Post by Phibred »

Hey, it has been a while and I'm trying to start up another operating system, this time in C and booting from GRUB.

Everything was working fine until I added

Code: Select all

char* helloWorld = "Hello World";
After that GRUB stopped booting my kernel. After that I commented out that line and it worked again.

I'm guessing the issue is something to do with my GRUB header is being pushed too deep into the file and grub is giving up on looking for it. Any advice on how to fix this? Maybe a linker trick I haven't found on the net?

Anyways, thanks for reading.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

I'm not 100%, But I think your linker script might need a .rodata section?
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Post by Solar »

BareBones in the Wiki has a "known good" GRUB loader / linker frame. Do you see any obvious differences between that and your code?
Every good solution is obvious once you've found it.
Post Reply