uboot-envtools: add support for Zyxel EX5601-T0 ubootmod
[openwrt/openwrt.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 glinet,gl-mt3000)
61 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000"
62 ;;
63 glinet,gl-mt6000)
64 local envdev=$(find_mmc_part "u-boot-env")
65 ubootenv_add_uci_config "$envdev" "0x0" "0x80000"
66 ;;
67 mercusys,mr90x-v1|\
68 routerich,ax3000)
69 local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
70 ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1"
71 ;;
72 cetron,ct3003|\
73 netgear,wax220|\
74 zbtlink,zbt-z8102ax)
75 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
76 ;;
77 ubnt,unifi-6-plus)
78 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x10000"
79 ;;
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"
85 ;;
86 h3c,magic-nx30-pro|\
87 jcg,q30-pro|\
88 qihoo,360t7|\
89 tplink,tl-xdr4288|\
90 tplink,tl-xdr6086|\
91 tplink,tl-xdr6088|\
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"
100 ;;
101 zyxel,ex5601-t0)
102 local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
103 ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x40000" "2"
104 ;;
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"
112 ;;
113 zyxel,ex5700-telenor)
114 ubootenv_add_uci_config "/dev/ubootenv" "0x0" "0x4000" "0x4000" "1"
115 ;;
116 esac
117
118 config_load ubootenv
119 config_foreach ubootenv_add_app_config
120
121 exit 0