build: centralize fakeroot code

This patch moves the fakeroot code required by some devices to
`image-commands.mk`.

Create the fakeroot on the fly by using the undocumented -s (skip copy)
parameter of mkimage.

Signed-off-by: Joseph C. Lehner <joseph.c.lehner@gmail.com>
[remove unused NETGEAR_KERNEL_MAGIC, remove workarounds to have a dummy
rootfs for mkimage]
Signed-off-by: Mathias Kresin <dev@kresin.me>
master
Joseph C. Lehner 8 years ago committed by Mathias Kresin
parent c1eae7a7b8
commit 7d00cfe9bb
  1. 16
      include/image-commands.mk
  2. 20
      target/linux/apm821xx/image/Makefile
  3. 11
      target/linux/ipq806x/image/Makefile
  4. 4
      target/linux/ramips/image/mt7620.mk
  5. BIN
      target/linux/ramips/image/netgear-fake-uImage-hdr.bin

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

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

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

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

Loading…
Cancel
Save