Nerves System for SG2002-based boards
View SourceThis is a custom Nerves system for SG2002-based single-board computers powered by the Sophgo SG2002 SoC.
Project Overview
This Nerves system provides a complete, bootable Linux image tailored for Elixir applications. It's built using Buildroot and includes the necessary kernel, bootloader, and root filesystem to run Elixir applications on SG2002-based devices.
The system is based on the official Sophgo SDK and has been adapted to work with the Nerves platform.
Features
- RISC-V 64-bit Architecture: Targets the
riscv64architecture with thelp64dABI. - Linux Kernel: Uses the Sophgo Linux 5.10 kernel.
- U-Boot Bootloader: Utilizes the Sophgo U-Boot 2021.10 bootloader.
- Toolchain: Built with a custom Musl-based toolchain.
- Networking: Supports networking via the onboard WiFi module.
- Peripherals: Includes support for various peripherals like GPIO, I2C, and SPI.
Getting Started
Prerequisites
Before you begin, ensure you have the following installed:
Building the Firmware
Clone the repository:
git clone https://github.com/fermuch/nerves_system_sg2002.git cd nerves_system_sg2002Set up your Elixir project: Create a new Elixir project or use an existing one.
mix nerves.new my_app cd my_appAdd the system as a dependency: In your
mix.exsfile, add this system to your dependencies:def deps do [ # ... other dependencies {:nerves_system_sg2002, github: "fermuch/nerves_system_sg2002", tag: "v0.1.0"} ] endSpecify the target: In your
mix.exs, set the target tonerves_system_sg2002:def project do [ # ... target: "nerves_system_sg2002" ] endGet dependencies and build the firmware:
mix deps.get mix firmware
Deploying to SG2002-based devices
Prepare an SD card: Format an SD card with a FAT32 partition.
Burn the firmware: Use the
fwuptool to burn the firmware to the SD card.mix firmware.burnBoot the device: Insert the SD card into your SG2002-based device and power it on. The device will boot into the Nerves system, and your Elixir application will start automatically.
Further Information
- Nerves Project: https://nerves-project.org
- Buildroot: https://buildroot.org
- Sophgo SDK: https://github.com/sophgo/