xref: /OK3568_Linux_fs/kernel/Documentation/admin-guide/initrd.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunUsing the initial RAM disk (initrd)
2*4882a593Smuzhiyun===================================
3*4882a593Smuzhiyun
4*4882a593SmuzhiyunWritten 1996,2000 by Werner Almesberger <werner.almesberger@epfl.ch> and
5*4882a593SmuzhiyunHans Lermen <lermen@fgan.de>
6*4882a593Smuzhiyun
7*4882a593Smuzhiyun
8*4882a593Smuzhiyuninitrd provides the capability to load a RAM disk by the boot loader.
9*4882a593SmuzhiyunThis RAM disk can then be mounted as the root file system and programs
10*4882a593Smuzhiyuncan be run from it. Afterwards, a new root file system can be mounted
11*4882a593Smuzhiyunfrom a different device. The previous root (from initrd) is then moved
12*4882a593Smuzhiyunto a directory and can be subsequently unmounted.
13*4882a593Smuzhiyun
14*4882a593Smuzhiyuninitrd is mainly designed to allow system startup to occur in two phases,
15*4882a593Smuzhiyunwhere the kernel comes up with a minimum set of compiled-in drivers, and
16*4882a593Smuzhiyunwhere additional modules are loaded from initrd.
17*4882a593Smuzhiyun
18*4882a593SmuzhiyunThis document gives a brief overview of the use of initrd. A more detailed
19*4882a593Smuzhiyundiscussion of the boot process can be found in [#f1]_.
20*4882a593Smuzhiyun
21*4882a593Smuzhiyun
22*4882a593SmuzhiyunOperation
23*4882a593Smuzhiyun---------
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunWhen using initrd, the system typically boots as follows:
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun  1) the boot loader loads the kernel and the initial RAM disk
28*4882a593Smuzhiyun  2) the kernel converts initrd into a "normal" RAM disk and
29*4882a593Smuzhiyun     frees the memory used by initrd
30*4882a593Smuzhiyun  3) if the root device is not ``/dev/ram0``, the old (deprecated)
31*4882a593Smuzhiyun     change_root procedure is followed. see the "Obsolete root change
32*4882a593Smuzhiyun     mechanism" section below.
33*4882a593Smuzhiyun  4) root device is mounted. if it is ``/dev/ram0``, the initrd image is
34*4882a593Smuzhiyun     then mounted as root
35*4882a593Smuzhiyun  5) /sbin/init is executed (this can be any valid executable, including
36*4882a593Smuzhiyun     shell scripts; it is run with uid 0 and can do basically everything
37*4882a593Smuzhiyun     init can do).
38*4882a593Smuzhiyun  6) init mounts the "real" root file system
39*4882a593Smuzhiyun  7) init places the root file system at the root directory using the
40*4882a593Smuzhiyun     pivot_root system call
41*4882a593Smuzhiyun  8) init execs the ``/sbin/init`` on the new root filesystem, performing
42*4882a593Smuzhiyun     the usual boot sequence
43*4882a593Smuzhiyun  9) the initrd file system is removed
44*4882a593Smuzhiyun
45*4882a593SmuzhiyunNote that changing the root directory does not involve unmounting it.
46*4882a593SmuzhiyunIt is therefore possible to leave processes running on initrd during that
47*4882a593Smuzhiyunprocedure. Also note that file systems mounted under initrd continue to
48*4882a593Smuzhiyunbe accessible.
49*4882a593Smuzhiyun
50*4882a593Smuzhiyun
51*4882a593SmuzhiyunBoot command-line options
52*4882a593Smuzhiyun-------------------------
53*4882a593Smuzhiyun
54*4882a593Smuzhiyuninitrd adds the following new options::
55*4882a593Smuzhiyun
56*4882a593Smuzhiyun  initrd=<path>    (e.g. LOADLIN)
57*4882a593Smuzhiyun
58*4882a593Smuzhiyun    Loads the specified file as the initial RAM disk. When using LILO, you
59*4882a593Smuzhiyun    have to specify the RAM disk image file in /etc/lilo.conf, using the
60*4882a593Smuzhiyun    INITRD configuration variable.
61*4882a593Smuzhiyun
62*4882a593Smuzhiyun  noinitrd
63*4882a593Smuzhiyun
64*4882a593Smuzhiyun    initrd data is preserved but it is not converted to a RAM disk and
65*4882a593Smuzhiyun    the "normal" root file system is mounted. initrd data can be read
66*4882a593Smuzhiyun    from /dev/initrd. Note that the data in initrd can have any structure
67*4882a593Smuzhiyun    in this case and doesn't necessarily have to be a file system image.
68*4882a593Smuzhiyun    This option is used mainly for debugging.
69*4882a593Smuzhiyun
70*4882a593Smuzhiyun    Note: /dev/initrd is read-only and it can only be used once. As soon
71*4882a593Smuzhiyun    as the last process has closed it, all data is freed and /dev/initrd
72*4882a593Smuzhiyun    can't be opened anymore.
73*4882a593Smuzhiyun
74*4882a593Smuzhiyun  root=/dev/ram0
75*4882a593Smuzhiyun
76*4882a593Smuzhiyun    initrd is mounted as root, and the normal boot procedure is followed,
77*4882a593Smuzhiyun    with the RAM disk mounted as root.
78*4882a593Smuzhiyun
79*4882a593SmuzhiyunCompressed cpio images
80*4882a593Smuzhiyun----------------------
81*4882a593Smuzhiyun
82*4882a593SmuzhiyunRecent kernels have support for populating a ramdisk from a compressed cpio
83*4882a593Smuzhiyunarchive. On such systems, the creation of a ramdisk image doesn't need to
84*4882a593Smuzhiyuninvolve special block devices or loopbacks; you merely create a directory on
85*4882a593Smuzhiyundisk with the desired initrd content, cd to that directory, and run (as an
86*4882a593Smuzhiyunexample)::
87*4882a593Smuzhiyun
88*4882a593Smuzhiyun	find . | cpio --quiet -H newc -o | gzip -9 -n > /boot/imagefile.img
89*4882a593Smuzhiyun
90*4882a593SmuzhiyunExamining the contents of an existing image file is just as simple::
91*4882a593Smuzhiyun
92*4882a593Smuzhiyun	mkdir /tmp/imagefile
93*4882a593Smuzhiyun	cd /tmp/imagefile
94*4882a593Smuzhiyun	gzip -cd /boot/imagefile.img | cpio -imd --quiet
95*4882a593Smuzhiyun
96*4882a593SmuzhiyunInstallation
97*4882a593Smuzhiyun------------
98*4882a593Smuzhiyun
99*4882a593SmuzhiyunFirst, a directory for the initrd file system has to be created on the
100*4882a593Smuzhiyun"normal" root file system, e.g.::
101*4882a593Smuzhiyun
102*4882a593Smuzhiyun	# mkdir /initrd
103*4882a593Smuzhiyun
104*4882a593SmuzhiyunThe name is not relevant. More details can be found on the
105*4882a593Smuzhiyun:manpage:`pivot_root(2)` man page.
106*4882a593Smuzhiyun
107*4882a593SmuzhiyunIf the root file system is created during the boot procedure (i.e. if
108*4882a593Smuzhiyunyou're building an install floppy), the root file system creation
109*4882a593Smuzhiyunprocedure should create the ``/initrd`` directory.
110*4882a593Smuzhiyun
111*4882a593SmuzhiyunIf initrd will not be mounted in some cases, its content is still
112*4882a593Smuzhiyunaccessible if the following device has been created::
113*4882a593Smuzhiyun
114*4882a593Smuzhiyun	# mknod /dev/initrd b 1 250
115*4882a593Smuzhiyun	# chmod 400 /dev/initrd
116*4882a593Smuzhiyun
117*4882a593SmuzhiyunSecond, the kernel has to be compiled with RAM disk support and with
118*4882a593Smuzhiyunsupport for the initial RAM disk enabled. Also, at least all components
119*4882a593Smuzhiyunneeded to execute programs from initrd (e.g. executable format and file
120*4882a593Smuzhiyunsystem) must be compiled into the kernel.
121*4882a593Smuzhiyun
122*4882a593SmuzhiyunThird, you have to create the RAM disk image. This is done by creating a
123*4882a593Smuzhiyunfile system on a block device, copying files to it as needed, and then
124*4882a593Smuzhiyuncopying the content of the block device to the initrd file. With recent
125*4882a593Smuzhiyunkernels, at least three types of devices are suitable for that:
126*4882a593Smuzhiyun
127*4882a593Smuzhiyun - a floppy disk (works everywhere but it's painfully slow)
128*4882a593Smuzhiyun - a RAM disk (fast, but allocates physical memory)
129*4882a593Smuzhiyun - a loopback device (the most elegant solution)
130*4882a593Smuzhiyun
131*4882a593SmuzhiyunWe'll describe the loopback device method:
132*4882a593Smuzhiyun
133*4882a593Smuzhiyun 1) make sure loopback block devices are configured into the kernel
134*4882a593Smuzhiyun 2) create an empty file system of the appropriate size, e.g.::
135*4882a593Smuzhiyun
136*4882a593Smuzhiyun	# dd if=/dev/zero of=initrd bs=300k count=1
137*4882a593Smuzhiyun	# mke2fs -F -m0 initrd
138*4882a593Smuzhiyun
139*4882a593Smuzhiyun    (if space is critical, you may want to use the Minix FS instead of Ext2)
140*4882a593Smuzhiyun 3) mount the file system, e.g.::
141*4882a593Smuzhiyun
142*4882a593Smuzhiyun	# mount -t ext2 -o loop initrd /mnt
143*4882a593Smuzhiyun
144*4882a593Smuzhiyun 4) create the console device::
145*4882a593Smuzhiyun
146*4882a593Smuzhiyun    # mkdir /mnt/dev
147*4882a593Smuzhiyun    # mknod /mnt/dev/console c 5 1
148*4882a593Smuzhiyun
149*4882a593Smuzhiyun 5) copy all the files that are needed to properly use the initrd
150*4882a593Smuzhiyun    environment. Don't forget the most important file, ``/sbin/init``
151*4882a593Smuzhiyun
152*4882a593Smuzhiyun    .. note:: ``/sbin/init`` permissions must include "x" (execute).
153*4882a593Smuzhiyun
154*4882a593Smuzhiyun 6) correct operation the initrd environment can frequently be tested
155*4882a593Smuzhiyun    even without rebooting with the command::
156*4882a593Smuzhiyun
157*4882a593Smuzhiyun	# chroot /mnt /sbin/init
158*4882a593Smuzhiyun
159*4882a593Smuzhiyun    This is of course limited to initrds that do not interfere with the
160*4882a593Smuzhiyun    general system state (e.g. by reconfiguring network interfaces,
161*4882a593Smuzhiyun    overwriting mounted devices, trying to start already running demons,
162*4882a593Smuzhiyun    etc. Note however that it is usually possible to use pivot_root in
163*4882a593Smuzhiyun    such a chroot'ed initrd environment.)
164*4882a593Smuzhiyun 7) unmount the file system::
165*4882a593Smuzhiyun
166*4882a593Smuzhiyun	# umount /mnt
167*4882a593Smuzhiyun
168*4882a593Smuzhiyun 8) the initrd is now in the file "initrd". Optionally, it can now be
169*4882a593Smuzhiyun    compressed::
170*4882a593Smuzhiyun
171*4882a593Smuzhiyun	# gzip -9 initrd
172*4882a593Smuzhiyun
173*4882a593SmuzhiyunFor experimenting with initrd, you may want to take a rescue floppy and
174*4882a593Smuzhiyunonly add a symbolic link from ``/sbin/init`` to ``/bin/sh``. Alternatively, you
175*4882a593Smuzhiyuncan try the experimental newlib environment [#f2]_ to create a small
176*4882a593Smuzhiyuninitrd.
177*4882a593Smuzhiyun
178*4882a593SmuzhiyunFinally, you have to boot the kernel and load initrd. Almost all Linux
179*4882a593Smuzhiyunboot loaders support initrd. Since the boot process is still compatible
180*4882a593Smuzhiyunwith an older mechanism, the following boot command line parameters
181*4882a593Smuzhiyunhave to be given::
182*4882a593Smuzhiyun
183*4882a593Smuzhiyun  root=/dev/ram0 rw
184*4882a593Smuzhiyun
185*4882a593Smuzhiyun(rw is only necessary if writing to the initrd file system.)
186*4882a593Smuzhiyun
187*4882a593SmuzhiyunWith LOADLIN, you simply execute::
188*4882a593Smuzhiyun
189*4882a593Smuzhiyun     LOADLIN <kernel> initrd=<disk_image>
190*4882a593Smuzhiyun
191*4882a593Smuzhiyune.g.::
192*4882a593Smuzhiyun
193*4882a593Smuzhiyun	LOADLIN C:\LINUX\BZIMAGE initrd=C:\LINUX\INITRD.GZ root=/dev/ram0 rw
194*4882a593Smuzhiyun
195*4882a593SmuzhiyunWith LILO, you add the option ``INITRD=<path>`` to either the global section
196*4882a593Smuzhiyunor to the section of the respective kernel in ``/etc/lilo.conf``, and pass
197*4882a593Smuzhiyunthe options using APPEND, e.g.::
198*4882a593Smuzhiyun
199*4882a593Smuzhiyun  image = /bzImage
200*4882a593Smuzhiyun    initrd = /boot/initrd.gz
201*4882a593Smuzhiyun    append = "root=/dev/ram0 rw"
202*4882a593Smuzhiyun
203*4882a593Smuzhiyunand run ``/sbin/lilo``
204*4882a593Smuzhiyun
205*4882a593SmuzhiyunFor other boot loaders, please refer to the respective documentation.
206*4882a593Smuzhiyun
207*4882a593SmuzhiyunNow you can boot and enjoy using initrd.
208*4882a593Smuzhiyun
209*4882a593Smuzhiyun
210*4882a593SmuzhiyunChanging the root device
211*4882a593Smuzhiyun------------------------
212*4882a593Smuzhiyun
213*4882a593SmuzhiyunWhen finished with its duties, init typically changes the root device
214*4882a593Smuzhiyunand proceeds with starting the Linux system on the "real" root device.
215*4882a593Smuzhiyun
216*4882a593SmuzhiyunThe procedure involves the following steps:
217*4882a593Smuzhiyun - mounting the new root file system
218*4882a593Smuzhiyun - turning it into the root file system
219*4882a593Smuzhiyun - removing all accesses to the old (initrd) root file system
220*4882a593Smuzhiyun - unmounting the initrd file system and de-allocating the RAM disk
221*4882a593Smuzhiyun
222*4882a593SmuzhiyunMounting the new root file system is easy: it just needs to be mounted on
223*4882a593Smuzhiyuna directory under the current root. Example::
224*4882a593Smuzhiyun
225*4882a593Smuzhiyun	# mkdir /new-root
226*4882a593Smuzhiyun	# mount -o ro /dev/hda1 /new-root
227*4882a593Smuzhiyun
228*4882a593SmuzhiyunThe root change is accomplished with the pivot_root system call, which
229*4882a593Smuzhiyunis also available via the ``pivot_root`` utility (see :manpage:`pivot_root(8)`
230*4882a593Smuzhiyunman page; ``pivot_root`` is distributed with util-linux version 2.10h or higher
231*4882a593Smuzhiyun[#f3]_). ``pivot_root`` moves the current root to a directory under the new
232*4882a593Smuzhiyunroot, and puts the new root at its place. The directory for the old root
233*4882a593Smuzhiyunmust exist before calling ``pivot_root``. Example::
234*4882a593Smuzhiyun
235*4882a593Smuzhiyun	# cd /new-root
236*4882a593Smuzhiyun	# mkdir initrd
237*4882a593Smuzhiyun	# pivot_root . initrd
238*4882a593Smuzhiyun
239*4882a593SmuzhiyunNow, the init process may still access the old root via its
240*4882a593Smuzhiyunexecutable, shared libraries, standard input/output/error, and its
241*4882a593Smuzhiyuncurrent root directory. All these references are dropped by the
242*4882a593Smuzhiyunfollowing command::
243*4882a593Smuzhiyun
244*4882a593Smuzhiyun	# exec chroot . what-follows <dev/console >dev/console 2>&1
245*4882a593Smuzhiyun
246*4882a593SmuzhiyunWhere what-follows is a program under the new root, e.g. ``/sbin/init``
247*4882a593SmuzhiyunIf the new root file system will be used with udev and has no valid
248*4882a593Smuzhiyun``/dev`` directory, udev must be initialized before invoking chroot in order
249*4882a593Smuzhiyunto provide ``/dev/console``.
250*4882a593Smuzhiyun
251*4882a593SmuzhiyunNote: implementation details of pivot_root may change with time. In order
252*4882a593Smuzhiyunto ensure compatibility, the following points should be observed:
253*4882a593Smuzhiyun
254*4882a593Smuzhiyun - before calling pivot_root, the current directory of the invoking
255*4882a593Smuzhiyun   process should point to the new root directory
256*4882a593Smuzhiyun - use . as the first argument, and the _relative_ path of the directory
257*4882a593Smuzhiyun   for the old root as the second argument
258*4882a593Smuzhiyun - a chroot program must be available under the old and the new root
259*4882a593Smuzhiyun - chroot to the new root afterwards
260*4882a593Smuzhiyun - use relative paths for dev/console in the exec command
261*4882a593Smuzhiyun
262*4882a593SmuzhiyunNow, the initrd can be unmounted and the memory allocated by the RAM
263*4882a593Smuzhiyundisk can be freed::
264*4882a593Smuzhiyun
265*4882a593Smuzhiyun	# umount /initrd
266*4882a593Smuzhiyun	# blockdev --flushbufs /dev/ram0
267*4882a593Smuzhiyun
268*4882a593SmuzhiyunIt is also possible to use initrd with an NFS-mounted root, see the
269*4882a593Smuzhiyun:manpage:`pivot_root(8)` man page for details.
270*4882a593Smuzhiyun
271*4882a593Smuzhiyun
272*4882a593SmuzhiyunUsage scenarios
273*4882a593Smuzhiyun---------------
274*4882a593Smuzhiyun
275*4882a593SmuzhiyunThe main motivation for implementing initrd was to allow for modular
276*4882a593Smuzhiyunkernel configuration at system installation. The procedure would work
277*4882a593Smuzhiyunas follows:
278*4882a593Smuzhiyun
279*4882a593Smuzhiyun  1) system boots from floppy or other media with a minimal kernel
280*4882a593Smuzhiyun     (e.g. support for RAM disks, initrd, a.out, and the Ext2 FS) and
281*4882a593Smuzhiyun     loads initrd
282*4882a593Smuzhiyun  2) ``/sbin/init`` determines what is needed to (1) mount the "real" root FS
283*4882a593Smuzhiyun     (i.e. device type, device drivers, file system) and (2) the
284*4882a593Smuzhiyun     distribution media (e.g. CD-ROM, network, tape, ...). This can be
285*4882a593Smuzhiyun     done by asking the user, by auto-probing, or by using a hybrid
286*4882a593Smuzhiyun     approach.
287*4882a593Smuzhiyun  3) ``/sbin/init`` loads the necessary kernel modules
288*4882a593Smuzhiyun  4) ``/sbin/init`` creates and populates the root file system (this doesn't
289*4882a593Smuzhiyun     have to be a very usable system yet)
290*4882a593Smuzhiyun  5) ``/sbin/init`` invokes ``pivot_root`` to change the root file system and
291*4882a593Smuzhiyun     execs - via chroot - a program that continues the installation
292*4882a593Smuzhiyun  6) the boot loader is installed
293*4882a593Smuzhiyun  7) the boot loader is configured to load an initrd with the set of
294*4882a593Smuzhiyun     modules that was used to bring up the system (e.g. ``/initrd`` can be
295*4882a593Smuzhiyun     modified, then unmounted, and finally, the image is written from
296*4882a593Smuzhiyun     ``/dev/ram0`` or ``/dev/rd/0`` to a file)
297*4882a593Smuzhiyun  8) now the system is bootable and additional installation tasks can be
298*4882a593Smuzhiyun     performed
299*4882a593Smuzhiyun
300*4882a593SmuzhiyunThe key role of initrd here is to re-use the configuration data during
301*4882a593Smuzhiyunnormal system operation without requiring the use of a bloated "generic"
302*4882a593Smuzhiyunkernel or re-compiling or re-linking the kernel.
303*4882a593Smuzhiyun
304*4882a593SmuzhiyunA second scenario is for installations where Linux runs on systems with
305*4882a593Smuzhiyundifferent hardware configurations in a single administrative domain. In
306*4882a593Smuzhiyunsuch cases, it is desirable to generate only a small set of kernels
307*4882a593Smuzhiyun(ideally only one) and to keep the system-specific part of configuration
308*4882a593Smuzhiyuninformation as small as possible. In this case, a common initrd could be
309*4882a593Smuzhiyungenerated with all the necessary modules. Then, only ``/sbin/init`` or a file
310*4882a593Smuzhiyunread by it would have to be different.
311*4882a593Smuzhiyun
312*4882a593SmuzhiyunA third scenario is more convenient recovery disks, because information
313*4882a593Smuzhiyunlike the location of the root FS partition doesn't have to be provided at
314*4882a593Smuzhiyunboot time, but the system loaded from initrd can invoke a user-friendly
315*4882a593Smuzhiyundialog and it can also perform some sanity checks (or even some form of
316*4882a593Smuzhiyunauto-detection).
317*4882a593Smuzhiyun
318*4882a593SmuzhiyunLast not least, CD-ROM distributors may use it for better installation
319*4882a593Smuzhiyunfrom CD, e.g. by using a boot floppy and bootstrapping a bigger RAM disk
320*4882a593Smuzhiyunvia initrd from CD; or by booting via a loader like ``LOADLIN`` or directly
321*4882a593Smuzhiyunfrom the CD-ROM, and loading the RAM disk from CD without need of
322*4882a593Smuzhiyunfloppies.
323*4882a593Smuzhiyun
324*4882a593Smuzhiyun
325*4882a593SmuzhiyunObsolete root change mechanism
326*4882a593Smuzhiyun------------------------------
327*4882a593Smuzhiyun
328*4882a593SmuzhiyunThe following mechanism was used before the introduction of pivot_root.
329*4882a593SmuzhiyunCurrent kernels still support it, but you should _not_ rely on its
330*4882a593Smuzhiyuncontinued availability.
331*4882a593Smuzhiyun
332*4882a593SmuzhiyunIt works by mounting the "real" root device (i.e. the one set with rdev
333*4882a593Smuzhiyunin the kernel image or with root=... at the boot command line) as the
334*4882a593Smuzhiyunroot file system when linuxrc exits. The initrd file system is then
335*4882a593Smuzhiyununmounted, or, if it is still busy, moved to a directory ``/initrd``, if
336*4882a593Smuzhiyunsuch a directory exists on the new root file system.
337*4882a593Smuzhiyun
338*4882a593SmuzhiyunIn order to use this mechanism, you do not have to specify the boot
339*4882a593Smuzhiyuncommand options root, init, or rw. (If specified, they will affect
340*4882a593Smuzhiyunthe real root file system, not the initrd environment.)
341*4882a593Smuzhiyun
342*4882a593SmuzhiyunIf /proc is mounted, the "real" root device can be changed from within
343*4882a593Smuzhiyunlinuxrc by writing the number of the new root FS device to the special
344*4882a593Smuzhiyunfile /proc/sys/kernel/real-root-dev, e.g.::
345*4882a593Smuzhiyun
346*4882a593Smuzhiyun  # echo 0x301 >/proc/sys/kernel/real-root-dev
347*4882a593Smuzhiyun
348*4882a593SmuzhiyunNote that the mechanism is incompatible with NFS and similar file
349*4882a593Smuzhiyunsystems.
350*4882a593Smuzhiyun
351*4882a593SmuzhiyunThis old, deprecated mechanism is commonly called ``change_root``, while
352*4882a593Smuzhiyunthe new, supported mechanism is called ``pivot_root``.
353*4882a593Smuzhiyun
354*4882a593Smuzhiyun
355*4882a593SmuzhiyunMixed change_root and pivot_root mechanism
356*4882a593Smuzhiyun------------------------------------------
357*4882a593Smuzhiyun
358*4882a593SmuzhiyunIn case you did not want to use ``root=/dev/ram0`` to trigger the pivot_root
359*4882a593Smuzhiyunmechanism, you may create both ``/linuxrc`` and ``/sbin/init`` in your initrd
360*4882a593Smuzhiyunimage.
361*4882a593Smuzhiyun
362*4882a593Smuzhiyun``/linuxrc`` would contain only the following::
363*4882a593Smuzhiyun
364*4882a593Smuzhiyun	#! /bin/sh
365*4882a593Smuzhiyun	mount -n -t proc proc /proc
366*4882a593Smuzhiyun	echo 0x0100 >/proc/sys/kernel/real-root-dev
367*4882a593Smuzhiyun	umount -n /proc
368*4882a593Smuzhiyun
369*4882a593SmuzhiyunOnce linuxrc exited, the kernel would mount again your initrd as root,
370*4882a593Smuzhiyunthis time executing ``/sbin/init``. Again, it would be the duty of this init
371*4882a593Smuzhiyunto build the right environment (maybe using the ``root= device`` passed on
372*4882a593Smuzhiyunthe cmdline) before the final execution of the real ``/sbin/init``.
373*4882a593Smuzhiyun
374*4882a593Smuzhiyun
375*4882a593SmuzhiyunResources
376*4882a593Smuzhiyun---------
377*4882a593Smuzhiyun
378*4882a593Smuzhiyun.. [#f1] Almesberger, Werner; "Booting Linux: The History and the Future"
379*4882a593Smuzhiyun    https://www.almesberger.net/cv/papers/ols2k-9.ps.gz
380*4882a593Smuzhiyun.. [#f2] newlib package (experimental), with initrd example
381*4882a593Smuzhiyun    https://www.sourceware.org/newlib/
382*4882a593Smuzhiyun.. [#f3] util-linux: Miscellaneous utilities for Linux
383*4882a593Smuzhiyun    https://www.kernel.org/pub/linux/utils/util-linux/
384