openwrt/target/linux/ath79/image/common-netgear.mk
Paul Fertser 25d6af98d0 ath79: fix factory image generation for Netgear and Zyxel boards
The factory images need to embed specific IDs to pass verification with
the OEM firmware (including TFTP recovery), so they need to be
per-device variables.

Fixes: ab1584a797 ("ath79: netgear: trim down uImage customisations")
Fixes: 459c8c9ef8 ("ath79: add support for ZyXEL NBG6616")
Reported-by: Marcin Juszkiewicz <marcin-openwrt@juszkiewicz.com.pl>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
[minor commit message adjustments, sort DEVICE_VARS]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-14 19:21:38 +01:00

42 lines
1.2 KiB
Makefile

define Build/netgear-rootfs
mkimage \
-A mips -O linux -T filesystem -C none \
$(if $(UIMAGE_MAGIC),-M $(UIMAGE_MAGIC)) \
-n '$(VERSION_DIST) filesystem' \
-d $(IMAGE_ROOTFS) $@.fs
cat $@.fs >> $@
rm -rf $@.fs
endef
define Build/netgear-squashfs
rm -rf $@.fs $@.squashfs
mkdir -p $@.fs/image
cp $@ $@.fs/image/uImage
$(STAGING_DIR_HOST)/bin/mksquashfs-lzma \
$@.fs $@.squashfs -be \
-noappend -root-owned -b 65536 \
$(if $(SOURCE_DATE_EPOCH),-fixed-time $(SOURCE_DATE_EPOCH))
dd if=/dev/zero bs=1k count=1 >> $@.squashfs
mkimage \
-A mips -O linux -T filesystem -C none \
$(if $(UIMAGE_MAGIC),-M $(UIMAGE_MAGIC)) \
-a 0xbf070000 -e 0xbf070000 \
-n 'MIPS $(VERSION_DIST) Linux-$(LINUX_VERSION)' \
-d $@.squashfs $@
rm -rf $@.squashfs $@.fs
endef
define Device/netgear_generic
DEVICE_VENDOR := NETGEAR
KERNEL := kernel-bin | append-dtb | lzma -d20 | uImage lzma
KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma -d20 | uImage lzma
IMAGES += factory.img
IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | netgear-squashfs | \
append-rootfs | pad-rootfs
IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | \
check-size
IMAGE/factory.img := $$(IMAGE/default) | netgear-dni | \
check-size
endef