From patchwork Mon Dec 18 13:51:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeniy Didin X-Patchwork-Id: 850055 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3z0jBn44Pbz9s71 for ; Tue, 19 Dec 2017 00:52:01 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 849D4881AE; Mon, 18 Dec 2017 13:51:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id C01cu7zuM+ia; Mon, 18 Dec 2017 13:51:59 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id D735A87F56; Mon, 18 Dec 2017 13:51:58 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 9B3E81BFA45 for ; Mon, 18 Dec 2017 13:51:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 9526E82110 for ; Mon, 18 Dec 2017 13:51:58 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Opi7jxuIChbu for ; Mon, 18 Dec 2017 13:51:56 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from smtprelay.synopsys.com (smtprelay2.synopsys.com [198.182.60.111]) by whitealder.osuosl.org (Postfix) with ESMTPS id 3DAB681C32 for ; Mon, 18 Dec 2017 13:51:56 +0000 (UTC) Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id ACA9310C118B; Mon, 18 Dec 2017 05:51:55 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 99A33BAA; Mon, 18 Dec 2017 05:51:55 -0800 (PST) Received: from ru20arcgnu1.internal.synopsys.com (ru20arcgnu1.internal.synopsys.com [10.121.9.48]) by mailhost.synopsys.com (Postfix) with ESMTP id 1DFA1B9A; Mon, 18 Dec 2017 05:51:53 -0800 (PST) From: Evgeniy Didin To: buildroot@busybox.net Date: Mon, 18 Dec 2017 16:51:44 +0300 Message-Id: <20171218135144.4000-1-didin@synopsys.com> X-Mailer: git-send-email 2.11.0 Subject: [Buildroot] [PATCH] support: Allow compression of sdcard.img X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Evgeniy Didin , Thomas Petazzoni , Alexey Brodkin , arc-buildroot@synopsys.com MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" 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 Cc: Alexey Brodkin Cc: arc-buildroot@synopsys.com Cc: Thomas Petazzoni --- 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 <&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