2003-03-12 08:16:08

by Oliver Tennert

[permalink] [raw]
Subject: Kernel setup()

Hi Marcelo,

I am lacking some understanding concerning the setup() routine of Linux
>=2.4.19.

If I understand it right, then with kernel version 2.4.19, some novelties
concerning the handling of initrd and rootdevs has entered the kernel.

The same "linuxrc" program, e.g., can work with a 2.4.18, but not with a
2.4.19/20.

I have thought (and the initrd documentation in the Documentation/
directory states it, too) that the pivot_root mechanism is the "new one",
whereas the change_root machanism which automatically takes place if the
linuxrc programs exits for some reason, is the "old one".

Now have a look a the following example linuxrc sniplet, taken from
SuSE-7.3/8.0.


--- mk_initrd Tue Mar 4 14:13:43 2003
+++ mk_initrd Tue Mar 4 14:14:43 2003
...

mount -n -t proc proc /proc
+echo 0x0100 > /proc/sys/kernel/real-root-dev
mount -n -t $rootfstype $rootdev /mnt
rm -f /mnt/.initrd 2>/dev/null
mkdir -p /mnt/.initrd
..

The point is that without the "echo ..." line, the mounting of the
__real__ root device (harddisk partition) won't work for kernels >=2.4.19.

On the other hand, this should actually not be necessary if using a
pivot_root call.

Recent distributions now handle the problem by just having linuxrc loading
the necessary modules and exiting all of a sudden, and everything works.

My question is: is pivot_root deprecated by now? I just am quite dazzled
and want to know how to __cleanly__ handle the mounting of a new root
device.

Best regards

Oliver


Dr. Oliver Tennert

+49 -7071 -9457-598

e-mail: [email protected]
science + computing AG
Hagellocher Weg 71
D-72070 Tuebingen



2003-03-12 16:14:07

by H. Peter Anvin

[permalink] [raw]
Subject: Re: Kernel setup()

Followup to: <[email protected]>
By author: Oliver Tennert <[email protected]>
In newsgroup: linux.dev.kernel
>
> My question is: is pivot_root deprecated by now? I just am quite dazzled
> and want to know how to __cleanly__ handle the mounting of a new root
> device.
>

pivot_root() is the currently preferred method. Depending on where
the initramfs is by the time Linux 2.6 comes out it may be replaced by
then, but for 2.4, pivot_root() is the way to go.

-hpa
--
<[email protected]> at work, <[email protected]> in private!
"Unix gives you enough rope to shoot yourself in the foot."
Architectures needed: ia64 m68k mips64 ppc ppc64 s390 s390x sh v850 x86-64