uboot-envtools: add support for Bananapi BPi-R3
[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 bananapi,bpi-r3)
16 . /lib/upgrade/common.sh
17 export_bootdevice
18 export_partdevice rootdev 0
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 *)
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 esac
41
42 config_load ubootenv
43 config_foreach ubootenv_add_app_config ubootenv
44
45 exit 0