What's interface when using Grub to load Linux kernel?

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
cxsnew

What's interface when using Grub to load Linux kernel?

Post by cxsnew »

Seems there are not source codes of Linux kenrel to indicates that this kernel is multiboot compliant. So my question is:
how the Grub can load a non-multiboot-compliant OS kernel?
Some hints here?
And also if I want the Grub to load the Linux kernel image into another memory place, say 0x200000, how can I get this targer?
Thanks!!
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:What's interface when using Grub to load Linux kernel?

Post by Solar »

cxsnew wrote: Seems there are not source codes of Linux kenrel to indicates that this kernel is multiboot compliant. So my question is:
how the Grub can load a non-multiboot-compliant OS kernel?
Some hints here?
In the GRUB manual...

For a non-ramdisk boot with /boot on /dev/hda5 and / on /dev/hda6, try:

Code: Select all

title Linux
root (hd0,4)
kernel /linux-2.6.10 root=/dev/hda6
Adjust the name of your kernel file accordingly. For a ramdisk boot:

Code: Select all

title Linux
root (hd0,4)
kernel /linux-2.6.10 root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=/dev/hda6
initrd /initrd-2.6.10
Adjust the name of your kernel and ramdisk file accordingly.
And also if I want the Grub to load the Linux kernel image into another memory place, say 0x200000, how can I get this targer?
Don't know if that is possible.
Every good solution is obvious once you've found it.
cxsnew

Re:What's interface when using Grub to load Linux kernel?

Post by cxsnew »

Maybe your answer doesn't hit my point.
I just want to know how the Grub can load a non-multiboot-compliant OS kernel image? Because I can't find that Linux define a multi_boot_header in its source codes.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:What's interface when using Grub to load Linux kernel?

Post by Pype.Clicker »

that's just because GRUB does *more* than multiboot compliance. It also knows what Linux kernel looks like and how to load it. (for instance, it is likely to refuse loading it without the appropriate vmlinuz=... file)
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:What's interface when using Grub to load Linux kernel?

Post by Solar »

GRUB can also (chain)load Windows, load NetBSD, GNU/Hurd and a variety of others.

Above two examples are taken right from my grub.conf, and are fully functional.
Every good solution is obvious once you've found it.
cxsnew

Re:What's interface when using Grub to load Linux kernel?

Post by cxsnew »

Thanks!
But for my second question, can I let Grub load the Linux kernel image to the 0x200000?
Since Linux itself doesn't define a multiboot related header in its code, so I guess Grub maybe can get the kernel location info which defined in the vmlinux.lds, if that true does that mean the only thing that I should do is to modify the vmlinux.lds?
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:What's interface when using Grub to load Linux kernel?

Post by Pype.Clicker »

i'm not 100% sure of this, but imho, if the kernel hasn't been compiled to be loaded at a given location, loading it at that location will fail most painfully ...

I admit i don't see at all why you'd like to have linux loaded at a specific target address (and a technical linux-specific forum would probably be a better place to ask ...)
Post Reply