diary at Telent Netowrks

Milestone 0 / Mildly stunned 1#

Tue, 20 Feb 2018 23:46:18 +0000

Since last week I added USB mass storage support and came up with a reasonably effective - I think - way to mount my USB hard drive when the disk appears.

This entailed rebuilding the kernel with usb-storage driver plus support for various kinds of filesystem and partition table I thought I might reasonably encounter, and then an inordinate amount of time poking through /sys and looking at kernel sources to find out why the disk still wasn't showing up. After girding my mental loins - hmm, that might be an image I could have lived without - in preparation for a deeply techy post about whatever subtle trick or obscure option was necessary to make it all work, a sudden flash of enlightenment led to the realisation that I simply hadn't copied the new kernel into the tftp server directory


The only actual problem I found was that USB is hotpluggable, so devices are added to the system asynchronously and generally after the rc script has run mount -a, so just putting the disk in /etc/fstab doesn't work. Instead I am using mdev to get events when devices are added/removed, and causing it to run a monit command to start/stop monit "filesystem" services. This works for my use case (mounting a known filesystem in a known place) but wouldn't be much good for a more dynamic environment - e.g. automounting random USB keys on insertion. I don't think I want to do that anyway though, because security.

So the only thing I really still need to do for M0 is get this onto the original router. If it still works. (And yes, I am alert to the possibility that this may require shrinking the image a bit, somehow, just to get it into the WR-842's flash)

Faced with that tantalising glimpse of success I decided it was time to make matters more complicated: I would upgrade my nixpkgs installation to current master and see how badly it caused nixwrt to break. And the answer, dear reader, which I still find really quite surprising, is "almost not at all". I have a couple of PRs to add mips32 support and to make monit cross-compile, and really that's about all there is.

Current status: waiting for a git filter-branch thing to finish, because I would like to extract nixwrt from the wreckage of the nixpkgs it grew up in and make it point to a package collection somewhere else.