[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [OT] initramfs (was: Why '-c DEV' option for switch_root?)
From:       Laurent Bercot <ska-dietlibc () skarnet ! org>
Date:       2013-12-17 15:05:07
Message-ID: 52B06823.70902 () skarnet ! org
[Download RAW message or body]


  Hi Didier,

>      I actually have a jffs2 filesystem on another part of the flash
> memory, but I decided not to use it for the purpose, for one reason: A
> single stupid bug might make the device non-bootable. Because, even if
> the jffs2 or squashfs is initially mounted read-only, the main reason to
> use it is the possibility to remount it read-write and modify it. You
> see the point? Better work hard in the beginning to work out a good
> stable initramfs which nobody can change/corrupt.

  Having an unmodifiable rootfs is indeed a very important guarantee to
have. But having it on the flash device doesn't mean it's a good idea
to remount it read-write ! As you say, your rootfs should remain
read-only all the time - that's why I traditionally used cramfs or
squashfs. You can partition the flash to contain both your read-only
rootfs and some jffs2 containing your read-write data.


>      With the initramfs, you restart always from a clean situation (once
> debugged of course). And the userland in my initramfs has a possibility
> to escape the normal sequence and start an interactive session, which
> allows to debug the environment.

  Same thing with a read-only rootfs stored in flash, with the additional
benefit that your debug environment doesn't have to be loaded into RAM
if you don't need it. Put a full recovery system in your rootfs, make it
as big and friendly as will fit in half your flash (to leave room for
firmware upgrades!), don't get constrained by RAM.


>      By the way, you wrote that initramfs is a trap. What is the trap,
> is it initramfs or the need for swhtch_root? Is it different if I
> switch_root from another filesystem?

  initramfs is not a lethal trap, it's just that in my experience, using
it will end up making you work more than not using it, for several
reasons. switch_root is one of those reasons; if you're booting from 
another filesystem, nothing forces you to switch_root. The simplest,
easiest design is to directly boot on your real rootfs - and whenever
you need to change roots, pivot_root is a lot friendlier than
switch_root, letting you keep working, open fds on the old root and
clean up later.

-- 
  Laurent
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic