filogic: add support for GL.iNet GL-MT6000
[openwrt/staging/hauke.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 bananapi,bpi-r3)
16 rootdev="$(cmdline_get_var root)"
17 rootdev="${rootdev##*/}"
18 rootdev="${rootdev%%p[0-9]*}"
19 case "$rootdev" in
20 mmc*)
21 local envdev=$(find_mmc_part "ubootenv" $rootdev)
22 ubootenv_add_uci_config "$envdev" "0x0" "0x40000" "0x40000" "1"
23 ubootenv_add_uci_config "$envdev" "0x40000" "0x40000" "0x40000" "1"
24 ;;
25 mtd*)
26 local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
27 ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1"
28 ubootenv_add_uci_config "$envdev" "0x20000" "0x20000" "0x20000" "1"
29 ;;
30 ubi*)
31 . /lib/upgrade/nand.sh
32 local envubi=$(nand_find_ubi ubi)
33 local envdev=/dev/$(nand_find_volume $envubi ubootenv)
34 local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
35 ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x1f000" "1"
36 ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x1f000" "1"
37 ;;
38 esac
39 ;;
40 glinet,gl-mt3000)
41 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000"
42 ;;
43 glinet,gl-mt6000)
44 local envdev=$(find_mmc_part "u-boot-env")
45 ubootenv_add_uci_config "$envdev" "0x0" "0x80000"
46 ;;
47 mercusys,mr90x-v1)
48 local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
49 ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1"
50 ;;
51 cetron,ct3003|\
52 netgear,wax220)
53 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
54 ;;
55 ubnt,unifi-6-plus)
56 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x10000"
57 ;;
58 xiaomi,mi-router-wr30u-112m-nmbm|\
59 xiaomi,mi-router-wr30u-stock|\
60 xiaomi,redmi-router-ax6000-stock)
61 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000"
62 ubootenv_add_uci_sys_config "/dev/mtd2" "0x0" "0x10000" "0x20000"
63 ;;
64 h3c,magic-nx30-pro|\
65 qihoo,360t7|\
66 tplink,tl-xdr4288|\
67 tplink,tl-xdr6086|\
68 tplink,tl-xdr6088|\
69 xiaomi,mi-router-wr30u-ubootmod|\
70 xiaomi,redmi-router-ax6000-ubootmod)
71 . /lib/upgrade/nand.sh
72 local envubi=$(nand_find_ubi ubi)
73 local envdev=/dev/$(nand_find_volume $envubi ubootenv)
74 local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
75 ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x20000" "1"
76 ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x20000" "1"
77 ;;
78 zyxel,ex5601-t0)
79 local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
80 ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x40000" "2"
81 ;;
82 zyxel,ex5700-telenor)
83 ubootenv_add_uci_config "/dev/ubootenv" "0x0" "0x4000" "0x4000" "1"
84 ;;
85 esac
86
87 config_load ubootenv
88 config_foreach ubootenv_add_app_config
89
90 exit 0