Re: Initrd Question

From: der . eremit
Date: Fri Feb 13 2004 - 10:23:46 EST


On Fri, 13 Feb 2004 15:20:13 +0100, you wrote in linux.kernel:
>>> echo 0x0100 > /proc/sys/kernel/real-root-dev
>> This makes no sense as you're using pivot_root.
> this makes all sort of sense. Please check sources. It is required so
> that kernel will not attempt to mount root passed to it by loader.
> You are welcome to clean up the code :)

I'm not doing that and it works as expected. Note that the initrd code
in question never exits. It execs init. So when would the kernel do
this attempted mount of the root filesystem passed in by the bootloader?
My understanding is that the old, non-pivot_root method works by
exiting the initrd script - and *then* the kernel attempts to mount
real-root-dev.

In any case, if that wasn't clear, I expect the bootloader to pass
in root=/dev/ram0 anyway. ;)

>>> mount -n -o ro /dev/sda2 /new_root
>>
>> This doesn't even match with the 0x0100 above, now does it?
>
> so what? kernel happily ignores real-root-dev, it is possible that
> some user-level tools may be confused but I have not seen any so far.

Now you're saying the kernel ignores real-root-dev, while a moment
before you state that it is important to set real-root-dev because
otherwise the kernel does something. Which is it?

>>> pivot_root /new_root /new_root/initrd
>> You should cd into /new_root before running pivot_root,
> Huh? Why?
>
> SYNOPSIS
> pivot_root new_root put_old

And just a couple of lines further down:

Note that, depending on the implementation of pivot_root, root and cwd
of the caller may or may not change. The following is a sequence for
invoking pivot_root that works in either case, assuming that pivot_root
and chroot are in the current PATH:

cd new_root
pivot_root . put_old
exec chroot . command

The pivot_root(2) manpage states the same, by the way.

--
Ciao,
Pascal
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/