[OpenWrt-Devel] [PATCH] gemini: Fix up image generation

Linus Walleij linus.walleij at linaro.org
Wed Oct 17 14:46:19 EDT 2018


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 <linus.walleij at linaro.org>
---
 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 a05b7111b5bc..3f4a4ba0d2ce 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
-- 
2.17.2


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list