From patchwork Thu Mar 1 20:55:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken Werner X-Patchwork-Id: 7040 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 5177523EAE for ; Thu, 1 Mar 2012 20:55:57 +0000 (UTC) Received: from mail-gy0-f180.google.com (mail-gy0-f180.google.com [209.85.160.180]) by fiordland.canonical.com (Postfix) with ESMTP id BEE9AA183C6 for ; Thu, 1 Mar 2012 20:55:56 +0000 (UTC) Received: by ghbz12 with SMTP id z12so595024ghb.11 for ; Thu, 01 Mar 2012 12:55:56 -0800 (PST) Received: from mr.google.com ([10.50.170.41]) by 10.50.170.41 with SMTP id aj9mr6457219igc.0.1330635356161 (num_hops = 1); Thu, 01 Mar 2012 12:55:56 -0800 (PST) MIME-Version: 1.0 Received: by 10.50.170.41 with SMTP id aj9mr5287870igc.0.1330635356119; Thu, 01 Mar 2012 12:55:56 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.53.18 with SMTP id k18csp27690ibg; Thu, 1 Mar 2012 12:55:55 -0800 (PST) Received: by 10.180.99.164 with SMTP id er4mr11548334wib.11.1330635354601; Thu, 01 Mar 2012 12:55:54 -0800 (PST) Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com. [195.75.94.111]) by mx.google.com with ESMTPS id n44si2531371weq.123.2012.03.01.12.55.54 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 01 Mar 2012 12:55:54 -0800 (PST) Received-SPF: neutral (google.com: 195.75.94.111 is neither permitted nor denied by best guess record for domain of ken.werner@linaro.org) client-ip=195.75.94.111; Authentication-Results: mx.google.com; spf=neutral (google.com: 195.75.94.111 is neither permitted nor denied by best guess record for domain of ken.werner@linaro.org) smtp.mail=ken.werner@linaro.org Received: from /spool/local by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 1 Mar 2012 20:55:53 -0000 Received: from d06nrmr1806.portsmouth.uk.ibm.com (9.149.39.193) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 1 Mar 2012 20:55:51 -0000 Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by d06nrmr1806.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q21Kto6U2949238 for ; Thu, 1 Mar 2012 20:55:50 GMT Received: from d06av05.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q21Kto8g019744 for ; Thu, 1 Mar 2012 13:55:50 -0700 Received: from bolide.boeblingen.de.ibm.com (dyn-9-152-213-71.boeblingen.de.ibm.com [9.152.213.71]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q21Ktoco019741; Thu, 1 Mar 2012 13:55:50 -0700 From: Ken Werner To: openembedded-core@lists.openembedded.org Subject: [PATCH] image_types: add IMAGE_ROOTFS_ALIGNMENT Date: Thu, 1 Mar 2012 21:55:44 +0100 Message-Id: <1330635344-27411-1-git-send-email-ken.werner@linaro.org> X-Mailer: git-send-email 1.7.5.4 x-cbid: 12030120-0342-0000-0000-0000010D6730 X-Gm-Message-State: ALoCoQmTIv+V9a0vszB4dB49zRm0xKAeIn3fO55ksjFaO5mGUc5npXU8tzg6MaZZJuR+IX5dEMOW Introduce a new variable called IMAGE_ROOTFS_ALIGNMENT that allows to control the aligment of the size of the rootfs. Its default value is set to 1KiB so that the existing behaviour is not changed. In case the SD card emulation of a QEMU system emulator gets used you may set the alignment to 2MiB. --- meta/classes/image_types.bbclass | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass index f756c39..314d6d1 100644 --- a/meta/classes/image_types.bbclass +++ b/meta/classes/image_types.bbclass @@ -55,9 +55,19 @@ def get_imagecmds(d): cmds += "\n" + localdata.getVar("runimagecmd", True) return cmds +# The default aligment of the size of the rootfs is set to 1KiB. In case +# you're using the SD card emulation of a QEMU system simulator you may +# set this value to 2048 (2MiB alignment). +IMAGE_ROOTFS_ALIGNMENT ?= "1" + runimagecmd () { # Image generation code for image type ${type} - ROOTFS_SIZE=`du -ks ${IMAGE_ROOTFS}|awk '{base_size = ($1 * ${IMAGE_OVERHEAD_FACTOR}); OFMT = "%.0f" ; print ((base_size > ${IMAGE_ROOTFS_SIZE} ? base_size : ${IMAGE_ROOTFS_SIZE}) + ${IMAGE_ROOTFS_EXTRA_SPACE}) }'` + # The base_size gets calculated: + # - initial size determined by `du -ks` of the IMAGE_ROOTFS + # - then multiplied by the IMAGE_OVERHEAD_FACTOR + # - then rounded up to IMAGE_ROOTFS_ALIGNMENT + # - finally tested against IMAGE_ROOTFS_SIZE + ROOTFS_SIZE=`du -ks ${IMAGE_ROOTFS}|awk '{base_size = $1 * ${IMAGE_OVERHEAD_FACTOR} + ${IMAGE_ROOTFS_ALIGNMENT} - 1; base_size -= base_size % ${IMAGE_ROOTFS_ALIGNMENT}; print ((base_size > ${IMAGE_ROOTFS_SIZE} ? base_size : ${IMAGE_ROOTFS_SIZE}) + ${IMAGE_ROOTFS_EXTRA_SPACE}) }'` ${cmd} # Now create the needed compressed versions cd ${DEPLOY_DIR_IMAGE}/