Force ImageBuilder to use older versions from /packages/

I'm compiling some of the packages with my own set of patches or config options, using OpenWrt SDK of the exact release version. Then I copy my packages to /packages/ folder of ImageBuilder and build the firmware with ImageBuilder.

OpenWrt SDK uses exact git commit hash for the non-base feeds:

src-git base https://git.openwrt.org/openwrt/openwrt.git;v22.03.5
src-git-full packages https://git.openwrt.org/feed/packages.git^d057936acbefd76b033e7c365baa68b48ccb9166
src-git-full luci https://git.openwrt.org/project/luci.git^0b38d70fbd47b0c702d5001de623213eb301a6fe
src-git-full routing https://git.openwrt.org/feed/routing.git^1cc7676b9f32acc30ec47f15fcb70380d5d6ef01
src-git-full telephony https://git.openwrt.org/feed/telephony.git^36d9f2f962bd0aba2eef674eb265819609ea99ed

However, ImageBuilder uses whatever present in the current repositories, which receive updates for the whole branch.

The issue as follows:

  1. I build cURL with the 22.03.5 SDK, it has 8.0.1 version
  2. The built .ipk is copied to /packages/ directory of 22.03.5 ImageBuilder
  3. ImageBuilder refreshes feeds, get cURL 8.1.1 (updated version) from the OpenWrt repositories
  4. cURL 8.0.1 .ipk from /packages/ is ignored, cURL 8.1.1 from the repositories is packaged into the firmware instead.

As a workaround, I've updated SDK feeds file to use openwrt-22.03 branch instead of explicit commit hash, but it also prone to break if I don't rebuild packages frequently enough.

Is there any proper way to pin the package version in the ImageBuilder, or to force "downgrading" packages from /packages/?
As another workaround, I could only think of patching package versions to 9999.something, to make it always newer than anything in the repository. But is there any other, more convenient way?

Not really, the imagebuilder depends on the generated (signed) repository indices - and even if it wouldn't, opkg doesn't really behave gracefully in the presence of multiple versions of a single package.

Ended up patching ImageBuilder's Makefile to install everything containing in /packages/:

# Patch ImageBuilder's Makefile to force-install local packages,
# just to make sure we'll have our own package versions in the image.
# NOTE: it will force-install ALL the packages in packages/ directory,
# even not mentioned in PACKAGES variable.
patch <<'EOF'
--- Makefile	2023-01-03 03:24:21.000000000 +0300
+++ Makefile	2023-06-13 16:57:23.768020555 +0300
@@ -167,6 +167,9 @@
 	$(OPKG) install $(firstword $(wildcard $(LINUX_DIR)/libc_*.ipk $(PACKAGE_DIR)/libc_*.ipk))
 	$(OPKG) install $(firstword $(wildcard $(LINUX_DIR)/kernel_*.ipk $(PACKAGE_DIR)/kernel_*.ipk))
 	$(OPKG) install $(BUILD_PACKAGES)
+	@echo
+	@echo Force-reinstalling local packages
+	$(OPKG) install --force-reinstall --force-downgrade $(wildcard $(PACKAGE_DIR)/*.ipk)
 
 prepare_rootfs: FORCE
 	@echo
EOF

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.