[LEDE-DEV] [PATCH] apm821xx: add size check for initramfs kernel for the Meraki MR24

Christian Lamparter chunkeey at googlemail.com
Fri Sep 2 13:35:03 PDT 2016


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 <russell at personaltelco.net>
Cc: Chris Blake <chrisrblake93 at gmail.com>
Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---
 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 8edd578..f151543 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
-- 
2.9.3




More information about the Lede-dev mailing list