2 # Copyright (C) 2014-2016 OpenWrt.org
3 # Copyright (C) 2016 LEDE-Project.org
6 [ -e /etc/config/ubootenv ] && exit 0
8 touch /etc/config/ubootenv
10 . /lib/uboot-envtools.sh
17 ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x10000"
20 idx="$(find_mtd_index u-boot-env)"
21 if [ -n "$idx" ]; then
22 ubootenv_add_uci_config "/dev/mtd${idx}" "0x0" "0x10000" "0x10000"
23 elif grep -q 'U-Boot 2015.10-rc2' /dev/mtd0; then
24 ubootenv_add_uci_config "/dev/mtd0" "0xc0000" "0x10000" "0x40000"
26 ubootenv_add_uci_config "/dev/mtd0" "0xf0000" "0x10000" "0x10000"
30 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x8000" "0x8000" "1"
32 globalscale,espressobin|\
33 globalscale,espressobin-emmc|\
34 globalscale,espressobin-ultra|\
35 globalscale,espressobin-v7|\
36 globalscale,espressobin-v7-emmc)
37 idx="$(find_mtd_index u-boot-env)"
38 if [ -n "$idx" ]; then
39 ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" "1"
41 ubootenv_add_uci_config "/dev/mtd0" "0x3f0000" "0x10000" "0x10000" "1"
44 marvell,armada8040-mcbin-doubleshot|\
45 marvell,armada8040-mcbin-singleshot)
46 ubootenv_add_uci_config "/dev/mtd0" "0x3f0000" "0x10000" "0x10000" "1"
49 linksys,wrt1900ac-v2|\
51 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x40000"
54 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x40000" "0x20000"
58 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
61 ubootenv_add_uci_config "/dev/mtd0" "0x180000" "0x10000" "0x10000"
66 config_foreach ubootenv_add_app_config ubootenv