3 # Copyright (C) 2016 LEDE
6 [ -e /etc
/config
/ubootenv
] && exit 0
8 touch /etc
/config
/ubootenv
10 .
/lib
/uboot-envtools.sh
16 UBOOTENV_PART
=$
(cat /proc
/mtd |
grep APPSBLENV
)
17 mtd_dev
=$
(echo $UBOOTENV_PART |
awk '{print $1}' |
sed 's/:$//')
18 mtd_size
=$
(echo $UBOOTENV_PART |
awk '{print "0x"$2}')
19 mtd_erase
=$
(echo $UBOOTENV_PART |
awk '{print "0x"$3}')
20 nor_flash
=$
(find /sys
/bus
/spi
/devices
/*/mtd
-name ${mtd_dev})
22 if [ -n "$nor_flash" ]; then
23 ubootenv_size
=$mtd_size
25 # size is fixed to 0x40000 in u-boot
29 sectors
=$
(( $ubootenv_size / $mtd_erase ))
30 echo /dev
/$mtd_dev 0x0 $ubootenv_size $mtd_erase $sectors
34 alfa-network
,ap120c-ac |\
35 devolo
,magic-2-wifi-next |\
44 ubootenv_add_uci_config
"/dev/mtd5" "0x0" "0x10000" "0x10000"
47 ubootenv_add_uci_config
"/dev/mtd13" "0x0" "0x10000" "0x10000"
50 ubootenv_add_uci_config
"/dev/mtd8" "0x0" "0x10000" "0x10000"
53 ubootenv_add_uci_config
"/dev/mtd8" "0x0" "0x40000" "0x20000"
56 ubootenv_add_uci_config
"/dev/mtd7" "0x0" "0x20000" "0x20000"
60 ubootenv_add_uci_config
"/dev/mtd7" "0x0" "0x40000" "0x20000"
63 ubootenv_add_uci_config
"/dev/mtd6" "0x0" "0x10000" "0x10000"
68 config_foreach ubootenv_add_app_config ubootenv