Add support for reading and writing environment stored in SPI flash device.
Signed-off-by: Oskari Lemmela <osk...@lemmela.net> --- package/boot/uboot-envtools/files/sunxi | 33 +++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 package/boot/uboot-envtools/files/sunxi diff --git a/package/boot/uboot-envtools/files/sunxi b/package/boot/uboot-envtools/files/sunxi new file mode 100644 index 0000000000..7d6c1d4912 --- /dev/null +++ b/package/boot/uboot-envtools/files/sunxi @@ -0,0 +1,33 @@ +#!/bin/sh +# +# Copyright (C) 2018 OpenWrt.org +# + +[ -e /etc/config/ubootenv ] && exit 0 + +touch /etc/config/ubootenv + +. /lib/uboot-envtools.sh +. /lib/functions.sh + +board=$(board_name) + +ubootenv_mtdinfo () { + UBOOTENV_PART=$(cat /proc/mtd | grep u-boot-env) + mtd_dev=$(echo $UBOOTENV_PART | awk '{print $1}' | sed 's/:$//') + mtd_size=$(echo $UBOOTENV_PART | awk '{print "0x"$2}') + mtd_erase=$(echo $UBOOTENV_PART | awk '{print "0x"$3}') + sectors=$(( $mtd_size / $mtd_erase )) + echo /dev/$mtd_dev 0x0 $mtd_size $mtd_erase $sectors +} + +case "$board" in +pine64,pine64-lts) + ubootenv_add_uci_config $(ubootenv_mtdinfo) + ;; +esac + +config_load ubootenv +config_foreach ubootenv_add_app_config ubootenv + +exit 0 -- 2.17.1 _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel