diary at Telent Netowrks

All MIPSy were the borogroves#

Wed, 27 Dec 2017 00:14:32 +0000

My New Year's Resolution is to blog something every Tuesday (shut up at the back there, I haven't been to bed yet so it's still nominally Tuesday in my personal timezone) whenever I haven't posted in the preceding week.

Recently I had the idea of repurposing my previous wireless router (a TL-WR842ND ) as the brain for a backup server in my study, by plugging a USB disk into it and installing rsync. In order to fulfill my yak shaving quota, I decided to do this using Nixpkgs/NixOS instead of just doing the sensible thing and installing the relevant OpenWRT package.

Story so far:

In the pursuit of getting a serial console on it, I have probably burnt out the UART by bad soldering and/or inadvertently connecting TX to the 5V rail.

But I also have an Arduino Yun lying around which has an Atheros AR9331 MIPS 32 bit SoC - more or less the same hardware as most consumer broadband routers - with an Arduino microcontroller stuck to it that can be persuaded into a role as a USB/serial converter - so I have a console and no soldering required. This felt like a waste of an Atmega, but clearly in a good cause so I pressed on.

Right now I'm at the stage where I can build a bootable kernel and an unuseably large filesystem for it. Here are some things I have learned:

Currently I am working from the branch named in that pull request: ar works and strip too, but I still have huge image sizes, now because it has decided that glibc depends on gcc and the kernel headers - this seems to be a problem with cross-compilation generally and not with MIPS specifically, because ARM has the same issue.

[dan@loaclhost:~/src/nixwrt]$ nix-store -q --references /nix/store/pf047ij2z1bfzlkkyf0v7m4p273713d6-glibc-2.26-75-armv6l-unknown-linux-gnueabihf-armv6l-unknown-linux-gnueabihf/
/nix/store/3x1wd17r8fg3zhasljxdm6vabyn7qr5y-gcc-6.4.0-armv6l-unknown-linux-gnuea
/nix/store/xh15qw8k4za1va29ks7z3kjbjlcfb15v-linux-headers-4.4.10-armv6l-unknown-
/nix/store/pf047ij2z1bfzlkkyf0v7m4p273713d6-glibc-2.26-75-armv6l-unknown-linux-g

It is entirely possible, of course, that I will never get a GLibc-based system into 8MiB even when it's not dragging in the kitchen sink, the plumber that installed it, and the staff and plant of the factory that made the plumber's van (er, figuratively) and I should switch to uclibc or musl, but in the meantime this is all educational.

I have some clearly still very work-in-progress code at https://github.com/obsidiansystems/nixpkgs/compare/02726a2...telent:nixwrt-cross-elegant for anyone who wants to see it.

In other news, I've also been addressing my apparent need to solder stuff by having Fun With Arduinos and Neopixels

[ Postemporaneous edit: the next thrilling installment in this series is now up at https://ww.telent.net/2018/1/2/gehen_sie_bitte_mit_hier_ist_nix_zu_sehen ]