From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Wed, 11 Oct 2023 08:51:23 +0200 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qqT3z-0046wX-GM for lore@lore.pengutronix.de; Wed, 11 Oct 2023 08:51:23 +0200 Received: from localhost ([127.0.0.1] helo=metis.whiteo.stw.pengutronix.de) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1qqT3y-00066B-3p; Wed, 11 Oct 2023 08:51:22 +0200 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qqT3r-00065x-R3; Wed, 11 Oct 2023 08:51:15 +0200 Received: from [2a0a:edc0:2:b01:1d::c5] (helo=pty.whiteo.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qqT3r-000pvc-Eo; Wed, 11 Oct 2023 08:51:15 +0200 Received: from mol by pty.whiteo.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qqT3r-006Mev-5m; Wed, 11 Oct 2023 08:51:15 +0200 Date: Wed, 11 Oct 2023 08:51:15 +0200 From: Michael Olbrich To: Roland Hieber Message-ID: Mail-Followup-To: Roland Hieber , distrokit@pengutronix.de References: <20231010191631.31141-1-rhi@pengutronix.de> <20231010191631.31141-5-rhi@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231010191631.31141-5-rhi@pengutronix.de> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain Subject: Re: [DistroKit] [PATCH 5/6] images: remove qemu size hack X-BeenThere: distrokit@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: DistroKit Mailinglist List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: distrokit@pengutronix.de Sender: "DistroKit" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: distrokit-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false On Tue, Oct 10, 2023 at 09:16:30PM +0200, Roland Hieber wrote: > genimage knows about the 'size' option for images to fill the image to a > certain size, and since genimage v14 it supports the 'fill' option to > write all zeroes at the end of the image and not cut them off to > optimise the image size. Use this to blow up the images that are used > with qemu to the next power of two so qemu can work with them, and > remove our invisible-partition-at-the-end hack. > > On MIPS, we also need to decrease the size of the last partition so that > it still fits inside the specified image size, because the first MiB > (when using 1 MiB alignment) is occupied by the partition table, so the > first partition only starts at offset 1 MiB. > > Signed-off-by: Roland Hieber > --- > .../platform-mips/config/images/ar9331.config | 16 ++++------------ > configs/platform-mips/config/images/malta.config | 16 ++++------------ > .../platform-mipsel/config/images/malta.config | 16 ++++------------ > .../config/images/vexpress-nor.config | 10 +++------- > .../platform-v7a/config/images/vexpress.config | 15 +++------------ > .../config/images/vexpress-nor.config | 10 +++------- > .../config/images/vexpress.config | 15 +++------------ > 7 files changed, 24 insertions(+), 74 deletions(-) > > diff --git a/configs/platform-mips/config/images/ar9331.config b/configs/platform-mips/config/images/ar9331.config > index 07125bea4c88..8012cf0f839d 100644 > --- a/configs/platform-mips/config/images/ar9331.config > +++ b/configs/platform-mips/config/images/ar9331.config > @@ -1,7 +1,10 @@ > image @IMAGE@ { > + /* Note: qemu will complain if the SD card size is not a power of two */ > + size = 1G > hdimage { > align = 1M > disk-signature = 0x74823abf > + fill = true > } > partition root-A { > image = root.ext2 > @@ -10,18 +13,7 @@ image @IMAGE@ { > } > partition data { > partition-type = 0x83 > - size = 512M > - } > - /* genimage does not write zeros at the end of an image to save space, > - * but the kernel in qemu will complain if the image file is smaller > - * than the partition sizes. work around this by adding an empty > - * partition at the end. > - */ > - partition end { > - image = /dev/null > - size = 1M > - offset = 1025M > - in-partition-table = false > + size = 511M The last partition can have a 'fill = true' property if the image size is explicitly specified. That's better than calculating it manually. Michael > } > } > > diff --git a/configs/platform-mips/config/images/malta.config b/configs/platform-mips/config/images/malta.config > index 07125bea4c88..8012cf0f839d 100644 > --- a/configs/platform-mips/config/images/malta.config > +++ b/configs/platform-mips/config/images/malta.config > @@ -1,7 +1,10 @@ > image @IMAGE@ { > + /* Note: qemu will complain if the SD card size is not a power of two */ > + size = 1G > hdimage { > align = 1M > disk-signature = 0x74823abf > + fill = true > } > partition root-A { > image = root.ext2 > @@ -10,18 +13,7 @@ image @IMAGE@ { > } > partition data { > partition-type = 0x83 > - size = 512M > - } > - /* genimage does not write zeros at the end of an image to save space, > - * but the kernel in qemu will complain if the image file is smaller > - * than the partition sizes. work around this by adding an empty > - * partition at the end. > - */ > - partition end { > - image = /dev/null > - size = 1M > - offset = 1025M > - in-partition-table = false > + size = 511M > } > } > > diff --git a/configs/platform-mipsel/config/images/malta.config b/configs/platform-mipsel/config/images/malta.config > index 07125bea4c88..8012cf0f839d 100644 > --- a/configs/platform-mipsel/config/images/malta.config > +++ b/configs/platform-mipsel/config/images/malta.config > @@ -1,7 +1,10 @@ > image @IMAGE@ { > + /* Note: qemu will complain if the SD card size is not a power of two */ > + size = 1G > hdimage { > align = 1M > disk-signature = 0x74823abf > + fill = true > } > partition root-A { > image = root.ext2 > @@ -10,18 +13,7 @@ image @IMAGE@ { > } > partition data { > partition-type = 0x83 > - size = 512M > - } > - /* genimage does not write zeros at the end of an image to save space, > - * but the kernel in qemu will complain if the image file is smaller > - * than the partition sizes. work around this by adding an empty > - * partition at the end. > - */ > - partition end { > - image = /dev/null > - size = 1M > - offset = 1025M > - in-partition-table = false > + size = 511M > } > } > > diff --git a/configs/platform-v7a/config/images/vexpress-nor.config b/configs/platform-v7a/config/images/vexpress-nor.config > index cc7edd28f628..58bbbfca404a 100644 > --- a/configs/platform-v7a/config/images/vexpress-nor.config > +++ b/configs/platform-v7a/config/images/vexpress-nor.config > @@ -1,6 +1,9 @@ > image @IMAGE@ { > + /* Note: qemu will complain if the SD card size is not a power of two */ > + size = 64M > hdimage { > partition-table-type = none > + fill = true > } > partition barebox { > image = barebox-vexpress-ca9.img > @@ -19,13 +22,6 @@ image @IMAGE@ { > in-partition-table = false > size = 1M > } > - /* expand image size to 64 MiB; dummy size, results in 0 bytes length */ > - partition end { > - image = /dev/null > - offset = 64M > - size = 1M > - in-partition-table = false > - } > } > > /* vim: set tabstop=8 noexpandtab : */ > diff --git a/configs/platform-v7a/config/images/vexpress.config b/configs/platform-v7a/config/images/vexpress.config > index 3aa64a4299ce..ba677fc3c946 100644 > --- a/configs/platform-v7a/config/images/vexpress.config > +++ b/configs/platform-v7a/config/images/vexpress.config > @@ -1,7 +1,10 @@ > image @IMAGE@ { > + /* Note: qemu will complain if the SD card size is not a power of two */ > + size = 256M > hdimage { > align = 1M > disk-signature = 0x74823abf > + fill = true > } > partition root-A { > image = root.ext2 > @@ -17,18 +20,6 @@ image @IMAGE@ { > partition-type = 0x83 > size = 63M > } > - /* genimage does not write zeros at the end of an image to save space, > - * but the kernel in qemu will complain if the image file is smaller > - * than the partition sizes, and qemu will complain if the SD card size > - * is not a power of 2. work around this issues by adding an empty > - * partition at the end. > - */ > - partition end { > - image = /dev/null > - size = 1M > - offset = 256M > - in-partition-table = false > - } > } > > /* vim: set tabstop=8 noexpandtab : */ > diff --git a/configs/platform-v7a_noneon/config/images/vexpress-nor.config b/configs/platform-v7a_noneon/config/images/vexpress-nor.config > index cc7edd28f628..58bbbfca404a 100644 > --- a/configs/platform-v7a_noneon/config/images/vexpress-nor.config > +++ b/configs/platform-v7a_noneon/config/images/vexpress-nor.config > @@ -1,6 +1,9 @@ > image @IMAGE@ { > + /* Note: qemu will complain if the SD card size is not a power of two */ > + size = 64M > hdimage { > partition-table-type = none > + fill = true > } > partition barebox { > image = barebox-vexpress-ca9.img > @@ -19,13 +22,6 @@ image @IMAGE@ { > in-partition-table = false > size = 1M > } > - /* expand image size to 64 MiB; dummy size, results in 0 bytes length */ > - partition end { > - image = /dev/null > - offset = 64M > - size = 1M > - in-partition-table = false > - } > } > > /* vim: set tabstop=8 noexpandtab : */ > diff --git a/configs/platform-v7a_noneon/config/images/vexpress.config b/configs/platform-v7a_noneon/config/images/vexpress.config > index d51a58be2893..5291cb31e385 100644 > --- a/configs/platform-v7a_noneon/config/images/vexpress.config > +++ b/configs/platform-v7a_noneon/config/images/vexpress.config > @@ -1,7 +1,10 @@ > image @IMAGE@ { > + /* Note: qemu will complain if the SD card size is not a power of two */ > + size = 256M > hdimage { > align = 1M > disk-signature = 0x74823abf > + fill = true > } > partition root-A { > image = root.ext2 > @@ -12,18 +15,6 @@ image @IMAGE@ { > partition-type = 0x83 > size = 63M > } > - /* genimage does not write zeros at the end of an image to save space, > - * but the kernel in qemu will complain if the image file is smaller > - * than the partition sizes, and qemu will complain if the SD card size > - * is not a power of 2. work around this issues by adding an empty > - * partition at the end. > - */ > - partition end { > - image = /dev/null > - size = 1M > - offset = 256M > - in-partition-table = false > - } > } > > /* vim: set tabstop=8 noexpandtab : */ > -- > 2.39.2 > > > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |