. /lib/uboot-envtools.sh
. /lib/functions.sh
+ubootenv_add_mmc_default() {
+ local envdev="$(find_mmc_part "ubootenv" "${1:-mmcblk0}")"
+ ubootenv_add_uci_config "$envdev" "0x0" "0x80000" "0x80000" "1"
+ ubootenv_add_uci_config "$envdev" "0x80000" "0x80000" "0x80000" "1"
+}
+
+ubootenv_add_ubi_default() {
+ . /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"
+}
+
board=$(board_name)
case "$board" in
ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x2000" "0x2000"
;;
linksys,e8450-ubi)
- ubootenv_add_uci_config "/dev/ubi0_0" "0x0" "0x1f000" "0x1f000" "1"
- ubootenv_add_uci_config "/dev/ubi0_1" "0x0" "0x1f000" "0x1f000" "1"
+ ubootenv_add_ubi_default
;;
bananapi,bpi-r64)
- rootdev="$(cmdline_get_var root)"
- rootdev="${rootdev##*/}"
- rootdev="${rootdev%%p[0-9]*}"
- case "$rootdev" in
+ . /lib/upgrade/platform.sh
+ bootdev="$(platform_get_bootdev)"
+ case "$bootdev" in
mmc*)
- local envdev=$(find_mmc_part "ubootenv" $rootdev)
- ubootenv_add_uci_config "$envdev" "0x0" "0x80000" "0x80000" "1"
- ubootenv_add_uci_config "$envdev" "0x80000" "0x80000" "0x80000" "1"
+ ubootenv_add_mmc_default "${bootdev%p[0-9]*}"
;;
ubi*)
- ubootenv_add_uci_config "/dev/ubi0_0" "0x0" "0x1f000" "0x1f000" "1"
- ubootenv_add_uci_config "/dev/ubi0_1" "0x0" "0x1f000" "0x1f000" "1"
+ ubootenv_add_ubi_default
;;
esac
;;