From 3e58efc4643555c1fe6df69174e972c9e071e382 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Tue, 28 Jul 2020 10:50:21 +0200 Subject: [PATCH 7/7] uboot-envtools: add ipq807x support Signed-off-by: John Crispin --- package/boot/uboot-envtools/files/ipq807x | 37 +++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 package/boot/uboot-envtools/files/ipq807x diff --git a/package/boot/uboot-envtools/files/ipq807x b/package/boot/uboot-envtools/files/ipq807x new file mode 100644 index 0000000000..6c429f1852 --- /dev/null +++ b/package/boot/uboot-envtools/files/ipq807x @@ -0,0 +1,37 @@ +[ -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 APPSBLENV) + 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}') + nor_flash=$(find /sys/bus/spi/devices/*/mtd -name ${mtd_dev}) + + if [ -n "$nor_flash" ]; then + ubootenv_size=$mtd_size + else + # size is fixed to 0x40000 in u-boot + ubootenv_size=0x40000 + fi + + sectors=$(( $ubootenv_size / $mtd_erase )) + echo /dev/$mtd_dev 0x0 $ubootenv_size $mtd_erase $sectors +} + +case "$board" in +*) + ubootenv_add_uci_config $(ubootenv_mtdinfo) + ;; +esac + +config_load ubootenv +config_foreach ubootenv_add_app_config ubootenv + +exit 0 -- 2.25.1