> Out of curiosity, Is is possible to free up the resources used by > initramfs. I would be very interested in knowing how this can be done.
That is the point of switch_root. When you switch_root from an initramfs to another rootfs, you free up all the initramfs resources. Of course, you can't do it if you are still using initramfs as your "main" rootfs. > In my case, i am developing a system for an embedded system with NAND > storage. Due to NAND corruption issues that mostly arise right now is > when system is powered off while NAND writes are being performed (i.e. > when files are being flushed out to the filesystem). This corruption > makes the system un-bootable. Due to this issue i want to make the > NAND filesystem readonly. Only at the time of system updates the > filesystem will be remounted in rw mode. This still leaves room for > the corruption to occur during system updates. There's only one way to guarantee bootability even with updates: have *two* read-only partitions for the rootfs. Boot on one; when you download an update, write the binary file to the other one. Reboot. If it boots, use the new partition as your new rootfs; if not, fall back on the old one (it still works) and report a failure. > Right now i am thinking of having a initramfs filesystem with a > recovery system that starts a device recovery process if the system > partition cannot be mounted. So the intention is: You can do that, but that means your device will be non-functional (i.e. stuck in recovery mode) at the first failing update. (And trust me, failing updates WILL happen.) Your users will complain, and rightfully so. Better have two rootfs partitions so you can always guarantee that one of them boots into a functional system. > Problem with this system is, I may not be able to release the > resources used by the initramfs after switching the root (at least i > am not aware how it should be done). You don't even need an initramfs. You just need to mount a tmpfs early on during the boot process to have a place to write to. It's very possible, and much simpler, to boot directly on your real rootfs. If you are building an embedded device, do not copy what mainstream Linux distributions do, with initramfs and /lib/init/rw and whatnot. This is extremely and needlessly complicated, and will only give you more resources usage, a longer boot time, and more opportunities for failures - not even mentioning more headaches. -- Laurent _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
