diary @ telent

To Arms#

Tue 03 Oct 2023 07:10:23 PM UTC

Topics: liminix

Progress on Liminix ARM support. The device I'm starting with is the Belkin RT3200 (also known as Linksys E8450) which seems to be a reasonably featureful piece of kit, and which I snagged for a very good price on the Bay of E.

Where are we right now?

What else needs doing?

What have we found?

There are some significant differences between this and the MIPS devices (yes, other than an entirely different architecture), mostly to do with "legacy boot" support or the lack thereof. For example:

Other than that, it was mostly the usual process of "did the kernel crash silently, or has it just been unable to open a console device?". In this regard, one neat trick: even though U-Boot on this device doesn't support pstore, we can use it anyway if we turn off compression. We enable

        PSTORE = "y";
        PSTORE_RAM = "y";
        PSTORE_CONSOLE = "y";
        PSTORE_DEFLATE_COMPRESS = "n";

then boot with panic=3 oops=panic, then when it resets use the U_Boot md command to see what happened:

MT7622> md 0x42ff0000
42ff0000: 43474244 00000000 00000ff4 3d3d3d3d    DBGC........====
42ff0010: 39342e31 36373031 500a442d 63696e61    1.491076-D.Panic
42ff0020: 50203123 31747261 3e363c0a 20505050    #1 Part1.<6>PPP
42ff0030: 20445342 706d6f43 73736572 206e6f69    BSD Compression
[... etc ...]
42ff0ca0: 20676e69 73756e75 6b206465 656e7265    ing unused kerne
42ff0cb0: 656d206c 79726f6d 3731203a 0a4b3832    l memory: 1728K.
42ff0cc0: 523e363c 2f206e75 74696e69 20736120    <6>Run /init as
42ff0cd0: 74696e69 6f727020 73736563 3e373c0a    init process.<7>
[... etc etc ...]

What next?

Wifi. And, er, test it properly this time?

Arms race#

Thu 12 Oct 2023 10:31:00 AM UTC

Topics: liminix

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.

... 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.