View previous topic :: View next topic |
Author |
Message |
sge_kane Tux's lil' helper
Joined: 10 Oct 2004 Posts: 84 Location: Germany (Frankfurt)
|
Posted: Sun Aug 21, 2005 9:37 pm Post subject: general GRUB question (root=) option |
|
|
When I set up my first Gentoo using GRUB and followed Gentoo's intallation manual step-by-step, I did not provide a "root=" option behind the kernel command in /boot/grub/grub.conf.
My setup is like this:
hda1 is Windoze
hda2 is my boot
hda3 is my swap
...
hda5 is my root
hda6 is my home
So everythin a provide in grub.conf for a specific kernel is:
Code: |
title = "...."
root (hd0,1)
kernel (hd0,1)/vmlinuz
|
As you can see there is no informatin about my real root device, containing the "init" stuff...
Ah, before I forget, I got ntldr in MBR and hda1, and grub in hda2 which is the active primary partition...
I just wondered why this works without specifying a "root=" option, which is mentioned in all actual Genttoo docs and the official Grub docs...
I did not find any clue concerning my question...
Thanx for any clues...
sge_kane
Last edited by sge_kane on Mon Aug 22, 2005 1:27 am; edited 1 time in total |
|
Back to top |
|
|
dev-urandom Apprentice
Joined: 24 Jun 2005 Posts: 260 Location: Huh?
|
Posted: Mon Aug 22, 2005 12:42 am Post subject: Re: general GRUB question (root=) option |
|
|
Hmm, you seem lucky I have 3 kernels and 2 roots to play with so i defenitely need it ) _________________ /earth: file system full. |
|
Back to top |
|
|
Taladar Guru
Joined: 09 Oct 2004 Posts: 458 Location: Bielefeld, Germany
|
Posted: Mon Aug 22, 2005 12:51 am Post subject: |
|
|
Something is not correct with the info you provided. With this config file Grub should search for the kernel on your Windows Partition which can not work. |
|
Back to top |
|
|
widan Veteran
Joined: 07 Jun 2005 Posts: 1512 Location: Paris, France
|
Posted: Mon Aug 22, 2005 12:53 am Post subject: |
|
|
There's a bit of magic there. For the i386 architecture (didn't look for others), it will work as long as the root device is the same at the time of kernel compilation and at boot time (ie it won't work if you compile a kernel on another machine with different devices, but it will work on a given machine).
A kernel image contains a "default" root device embedded in it. The default root device is set by the build program (in arch/i386/boot/tools/build.c) after final linking (this program creates the final image from a boot sector, some startup code, and the actual kernel). If you look at arch/i386/boot/Makefile, you will find a line:
Code: | ROOT_DEV := CURRENT |
In there you can put a /dev/somedev, FLOPPY or CURRENT. The "magic" one is CURRENT. This tells the build program to embed the current root device as the default root in the kernel image (it makes sense, since you usually build a new kernel on the system that will run it... so the root won't change). It gets the proper device by stat()-ing the / mount point and looking at the device it lives on. Since during a gentoo install you're in a chroot, the / as seen by the build program is on the correct root device... so it works. |
|
Back to top |
|
|
sge_kane Tux's lil' helper
Joined: 10 Oct 2004 Posts: 84 Location: Germany (Frankfurt)
|
Posted: Mon Aug 22, 2005 1:26 am Post subject: |
|
|
@taladar:
i created this thread on another machine and therefore hadn't the luck to use a nice copy&paste to insert my correct grub.conf....
You're of course absolutely right, as this wouldn't make any sense... Edited above to (hd0,1).....
@widan:
Many thanx for this very informative reply... Now, everything makes sense... Thought of something like that, but now I know for sure...
sge_kane |
|
Back to top |
|
|
|