• Stars
    star
    407
  • Rank 102,341 (Top 3 %)
  • Language
    Shell
  • License
    GNU General Publi...
  • Created over 10 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Platform infrastructure for embedded Erlang/OTP, Elixir, and LFE projects

nerves_system_br

CircleCI Hex version

Nerves System BR provides the common logic for building Nerves Systems using Buildroot. If you're new to Nerves, you probably don't want to look at this repository. Please check out the official documentation.

For examples of using nerves_system_br, take a look at the officially supported hardware systems:

We only officially support easily obtained hardware, but that doesn't mean that Nerves only works on these boards. If it's possible to use Buildroot to create a Linux root filesystem for your hardware, then it's possible that Nerves can be made to run. The general steps to supporting a new board are the following:

  1. Create a minimal Buildroot defconfig that boots and runs on the board. This doesn't use Nerves at all.
  2. If the defconfig requires a writable root filesystem, figure out how to make it read-only. This should be pretty easy unless you're using systemd. Since Nerves uses a custom init system, keep in mind for later that systemd may be helping initialize something on the board that will need to be done manually later.
  3. Take a look at the Flash memory layout and compare that to the layouts used in one of the supported systems. We use fwup to create images. There's a lot of variety in how one can lay out Flash memory and deal with things like failbacks. At this point, just see if you can get fwup to create an image.
  4. Clone one of the official systems that seems close for your board. Update the nerves_defconfig based on the Buildroot defconfig that works.
  5. Build the system using mix or manually by running the create-build.sh script.

Non-mix way of using Nerves

It is highly recommended that all users follow the official documentation on using systems. However, advanced users have found the information to be helpful, so it hasn't been deleted. This ONLY works on Linux.

After you have manually built Nerves, activate it before running any Elixir or Erlang build tools on your application.

source build/nerves-env.sh

In the above line, substitute build for whatever directory was used to build the Nerve System. If you downloaded a pre-built Nerves System, source the nerves-env.sh inside of it. When using a rebuilt system, the crosscompiler toolchain must also be downloaded. See the toolchains project. As stated before, the Nerves mix integration takes care of this for you.

This step has to be done each time you launch a shell. The key environment settings updated by the script are the PATH variable and a set of variables that direct build tools such as rebar, mix, relx, and other Makefiles to invoke the cross-compiler.

Enabling a native library or application

Buildroot comes with support for a zillion C libraries and applications. Nerves enables the minimum number of packages to keep the base system image small. Examples of packages that you may want to add are things like graphics and UI frameworks, command line utilities, databases, and file system utilities. To browse available packages, go to your build directory and run:

make menuconfig

If you can't find a package, try typing / to search for it. After you have enabled a package, save your changes and exit menuconfig. The changes are saved to the .config file in your build directory. To save them to your system's nerves_defconfig file, run make savedefconfig.

Enabling an application or library is only part of the process to getting it to work. If that package needs to write to the filesystem, it may need to be configured to write to /root or another location since Nerves keeps the root filesystem readonly. This is done on purpose to avoid corrupting the root filesystem.

Be aware that Buildroot caches the root filesystem between builds and that when you deselect a configuration option, it will not disappear from the Nerves root file system image until a clean build.

Enabling a Linux kernel driver

If you have a piece of hardware that requires a special Linux driver that isn't enabled by default, run:

make linux-menuconfig

This will let you config kernel options. When done, save and exit. Like before, the configuration is saved to your build directory. To make the change permanent, run make linux-update-defconfig.

Enabling simple commandline utilities

If you're looking for many standard commandline utilities like ls(1), dd(1), cat(1), etc., they'll be in a package called Busybox. Nerves disables most of them since it uses the Erlang, Elixir, or LFE shells. To enable more of them, run:

make busybox-menuconfig

Just like the other configuration menus, when you exit menuconfig, the options will only be stored in your build directory. To make them permanent, save the .config (see build/busybox-*/.config) to your configuration directory. You will need to run make menuconfig to update the location of the Busybox configuration.

More Repositories

1

nerves

Craft and deploy bulletproof embedded software in Elixir
Elixir
2,140
star
2

nerves_examples

Small example programs using Nerves
Elixir
364
star
3

nerves_system_rpi0

Base Nerves system configuration for the Raspberry Pi Zero and Zero W
Elixir
95
star
4

nerves_system_rpi3

Base Nerves system configuration for the Raspberry Pi 3
Elixir
91
star
5

nerves_system_rpi4

Base Nerves system configuration for the Raspberry Pi 4
Elixir
84
star
6

erlinit

Replacement for /sbin/init that launches an Erlang/OTP Release
Shell
75
star
7

ring_logger

Elixir Logger ring buffer backend
Elixir
74
star
8

nerves_runtime

Small, general initialization and utilities for Nerves devices
Elixir
57
star
9

nerves_pack

Initialization setup for Nerves devices
Elixir
45
star
10

shoehorn

Handle OTP application failures without restarting the Erlang VM
Elixir
44
star
11

nerves_bootstrap

Nerves mix integration bootstrap and new project generator
Elixir
39
star
12

nerves_system_rpi

Base Nerves system configuration for the Raspberry Pi A+ and B+
Elixir
39
star
13

nerves_system_bbb

Base Nerves system configuration for the BeagleBone-based boards
Shell
32
star
14

nerves_system_x86_64

Elixir
20
star
15

property_table

In-memory key-value store with subscriptions
Elixir
19
star
16

nerves_system_mangopi_mq_pro

Nerves system for the MangoPi MQ Pro
Elixir
19
star
17

nerves_ssh

Nerves SSH support
Elixir
18
star
18

nerves-project.github.io

Website content
HTML
17
star
19

nerves_system_grisp2

Base Nerves system configuration for the GRiSP 2
Elixir
17
star
20

toolchains

Nerves Toolchains
Elixir
15
star
21

nerves_system_vultr

Experimental - join the #nerves channel on elixir-lang slack if interested
Elixir
15
star
22

nerves_system_rpi3a

Nerves system for the Raspberry Pi 3 Model A+ w/ gadget mode
Elixir
14
star
23

nerves_leds

Functions to drive LEDs on embedded systems
Elixir
13
star
24

nerves_heart

Erlang heartbeat support for Nerves
C
11
star
25

boardid

Print out a platform-specific board serial number
Shell
11
star
26

ssh_subsystem_fwup

Erlang SSH Subsystem for Nerves firmware updates
Elixir
11
star
27

nerves_systems

Build scripts for maintaining multiple repositories
Elixir
11
star
28

nerves_system_rpi2

Base Nerves system configuration for the Raspberry Pi 2
Elixir
10
star
29

nerves_system_rpi5

Future Nerves system for the Raspberry Pi 5
Elixir
8
star
30

nerves_motd

Message of the Day for Nerves devices
Elixir
7
star
31

nerves_initramfs

An initramfs for early boot handling of Nerves devices (Work in progress!)
C
7
star
32

uboot_env

Elixir package to read and write U-Boot environment blocks
Elixir
6
star
33

nerves_system_osd32mp1

Base system for Octavo OSD32MP1
Elixir
5
star
34

nerves_logging

Route system log messages through the Elixir logger
Elixir
5
star
35

nerves_system_linter

Mix task to check Nerves system configuration files.
Elixir
4
star
36

nerves_uevent

Simple UEvent monitor for detecting hardware and automatically loading drivers
C
4
star
37

documentation

Nerves Docs (WIP: See https://hexdocs.pm/nerves for current docs)
4
star
38

nerves_fw_loaders

A collection of firmware loaders for boards with internal storage
Shell
3
star
39

build-tools

CircleCI Orb nerves-project/build-tools
3
star
40

system_registry_term_storage

Simple term storage for SystemRegistry
Elixir
2
star
41

nerves_tips

Short Nerves tips packaged as fortunes
Elixir
2
star
42

.github

Default GitHub community files for the Nerves Project
1
star