Current section
Files
Jump to
Current section
Files
nerves_system_openwrt_one
ubinize-fit.cfg
ubinize-fit.cfg
# UBI image configuration for OpenWRT One SPI NAND
#
# Layout extends the OpenWrt 24.10 factory layout with A/B FIT slots so
# OTA updates can swap kernel + initramfs without overwriting the
# currently-running copy:
#
# BL2 (SPI NOR bl2-nor)
# -> reads UBI volume "fip" from SPI NAND
# -> loads BL31 + U-Boot proper from FIP
# U-Boot
# -> reads UBI volume "fit_${nerves_fw_active}" (= fit_a or fit_b)
# -> bootm config-1 -> Linux
#
# Volume IDs:
# 0 ubootenv (redundant U-Boot env, A)
# 1 ubootenv2 (redundant U-Boot env, B)
# 2 fip (BL31 + U-Boot proper, static)
# 3 fit_a (kernel + initramfs, slot A)
# 4 fit_b (kernel + initramfs, slot B; empty until first OTA)
# 5 rootfs_data (autoresize)
#
# NAND parameters (from OpenWrt filogic.mk):
# Block size: 128 KiB (0x20000)
# Page size: 2048 bytes
# Sub-page: 0 (not supported on SPI NAND)
# ubootenv and ubootenv2 are the redundant U-Boot environment volumes.
# wrap-firmware.sh generates a binary env block from the .fw metadata
# (via mkenvimage) and points BOTH volumes at the same content so that
# fresh-flashed devices already have populated nerves_fw_* values --
# Nerves.Runtime.KV reads these at boot before erlinit starts the BEAM,
# so NervesMOTD shows real metadata immediately on first boot.
[ubootenv]
mode=ubi
vol_id=0
vol_type=dynamic
vol_name=ubootenv
vol_size=128KiB
image=BINARIES_DIR/uboot-env.bin
[ubootenv2]
mode=ubi
vol_id=1
vol_type=dynamic
vol_name=ubootenv2
vol_size=128KiB
image=BINARIES_DIR/uboot-env.bin
[fip]
mode=ubi
vol_id=2
vol_type=static
vol_name=fip
image=BOARD_DIR/prebuilt/openwrt-one-fip.bin
# A/B FIT slots. fit_a is populated at flash time with the initial
# firmware; fit_b is reserved (empty) until the first OTA writes a new
# image to it via ubiupdatevol. Each slot is sized at 50 MiB which
# comfortably holds the current ~38 MiB FIT (kernel + dtb + cpio.gz)
# plus headroom. The active slot is selected at boot time by U-Boot
# from the `nerves_fw_active` env variable -- see ubi_read_production
# in prebuilt/uboot-env-template.txt.
[fit_a]
mode=ubi
vol_id=3
vol_type=dynamic
vol_name=fit_a
vol_size=50MiB
image=BINARIES_DIR/openwrt-one-initramfs.itb
[fit_b]
mode=ubi
vol_id=4
vol_type=dynamic
vol_name=fit_b
vol_size=50MiB
# No image= -- volume is created empty. First OTA writes to here.
# rootfs_data exists so OpenWrt's U-Boot ubi_prepare_rootfs script
# (run after `ubi read fit_*`) doesn't try to create it itself and
# fail with "No space left in UBI device". autoresize lets it
# claim all remaining free space on the partition.
[rootfs_data]
mode=ubi
vol_id=5
vol_type=dynamic
vol_name=rootfs_data
vol_size=1MiB
vol_flags=autoresize