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" "0x20000" "0x80000"
67 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
75 xiaomi,mi-router-ax3000t-ubootmod|\
76 xiaomi,mi-router-wr30u-ubootmod|\
77 xiaomi,redmi-router-ax6000-ubootmod)
78 . /lib/upgrade/nand.sh
79 local envubi=$(nand_find_ubi ubi)
80 local envdev=/dev/$(nand_find_volume $envubi ubootenv)
81 local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
82 ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x20000" "1"
83 ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x20000" "1"
87 local envdev=$(find_mmc_part "u-boot-env")
88 ubootenv_add_uci_config "$envdev" "0x0" "0x80000"
91 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000"
94 local envdev=$(find_mmc_part "ubootenv" "mmcblk0")
95 ubootenv_add_uci_config "$envdev" "0x0" "0x40000" "0x40000" "1"
96 ubootenv_add_uci_config "$envdev" "0x40000" "0x40000" "0x40000" "1"
100 local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
101 ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1"
104 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x10000"
106 xiaomi,mi-router-ax3000t|\
107 xiaomi,mi-router-wr30u-stock|\
108 xiaomi,redmi-router-ax6000-stock)
109 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000"
110 ubootenv_add_uci_sys_config "/dev/mtd2" "0x0" "0x10000" "0x20000"
113 local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
114 ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x40000" "2"
116 zyxel,ex5601-t0-ubootmod)
117 . /lib/upgrade/nand.sh
118 local envubi=$(nand_find_ubi ubi)
119 local envdev=/dev/$(nand_find_volume $envubi ubootenv)
120 local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
121 ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x20000" "1"
122 ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x20000" "1"
124 zyxel,ex5700-telenor)
125 ubootenv_add_uci_config "/dev/ubootenv" "0x0" "0x4000" "0x4000" "1"
130 config_foreach ubootenv_add_app_config