[openwrt/openwrt] imagebuilder: fix APK architecture setting

LEDE Commits lede-commits at lists.infradead.org
Tue Nov 19 10:52:09 PST 2024


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/1c308bad5445df91d901d8389bfe31c888d0e8c9

commit 1c308bad5445df91d901d8389bfe31c888d0e8c9
Author: Robert Marko <robimarko at gmail.com>
AuthorDate: Tue Nov 19 14:36:17 2024 +0100

    imagebuilder: fix APK architecture setting
    
    Currently, when "apk add --initdb" is called it will populate the
    /etc/apk/arch file with the architecture of the host instead of the target
    package architecture and this will then make it impossible for new packages
    to be installed on the device as the target architecture will not match
    after APK is updated to include [1].
    
    So, lets use override the architecture by passing the target package one
    by using the "--arch" argument to "apk add".
    
    [1] https://gitlab.alpinelinux.org/alpine/apk-tools/-/commit/c1a3e69f24e235fc78f4dddb1f85fdf281464446
    
    Fixes: #16953
    Link: https://github.com/openwrt/openwrt/pull/17015
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 target/imagebuilder/files/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile
index d1502d40c1..2c6e26e4ee 100644
--- a/target/imagebuilder/files/Makefile
+++ b/target/imagebuilder/files/Makefile
@@ -200,7 +200,7 @@ ifeq ($(CONFIG_USE_APK),)
 		$(OPKG) update >&2 || true; \
 	fi
 else
-	$(APK) add --initdb
+	$(APK) add --arch $(ARCH_PACKAGES) --initdb
 	if [ -d "$(PACKAGE_DIR)" ] && ( \
 			[ ! -f "$(PACKAGE_DIR)/packages.adb" ] || \
 			[ "`find $(PACKAGE_DIR) -cnewer $(PACKAGE_DIR)/packages.adb`" ] ); then \
@@ -227,7 +227,7 @@ ifeq ($(CONFIG_USE_APK),)
 	$(OPKG) install $(wildcard $(PACKAGE_DIR)/kernel_*.ipk)
 	$(OPKG) install $(BUILD_PACKAGES)
 else
-	$(APK) add --no-scripts $(BUILD_PACKAGES)
+	$(APK) add --arch $(ARCH_PACKAGES) --no-scripts $(BUILD_PACKAGES)
 endif
 
 prepare_rootfs: FORCE




More information about the lede-commits mailing list