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) \
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) \
@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
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)
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
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 :=
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
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
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