[uClibc] [ot] Initrd issues (was: Linux 2.6 ROMFS vs EXT2)

Matthias Kilian kili at outback.escape.de
Thu Mar 11 21:49:57 UTC 2004


Sorry for beeing a little bit offtopic; for further discussions, I
suggest to use PM.

On Thu, Mar 11, 2004 at 03:45:12PM -0500, Dave Dodge wrote:
> The usual problem has been that the kernel then immediately mounts the
> real root device on top of it.
[...]
>   http://www.zytor.com/pipermail/klibc/2003-November/000168.html

[I'm a little bit tired, so I didn't read the page mentioned above]

Radical patch: remove mount_root() call near the end of init/do_mounts.c,
which worked for <= 2.6.2. You'll get a kernel that can *only* boot with
an initramfs. More on this on sunday or so; I'll play with 2.6.3. this
weekend.


> I think it's also the case that when root does get mounted on top of
> the initramfs, any files left in the unpacked initramfs may be
> inaccessible but occupying memory.  So if you have a large initramfs
> you might have to actually delete the files prior to the mount if you want
> to free up the space.

With a little bit of pivot_root()/chroot() magic (which also holds for
the "new style" initrd setup, documented in Documentation/initrd.txt),
this shouldn't happen. After pivot_root()/chroot() you're on the real
rootfs and can umount() the initramfs.

Common errors/pitfalls:

- /proc and/or /dev are still mounted on the initramfs
- stdin, stdout and stderr (fd 0, 1, and 2) are still associated with
  /dev/console on initramfs. Something like

      exec < /newroot/dev/console > /newroot/dev/console 2>&1

  just before the pivot_root/chroot should help.

Ciao,
	Kili



More information about the uClibc mailing list