17a63302c29d132d761296e9f647102eff592be6
[openwrt/staging/jow.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 comfast,cf-e393ax)
61 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x80000"
62 ;;
63 cetron,ct3003|\
64 netgear,wax220|\
65 zbtlink,zbt-z8102ax|\
66 zbtlink,zbt-z8103ax)
67 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
68 ;;
69 h3c,magic-nx30-pro|\
70 jcg,q30-pro|\
71 qihoo,360t7|\
72 tplink,tl-xdr4288|\
73 tplink,tl-xdr6086|\
74 tplink,tl-xdr6088|\
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"
84 ;;
85 glinet,gl-mt2500|\
86 glinet,gl-mt6000)
87 local envdev=$(find_mmc_part "u-boot-env")
88 ubootenv_add_uci_config "$envdev" "0x0" "0x80000"
89 ;;
90 glinet,gl-mt3000)
91 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000"
92 ;;
93 jdcloud,re-cp-03)
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"
97 ;;
98 mercusys,mr90x-v1|\
99 routerich,ax3000)
100 local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
101 ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1"
102 ;;
103 ubnt,unifi-6-plus)
104 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x10000"
105 ;;
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"
111 ;;
112 zyxel,ex5601-t0)
113 local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
114 ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x40000" "2"
115 ;;
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"
123 ;;
124 zyxel,ex5700-telenor)
125 ubootenv_add_uci_config "/dev/ubootenv" "0x0" "0x4000" "0x4000" "1"
126 ;;
127 esac
128
129 config_load ubootenv
130 config_foreach ubootenv_add_app_config
131
132 exit 0