[openwrt/openwrt] targetwide: imagebuilder: add explicit guards around initramfs rules
LEDE Commits
lede-commits at lists.infradead.org
Sun Oct 19 09:38:14 PDT 2025
hauke pushed a commit to openwrt/openwrt.git, branch openwrt-24.10:
https://git.openwrt.org/29397011ccef8cca2b26ebf8e2189224a88228bd
commit 29397011ccef8cca2b26ebf8e2189224a88228bd
Author: Eric Fahlgren <ericfahlgren at gmail.com>
AuthorDate: Wed Oct 8 09:42:21 2025 -0700
targetwide: imagebuilder: add explicit guards around initramfs rules
The imagebuilder is not intended to build initramfs images. Some
profiles attempt to do this and succeed, due to buildroot leaking
the initramfs-kernel into staging_dir; others attempt it, but fail
due to not having initramfs binaries present in the imagebuilder.
Fix this by adding an explict guard around the unsupported generation
of the initramfs images. This saves space and time during imagebuilder
runs, fixes those that are currently broken and protects against future
breakage for profiles that inadvertently work now.
Fixes: https://github.com/openwrt/openwrt/issues/20151
Signed-off-by: Eric Fahlgren <ericfahlgren at gmail.com>
Link: https://github.com/openwrt/openwrt/pull/20347
Signed-off-by: Robert Marko <robimarko at gmail.com>
(cherry picked from commit f6e0f57be0afd1baae8376c8c58535f9a9fe6e4d)
Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
target/linux/ath79/image/common-nec.mk | 2 ++
target/linux/ath79/image/generic.mk | 4 ++++
target/linux/mediatek/image/filogic.mk | 20 ++++++++++++++++++++
target/linux/qualcommax/image/ipq807x.mk | 4 ++++
target/linux/ramips/image/mt7620.mk | 4 ++++
target/linux/ramips/image/mt7621.mk | 10 ++++++++++
6 files changed, 44 insertions(+)
diff --git a/target/linux/ath79/image/common-nec.mk b/target/linux/ath79/image/common-nec.mk
index 23671e215d..d18ec25f69 100644
--- a/target/linux/ath79/image/common-nec.mk
+++ b/target/linux/ath79/image/common-nec.mk
@@ -12,6 +12,7 @@ define Device/nec-netbsd-aterm
KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | uImage none
KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | loader-kernel | uImage none
ARTIFACTS := uboot.bin
+ifeq ($(IB),)
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
COMPILE := loader-$(1).bin
COMPILE/loader-$(1).bin := loader-okli-compile
@@ -19,6 +20,7 @@ ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
ARTIFACT/initramfs-factory.bin := append-image-stage initramfs-kernel.bin | \
pad-to 4 skip=16 | \
nec-usbaterm-fw -f 0x0003 -d $$(KDIR)/loader-$(1).bin -d $$$$@ | check-size
+endif
endif
UBOOT_PATH := $$(STAGING_DIR_IMAGE)/$$(SOC)_nec_aterm-u-boot.bin
ARTIFACT/uboot.bin := append-uboot | check-size 128k
diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk
index e7aed14bd3..59c64e716d 100644
--- a/target/linux/ath79/image/generic.mk
+++ b/target/linux/ath79/image/generic.mk
@@ -1370,11 +1370,13 @@ define Device/elecom_wrc-1750ghbk2-i
DEVICE_VENDOR := ELECOM
DEVICE_MODEL := WRC-1750GHBK2-I/C
IMAGE_SIZE := 15808k
+ifeq ($(IB),)
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
ARTIFACTS := initramfs-factory.bin
ARTIFACT/initramfs-factory.bin := append-image initramfs-kernel.bin | \
pad-to 2 | edimax-header -b -s CSYS -m RN68 -f 0x70000 -S 0x01100000 | \
elecom-product-header WRC-1750GHBK2 | check-size
+endif
endif
DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct
endef
@@ -1385,12 +1387,14 @@ define Device/elecom_wrc-300ghbk2-i
DEVICE_VENDOR := ELECOM
DEVICE_MODEL := WRC-300GHBK2-I
IMAGE_SIZE := 7616k
+ifeq ($(IB),)
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
ARTIFACTS := initramfs-factory.bin
ARTIFACT/initramfs-factory.bin := append-image initramfs-kernel.bin | \
pad-to 2 | edimax-header -b -s CSYS -m RN51 -f 0x70000 -S 0x01100000 | \
elecom-product-header WRC-300GHBK2-I | check-size
endif
+endif
endef
TARGET_DEVICES += elecom_wrc-300ghbk2-i
diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk
index d062a47e4a..acf956e8ec 100644
--- a/target/linux/mediatek/image/filogic.mk
+++ b/target/linux/mediatek/image/filogic.mk
@@ -270,9 +270,11 @@ define Device/asus_rt-ax52
KERNEL_INITRAMFS := kernel-bin | lzma | \
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+ifeq ($(IB),)
ARTIFACTS := initramfs.trx
ARTIFACT/initramfs.trx := append-image-stage initramfs-kernel.bin | \
uImage none | asus-trx -v 3 -n $$(DEVICE_MODEL)
+endif
endef
TARGET_DEVICES += asus_rt-ax52
@@ -865,10 +867,12 @@ define Device/dlink_aquila-pro-ai-m30-a1
IMAGES += recovery.bin
IMAGE_SIZE := 51200k
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+ifeq ($(IB),)
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
IMAGE/recovery.bin := append-image-stage initramfs-kernel.bin | sysupgrade-tar kernel=$$$$@ |\
pad-to $$(IMAGE_SIZE) | dlink-ai-recovery-header DLK6E6110001 \x6A\x28\xEE\x0B \x00\x00\x2C\x00 \x00\x00\x20\x03 \x61\x6E
endif
+endif
endef
TARGET_DEVICES += dlink_aquila-pro-ai-m30-a1
@@ -882,10 +886,12 @@ define Device/dlink_aquila-pro-ai-m60-a1
IMAGES += recovery.bin
IMAGE_SIZE := 51200k
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+ifeq ($(IB),)
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
IMAGE/recovery.bin := append-image-stage initramfs-kernel.bin | sysupgrade-tar kernel=$$$$@ |\
pad-to $$(IMAGE_SIZE) | dlink-ai-recovery-header DLK6E8202001 \x30\x6C\x19\x0C \x00\x00\x2C\x00 \x00\x00\x20\x03 \x82\x6E
endif
+endif
endef
TARGET_DEVICES += dlink_aquila-pro-ai-m60-a1
@@ -1821,9 +1827,11 @@ define Device/xiaomi_mi-router-ax3000t
BLOCKSIZE := 128k
PAGESIZE := 2048
DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware
+ifeq ($(IB),)
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
ARTIFACTS := initramfs-factory.ubi
ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-kernel.bin | ubinize-kernel
+endif
endif
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
endef
@@ -1850,10 +1858,12 @@ define Device/xiaomi_mi-router-ax3000t-ubootmod
ARTIFACTS := preloader.bin bl31-uboot.fip
ARTIFACT/preloader.bin := mt7981-bl2 spim-nand-ddr3
ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot xiaomi_mi-router-ax3000t
+ifeq ($(IB),)
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
ARTIFACTS += initramfs-factory.ubi
ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-recovery.itb | ubinize-kernel
endif
+endif
endef
TARGET_DEVICES += xiaomi_mi-router-ax3000t-ubootmod
@@ -1866,9 +1876,11 @@ define Device/xiaomi_mi-router-wr30u-stock
BLOCKSIZE := 128k
PAGESIZE := 2048
DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware
+ifeq ($(IB),)
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
ARTIFACTS := initramfs-factory.ubi
ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-kernel.bin | ubinize-kernel
+endif
endif
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
endef
@@ -1895,10 +1907,12 @@ define Device/xiaomi_mi-router-wr30u-ubootmod
ARTIFACTS := preloader.bin bl31-uboot.fip
ARTIFACT/preloader.bin := mt7981-bl2 spim-nand-ddr3
ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot xiaomi_mi-router-wr30u
+ifeq ($(IB),)
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
ARTIFACTS += initramfs-factory.ubi
ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-recovery.itb | ubinize-kernel
endif
+endif
endef
TARGET_DEVICES += xiaomi_mi-router-wr30u-ubootmod
@@ -1911,9 +1925,11 @@ define Device/xiaomi_redmi-router-ax6000-stock
UBINIZE_OPTS := -E 5
BLOCKSIZE := 128k
PAGESIZE := 2048
+ifeq ($(IB),)
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
ARTIFACTS := initramfs-factory.ubi
ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-kernel.bin | ubinize-kernel
+endif
endif
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
endef
@@ -1940,10 +1956,12 @@ define Device/xiaomi_redmi-router-ax6000-ubootmod
ARTIFACTS := preloader.bin bl31-uboot.fip
ARTIFACT/preloader.bin := mt7986-bl2 spim-nand-ddr4
ARTIFACT/bl31-uboot.fip := mt7986-bl31-uboot xiaomi_redmi-router-ax6000
+ifeq ($(IB),)
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
ARTIFACTS += initramfs-factory.ubi
ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-recovery.itb | ubinize-kernel
endif
+endif
endef
TARGET_DEVICES += xiaomi_redmi-router-ax6000-ubootmod
@@ -2069,10 +2087,12 @@ define Device/zyxel_ex5601-t0-ubootmod
ARTIFACTS := preloader.bin bl31-uboot.fip
ARTIFACT/preloader.bin := mt7986-bl2 spim-nand-4k-ddr4
ARTIFACT/bl31-uboot.fip := mt7986-bl31-uboot zyxel_ex5601-t0
+ifeq ($(IB),)
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
ARTIFACTS += initramfs-factory.ubi
ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-recovery.itb | ubinize-kernel
endif
+endif
endef
TARGET_DEVICES += zyxel_ex5601-t0-ubootmod
diff --git a/target/linux/qualcommax/image/ipq807x.mk b/target/linux/qualcommax/image/ipq807x.mk
index e934ce31ba..d72d72a372 100644
--- a/target/linux/qualcommax/image/ipq807x.mk
+++ b/target/linux/qualcommax/image/ipq807x.mk
@@ -62,6 +62,7 @@ define Device/asus_rt-ax89x
append-kernel | asus-fake-ramdisk |\
multiImage gzip $$(KDIR)/tmp/fakerd $$(KDIR)/image-$$(DEVICE_DTS).dtb |\
sysupgrade-tar kernel=$$$$@ | append-metadata
+ifeq ($(IB),)
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
ARTIFACTS := initramfs-factory.trx initramfs-uImage.itb
ARTIFACT/initramfs-uImage.itb := \
@@ -72,6 +73,7 @@ ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
multiImage gzip $$(KDIR)/tmp/fakehsqs $$(KDIR)/image-$$(DEVICE_DTS).dtb |\
asus-trx -v 2 -n RT-AX89U -b 388 -e 49000
endif
+endif
endef
TARGET_DEVICES += asus_rt-ax89x
@@ -246,11 +248,13 @@ define Device/netgear_rax120v2
NETGEAR_HW_ID := 29765589+0+512+1024+4x4+8x8
DEVICE_PACKAGES := ipq-wifi-netgear_rax120v2 kmod-spi-gpio \
kmod-spi-bitbang kmod-gpio-nxp-74hc164 kmod-hwmon-g762
+ifeq ($(IB),)
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
IMAGES += web-ui-factory.img
IMAGE/web-ui-factory.img := append-image initramfs-uImage.itb | \
pad-offset $$$$(BLOCKSIZE) 64 | append-uImage-fakehdr filesystem | \
netgear-dni
+endif
endif
IMAGE/sysupgrade.bin := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | \
append-uImage-fakehdr filesystem | sysupgrade-tar kernel=$$$$@ | \
diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk
index 310cff692e..2ae329e096 100644
--- a/target/linux/ramips/image/mt7620.mk
+++ b/target/linux/ramips/image/mt7620.mk
@@ -1129,10 +1129,12 @@ define Device/rostelecom_rt-fl-1
$(Device/sercomm_cpj)
DEVICE_MODEL := RT-FL-1
DEVICE_ALT0_MODEL := RT-FL-1
+ifeq ($(IB),)
ARTIFACT/initramfs-factory.img := \
append-image-stage initramfs-kernel.bin | check-size | \
sercomm-factory-cpj | gzip | sercomm-payload | \
sercomm-pid-setbit 0x11 | sercomm-crypto
+endif
endef
TARGET_DEVICES += rostelecom_rt-fl-1
@@ -1140,9 +1142,11 @@ define Device/rostelecom_s1010
$(Device/sercomm_cpj)
DEVICE_MODEL := S1010
DEVICE_ALT0_MODEL := S1010.RT
+ifeq ($(IB),)
ARTIFACT/initramfs-factory.img := \
append-image-stage initramfs-kernel.bin | check-size | \
sercomm-factory-cpj | gzip | sercomm-payload | sercomm-crypto
+endif
endef
TARGET_DEVICES += rostelecom_s1010
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index adaa27908f..44aa7dda7f 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -1178,11 +1178,13 @@ define Device/elecom_wmc-x1800gst
KERNEL_LOADADDR := 0x82000000
KERNEL := kernel-bin | relocate-kernel $(loadaddr-y) | lzma | \
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
+ifeq ($(IB),)
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
ARTIFACTS := initramfs-factory.bin
ARTIFACT/initramfs-factory.bin := append-image-stage initramfs-kernel.bin | \
check-size $$$$(KERNEL_SIZE) | elecom-wrc-gs-factory WMC-2LX 0.00 -N | \
append-string MT7621_ELECOM_WMC-2LX
+endif
endif
DEVICE_PACKAGES := kmod-mt7915-firmware -uboot-envtools
endef
@@ -1311,11 +1313,13 @@ define Device/elecom_wrc-x1800gs
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
KERNEL_SIZE := 8192k
IMAGE_SIZE := 51456k
+ifeq ($(IB),)
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
ARTIFACTS := initramfs-factory.bin
ARTIFACT/initramfs-factory.bin := append-image-stage initramfs-kernel.bin | \
znet-header 4.04(XVF.1)b90 COMC 0x68 | elecom-product-header WRC-X1800GS | \
check-size
+endif
endif
DEVICE_PACKAGES := kmod-mt7915-firmware
endef
@@ -1329,11 +1333,13 @@ define Device/elecom_wsc-x1800gs
KERNEL_LOADADDR := 0x82000000
KERNEL := kernel-bin | relocate-kernel $(loadaddr-y) | lzma | \
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
+ifeq ($(IB),)
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
ARTIFACTS := initramfs-factory.bin
ARTIFACT/initramfs-factory.bin := append-image-stage initramfs-kernel.bin | \
check-size $$$$(KERNEL_SIZE) | elecom-wrc-gs-factory WMC-2LX 0.00 -N | \
append-string MT7621_ELECOM_WMC-2LX
+endif
endif
DEVICE_PACKAGES := kmod-mt7915-firmware -uboot-envtools
endef
@@ -1406,10 +1412,12 @@ define Device/genexis_pulse-ex400/common
--log-lebs=2 --space-fixup --squash-uids
KERNEL := kernel-bin | lzma | uImage lzma
KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma
+ifeq ($(IB),)
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
IMAGES += factory.bin
IMAGE/factory.bin := append-image-stage initramfs-kernel.bin | \
inteno-bootfs | inteno-y3-header EX400 | append-md5sum-ascii-salted
+endif
endif
IMAGE/sysupgrade.bin := append-kernel | inteno-bootfs | pad-to 10M | \
sysupgrade-tar kernel=$$$$@ | check-size | append-metadata
@@ -1503,10 +1511,12 @@ define Device/haier-sim_wr1800k
KERNEL_LOADADDR := 0x82000000
KERNEL := kernel-bin | relocate-kernel $(loadaddr-y) | lzma | \
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
+ifeq ($(IB),)
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
ARTIFACTS := initramfs-factory.bin
ARTIFACT/initramfs-factory.bin := append-image-stage initramfs-kernel.bin | \
haier-sim_wr1800k-factory
+endif
endif
DEVICE_PACKAGES := kmod-mt7915-firmware
endef
More information about the lede-commits
mailing list