02 Rootfs - Kakemixen/CrossLFS-nix GitHub Wiki

Rootfs

This page will describe the setup of the rootfs.

Read-only part

The main part of the system is a read-only squashfs filesystem (guide), containing all binaries and configuration files for the system to run. This will be the main part of a software update.

Writable part

The plan is to mount a partition of the storage medium as data storage, e.g. as /data. That was the system is able to write files across boots. This will most likely be database-like stuff or similar.

Binaries on the system probably expects other folder on the system to be writeable as well, and for that, perhaps tmpfs should work, such as for logs. One example guide can be found here

Old

It runs the init-program just fine, the debug-led on the rpi3 blinks, but everything seems to work well, I'll deal with it later.

Running the kernel with init=/bin/sh doesn't work, as the sysem seems to just hang. Could just be that it needs some initialization, which is done by the clfs bootscripts, so perhaps using an initramfs could solve this?

Pitfalls

  • When merging the rootfs to format the partitions with is, the nix web symlinks is difficult to work with.
    • Ended up creating a script to follow symlinks for links to /nix/store, as we want to keep the relative symlinks that will work on the system.
  • When creating binaries for the system, you may end up with the cross-compiled binaries shadowing binaries for your system.
  • When joining symlinks, directory-links are not merged.
    • So make sure all relevant diretories are "true" diretories, and only files are symlinked.