2 # Copyright (C) 2021 OpenWrt.org
5 [ -e /etc/config/ubootenv ] && exit 0
7 touch /etc/config/ubootenv
9 . /lib/uboot-envtools.sh
16 ubootenv_add_uci_config "/dev/mtd0" "0x100000" "0x20000" "0x20000"
19 rootdev="$(cmdline_get_var root)"
20 rootdev="${rootdev##*/}"
21 rootdev="${rootdev%%p[0-9]*}"
24 local envdev=$(find_mmc_part "ubootenv" $rootdev)
25 ubootenv_add_uci_config "$envdev" "0x0" "0x40000" "0x40000" "1"
26 ubootenv_add_uci_config "$envdev" "0x40000" "0x40000" "0x40000" "1"
29 local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
30 ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1"
31 ubootenv_add_uci_config "$envdev" "0x20000" "0x20000" "0x20000" "1"
34 . /lib/upgrade/nand.sh
35 local envubi=$(nand_find_ubi ubi)
36 local envdev=/dev/$(nand_find_volume $envubi ubootenv)
37 local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
38 ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x1f000" "1"
39 ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x1f000" "1"
44 case "$(cmdline_get_var root)" in
46 local envdev=$(find_mmc_part "ubootenv" "mmcblk0")
47 ubootenv_add_uci_config "$envdev" "0x0" "0x40000" "0x40000" "1"
48 ubootenv_add_uci_config "$envdev" "0x40000" "0x40000" "0x40000" "1"
51 . /lib/upgrade/nand.sh
52 local envubi=$(nand_find_ubi ubi)
53 local envdev=/dev/$(nand_find_volume $envubi ubootenv)
54 local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
55 ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x1f000" "1"
56 ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x1f000" "1"
61 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000"
64 local envdev=$(find_mmc_part "u-boot-env")
65 ubootenv_add_uci_config "$envdev" "0x0" "0x80000"
69 local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
70 ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1"
75 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
78 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x10000"
80 xiaomi,mi-router-wr30u-112m-nmbm|\
81 xiaomi,mi-router-wr30u-stock|\
82 xiaomi,redmi-router-ax6000-stock)
83 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000"
84 ubootenv_add_uci_sys_config "/dev/mtd2" "0x0" "0x10000" "0x20000"
92 xiaomi,mi-router-wr30u-ubootmod|\
93 xiaomi,redmi-router-ax6000-ubootmod)
94 . /lib/upgrade/nand.sh
95 local envubi=$(nand_find_ubi ubi)
96 local envdev=/dev/$(nand_find_volume $envubi ubootenv)
97 local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
98 ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x20000" "1"
99 ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x20000" "1"
102 local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
103 ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x40000" "2"
105 zyxel,ex5601-t0-ubootmod)
106 . /lib/upgrade/nand.sh
107 local envubi=$(nand_find_ubi ubi)
108 local envdev=/dev/$(nand_find_volume $envubi ubootenv)
109 local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
110 ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x20000" "1"
111 ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x20000" "1"
113 zyxel,ex5700-telenor)
114 ubootenv_add_uci_config "/dev/ubootenv" "0x0" "0x4000" "0x4000" "1"
119 config_foreach ubootenv_add_app_config