Are there any special considerations to keep in mind when buying hardware for a Nerves project?

I want to put something out there that may help someone else out down the line about buying/selecting a device that can run Nerves. Sorry in advance for the huge wall of text you are about to witness.

What it means to “run” Nerves.

I see a lot of confusion here as what it means to run Nerves, so i am going to define this first. Nerves itself is just a lot of tooling that essentially removes everything that might be in your way. This includes building the kernel (hereafter referred to as simply linux) and the root file system (this contains your various root dirs such as /bin, /usr/, /etc and all their contents). these things are related but not the same as some fruity organizations would lead you to believe. So Nerves is just the tooling that brings all those pieces together using a project called buildroot. It compiles both linux, and the rootfs using a cross compiler toolchain. (we won’t get into that, it’s essentially magic).

so what it means to “run” Nerves is the device must have linux support to some extent, and buildroot support. If you start with linux, buildroot is usually pretty easy depending on how true to the kernel build process your manufacturer is.

Now some boards have both linux and buildroot, can’t (read “no one has put the work in yet”) work with Nerves. This includes the elusive C.H.I.P board. I won’t go into the details as to why it doesn’t work easily, but I will say there is a third part that makes Nerves so magic: fwup.

Fwup is how linux, the rootfs, and your elixir project is all packaged. Now supporting fwup is nothing all to special, its just a configuration file with a manifest of all the required files, some block offsets mapping to a block devices, etc that builds a special zip file. the caveat is that while it doesn’t require a certain sort of storage device, it makes it so much easier to get up and running.

If you’re still confused just know that if your device of choice can boot linux somehow, and a root filesystem can be written to an sdcard, you are probably good.

This means Nerves will never “run” on an embedded micro controller such as Arduino, Teensy, etc. They just won’t/can’t meet the requirements that the Nerves tooling expects or requires. That is not to say that Nerves can’t interface with those devices however.

So if looking for a device that “supports” Nerves, just know if you want to “interface” with a Nerves device, or “be” the Nerves device.

8 Likes