This is the base Nerves System configuration for a JSLinux. This is not a complete Nerves port since some features like firmware updates and a persistent data partition are not implemented at all. The port is intended as a proof of concept and a browser-only way of demoing some simple features.
| Feature | Description |
|---|---|
| CPU | 64 bit RISC-V |
| Memory | 128 MB (configurable) |
| Storage | Temporary |
| Linux kernel | 5.19 |
| IEx terminal | VirtIO ttyhvc0 |
| GPIO, I2C, SPI | Emulated - Elixir Circuits |
| Display | Yes, but not supported yet |
| ADC | No |
| PWM | No |
| UART | No |
| Camera | No |
| Ethernet | VirtIO, but not supported yet |
| WiFi | No |
| RTC | No |
| HW Watchdog | Software |
The most common way of using this Nerves System is create a project with mix nerves.new and add jslinux references where needed and in a similar way
to the default systems like bbb, etc. Then export MIX_TARGET=jslinux.
See the Getting started
guide
for more information.
If you need custom modifications to this system for your device, clone this repository and update as described in Making custom systems.
This example assumes some familiarity with Nerves. To use this system, you'll need OTP 25. Follow the Nerves installation instructions for additional system dependencies.
Creating a new hello world application:
mix nerves.new hello_jslinux
cd hello_jslinuxOpen up your mix.exs and add :jslinux to the @all_targets list at
the top. It's ok to delete targets that you don't plan on using.
Then add the :nerves_system_jslinux dependency to the deps function:
{:nerves_system_jslinux, "~> 0.1", runtime: false, targets: :jslinux},This will load the latest released version. To use the latest code on the main
branch here, add the following line:
{:nerves_system_jslinux, runtime: false, targets: :jslinux, nerves: [compile: true], git: "https://github.com/fhunleth/nerves_system_jslinux", branch: "main"}To build, run:
export MIX_TARGET=jslinux
mix deps.get
mix firmware
...The console appears in the JSTerm Window.
The board has a VirtIO network interfaces. I haven't figured out how to use it yet.
This port uses Fabrice Bellard's TinyEMU. Ahmad Fatoum's fork had a super helpful fix for newer versions of Emscripten. This unblocked me when I got stuck trying out various Emscripten versions to try to fix runtime errors.
