diff --git a/include/image-commands.mk b/include/image-commands.mk index 7d124ece19b..49e438954a8 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -62,6 +62,18 @@ define Build/netgear-dni mv $@.new $@ endef +# append a fake/empty rootfs uImage header, to fool the bootloaders +# rootfs integrity check +define Build/append-uImage-fakeroot-hdr + rm -f $@.fakeroot + $(STAGING_DIR_HOST)/bin/mkimage \ + -A $(LINUX_KARCH) -O linux -T filesystem -C none \ + -n '$(call toupper,$(LINUX_KARCH)) LEDE fakeroot' \ + -s \ + $@.fakeroot + cat $@.fakeroot >> $@ +endef + define Build/tplink-safeloader -$(STAGING_DIR_HOST)/bin/tplink-safeloader \ -B $(TPLINK_BOARD_NAME) \ @@ -143,10 +155,6 @@ define Build/append-rootfs dd if=$(IMAGE_ROOTFS) >> $@ endef -define Build/append-file - cat "$(1)" >> "$@" -endef - define Build/append-ubi sh $(TOPDIR)/scripts/ubinize-image.sh \ $(if $(UBOOTENV_IN_UBI),--uboot-env) \ diff --git a/target/linux/apm821xx/image/Makefile b/target/linux/apm821xx/image/Makefile index 0ded83dd999..a11e9897052 100644 --- a/target/linux/apm821xx/image/Makefile +++ b/target/linux/apm821xx/image/Makefile @@ -129,23 +129,6 @@ define Build/create-uImage-dtb @mv $@.new $@ endef -define Build/append-fakerootfs - rm -rf $@.fakerootsquashfs $@.fakefs - - # append a fake/empty rootfs to fool netgear's uboot - # CHECK_DNI_FIRMWARE_ROOTFS_INTEGRITY in do_chk_dniimg() - dd if=/dev/zero of=$@.fakerd bs=16 count=1 conv=sync - - -$(STAGING_DIR_HOST)/bin/mkimage \ - -A $(LINUX_KARCH) -O linux -T filesystem -C none \ - -a 0x00000000 -e 0x00000000 \ - -n '$(DEVICE_PROFILE) fakerootfs' \ - -d $@.fakerd $@.fakefs - - cat $@.fakefs >> $@ - rm -rf $@.fakerootsquashfs $@.fakefs -endef - define Build/wndr4700-specialImage rm -rf $@.fakerd $@.new @@ -192,7 +175,8 @@ define Device/WNDR4700 IMAGE_SIZE := 24960k IMAGES := factory.img sysupgrade.tar kernel.dtb KERNEL_SIZE := 1920k - KERNEL := dtb | kernel-bin | lzma | uImage lzma | pad-offset $$(BLOCKSIZE) 64 | append-fakerootfs + KERNEL := dtb | kernel-bin | lzma | uImage lzma | pad-offset $$(BLOCKSIZE) 64 | \ + append-uImage-fakeroot-hdr KERNEL_INITRAMFS := kernel-bin | gzip | dtb | wndr4700-specialImage gzip IMAGE/factory.img := create-uImage-dtb | append-kernel | pad-to 2M | append-ubi | \ netgear-dni | check-size $$$$(IMAGE_SIZE) diff --git a/target/linux/ipq806x/image/Makefile b/target/linux/ipq806x/image/Makefile index 33dc31d41ed..b00e1975864 100644 --- a/target/linux/ipq806x/image/Makefile +++ b/target/linux/ipq806x/image/Makefile @@ -9,12 +9,6 @@ KERNEL_LOADADDR := 0x42208000 define Image/Prepare $(CP) $(LINUX_DIR)/vmlinux $(KDIR)/$(IMG_PREFIX)-vmlinux.elf - mkimage -A arm -O linux -T filesystem -C none \ - -a $(KERNEL_LOADADDR) -e $(KERNEL_LOADADDR) \ - -n 'ARM OpenWrt fakeroot' \ - -s $(KDIR_TMP)/root.dummy-uImage.tmp - echo -ne '\xff' > $(KDIR_TMP)/root.dummy - cat $(KDIR_TMP)/root.dummy $(KDIR_TMP)/root.dummy-uImage.tmp > $(KDIR)/root.dummy endef define Image/BuildKernel @@ -64,7 +58,8 @@ define Device/DniImage FILESYSTEMS := squashfs KERNEL_SUFFIX := -uImage KERNEL_INITRAMFS := kernel-bin | append-dtb | uImage none - KERNEL = kernel-bin | append-dtb | pad-to $$$$(($$(KERNEL_SIZE)-2*64-1)) | uImage none | append-file $(KDIR)/root.dummy + KERNEL = kernel-bin | append-dtb | uImage none | pad-offset $$(KERNEL_SIZE) 64 | \ + append-uImage-fakeroot-hdr KERNEL_NAME := zImage NETGEAR_BOARD_ID := NETGEAR_HW_ID := @@ -161,7 +156,7 @@ define Device/EA8500 BLOCKSIZE := 128k KERNEL_SIZE := 3072k FILESYSTEMS := squashfs - KERNEL = kernel-bin | append-dtb | uImage none | append-file $(KDIR)/root.dummy + KERNEL = kernel-bin | append-dtb | uImage none | append-uImage-fakeroot-hdr PROFILES += $$(DEVICE_NAME) BOARD_NAME := ea8500 UBINIZE_OPTS := -E 5 diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index 50eae2f63e5..446bd9981e2 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -58,7 +58,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-file netgear-fake-uImage-hdr.bin + KERNEL := $(KERNEL_DTB) | uImage lzma | pad-offset 64k 64 | append-uImage-fakeroot-hdr IMAGE/factory.bin := $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | \ netgear-dni DEVICE_TITLE := Netgear EX2700 @@ -71,7 +71,7 @@ define Device/wn3000rpv3 DTS := WN3000RPV3 BLOCKSIZE := 4k IMAGES += factory.bin - KERNEL := $(KERNEL_DTB) | uImage lzma | pad-offset 64k 64 | append-file netgear-fake-uImage-hdr.bin + KERNEL := $(KERNEL_DTB) | uImage lzma | pad-offset 64k 64 | append-uImage-fakeroot-hdr IMAGE/factory.bin := $$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | \ netgear-dni DEVICE_TITLE := Netgear WN3000RPv3 diff --git a/target/linux/ramips/image/netgear-fake-uImage-hdr.bin b/target/linux/ramips/image/netgear-fake-uImage-hdr.bin deleted file mode 100644 index 9a534b63502..00000000000 Binary files a/target/linux/ramips/image/netgear-fake-uImage-hdr.bin and /dev/null differ