uboot-mediatek: add support for JDCloud RE-CP-03
[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 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 mercusys,mr90x-v1|\
91 routerich,ax3000)
92 local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
93 ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1"
94 ;;
95 ubnt,unifi-6-plus)
96 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x10000"
97 ;;
98 xiaomi,mi-router-ax3000t|\
99 xiaomi,mi-router-wr30u-112m-nmbm|\
100 xiaomi,mi-router-wr30u-stock|\
101 xiaomi,redmi-router-ax6000-stock)
102 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000"
103 ubootenv_add_uci_sys_config "/dev/mtd2" "0x0" "0x10000" "0x20000"
104 ;;
105 zyxel,ex5601-t0)
106 local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
107 ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x40000" "2"
108 ;;
109 zyxel,ex5601-t0-ubootmod)
110 . /lib/upgrade/nand.sh
111 local envubi=$(nand_find_ubi ubi)
112 local envdev=/dev/$(nand_find_volume $envubi ubootenv)
113 local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
114 ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x20000" "1"
115 ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x20000" "1"
116 ;;
117 zyxel,ex5700-telenor)
118 ubootenv_add_uci_config "/dev/ubootenv" "0x0" "0x4000" "0x4000" "1"
119 ;;
120 esac
121
122 config_load ubootenv
123 config_foreach ubootenv_add_app_config
124
125 exit 0