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 <dev@kresin.me>
This commit is contained in:
Mathias Kresin 2018-04-20 06:30:46 +02:00
parent 5950ab067b
commit 74a0d8cd92
7 changed files with 20 additions and 30 deletions

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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