From 74a0d8cd92c7e753c6a342a7b90151ec042a03c5 Mon Sep 17 00:00:00 2001 From: Mathias Kresin Date: Fri, 20 Apr 2018 06:30:46 +0200 Subject: [PATCH] build: consolidate fake uImage header build commands Merge the two existing functions and use a parameter for the type header field. It updates the syntax of the former mpc85xx fake ramdisk header command to be compatible with mkimage from u-boot 2018.03 and fixes the build error spotted by the build bot. Signed-off-by: Mathias Kresin --- include/image-commands.mk | 18 +++++++++--------- target/linux/apm821xx/image/Makefile | 2 +- target/linux/ipq40xx/image/Makefile | 4 ++-- target/linux/ipq806x/image/Makefile | 6 +++--- target/linux/lantiq/image/Makefile | 4 ++-- target/linux/mpc85xx/image/Makefile | 12 +----------- target/linux/ramips/image/mt7620.mk | 4 ++-- 7 files changed, 20 insertions(+), 30 deletions(-) diff --git a/include/image-commands.mk b/include/image-commands.mk index 5f7845a6d9..a848655399 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -77,17 +77,17 @@ define Build/append-squashfs-fakeroot-be cat $@.fakesquashfs >> $@ endef -# append a fake/empty rootfs uImage header, to fool the bootloaders -# rootfs integrity check -define Build/append-uImage-fakeroot-hdr - touch $@.fakeroot +# append a fake/empty uImage header, to fool bootloaders rootfs integrity check +# for example +define Build/append-uImage-fakehdr + touch $@.fakehdr $(STAGING_DIR_HOST)/bin/mkimage \ - -A $(LINUX_KARCH) -O linux -T filesystem -C none \ - -n '$(call toupper,$(LINUX_KARCH)) $(VERSION_DIST) fakeroot' \ - -d $@.fakeroot \ + -A $(LINUX_KARCH) -O linux -T $(1) -C none \ + -n '$(VERSION_DIST) fake $(1)' \ + -d $@.fakehdr \ -s \ - $@.fakeroot - cat $@.fakeroot >> $@ + $@.fakehdr + cat $@.fakehdr >> $@ endef define Build/tplink-safeloader diff --git a/target/linux/apm821xx/image/Makefile b/target/linux/apm821xx/image/Makefile index 4cfbea4cbd..094c9e47de 100644 --- a/target/linux/apm821xx/image/Makefile +++ b/target/linux/apm821xx/image/Makefile @@ -171,7 +171,7 @@ define Device/netgear_wndr4700 # append a fake/empty rootfs to fool netgear's uboot # CHECK_DNI_FIRMWARE_ROOTFS_INTEGRITY in do_chk_dniimg() KERNEL := kernel-bin | lzma | uImage lzma | pad-offset $$(BLOCKSIZE) 64 | \ - append-uImage-fakeroot-hdr | dtb | create-uImage-dtb | prepend-dtb + append-uImage-fakehdr filesystem | dtb | create-uImage-dtb | prepend-dtb KERNEL_INITRAMFS := kernel-bin | gzip | dtb | MuImage-initramfs gzip IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \ netgear-dni | check-size $$$$(IMAGE_SIZE) diff --git a/target/linux/ipq40xx/image/Makefile b/target/linux/ipq40xx/image/Makefile index 058cab3399..b305ea0960 100644 --- a/target/linux/ipq40xx/image/Makefile +++ b/target/linux/ipq40xx/image/Makefile @@ -38,8 +38,8 @@ define Device/DniImage NETGEAR_BOARD_ID := NETGEAR_HW_ID := IMAGES := factory.img sysupgrade.bin - IMAGE/factory.img := append-kernel | pad-offset 64k 64 | append-uImage-fakeroot-hdr | pad-to $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | netgear-dni - IMAGE/sysupgrade.bin := append-kernel | pad-offset 64k 64 | append-uImage-fakeroot-hdr | pad-to $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | append-metadata + IMAGE/factory.img := append-kernel | pad-offset 64k 64 | append-uImage-fakehdr filesystem | pad-to $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | netgear-dni + IMAGE/sysupgrade.bin := append-kernel | pad-offset 64k 64 | append-uImage-fakehdr filesystem | pad-to $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | append-metadata endef DEVICE_VARS += NETGEAR_BOARD_ID NETGEAR_HW_ID diff --git a/target/linux/ipq806x/image/Makefile b/target/linux/ipq806x/image/Makefile index 73b6ca8c34..a737e165b0 100644 --- a/target/linux/ipq806x/image/Makefile +++ b/target/linux/ipq806x/image/Makefile @@ -47,8 +47,8 @@ define Device/DniImage NETGEAR_HW_ID := UBINIZE_OPTS := -E 5 IMAGES := factory.img sysupgrade.bin - IMAGE/factory.img := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-uImage-fakeroot-hdr | pad-to $$$$(KERNEL_SIZE) | append-ubi | netgear-dni - IMAGE/sysupgrade.bin := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-uImage-fakeroot-hdr | sysupgrade-tar kernel=$$$$@ | append-metadata + IMAGE/factory.img := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-uImage-fakehdr filesystem | pad-to $$$$(KERNEL_SIZE) | append-ubi | netgear-dni + IMAGE/sysupgrade.bin := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-uImage-fakehdr filesystem | sysupgrade-tar kernel=$$$$@ | append-metadata endef DEVICE_VARS += NETGEAR_BOARD_ID NETGEAR_HW_ID @@ -90,7 +90,7 @@ define Device/linksys_ea8500 PAGESIZE := 2048 BLOCKSIZE := 128k KERNEL_SIZE := 3072k - KERNEL = kernel-bin | append-dtb | uImage none | append-uImage-fakeroot-hdr + KERNEL = kernel-bin | append-dtb | uImage none | append-uImage-fakehdr filesystem BOARD_NAME := ea8500 SUPPORTED_DEVICES += ea8500 UBINIZE_OPTS := -E 5 diff --git a/target/linux/lantiq/image/Makefile b/target/linux/lantiq/image/Makefile index 3541ca8b54..031c3fcb83 100644 --- a/target/linux/lantiq/image/Makefile +++ b/target/linux/lantiq/image/Makefile @@ -585,8 +585,8 @@ define Device/netgear_dm200 DEVICE_DTS := DM200 IMAGES := sysupgrade.bin factory.img IMAGE/sysupgrade.bin := append-kernel | \ - pad-offset 64k 64 | append-uImage-fakeroot-hdr | \ - pad-offset 64k 64 | append-uImage-fakeroot-hdr | \ + pad-offset 64k 64 | append-uImage-fakehdr filesystem | \ + pad-offset 64k 64 | append-uImage-fakehdr filesystem | \ append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE) IMAGE/factory.img := $$(IMAGE/sysupgrade.bin) | netgear-dni IMAGE_SIZE := 7872k diff --git a/target/linux/mpc85xx/image/Makefile b/target/linux/mpc85xx/image/Makefile index 7ae6e27b35..4dd1f17321 100644 --- a/target/linux/mpc85xx/image/Makefile +++ b/target/linux/mpc85xx/image/Makefile @@ -16,16 +16,6 @@ define Device/Default KERNEL := kernel-bin endef -define Build/append-uImage-fakeramdisk-hdr - rm -f $@.fakeramdisk - $(STAGING_DIR_HOST)/bin/mkimage \ - -A $(LINUX_KARCH) -O linux -T ramdisk -C none \ - -n 'fakeramdisk' \ - -s \ - $@.fakeramdisk - cat $@.fakeramdisk >> $@ -endef - define Build/tplink-v1-image $(STAGING_DIR_HOST)/bin/mktplinkfw \ -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -F $(TPLINK_FLASHLAYOUT) \ @@ -68,7 +58,7 @@ define Device/hiveap-330 IMAGES := fdt.bin sysupgrade.bin IMAGE/fdt.bin := append-dtb IMAGE/sysupgrade.bin := append-dtb | pad-to 256k | check-size 256k | \ - append-uImage-fakeramdisk-hdr | pad-to 256k | check-size 512k | \ + append-uImage-fakehdr ramdisk | pad-to 256k | check-size 512k | \ append-rootfs | pad-rootfs $$(BLOCKSIZE) | pad-to 41216k | check-size 41216k | \ append-kernel | append-metadata endef diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index c12a915245..102a846e02 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -201,7 +201,7 @@ define Device/ex2700 BLOCKSIZE := 4k IMAGE_SIZE := $(ralink_default_fw_size_4M) IMAGES += factory.bin - KERNEL := $(KERNEL_DTB) | uImage lzma | pad-offset 64k 64 | append-uImage-fakeroot-hdr + KERNEL := $(KERNEL_DTB) | uImage lzma | pad-offset 64k 64 | append-uImage-fakehdr filesystem IMAGE/factory.bin := $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | \ netgear-dni DEVICE_PACKAGES := -kmod-mt76 @@ -512,7 +512,7 @@ define Device/wn3000rpv3 DTS := WN3000RPV3 BLOCKSIZE := 4k IMAGES += factory.bin - KERNEL := $(KERNEL_DTB) | uImage lzma | pad-offset 64k 64 | append-uImage-fakeroot-hdr + KERNEL := $(KERNEL_DTB) | uImage lzma | pad-offset 64k 64 | append-uImage-fakehdr filesystem IMAGE/factory.bin := $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | \ netgear-dni DEVICE_TITLE := Netgear WN3000RPv3 -- 2.30.2