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|\
38 idx="$(find_mtd_index u-boot-env)"
39 if [ -n "$idx" ]; then
40 ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" "1"
42 ubootenv_add_uci_config "/dev/mtd0" "0x3f0000" "0x10000" "0x10000" "1"
45 marvell,armada8040-mcbin-doubleshot|\
46 marvell,armada8040-mcbin-singleshot)
47 ubootenv_add_uci_config "/dev/mtd0" "0x3f0000" "0x10000" "0x10000" "1"
50 linksys,wrt1900ac-v2|\
52 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x40000"
55 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x40000" "0x20000"
59 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
62 ubootenv_add_uci_config "/dev/mtd0" "0x180000" "0x10000" "0x10000"
67 config_foreach ubootenv_add_app_config ubootenv