Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Evgeniy Didin <Evgeniy.Didin@synopsys.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] support: Allow compression of sdcard.img
Date: Mon, 18 Dec 2017 16:51:44 +0300	[thread overview]
Message-ID: <20171218135144.4000-1-didin@synopsys.com> (raw)

In image files, generated by genimage.sh, there
are tens of megabytes most of which might be filled
with zeros as partitions are made a bit larger than
needed for minimalictic rootfs (which allows users to
add more libs and aps later on without messign with
partition sizes).

So adding an option for genimage.sh script, setting which
we gzip image file and greatly reduce it size.

Signed-off-by: Evgeniy Didin <didin@synopsys.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: arc-buildroot at synopsys.com
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 support/scripts/genimage.sh | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/support/scripts/genimage.sh b/support/scripts/genimage.sh
index 039b3fef1d..fa00e12855 100755
--- a/support/scripts/genimage.sh
+++ b/support/scripts/genimage.sh
@@ -1,16 +1,17 @@
 #!/usr/bin/env bash
+# -g option gzips IMAGE_FILE to reduce it size
 
 die() {
   cat <<EOF >&2
 Error: $@
 
-Usage: ${0} -c GENIMAGE_CONFIG_FILE
+Usage: ${0} -c GENIMAGE_CONFIG_FILE -g IMAGE_FILE
 EOF
   exit 1
 }
 
 # Parse arguments and put into argument list of the script
-opts="$(getopt -n "${0##*/}" -o c: -- "$@")" || exit $?
+opts="$(getopt -n "${0##*/}" -o c:g: -- "$@")" || exit $?
 eval set -- "$opts"
 
 GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
@@ -23,6 +24,9 @@ while true ; do
 	--) # Discard all non-option parameters
 	  shift 1;
 	  break ;;
+        -g)
+	  GENIMAGE_NAME="${2}";
+          shift 2;;
 	*)
 	  die "unknown option '${1}'" ;;
 	esac
@@ -38,3 +42,8 @@ genimage \
 	--inputpath "${BINARIES_DIR}"  \
 	--outputpath "${BINARIES_DIR}" \
 	--config "${GENIMAGE_CFG}"
+if [ ${GENIMAGE_NAME} ]
+then
+echo ${GENIMAGE_NAME}
+gzip < ${BINARIES_DIR}/${GENIMAGE_NAME} > ${BINARIES_DIR}/${GENIMAGE_NAME}.gz
+fi
-- 
2.11.0

             reply	other threads:[~2017-12-18 13:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-18 13:51 Evgeniy Didin [this message]
2018-01-07 23:00 ` [Buildroot] [PATCH] support: Allow compression of sdcard.img Yann E. MORIN
2018-01-10 18:35   ` Alexey Brodkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171218135144.4000-1-didin@synopsys.com \
    --to=evgeniy.didin@synopsys.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox