It ought to work, anyway. Next week maybe I can talk about it in the past tense and not the future conditional.

This update is a day late and a few hundred words short, but we’re in a state of “it appears to work”:

testbed login: root
login[326]: root login on 'console'

BusyBox v1.35.0 () built-in shell (ash)

# df
Filesystem           1024-blocks    Used Available Use% Mounted on
mtd5                     13184     12664       520  96% /persist
mtd5                     13184     12664       520  96% /nix
dev                      60156         0     60156   0% /dev
tmpfs                    60848       856     59992   1% /run
# ls /
bin      etc      lib      persist  run      sys
dev      home     nix      proc     srv
# touch /persist/HELLO
# ls -l /persist/HELLO
-rw-r--r--    1         0 Jan  1 05:43 /persist/HELLO

How did we get here?

  • make qemu boot from an MTD instead of a virtio block device. This is a closer match with hardware characteristics, and in fact jffs2 won’t run on a block device.
  • add support for initramfs, consisting of a shell script /init and a very stripped-down busybox that can run it
  • take the existing config.filesystem data that we’re using to generate pseudofiles for squashfs, and use it to generate a shell script that runs from the initramfs and populates all the FHS-ish directories (/etc/, /var, /home &c). The script lives in the persistent filesystem, so that if we need to change config.filesystem then the change will take effect when we reboot and we don’t have to rebuild the initramfs as well.
  • fun with MTD erase block size

There is of course a bunch of cleanup to do, and some serious “what happened to all my storage space?” work - it might be a bit academic that I can write to the filesystem if there’s less than half a megabyte of space left on it. Once we have some free space to play with we can try running nix-copy-closure