From 78e63ce7e3ee16a91e250f6fdbd4b5a9e90978ac Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Fri, 2 Sep 2016 22:35:03 +0200 Subject: [PATCH] apm821xx: add size check for initramfs kernel for the Meraki MR24 Russell Senior reported an issue with the MR24 initramfs kernels: > ## Booting kernel from Legacy Image at 00c10000 ... > Image Name: POWERPC LEDE Linux-4.4.19 > Created: 2016-08-31 11:57:05 UTC > Image Type: PowerPC Linux Kernel Image (gzip compressed) > Data Size: 2155723 Bytes = 2.1 MiB > Load Address: 00000000 > Entry Point: 00000000 > Verifying Checksum ... OK >Wrong Ramdisk Image Format >Ramdisk image is corrupt or invalid For the MR24, the kernel is uploaded to 0x10000. The ramdisk starts at 0x200000. This leaves the kernel with just 0x1f0000 bytes = 1984kb. This patch adds a size check so the image creation script will abort instead of producing a unbootable initramfs image. A separate patch "apm821xx: Fix initramfs image for the Meraki MR24" which fixed the reported issue was submitted earlier. Cc: Russell Senior Cc: Chris Blake Signed-off-by: Christian Lamparter --- target/linux/apm821xx/image/Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/target/linux/apm821xx/image/Makefile b/target/linux/apm821xx/image/Makefile index 8edd5780f0..f151543b9c 100644 --- a/target/linux/apm821xx/image/Makefile +++ b/target/linux/apm821xx/image/Makefile @@ -72,10 +72,13 @@ define Device/mr24 BLOCKSIZE := 64512 IMAGES := sysupgrade.tar DTB_SIZE := 64512 - KERNEL_SIZE := 2048k + KERNEL_SIZE := 1984k IMAGE_SIZE := 8191k KERNEL := kernel-bin | lzma | uImage lzma | MerakiAdd-dtb | MerakiNAND - KERNEL_INITRAMFS := copy-file $(KDIR)/vmlinux | lzma | uImage lzma | MerakiAdd-dtb | pad-to 2047k | MerakiAdd-initramfs | MerakiNAND + KERNEL_INITRAMFS := copy-file $(KDIR)/vmlinux | lzma | uImage lzma | \ + check-size $$(KERNEL_SIZE) | \ + MerakiAdd-dtb | pad-to 2047k | MerakiAdd-initramfs | \ + MerakiNAND IMAGE/sysupgrade.tar := sysupgrade-tar endef TARGET_DEVICES += mr24