[OT] initramfs (was: Why '-c DEV' option for switch_root?)

Laurent Bercot ska-dietlibc at skarnet.org
Tue Dec 17 10:50:36 UTC 2013


  Hi Harald,


> ... still have the question: How is a read only file system, like
> squashfs easier to maintain than a initramfs? IMO you only
> compare with kernel bundled initramfs usage, but initramfs means
> cpio archiv which may be loaded separately.

  Well, my point was comparing with a kernel-bundled initramfs, yes.
I agree that a simple cpio archive isn't any worse than any other
file archive made with mksquashfs/mcramfs/whatever.
  Honestly, you might be right, and it has also been some time since
I've used initramfs; back then, I found it impractical, then tried
doing without it when I had full powers on a project, and liked that
approach better.

  My main dislike isn't actually with initramfs, it's with switch_root.
I find pivot_root elegant and intuitive, whereas switch_root is kludgy
and ugly (especially since I had to do everything by hand for some
reason I can't remember). I wouldn't argue much against initramfs if
you could pivot_root out of it.  Which brings us to the next point:


> Live firmware upgrades on a read only file system? How do you do
> this? You need to at least create a new squashfs image. If yourr
> flash does not contain an underlying file system with lots of
> extra space you can't install the new image. If your flash device
> does only contain the squashfs as bare file system, you need to
> overwrite this image. Live update?

  Of course I assumed you had enough space on your storage for both
your old and your new image. You can mount your new image,
pivot_root to it, live test, and set bootloader flags if it works. Just
pivot_root back if it fails. Of course you need to restart your
application anyway, but you might have some lighter test procedures to
perform first.
  If your firmware lives in an initramfs, you have to reboot for the
upgrade, and reboot again if you need to roll back.


> What is different here? Why can't you access your utilities
> from a mass storage drive when booting with an initramfs? Just
> check and mount the local file system then you have access.

  Well if you have local storage, then you don't need an initramfs. xD
It's just less of a hassle to have a fully populated /bin as soon as
you boot. With an initramfs, you have to duplicate a few binaries and
perform additional work to get to the same point. Nothing deal-breaking,
but it still makes your life harder than it needs to be.

-- 
  Laurent



More information about the busybox mailing list