initrd in 2.6
initrd in 2.6
Posted Nov 23, 2006 8:09 UTC (Thu) by ldo (guest, #40946)Parent article: Embedded Linux: Small Root Filesystems
The article seems to suggest that initrd is no longer used with 2.6 kernels. In fact initrd is still available with 2.6, and is used instead of initramfs by Red Hat and SuSE, that I know of.
Posted Nov 23, 2006 15:18 UTC (Thu)
by scottt (guest, #5028)
[Link] (3 responses)
Posted Nov 24, 2006 1:43 UTC (Fri)
by ldo (guest, #40946)
[Link] (2 responses)
You're right! I checked the initrd on my SuSE 10.0 system, and it is in fact a compressed cpio archive! No wonder I had no luck trying to mount it as a loopback image :).
Another thought, though: with the old loopback initrd, all the memory used was freed after the pivot_root and the dismount. But with the initramfs mechanism putting things into rootfs, those things stay there, taking up memory, being only hidden when the real root filesystem is mounted on /. Does that make sense?
Posted Nov 26, 2006 0:11 UTC (Sun)
by landley (guest, #6789)
[Link] (1 responses)
cd newroot
This frees up the space used by the initramfs by deleting all the files
The reason you can't do this in a shell script is after the "rm -rf" step,
Posted Nov 27, 2006 6:24 UTC (Mon)
by ldo (guest, #40946)
[Link]
Of course, you wouldn't need a special boot-time utility for this, you could do the cleanup at your leisure afterwards, if only something like this were permissible:
But this appears to be ruled out by the NOUSER flag...
dmesg | grep initramfsthe initrd is actually an initramfs
checking if image is initramfs... it is
Re: the initrd is actually an initramfs
The switch_root utility essentially does:Re: the initrd is actually an initramfs
find / -xdev | xargs rm -rf
mount --move . /
chroot . /sbin/init
before switching to the new root device. (With ramfs, deleting the file
frees the memory.)
the shell script hasn't got a "mount" command to run anymore...
Re: the initrd is actually an initramfs
mount -t rootfs rootfs /mnt