From 36c19c9f0be23ad327085aa762e95de638e19b4a Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Tue, 9 Oct 2018 19:38:29 +0200 Subject: [PATCH] apm821xx: switch MX60(W)'s recovery images to multi-image method In the past, the MX60(W)'s recovery images always had problems with the size restriction and never really worked without manual intervention. But starting with 4.19, the MX60(W)'s kernel image outgrew the allocated space for sysupgrade images as well. Hence This patch reworks the initramfs, which allows the device to ease up on the impossible tight kernel size requirements for the sysupgrade creation and packaging. And as a result, the now orphaned special ramdisk setup is removed in the process. This new initramfs can be loaded through the MX60(W) U-boot in the following way: => setenv bootargs console=ttyS0,$baudrate => tftpboot $meraki_loadaddr meraki_mx60-initramfs-kernel.bin [...] Load address: 0x800000 Loading: ################################################ [...] done [...] => bootm $fileaddr \## Booting kernel from Legacy Image at 00800000 ... ... Updated Flashing instructions for new installations which integrates the new recovery method. Users of existing installations that only want to sysupgrade don't need to update their existing u-boot env. => setenv owrt_load1 ubi read \${meraki_loadaddr} kernel => setenv owrt_load2 ubi read \${meraki_loadaddr} recovery => setenv lede_bootkernel bootm \${meraki_loadaddr_kernel} - \${meraki_loadaddr_fdt} => setenv owrt_bootkernel bootm \${meraki_loadaddr} => setenv owrt_bootargs setenv bootargs console=ttyS0,\${baudrate} rootfstype=squashfs mtdoops.mtddev=oops => setenv owrt_boot run meraki_ubi owrt_bootargs\; run owrt_load1 meraki_checkpart lede_bootkernel\; run owrt_load2 owrt_bootkernel => setenv bootcmd run owrt_boot => saveenv For more information and the latest flashing guide: please visit the OpenWrt Wiki Page for the MR60: Signed-off-by: Chris Blake Signed-off-by: Christian Lamparter --- target/linux/apm821xx/image/Makefile | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/target/linux/apm821xx/image/Makefile b/target/linux/apm821xx/image/Makefile index 1925a00d6e4..a808a6342ce 100644 --- a/target/linux/apm821xx/image/Makefile +++ b/target/linux/apm821xx/image/Makefile @@ -61,21 +61,6 @@ define Build/MerakiAdd-dtb @mv $@.new $@ endef -define Build/MerakiAdd-initramfs - $(call Image/cpiogz) - - -$(STAGING_DIR_HOST)/bin/mkimage -A $(LINUX_KARCH) -O linux -T ramdisk \ - -C gzip -n "$(PROFILE) rootfs" \ - -d $(KDIR_TMP)/$(IMG_PREFIX)-rootfs.cpio.gz \ - $(KDIR_TMP)/$(IMG_PREFIX)-uramdisk.image.gz - - ( \ - dd if=$@ bs=1k conv=sync; \ - dd if=$(KDIR_TMP)/$(IMG_PREFIX)-uramdisk.image.gz bs=$(BLOCKSIZE) conv=sync; \ - ) > $@.new - @mv $@.new $@ -endef - define Build/MerakiNAND -$(STAGING_DIR_HOST)/bin/mkmerakifw \ -B $(BOARD_NAME) -s \ @@ -154,23 +139,16 @@ TARGET_DEVICES += meraki_mr24 define Device/meraki_mx60 DEVICE_TITLE := Cisco Meraki MX60/MX60W DEVICE_PACKAGES := kmod-spi-gpio kmod-usb-ledtrig-usbport kmod-usb-dwc2 \ - kmod-usb-storage block-mount + kmod-usb-storage block-mount BOARD_NAME := mx60 DEVICE_DTS := meraki-mx60 BLOCKSIZE := 63k IMAGES := sysupgrade.tar DTB_SIZE := 64512 - # The kernel size will need to match the offset defined in mkmerakifw.c, - # otherwise the final image will fail to boot. This is set within the - # MX60 kernel header definition which is found at - # ./tools/firmware-utils/src/mkmerakifw.c, line 103~ - KERNEL_SIZE := 2984k IMAGE_SIZE := 1021m + KERNEL_SIZE := 4031k KERNEL := kernel-bin | gzip | uImage gzip | MerakiAdd-dtb | MerakiNAND - KERNEL_INITRAMFS := copy-file $(KDIR)/vmlinux | gzip | uImage gzip | \ - check-size $$(KERNEL_SIZE) | \ - MerakiAdd-dtb | pad-to 2047k | MerakiAdd-initramfs | \ - MerakiNAND + KERNEL_INITRAMFS := kernel-bin | gzip | dtb | MuImage-initramfs gzip IMAGE/sysupgrade.tar := sysupgrade-tar | append-metadata UBINIZE_OPTS := -E 5 SUPPORTED_DEVICES += mx60 -- 2.30.2