2022-07-16 21:07:20 +01:00
|
|
|
#
|
|
|
|
# Copyright (C) 2021 OpenWrt.org
|
|
|
|
#
|
|
|
|
|
|
|
|
[ -e /etc/config/ubootenv ] && exit 0
|
|
|
|
|
|
|
|
touch /etc/config/ubootenv
|
|
|
|
|
|
|
|
. /lib/uboot-envtools.sh
|
|
|
|
. /lib/functions.sh
|
|
|
|
|
|
|
|
board=$(board_name)
|
|
|
|
|
|
|
|
case "$board" in
|
2024-07-01 13:36:10 +08:00
|
|
|
bananapi,bpi-r3|\
|
|
|
|
bananapi,bpi-r4|\
|
|
|
|
bananapi,bpi-r4-poe)
|
2022-10-18 20:01:23 +01:00
|
|
|
case "$(cmdline_get_var root)" in
|
|
|
|
/dev/mmc*)
|
2022-07-16 21:07:20 +01:00
|
|
|
local envdev=$(find_mmc_part "ubootenv" $rootdev)
|
|
|
|
ubootenv_add_uci_config "$envdev" "0x0" "0x40000" "0x40000" "1"
|
|
|
|
ubootenv_add_uci_config "$envdev" "0x40000" "0x40000" "0x40000" "1"
|
|
|
|
;;
|
2022-10-18 20:01:23 +01:00
|
|
|
/dev/mtd*)
|
2022-07-16 21:07:20 +01:00
|
|
|
local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
|
|
|
|
ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1"
|
|
|
|
ubootenv_add_uci_config "$envdev" "0x20000" "0x20000" "0x20000" "1"
|
|
|
|
;;
|
2022-10-18 20:01:23 +01:00
|
|
|
/dev/ubi*)
|
2022-07-16 21:07:20 +01:00
|
|
|
. /lib/upgrade/nand.sh
|
|
|
|
local envubi=$(nand_find_ubi ubi)
|
|
|
|
local envdev=/dev/$(nand_find_volume $envubi ubootenv)
|
|
|
|
local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
|
|
|
|
ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x1f000" "1"
|
|
|
|
ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x1f000" "1"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
2024-01-21 16:00:17 +08:00
|
|
|
cetron,ct3003|\
|
|
|
|
imou,lc-hx3001)
|
|
|
|
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
|
|
|
|
;;
|
2023-12-03 06:49:40 +01:00
|
|
|
glinet,gl-mt2500|\
|
|
|
|
glinet,gl-mt6000)
|
2023-04-20 19:49:55 +02:00
|
|
|
local envdev=$(find_mmc_part "u-boot-env")
|
2023-12-03 06:49:40 +01:00
|
|
|
ubootenv_add_uci_config "$envdev" "0x0" "0x80000"
|
2023-04-20 19:49:55 +02:00
|
|
|
;;
|
|
|
|
glinet,gl-mt3000)
|
|
|
|
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000"
|
|
|
|
;;
|
2024-10-08 19:42:37 +08:00
|
|
|
openembed,som7981)
|
|
|
|
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x80000"
|
|
|
|
ubootenv_add_uci_sys_config "/dev/mtd3" "0x0" "0x100000" "0x100000"
|
|
|
|
;;
|
2023-05-18 23:08:05 +08:00
|
|
|
xiaomi,mi-router-wr30u|\
|
2023-09-15 23:06:10 +08:00
|
|
|
xiaomi,mi-router-ax3000t|\
|
2022-11-02 14:30:11 +08:00
|
|
|
xiaomi,redmi-router-ax6000)
|
|
|
|
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000"
|
|
|
|
ubootenv_add_uci_sys_config "/dev/mtd2" "0x0" "0x10000" "0x20000"
|
|
|
|
;;
|
2022-07-16 21:07:20 +01:00
|
|
|
esac
|
|
|
|
|
|
|
|
config_load ubootenv
|
2022-11-02 14:30:11 +08:00
|
|
|
config_foreach ubootenv_add_app_config
|
2022-07-16 21:07:20 +01:00
|
|
|
|
|
|
|
exit 0
|