[source] apm821xx: add size check for initramfs kernel for the Meraki MR24

LEDE Commits lede-commits at lists.infradead.org
Sun Sep 4 22:31:21 PDT 2016


blogic pushed a commit to source.git, branch master:
https://git.lede-project.org/78e63ce7e3ee16a91e250f6fdbd4b5a9e90978ac

commit 78e63ce7e3ee16a91e250f6fdbd4b5a9e90978ac
Author: Christian Lamparter <chunkeey at googlemail.com>
AuthorDate: Fri Sep 2 22:35:03 2016 +0200

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



More information about the lede-commits mailing list