uboot-envtools: mediatek_filogic: fix BPi-R3 when no OS is installed
[openwrt/staging/noltari.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 case "$(cmdline_get_var root)" in
17 /dev/mmc*)
18 local envdev=$(find_mmc_part "ubootenv" $rootdev)
19 ubootenv_add_uci_config "$envdev" "0x0" "0x40000" "0x40000" "1"
20 ubootenv_add_uci_config "$envdev" "0x40000" "0x40000" "0x40000" "1"
21 ;;
22 /dev/mtd*)
23 local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
24 ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1"
25 ubootenv_add_uci_config "$envdev" "0x20000" "0x20000" "0x20000" "1"
26 ;;
27 /dev/ubi*)
28 . /lib/upgrade/nand.sh
29 local envubi=$(nand_find_ubi ubi)
30 local envdev=/dev/$(nand_find_volume $envubi ubootenv)
31 local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
32 ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x1f000" "1"
33 ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x1f000" "1"
34 ;;
35 esac
36 ;;
37 esac
38
39 config_load ubootenv
40 config_foreach ubootenv_add_app_config ubootenv
41
42 exit 0