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
18 ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x10000"
21 idx="$(find_mtd_index u-boot-env)"
22 if [ -n "$idx" ]; then
23 ubootenv_add_uci_config "/dev/mtd${idx}" "0x0" "0x10000" "0x10000"
24 elif grep -q 'U-Boot 2015.10-rc2' /dev/mtd0; then
25 ubootenv_add_uci_config "/dev/mtd0" "0xc0000" "0x10000" "0x40000"
27 ubootenv_add_uci_config "/dev/mtd0" "0xf0000" "0x10000" "0x10000"
31 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x8000" "0x8000" "1"
33 globalscale,espressobin|\
34 globalscale,espressobin-emmc|\
35 globalscale,espressobin-ultra|\
36 globalscale,espressobin-v7|\
37 globalscale,espressobin-v7-emmc|\
39 idx="$(find_mtd_index u-boot-env)"
40 if [ -n "$idx" ]; then
41 ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" "1"
43 ubootenv_add_uci_config "/dev/mtd0" "0x3f0000" "0x10000" "0x10000" "1"
46 marvell,armada8040-mcbin-doubleshot|\
47 marvell,armada8040-mcbin-singleshot)
48 ubootenv_add_uci_config "/dev/mtd0" "0x3f0000" "0x10000" "0x10000" "1"
51 linksys,wrt1900ac-v2|\
53 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x40000"
56 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x40000" "0x20000"
60 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
64 idx="$(find_mtd_index u-boot-env)"
65 if [ -n "$idx" ]; then
66 ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" "1"
68 ubootenv_add_uci_config "/dev/mtd0" "0x180000" "0x10000" "0x10000"
72 idx="$(find_mtd_index u-boot-env)"
73 [ -n "$idx" ] && ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000"
78 config_foreach ubootenv_add_app_config ubootenv