From f280bd7fa8423c04028757bbf28284574c7a5bc9 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Wed, 17 Oct 2018 20:46:19 +0200 Subject: [PATCH] gemini: Fix up image generation I noticed that the image generator for the Gemini generates some 10+ MB files for the second (application) partition. This is just wrong. The first 6144K partition named initramfs easily fits OpenWRTs squashfs,jffs2 overlayed partitions with nice headroom for storing configuration files. Generate a blank partition for the hddapp.tgz file and delete it after generating the firmware image - when performing updates manually you just want the "rd.z" file around anyways. Signed-off-by: Linus Walleij --- target/linux/gemini/image/Makefile | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/target/linux/gemini/image/Makefile b/target/linux/gemini/image/Makefile index 9e7daea03a..c1d7792bf8 100644 --- a/target/linux/gemini/image/Makefile +++ b/target/linux/gemini/image/Makefile @@ -40,16 +40,20 @@ define Build/dns313-images endef # Create the special NAS4220B image format with the squashfs -# split across two "partitions" named rd.gz and hddapp.tgz but -# essentially just being used by OpenWRT as one big partition +# and overlay inside the "rd.gz" file. We pad it out to 6144K +# which is the size of the initramfs partition. +# +# The "application" partition is just blank. You can put anything +# there when using OpenWRT. We just use that to create the +# "sysupgrade" firmware image. define Build/nas4220b-images dd if=$(IMAGE_ROOTFS) of=$(BIN_DIR)/rd.gz bs=6144k conv=sync - dd if=$(IMAGE_ROOTFS) of=$(BIN_DIR)/hddapp.tgz bs=6144k count=1 seek=1 + dd if=/dev/zero of=$(BIN_DIR)/hddapp.tgz bs=6144k count=1 cp $(IMAGE_KERNEL) $(BIN_DIR)/zImage cp ./ImageInfo-ib4220 $(BIN_DIR)/ImageInfo (cd $(BIN_DIR); tar -czf $(IMG_PREFIX)-sysupgrade-ib4220b.tar.gz ImageInfo zImage rd.gz hddapp.tgz) mv $(BIN_DIR)/rd.gz $(BIN_DIR)/$(IMG_PREFIX)-nas4220b-rd.gz - mv $(BIN_DIR)/hddapp.tgz $(BIN_DIR)/$(IMG_PREFIX)-nas4220b-hddapp.tgz + rm $(BIN_DIR)/hddapp.tgz mv $(BIN_DIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-nas4220b-zImage rm -f $(BIN_DIR)/ImageInfo endef @@ -57,13 +61,13 @@ endef # The Itian Square One SQ201 uses the same method. define Build/sq201-images dd if=$(IMAGE_ROOTFS) of=$(BIN_DIR)/rd.gz bs=6144k conv=sync - dd if=$(IMAGE_ROOTFS) of=$(BIN_DIR)/hddapp.tgz bs=6144k count=1 seek=1 + dd if=/dev/zero of=$(BIN_DIR)/hddapp.tgz bs=6144k count=1 cp $(IMAGE_KERNEL) $(BIN_DIR)/zImage cp ./ImageInfo-sq201 $(BIN_DIR)/ImageInfo sed -i -e "s/DATESTR/`date +%Y%m%d`/g" $(BIN_DIR)/ImageInfo (cd $(BIN_DIR); tar -czf $(IMG_PREFIX)-sysupgrade-sq201.tar.gz ImageInfo zImage rd.gz hddapp.tgz) mv $(BIN_DIR)/rd.gz $(BIN_DIR)/$(IMG_PREFIX)-sq201-rd.gz - mv $(BIN_DIR)/hddapp.tgz $(BIN_DIR)/$(IMG_PREFIX)-sq201-hddapp.tgz + rm $(BIN_DIR)/hddapp.tgz mv $(BIN_DIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-sq201-zImage rm -f $(BIN_DIR)/ImageInfo endef