Since getting that NAS, I've been poking around and looking at adding some useful programs to the existing firmware. The initial one I want to run on it is smartmontools, so I can see just what start the hard disks are in and try and prod the second one into actually responding.
As with most embedded stuff, it runs Linux. So getting my own code to run is merely a case of building a cross-compiler that'll run on an actual system and produces output that works on the NAS' armv5l-linux architecture. Actually, since this is a NAS with actual disks I'm not limited to the pokey little flash chip that most embedded stuff has (this device has 16MB of flash - most routers have 8MB or even only 4MB!) and so I could run the compiler on the NAS itself. Unfortunately, it doesn't come with one, and to build a compiler you first need a compiler. Hence the need for a cross-compiler. Since the target is Linux that'd normally mean I'd also need to install a Linux development environment, which I'd rather not have to do - Linux and I don't get on well.
Now, something I tripped across recently is a page on the MinGW website, containing instructions for building a cross-compiler hosted under MinGW. The useful part of this for me is that MinGW along with MSYS is a port of a whole bunch of Linux tools to Windows. So in theory I should be able to use that to build and run my cross-compiler on Windows. This is completely against the normal way of doing things, but the wiki page is proof that it should be possible.
Unfortunately the instructions are rather out of date, so I'm having to make it up as I go along (using a vaguely recent set of instructions for a GNU/Linux ARM toolchain and an older Linux/ARM howto for more recent details). I intend to document this as I go along, partially as a set of notes to myself, partially in the hope that the next person to try this finds it useful, but mainly so you can all point and laugh when it inevitably fails in some spectacular fashion.( Collapse )