[openwrt/openwrt] lantiq: fix DM200 boot with fake uImage headers

LEDE Commits lede-commits at lists.infradead.org
Sun Mar 18 23:52:01 PDT 2018

mkresin pushed a commit to openwrt/openwrt.git, branch master:

commit 8c88e23b99cca002c883b89d06e4b582a1b45e94
Author: Thomas Nixon <tom at tomn.co.uk>
AuthorDate: Sat Mar 3 15:06:53 2018 +0000

    lantiq: fix DM200 boot with fake uImage headers
    The latest bootloader versions load the firmware into memory and call
    `chk_dniimg` (defined in Netgear GPL release), which expects to find
    three consecutive block-aligned uImages. Add two fake uImage headers
    after the kernel to fool this check.
    This wastes up to 128k of space for alignment. The alternative would be
    to put the rootfs in a second uImage, but this would limit the firmware
    size to 0x710000 (the number of bytes loaded and verified by the
    bootloader) instead of 0x7b0000 (the size of the firmware partition).
    Signed-off-by: Thomas Nixon <tom at tomn.co.uk>
 target/linux/lantiq/image/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/target/linux/lantiq/image/Makefile b/target/linux/lantiq/image/Makefile
index e6fbc1d..3541ca8 100644
--- a/target/linux/lantiq/image/Makefile
+++ b/target/linux/lantiq/image/Makefile
@@ -584,6 +584,10 @@ TARGET_DEVICES += bt_homehub-v5a
 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 | \
+	append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
   IMAGE/factory.img := $$(IMAGE/sysupgrade.bin) | netgear-dni
   IMAGE_SIZE := 7872k
   DEVICE_TITLE := Netgear DM200

More information about the lede-commits mailing list