uboot-envtools: fix BPI-R2 boot device

Resolve the production partition through fit.sh so the generated
environment configuration uses the actual MMC block device.

Migrate legacy /dev/p1 device fields in place while preserving custom
geometry, additional entries, and unrelated configurations.

Fixes: de2df0f2c5 ("base-files: remove fitblk_get_bootdev() from /lib/upgrade/common.sh")
Signed-off-by: Stefan Reisinger <dev@stefan-reisinger.at>
Link: https://github.com/openwrt/openwrt/pull/25197
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Stefan Reisinger authored and Robert Marko committed 2026-09-19 12:02:31 +02:00
1 parent cd6e27418a
commit d9fcbfc585
2 files changed
+31 -8

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_DISTNAME:=u-boot
PKG_VERSION:=2026.07
PKG_RELEASE:=2
PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:= \
@@ -2,10 +2,6 @@
# Copyright (C) 2021 OpenWrt.org
#
[ -e /etc/config/ubootenv ] && exit 0
touch /etc/config/ubootenv
. /lib/uboot-envtools.sh
. /lib/functions.sh
@@ -13,13 +9,40 @@ board=$(board_name)
case "$board" in
bananapi,bpi-r2)
. /lib/upgrade/common.sh
bootdev="$(fitblk_get_bootdev)"
ubootenv_add_uci_config "/dev/${bootdev%p[0-9]*}p1" "0xb0000" "0x10000" "0x10000" "1"
. /lib/upgrade/fit.sh
export_fitblk_bootdev
[ -n "$EMMC_KERN_DEV" ] || exit 1
bootdev=${EMMC_KERN_DEV%%p[0-9]*}
newdev="${bootdev}p1"
if [ -e /etc/config/ubootenv ]; then
if [ "$(uci -q get ubootenv.@ubootenv[0].dev)" = "/dev/p1" ]; then
if [ -s /etc/fw_env.config ]; then
if grep -q '^[[:space:]]*/dev/p1[[:space:]]' /etc/fw_env.config; then
sed -i "s|^\([[:space:]]*\)/dev/p1\([[:space:]]\)|\1$newdev\2|" /etc/fw_env.config || exit 1
elif ! grep -q "^[[:space:]]*$newdev[[:space:]]" /etc/fw_env.config; then
exit 0
fi
fi
uci set ubootenv.@ubootenv[0].dev="$newdev" || exit 1
uci commit ubootenv || exit 1
[ -s /etc/fw_env.config ] && exit 0
else
exit 0
fi
else
touch /etc/config/ubootenv
ubootenv_add_uci_config "$newdev" "0xb0000" "0x10000" "0x10000" "1"
fi
;;
unielec,u7623-02)
[ -e /etc/config/ubootenv ] && exit 0
touch /etc/config/ubootenv
ubootenv_add_uci_config "/dev/mmcblk0p1" "0xc0000" "0x10000" "0x10000" "1"
;;
*)
[ -e /etc/config/ubootenv ] && exit 0
touch /etc/config/ubootenv
;;
esac
config_load ubootenv