Skip to content

Commit 2939701

Browse files
efahlhauke
authored andcommitted
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: openwrt/openwrt#20151 Signed-off-by: Eric Fahlgren <[email protected]> Link: openwrt/openwrt#20347 Signed-off-by: Robert Marko <[email protected]> (cherry picked from commit f6e0f57) Signed-off-by: Hauke Mehrtens <[email protected]>
1 parent c5892fe commit 2939701

File tree

6 files changed

+44
-0
lines changed

6 files changed

+44
-0
lines changed

target/linux/ath79/image/common-nec.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ define Device/nec-netbsd-aterm
1212
KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | uImage none
1313
KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | loader-kernel | uImage none
1414
ARTIFACTS := uboot.bin
15+
ifeq ($(IB),)
1516
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
1617
COMPILE := loader-$(1).bin
1718
COMPILE/loader-$(1).bin := loader-okli-compile
1819
ARTIFACTS += initramfs-factory.bin
1920
ARTIFACT/initramfs-factory.bin := append-image-stage initramfs-kernel.bin | \
2021
pad-to 4 skip=16 | \
2122
nec-usbaterm-fw -f 0x0003 -d $$(KDIR)/loader-$(1).bin -d $$$$@ | check-size
23+
endif
2224
endif
2325
UBOOT_PATH := $$(STAGING_DIR_IMAGE)/$$(SOC)_nec_aterm-u-boot.bin
2426
ARTIFACT/uboot.bin := append-uboot | check-size 128k

target/linux/ath79/image/generic.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,11 +1370,13 @@ define Device/elecom_wrc-1750ghbk2-i
13701370
DEVICE_VENDOR := ELECOM
13711371
DEVICE_MODEL := WRC-1750GHBK2-I/C
13721372
IMAGE_SIZE := 15808k
1373+
ifeq ($(IB),)
13731374
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
13741375
ARTIFACTS := initramfs-factory.bin
13751376
ARTIFACT/initramfs-factory.bin := append-image initramfs-kernel.bin | \
13761377
pad-to 2 | edimax-header -b -s CSYS -m RN68 -f 0x70000 -S 0x01100000 | \
13771378
elecom-product-header WRC-1750GHBK2 | check-size
1379+
endif
13781380
endif
13791381
DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct
13801382
endef
@@ -1385,12 +1387,14 @@ define Device/elecom_wrc-300ghbk2-i
13851387
DEVICE_VENDOR := ELECOM
13861388
DEVICE_MODEL := WRC-300GHBK2-I
13871389
IMAGE_SIZE := 7616k
1390+
ifeq ($(IB),)
13881391
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
13891392
ARTIFACTS := initramfs-factory.bin
13901393
ARTIFACT/initramfs-factory.bin := append-image initramfs-kernel.bin | \
13911394
pad-to 2 | edimax-header -b -s CSYS -m RN51 -f 0x70000 -S 0x01100000 | \
13921395
elecom-product-header WRC-300GHBK2-I | check-size
13931396
endif
1397+
endif
13941398
endef
13951399
TARGET_DEVICES += elecom_wrc-300ghbk2-i
13961400

target/linux/mediatek/image/filogic.mk

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,11 @@ define Device/asus_rt-ax52
270270
KERNEL_INITRAMFS := kernel-bin | lzma | \
271271
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
272272
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
273+
ifeq ($(IB),)
273274
ARTIFACTS := initramfs.trx
274275
ARTIFACT/initramfs.trx := append-image-stage initramfs-kernel.bin | \
275276
uImage none | asus-trx -v 3 -n $$(DEVICE_MODEL)
277+
endif
276278
endef
277279
TARGET_DEVICES += asus_rt-ax52
278280

@@ -865,10 +867,12 @@ define Device/dlink_aquila-pro-ai-m30-a1
865867
IMAGES += recovery.bin
866868
IMAGE_SIZE := 51200k
867869
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
870+
ifeq ($(IB),)
868871
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
869872
IMAGE/recovery.bin := append-image-stage initramfs-kernel.bin | sysupgrade-tar kernel=$$$$@ |\
870873
pad-to $$(IMAGE_SIZE) | dlink-ai-recovery-header DLK6E6110001 \x6A\x28\xEE\x0B \x00\x00\x2C\x00 \x00\x00\x20\x03 \x61\x6E
871874
endif
875+
endif
872876
endef
873877
TARGET_DEVICES += dlink_aquila-pro-ai-m30-a1
874878

@@ -882,10 +886,12 @@ define Device/dlink_aquila-pro-ai-m60-a1
882886
IMAGES += recovery.bin
883887
IMAGE_SIZE := 51200k
884888
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
889+
ifeq ($(IB),)
885890
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
886891
IMAGE/recovery.bin := append-image-stage initramfs-kernel.bin | sysupgrade-tar kernel=$$$$@ |\
887892
pad-to $$(IMAGE_SIZE) | dlink-ai-recovery-header DLK6E8202001 \x30\x6C\x19\x0C \x00\x00\x2C\x00 \x00\x00\x20\x03 \x82\x6E
888893
endif
894+
endif
889895
endef
890896
TARGET_DEVICES += dlink_aquila-pro-ai-m60-a1
891897

@@ -1821,9 +1827,11 @@ define Device/xiaomi_mi-router-ax3000t
18211827
BLOCKSIZE := 128k
18221828
PAGESIZE := 2048
18231829
DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware
1830+
ifeq ($(IB),)
18241831
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
18251832
ARTIFACTS := initramfs-factory.ubi
18261833
ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-kernel.bin | ubinize-kernel
1834+
endif
18271835
endif
18281836
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
18291837
endef
@@ -1850,10 +1858,12 @@ define Device/xiaomi_mi-router-ax3000t-ubootmod
18501858
ARTIFACTS := preloader.bin bl31-uboot.fip
18511859
ARTIFACT/preloader.bin := mt7981-bl2 spim-nand-ddr3
18521860
ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot xiaomi_mi-router-ax3000t
1861+
ifeq ($(IB),)
18531862
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
18541863
ARTIFACTS += initramfs-factory.ubi
18551864
ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-recovery.itb | ubinize-kernel
18561865
endif
1866+
endif
18571867
endef
18581868
TARGET_DEVICES += xiaomi_mi-router-ax3000t-ubootmod
18591869

@@ -1866,9 +1876,11 @@ define Device/xiaomi_mi-router-wr30u-stock
18661876
BLOCKSIZE := 128k
18671877
PAGESIZE := 2048
18681878
DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware
1879+
ifeq ($(IB),)
18691880
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
18701881
ARTIFACTS := initramfs-factory.ubi
18711882
ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-kernel.bin | ubinize-kernel
1883+
endif
18721884
endif
18731885
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
18741886
endef
@@ -1895,10 +1907,12 @@ define Device/xiaomi_mi-router-wr30u-ubootmod
18951907
ARTIFACTS := preloader.bin bl31-uboot.fip
18961908
ARTIFACT/preloader.bin := mt7981-bl2 spim-nand-ddr3
18971909
ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot xiaomi_mi-router-wr30u
1910+
ifeq ($(IB),)
18981911
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
18991912
ARTIFACTS += initramfs-factory.ubi
19001913
ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-recovery.itb | ubinize-kernel
19011914
endif
1915+
endif
19021916
endef
19031917
TARGET_DEVICES += xiaomi_mi-router-wr30u-ubootmod
19041918

@@ -1911,9 +1925,11 @@ define Device/xiaomi_redmi-router-ax6000-stock
19111925
UBINIZE_OPTS := -E 5
19121926
BLOCKSIZE := 128k
19131927
PAGESIZE := 2048
1928+
ifeq ($(IB),)
19141929
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
19151930
ARTIFACTS := initramfs-factory.ubi
19161931
ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-kernel.bin | ubinize-kernel
1932+
endif
19171933
endif
19181934
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
19191935
endef
@@ -1940,10 +1956,12 @@ define Device/xiaomi_redmi-router-ax6000-ubootmod
19401956
ARTIFACTS := preloader.bin bl31-uboot.fip
19411957
ARTIFACT/preloader.bin := mt7986-bl2 spim-nand-ddr4
19421958
ARTIFACT/bl31-uboot.fip := mt7986-bl31-uboot xiaomi_redmi-router-ax6000
1959+
ifeq ($(IB),)
19431960
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
19441961
ARTIFACTS += initramfs-factory.ubi
19451962
ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-recovery.itb | ubinize-kernel
19461963
endif
1964+
endif
19471965
endef
19481966
TARGET_DEVICES += xiaomi_redmi-router-ax6000-ubootmod
19491967

@@ -2069,10 +2087,12 @@ define Device/zyxel_ex5601-t0-ubootmod
20692087
ARTIFACTS := preloader.bin bl31-uboot.fip
20702088
ARTIFACT/preloader.bin := mt7986-bl2 spim-nand-4k-ddr4
20712089
ARTIFACT/bl31-uboot.fip := mt7986-bl31-uboot zyxel_ex5601-t0
2090+
ifeq ($(IB),)
20722091
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
20732092
ARTIFACTS += initramfs-factory.ubi
20742093
ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-recovery.itb | ubinize-kernel
20752094
endif
2095+
endif
20762096
endef
20772097
TARGET_DEVICES += zyxel_ex5601-t0-ubootmod
20782098

target/linux/qualcommax/image/ipq807x.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ define Device/asus_rt-ax89x
6262
append-kernel | asus-fake-ramdisk |\
6363
multiImage gzip $$(KDIR)/tmp/fakerd $$(KDIR)/image-$$(DEVICE_DTS).dtb |\
6464
sysupgrade-tar kernel=$$$$@ | append-metadata
65+
ifeq ($(IB),)
6566
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
6667
ARTIFACTS := initramfs-factory.trx initramfs-uImage.itb
6768
ARTIFACT/initramfs-uImage.itb := \
@@ -72,6 +73,7 @@ ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
7273
multiImage gzip $$(KDIR)/tmp/fakehsqs $$(KDIR)/image-$$(DEVICE_DTS).dtb |\
7374
asus-trx -v 2 -n RT-AX89U -b 388 -e 49000
7475
endif
76+
endif
7577
endef
7678
TARGET_DEVICES += asus_rt-ax89x
7779

@@ -246,11 +248,13 @@ define Device/netgear_rax120v2
246248
NETGEAR_HW_ID := 29765589+0+512+1024+4x4+8x8
247249
DEVICE_PACKAGES := ipq-wifi-netgear_rax120v2 kmod-spi-gpio \
248250
kmod-spi-bitbang kmod-gpio-nxp-74hc164 kmod-hwmon-g762
251+
ifeq ($(IB),)
249252
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
250253
IMAGES += web-ui-factory.img
251254
IMAGE/web-ui-factory.img := append-image initramfs-uImage.itb | \
252255
pad-offset $$$$(BLOCKSIZE) 64 | append-uImage-fakehdr filesystem | \
253256
netgear-dni
257+
endif
254258
endif
255259
IMAGE/sysupgrade.bin := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | \
256260
append-uImage-fakehdr filesystem | sysupgrade-tar kernel=$$$$@ | \

target/linux/ramips/image/mt7620.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,20 +1129,24 @@ define Device/rostelecom_rt-fl-1
11291129
$(Device/sercomm_cpj)
11301130
DEVICE_MODEL := RT-FL-1
11311131
DEVICE_ALT0_MODEL := RT-FL-1
1132+
ifeq ($(IB),)
11321133
ARTIFACT/initramfs-factory.img := \
11331134
append-image-stage initramfs-kernel.bin | check-size | \
11341135
sercomm-factory-cpj | gzip | sercomm-payload | \
11351136
sercomm-pid-setbit 0x11 | sercomm-crypto
1137+
endif
11361138
endef
11371139
TARGET_DEVICES += rostelecom_rt-fl-1
11381140

11391141
define Device/rostelecom_s1010
11401142
$(Device/sercomm_cpj)
11411143
DEVICE_MODEL := S1010
11421144
DEVICE_ALT0_MODEL := S1010.RT
1145+
ifeq ($(IB),)
11431146
ARTIFACT/initramfs-factory.img := \
11441147
append-image-stage initramfs-kernel.bin | check-size | \
11451148
sercomm-factory-cpj | gzip | sercomm-payload | sercomm-crypto
1149+
endif
11461150
endef
11471151
TARGET_DEVICES += rostelecom_s1010
11481152

target/linux/ramips/image/mt7621.mk

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,11 +1178,13 @@ define Device/elecom_wmc-x1800gst
11781178
KERNEL_LOADADDR := 0x82000000
11791179
KERNEL := kernel-bin | relocate-kernel $(loadaddr-y) | lzma | \
11801180
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
1181+
ifeq ($(IB),)
11811182
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
11821183
ARTIFACTS := initramfs-factory.bin
11831184
ARTIFACT/initramfs-factory.bin := append-image-stage initramfs-kernel.bin | \
11841185
check-size $$$$(KERNEL_SIZE) | elecom-wrc-gs-factory WMC-2LX 0.00 -N | \
11851186
append-string MT7621_ELECOM_WMC-2LX
1187+
endif
11861188
endif
11871189
DEVICE_PACKAGES := kmod-mt7915-firmware -uboot-envtools
11881190
endef
@@ -1311,11 +1313,13 @@ define Device/elecom_wrc-x1800gs
13111313
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
13121314
KERNEL_SIZE := 8192k
13131315
IMAGE_SIZE := 51456k
1316+
ifeq ($(IB),)
13141317
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
13151318
ARTIFACTS := initramfs-factory.bin
13161319
ARTIFACT/initramfs-factory.bin := append-image-stage initramfs-kernel.bin | \
13171320
znet-header 4.04(XVF.1)b90 COMC 0x68 | elecom-product-header WRC-X1800GS | \
13181321
check-size
1322+
endif
13191323
endif
13201324
DEVICE_PACKAGES := kmod-mt7915-firmware
13211325
endef
@@ -1329,11 +1333,13 @@ define Device/elecom_wsc-x1800gs
13291333
KERNEL_LOADADDR := 0x82000000
13301334
KERNEL := kernel-bin | relocate-kernel $(loadaddr-y) | lzma | \
13311335
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
1336+
ifeq ($(IB),)
13321337
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
13331338
ARTIFACTS := initramfs-factory.bin
13341339
ARTIFACT/initramfs-factory.bin := append-image-stage initramfs-kernel.bin | \
13351340
check-size $$$$(KERNEL_SIZE) | elecom-wrc-gs-factory WMC-2LX 0.00 -N | \
13361341
append-string MT7621_ELECOM_WMC-2LX
1342+
endif
13371343
endif
13381344
DEVICE_PACKAGES := kmod-mt7915-firmware -uboot-envtools
13391345
endef
@@ -1406,10 +1412,12 @@ define Device/genexis_pulse-ex400/common
14061412
--log-lebs=2 --space-fixup --squash-uids
14071413
KERNEL := kernel-bin | lzma | uImage lzma
14081414
KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma
1415+
ifeq ($(IB),)
14091416
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
14101417
IMAGES += factory.bin
14111418
IMAGE/factory.bin := append-image-stage initramfs-kernel.bin | \
14121419
inteno-bootfs | inteno-y3-header EX400 | append-md5sum-ascii-salted
1420+
endif
14131421
endif
14141422
IMAGE/sysupgrade.bin := append-kernel | inteno-bootfs | pad-to 10M | \
14151423
sysupgrade-tar kernel=$$$$@ | check-size | append-metadata
@@ -1503,10 +1511,12 @@ define Device/haier-sim_wr1800k
15031511
KERNEL_LOADADDR := 0x82000000
15041512
KERNEL := kernel-bin | relocate-kernel $(loadaddr-y) | lzma | \
15051513
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
1514+
ifeq ($(IB),)
15061515
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
15071516
ARTIFACTS := initramfs-factory.bin
15081517
ARTIFACT/initramfs-factory.bin := append-image-stage initramfs-kernel.bin | \
15091518
haier-sim_wr1800k-factory
1519+
endif
15101520
endif
15111521
DEVICE_PACKAGES := kmod-mt7915-firmware
15121522
endef

0 commit comments

Comments
 (0)