Packages

Nerves System - OpenWRT One (MediaTek MT7981B / Filogic 820)

Current section

Files

Jump to
nerves_system_openwrt_one rootfs_overlay etc fw_env.config
Raw

rootfs_overlay/etc/fw_env.config

# U-Boot environment configuration for the OpenWRT One
#
# Two redundant ubootenv UBI volumes on SPI NAND. The C tool fw_printenv
# (from u-boot-tools) and the Erlang `uboot_env` library used by
# Nerves.Runtime.KV both read this file. Both implementations agree on
# the CRC format so values written by one can be read by the other.
#
# Format: device_path offset env_size flash_sector_size num_sectors
#
# - device_path: the UBI volume character devices. We use /dev/ubi0_N
# (the per-volume nodes) instead of the /dev/ubi0:<name> syntax that
# only the C tool understands -- the Erlang `uboot_env` library opens
# the path with File.open and needs a real file, not a "find by name"
# shorthand. The C tool happily accepts /dev/ubi0_N too, so both
# implementations end up reading the exact same volume.
# - offset: always 0 for UBI volumes (the volume itself starts at 0)
# - env_size: 0x1F000 (126976) -- MUST match CONFIG_ENV_SIZE in
# OpenWrt's mt7981 U-Boot (the one loaded from our `fip` volume).
# The env we bake includes the full OpenWrt default env (bootcmd,
# boot_*, ubi_*, bootmenu_*, etc.) plus the nerves_fw_* metadata
# keys -- see prebuilt/uboot-env-template.txt in the system source.
# With matching sizes the CRC check passes for U-Boot, boardid, and
# the Erlang `uboot_env` library, all reading from the same volume.
# - sector_size: one UBI LEB on this NAND
# - num_sectors: 1 (env fits in a single LEB)
/dev/ubi0_0 0x0 0x1F000 0x1F000 1
/dev/ubi0_1 0x0 0x1F000 0x1F000 1