2003-08-07 22:30:28

by H. J. Lu

[permalink] [raw]
Subject: Initrd problem with 2.6 kernel

There is a chicken and egg problem with initrd on 2.6. When
root=/dev/xxx is passed to kernel, kernel will call try_name, which
uses /sys/block/drive/dev, to find out the device number for ROOT_DEV.
The problem is /sys/block/drive may not exist if the driver is loaded
by /linuxrc in initrd. As the result, /linuxrc can't use
/proc/sys/kernel/real-root-dev to determine the root device number.


H.J.


2003-08-08 00:30:31

by Andrew Morton

[permalink] [raw]
Subject: Re: Initrd problem with 2.6 kernel

"H. J. Lu" <[email protected]> wrote:
>
> There is a chicken and egg problem with initrd on 2.6. When
> root=/dev/xxx is passed to kernel, kernel will call try_name, which
> uses /sys/block/drive/dev, to find out the device number for ROOT_DEV.
> The problem is /sys/block/drive may not exist if the driver is loaded
> by /linuxrc in initrd. As the result, /linuxrc can't use
> /proc/sys/kernel/real-root-dev to determine the root device number.

You should be able to use the numeric identifier:

root=03:02

that's major:minor, and it recently changed. In 2.6.0-test2 that would be
"0302".


2003-08-08 10:49:34

by Herbert Xu

[permalink] [raw]
Subject: Re: Initrd problem with 2.6 kernel

H. J. Lu <[email protected]> wrote:
> There is a chicken and egg problem with initrd on 2.6. When
> root=/dev/xxx is passed to kernel, kernel will call try_name, which
> uses /sys/block/drive/dev, to find out the device number for ROOT_DEV.
> The problem is /sys/block/drive may not exist if the driver is loaded
> by /linuxrc in initrd. As the result, /linuxrc can't use
> /proc/sys/kernel/real-root-dev to determine the root device number.

You can replicate the sysfs probing in userspace. I did that in
Debian initrd-tools 0.1.51.
--
Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ )
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

2003-08-08 15:23:44

by H. J. Lu

[permalink] [raw]
Subject: Re: Initrd problem with 2.6 kernel

On Fri, Aug 08, 2003 at 08:49:16PM +1000, Herbert Xu wrote:
> H. J. Lu <[email protected]> wrote:
> > There is a chicken and egg problem with initrd on 2.6. When
> > root=/dev/xxx is passed to kernel, kernel will call try_name, which
> > uses /sys/block/drive/dev, to find out the device number for ROOT_DEV.
> > The problem is /sys/block/drive may not exist if the driver is loaded
> > by /linuxrc in initrd. As the result, /linuxrc can't use
> > /proc/sys/kernel/real-root-dev to determine the root device number.
>
> You can replicate the sysfs probing in userspace. I did that in
> Debian initrd-tools 0.1.51.

It sounds a good idea. I will give it a try.

Thanks.

H.J.

2003-08-08 20:52:20

by Andrey Borzenkov

[permalink] [raw]
Subject: Re: Initrd problem with 2.6 kernel

> There is a chicken and egg problem with initrd on 2.6. When
> root=/dev/xxx is passed to kernel, kernel will call try_name, which
> uses /sys/block/drive/dev, to find out the device number for ROOT_DEV.
> The problem is /sys/block/drive may not exist if the driver is loaded
> by /linuxrc in initrd. As the result, /linuxrc can't use
> /proc/sys/kernel/real-root-dev to determine the root device number.

{pts/1}% grep \"/sys\" *
do_mounts.c: sys_mkdir("/sys", 0700);
do_mounts.c: if (sys_mount("sysfs", "/sys", "sysfs", 0, NULL) < 0)
do_mounts.c: sys_umount("/sys", 0);
do_mounts.c: sys_rmdir("/sys");

or do you mean something different?

-andrey