Targets

Nerves supports a variety of hardware. These are called targets and are identified by short tag names. Examples of tag names are rpi0, bbb, etc.

When building a Nerves project, set the MIX_TARGET environment variable to the tag name. This controls which dependencies and configuration settings are used when building your project. See the Mix Targets documentation for further information on this concept.

In Nerves, the term system refers to the library (usually posted to hex.pm) that provides the bootloader, Linux kernel, C libraries, and more for a device. Systems have names like nerves_system_rpi0. Since it's possible to create firmware for more than one hardware device, Nerves uses the Mix target feature to select the desired system in your project's mix.exs.

The naming of target tags is arbitrary. You can choose tags however makes the most sense for your project. Nerves uses the convention of naming the target tag after the system that it uses. For example, when using the Nerves new project generator, it will set up the mix.exs to use the tag rpi0 to select the nerves_system_rpi0 library for building for a Raspberry Pi Zero.

Supported Targets and Systems

The following table summarize officially supported hardware, the associated system and the $MIX_TARGET tag to use.

TargetSystemTag
Raspberry Pi A+, B, B+nerves_system_rpirpi
Raspberry Pi Zero and Zero Wnerves_system_rpi0rpi0
Raspberry Pi 2nerves_system_rpi2rpi2
Raspberry Pi 3 B, B+nerves_system_rpi3rpi3
Raspberry Pi 4nerves_system_rpi4rpi4
BeagleBone Black, BeagleBone Green, BeagleBone Green Wireless, and PocketBeagle.nerves_system_bbbbbb
Generic x86_64nerves_system_x86_64x86_64
OSD32MP1nerves_system_osd32mp1osd32mp1

While the Nerves core team only officially supports the above hardware, the community has added support for other boards. See Nerves Systems on hex.pm

Supporting New Target Hardware

If you're trying to support a new Target, there may be quite a bit more work involved, depending on how mature the support for that hardware is in the Buildroot community. If you're not familiar with Buildroot, you should learn about that first, using the excellent training materials on their website.

If you can find an existing Buildroot configuration for your intended hardware and you want to get it working with Nerves, you will need to make a custom System as follows:

  1. Follow their procedure and confirm your target boots (independent of Nerves).

  2. Figure out how to get everything working with the version of Buildroot Nerves uses. See the NERVES_BR_VERSION variable in create-build.sh.

  • Look for packages and board configs can need to be copied into your System.
  • Look for patches to existing packages that are needed.
  1. Create a defconfig that mimics the one from step 1, and get nerves_system_br to build it. See the section in the System documentation about customizing Nerves Systems.

NOTE: You probably want to disable any userland packages that may be included by default to avoid distraction.