This week: I have landed the WIP port for the Belkin RT3200. It’s not finished - nothing flashable yet - but I have cleaned up sufficient of the initial hacks that it can go to main without breaking the MIPS machines.

This has meant some extra config options: setting boot.imageFormat = "fit" (instead of the default uimage) causes Liminix not to embed the FDT into the kernel ELF image before compressing it, but instead to generate a Flattened Image Tree containing kernel and FDT as separate components. (This has just given me a Good Idea, which is that maybe we could use the same mechanism to deal with the initramfs, which would mean not having to rebuild the kernel when the preinit has changed.)

As advised by the OpenWrt device page, I have converted the device to UBI layout, and will be advising the same action to Liminux users: the factory image contains ECC errors that means mainline Linux can’t read it, and this prevents the 5GHz wifi radio driver from reading its calibration data.

Side note: the instructions document installation using the router’s Web UI. If like me you already have a serial connection and TFTP hooked up (I appreciate this is a minority of people), you can just use U-Boot instead:

MT7622> tftpboot  0x4007ff28 openwrt-22.03.3-mediatek-mt7622-linksys_e8450-ubi-initramfs-recovery-installer.itb
MT7622> bootm 0x4007ff28

After that, the wireless mostly started working, on both 2.4GHZ and 5GH radios - at least, tested to the extent that I can see it by scanning with WiFi Analyzer - I haven’t reached the point of testing actual data yet.

So that was that. The next stage, which is ongoing, is to make it run from flash.

  • I made a kernel with all the right config options
  • I made a ubifs with /nix/store/ in it plus the activate command as we do for JFFS2
  • I used U-Boot to write the filesystem to flash
  • from U-Boot I can boot the kernel and point it at the filesystem, and it mounts and runs services

… so all the bits are there, it’s just a question of figuring out how to package it up in such a way that people can actually install it without sticking wires into their router PCB. UBI-aware tools go to some lengths to preserve the erase counts which it uses for write levelling, and it seems non-optimal if we let the primary installation method trash them every time there’s a new nixpkgs release.