From 826309f7bc8598c99f66a416f142c17fa55a4b80 Mon Sep 17 00:00:00 2001 From: Tom Urlings Date: Thu, 29 May 2025 14:43:19 -0700 Subject: [PATCH] rockchip64/rk3328: U-Boot v2022.04/07 add setexpr - aimed at nanopi-r2s and nanopineo3 - impacts: - boards (re)using 'nanopi-r2s-rk3328_defconfig' (rk3328) and: - boards using U-Boot v2022.04 or - boards using U-Boot v2022.07 - added explicit dependency on python3-setuptools as (at least) U-Boot v2022.04 and v2022.07 fail building due to missing 'distutils' for boards that use U-Boot v2022.04 or v2022.07 --- lib/functions/host/prepare-host.sh | 8 +++- ...config-0001-enable-setexpr-fmt-regex.patch | 46 +++++++++++++++++++ ...config-0001-enable-setexpr-fmt-regex.patch | 46 +++++++++++++++++++ 3 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 patch/u-boot/u-boot-rockchip64-v2022.04/nanopi-r2s-rk3328_defconfig-0001-enable-setexpr-fmt-regex.patch create mode 100644 patch/u-boot/u-boot-rockchip64/nanopi-r2s-rk3328_defconfig-0001-enable-setexpr-fmt-regex.patch diff --git a/lib/functions/host/prepare-host.sh b/lib/functions/host/prepare-host.sh index 8affa5407..28bdd0ad3 100644 --- a/lib/functions/host/prepare-host.sh +++ b/lib/functions/host/prepare-host.sh @@ -203,7 +203,7 @@ function adaptative_prepare_host_dependencies() { udev # causes initramfs rebuild, but is usually pre-installed. uuid-dev zlib1g-dev - gcc-arm-linux-gnueabi # necessary for rockchip64 (and maybe other too) ATF compilation + gcc-arm-linux-gnueabi # necessary for rockchip64 (and maybe other too) ATF compilation # by-category below file tree expect # logging utilities; expect is needed for 'unbuffer' command @@ -228,6 +228,12 @@ function adaptative_prepare_host_dependencies() { # Needed for some u-boot's, lest "tools/mkeficapsule.c:21:10: fatal error: gnutls/gnutls.h" host_dependencies+=("libgnutls28-dev") + # Some versions of U-Boot do not require/import 'python3-setuptools' properly, so add them explicitly. + if [[ 'tag:v2022.04' == "${BOOTBRANCH:-}" || 'tag:v2022.07' == "${BOOTBRANCH:-}" ]]; then + display_alert "Adding 'python3-setuptools' to host_dependencies" + host_dependencies+=("python3-setuptools") + fi + ### Python2 -- required for some older u-boot builds # Debian newer than 'bookworm' and Ubuntu newer than 'lunar'/'mantic' does not carry python2 anymore; in this case some u-boot's might fail to build. # Last versions to support python2 were Debian 'bullseye' and Ubuntu 'jammy' diff --git a/patch/u-boot/u-boot-rockchip64-v2022.04/nanopi-r2s-rk3328_defconfig-0001-enable-setexpr-fmt-regex.patch b/patch/u-boot/u-boot-rockchip64-v2022.04/nanopi-r2s-rk3328_defconfig-0001-enable-setexpr-fmt-regex.patch new file mode 100644 index 000000000..7749f7695 --- /dev/null +++ b/patch/u-boot/u-boot-rockchip64-v2022.04/nanopi-r2s-rk3328_defconfig-0001-enable-setexpr-fmt-regex.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tom Urlings +Date: Tue May 27 12:45:35 PDT 2025 +Subject: Enable monitor command setexpr w/fmt and sub/gsub/regex options + +This will enable bootscripts to calculate load address dynamically during boot, +removing the need for updating load addresses whenever kernel/initial ramdisk +change size. + +Also, this will enable bootscripts to find device tree files in folder structures +that contain a vendor path component, e.g. dtb/allwinnner/... +--- + configs/nanopi-r2s-rk3328_defconfig | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/configs/nanopi-r2s-rk3328_defconfig b/configs/nanopi-r2s-rk3328_defconfig +index cafb38ffcee..7941af4ff2e 100644 +--- a/configs/nanopi-r2s-rk3328_defconfig ++++ b/configs/nanopi-r2s-rk3328_defconfig +@@ -34,11 +34,12 @@ CONFIG_SPL_ATF=y + CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y + CONFIG_CMD_BOOTZ=y + CONFIG_CMD_GPT=y + CONFIG_CMD_MMC=y + CONFIG_CMD_USB=y +-# CONFIG_CMD_SETEXPR is not set ++CONFIG_CMD_SETEXPR=y ++CONFIG_CMD_SETEXPR_FMT=y + CONFIG_CMD_TIME=y + CONFIG_SPL_OF_CONTROL=y + CONFIG_TPL_OF_CONTROL=y + CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" + CONFIG_TPL_OF_PLATDATA=y +@@ -94,8 +95,9 @@ CONFIG_USB_OHCI_GENERIC=y + CONFIG_USB_DWC2=y + CONFIG_USB_DWC3=y + # CONFIG_USB_DWC3_GADGET is not set + CONFIG_USB_GADGET=y + CONFIG_USB_GADGET_DWC2_OTG=y ++CONFIG_REGEX=y + CONFIG_SPL_TINY_MEMSET=y + CONFIG_TPL_TINY_MEMSET=y + CONFIG_ERRNO_STR=y +-- +Created with Armbian build tools https://github.com/armbian/build + diff --git a/patch/u-boot/u-boot-rockchip64/nanopi-r2s-rk3328_defconfig-0001-enable-setexpr-fmt-regex.patch b/patch/u-boot/u-boot-rockchip64/nanopi-r2s-rk3328_defconfig-0001-enable-setexpr-fmt-regex.patch new file mode 100644 index 000000000..1fe36de09 --- /dev/null +++ b/patch/u-boot/u-boot-rockchip64/nanopi-r2s-rk3328_defconfig-0001-enable-setexpr-fmt-regex.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tom Urlings +Date: Tue May 27 12:45:35 PDT 2025 +Subject: Enable monitor command setexpr w/fmt and sub/gsub/regex options + +This will enable bootscripts to calculate load address dynamically during boot, +removing the need for updating load addresses whenever kernel/initial ramdisk +change size. + +Also, this will enable bootscripts to find device tree files in folder structures +that contain a vendor path component, e.g. dtb/allwinnner/... +--- + configs/nanopi-r2s-rk3328_defconfig | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/configs/nanopi-r2s-rk3328_defconfig b/configs/nanopi-r2s-rk3328_defconfig +index ed6b8030216..be1906e8deb 100644 +--- a/configs/nanopi-r2s-rk3328_defconfig ++++ b/configs/nanopi-r2s-rk3328_defconfig +@@ -35,11 +35,12 @@ CONFIG_SPL_ATF=y + CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y + CONFIG_CMD_BOOTZ=y + CONFIG_CMD_GPT=y + CONFIG_CMD_MMC=y + CONFIG_CMD_USB=y +-# CONFIG_CMD_SETEXPR is not set ++CONFIG_CMD_SETEXPR=y ++CONFIG_CMD_SETEXPR_FMT=y + CONFIG_CMD_TIME=y + CONFIG_SPL_OF_CONTROL=y + CONFIG_TPL_OF_CONTROL=y + CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" + CONFIG_TPL_OF_PLATDATA=y +@@ -96,8 +97,9 @@ CONFIG_USB_OHCI_GENERIC=y + CONFIG_USB_DWC2=y + CONFIG_USB_DWC3=y + # CONFIG_USB_DWC3_GADGET is not set + CONFIG_USB_GADGET=y + CONFIG_USB_GADGET_DWC2_OTG=y ++CONFIG_REGEX=y + CONFIG_SPL_TINY_MEMSET=y + CONFIG_TPL_TINY_MEMSET=y + CONFIG_ERRNO_STR=y +-- +Created with Armbian build tools https://github.com/armbian/build +