mediatek: drop NMBM layout for Xiaomi WR30U
[openwrt/staging/wigyori.git] / package / boot / uboot-envtools / files / mediatek_filogic
1 #
2 # Copyright (C) 2021 OpenWrt.org
3 #
4
5 [ -e /etc/config/ubootenv ] && exit 0
6
7 touch /etc/config/ubootenv
8
9 . /lib/uboot-envtools.sh
10 . /lib/functions.sh
11
12 board=$(board_name)
13
14 case "$board" in
15 asus,rt-ax59u)
16 ubootenv_add_uci_config "/dev/mtd0" "0x100000" "0x20000" "0x20000"
17 ;;
18 bananapi,bpi-r3)
19 rootdev="$(cmdline_get_var root)"
20 rootdev="${rootdev##*/}"
21 rootdev="${rootdev%%p[0-9]*}"
22 case "$rootdev" in
23 mmc*)
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"
27 ;;
28 mtd*)
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"
32 ;;
33 ubi*)
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"
40 ;;
41 esac
42 ;;
43 cmcc,rax3000m)
44 case "$(cmdline_get_var root)" in
45 /dev/mmc*)
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"
49 ;;
50 *)
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"
57 ;;
58 esac
59 ;;
60 cetron,ct3003|\
61 netgear,wax220|\
62 zbtlink,zbt-z8102ax|\
63 zbtlink,zbt-z8103ax)
64 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
65 ;;
66 h3c,magic-nx30-pro|\
67 jcg,q30-pro|\
68 qihoo,360t7|\
69 tplink,tl-xdr4288|\
70 tplink,tl-xdr6086|\
71 tplink,tl-xdr6088|\
72 xiaomi,mi-router-ax3000t-ubootmod|\
73 xiaomi,mi-router-wr30u-ubootmod|\
74 xiaomi,redmi-router-ax6000-ubootmod)
75 . /lib/upgrade/nand.sh
76 local envubi=$(nand_find_ubi ubi)
77 local envdev=/dev/$(nand_find_volume $envubi ubootenv)
78 local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
79 ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x20000" "1"
80 ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x20000" "1"
81 ;;
82 glinet,gl-mt2500|\
83 glinet,gl-mt6000)
84 local envdev=$(find_mmc_part "u-boot-env")
85 ubootenv_add_uci_config "$envdev" "0x0" "0x80000"
86 ;;
87 glinet,gl-mt3000)
88 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000"
89 ;;
90 jdcloud,re-cp-03)
91 local envdev=$(find_mmc_part "ubootenv" "mmcblk0")
92 ubootenv_add_uci_config "$envdev" "0x0" "0x40000" "0x40000" "1"
93 ubootenv_add_uci_config "$envdev" "0x40000" "0x40000" "0x40000" "1"
94 ;;
95 mercusys,mr90x-v1|\
96 routerich,ax3000)
97 local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
98 ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1"
99 ;;
100 ubnt,unifi-6-plus)
101 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x10000"
102 ;;
103 xiaomi,mi-router-ax3000t|\
104 xiaomi,mi-router-wr30u-stock|\
105 xiaomi,redmi-router-ax6000-stock)
106 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000"
107 ubootenv_add_uci_sys_config "/dev/mtd2" "0x0" "0x10000" "0x20000"
108 ;;
109 zyxel,ex5601-t0)
110 local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
111 ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x40000" "2"
112 ;;
113 zyxel,ex5601-t0-ubootmod)
114 . /lib/upgrade/nand.sh
115 local envubi=$(nand_find_ubi ubi)
116 local envdev=/dev/$(nand_find_volume $envubi ubootenv)
117 local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
118 ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x20000" "1"
119 ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x20000" "1"
120 ;;
121 zyxel,ex5700-telenor)
122 ubootenv_add_uci_config "/dev/ubootenv" "0x0" "0x4000" "0x4000" "1"
123 ;;
124 esac
125
126 config_load ubootenv
127 config_foreach ubootenv_add_app_config
128
129 exit 0