public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: "Mathieu Dubois-Briand" <mathieu.dubois-briand@bootlin.com>
To: <pierre-loup.gosse@smile.fr>, <openembedded-core@lists.openembedded.org>
Cc: "Alexander Kanavin" <alex.kanavin@gmail.com>
Subject: Re: [PATCH v5 1/2] wic: add --extra-partition-space option to set unused space
Date: Fri, 03 Oct 2025 17:15:39 +0200	[thread overview]
Message-ID: <DD8SAYMI039W.2BNRYZDREQTNO@bootlin.com> (raw)
In-Reply-To: <20250903144528.2248743-1-pierre-loup.gosse@smile.fr>

On Wed Sep 3, 2025 at 4:45 PM CEST, pierre-loup.gosse wrote:
> From: Pierre-Loup GOSSE <pierre-loup.gosse@smile.fr>
>
> By default, the content of the partition is filled by the filesystem
> without leaving any unused free space. The --extra-space flag adds
> extra space to the filesystem size, not to the partition.
>
> Unused free space after the filesystem can be useful for some cases,
> such as encrypting a partition at runtime.
> With --extra-partition-space 32M, we ensure that the last 32M of the
> partition is unused: this space does not contain filesystem data and
> can store the LUKS2 header.
>
> The implementation sets a difference between the partition and
> filesystem size:
>   - With --fixed-size, the extra part space is removed from the
>     filesystem size.
>   - Otherwise (with or without --size flag), the extra part space is
>     added to the partition size.
>
> Signed-off-by: Pierre-Loup GOSSE <pierre-loup.gosse@smile.fr>
>
> CC: Alexander Kanavin <alex.kanavin@gmail.com>
> CC: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
> ---

Hi Pierre-Loup,

Thanks for the new version.

> +    def test_extra_partition_space(self):
> +        native_sysroot = get_bb_var("RECIPE_SYSROOT_NATIVE", "wic-tools")
> +
> +        with NamedTemporaryFile("w", suffix=".wks") as tempf:
> +            tempf.write("bootloader --ptable gpt\n" \
> +                        "part                 --ondisk hda --size 10M        --extra-partition-space 10M --fstype=ext4\n" \
> +                        "part                 --ondisk hda --fixed-size 20M  --extra-partition-space 10M --fstype=ext4\n" \
> +                        "part --source rootfs --ondisk hda                   --extra-partition-space 10M --fstype=ext4\n" \
> +                        "part --source rootfs --ondisk hda --fixed-size 200M --extra-partition-space 10M --fstype=ext4\n")
> +            tempf.flush()
> +
> +            _, wicimg = self._get_wic(tempf.name)
> +
> +            res = runCmd("parted -m %s unit b p" % wicimg,
> +                            native_sysroot=native_sysroot, stderr=subprocess.PIPE)
> +

This fails when "parted" is not installed on the host machine:

2025-10-03 13:42:20,053 - oe-selftest - INFO - 9: 73/93 615/639 (37.32s) (0 failed) (wic.Wic2.test_extra_partition_plugin)
2025-10-03 13:42:20,053 - oe-selftest - INFO - testtools.testresult.real._StringException: Traceback (most recent call last):
  File "/srv/pokybuild/yocto-worker/oe-selftest-debian/build/meta/lib/oeqa/selftest/cases/wic.py", line 1683, in test_extra_partition_plugin
    self.assertEqual('4', result.output, msg="Expect 3 partitions, not %s" % result.output)
  File "/usr/lib/python3.11/unittest/case.py", line 873, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/usr/lib/python3.11/unittest/case.py", line 1253, in assertMultiLineEqual
    self.fail(self._formatMessage(msg, standardMsg))
  File "/usr/lib/python3.11/unittest/case.py", line 703, in fail
    raise self.failureException(msg)
AssertionError: '4' != "ERROR: Can't find executable parted\n1"
- 4
+ ERROR: Can't find executable parted
1
 : Expect 3 partitions, not ERROR: Can't find executable parted
1

https://autobuilder.yoctoproject.org/valkyrie/#/builders/35/builds/2456

You can easily reproduce this on a test machine by removing parted from
the host. Also, test_wic_sector_size use parted but does not show the
same issue:

oe-selftest -r wic.Wic.test_wic_sector_size
...
2025-10-03 15:05:58,051 - oe-selftest - INFO - RESULTS - wic.Wic.test_wic_sector_size: PASSED (94.37s)

I believe this comes from the following line and the associated
try/finally block to revert to the default PATH variable:

os.environ['PATH'] = get_bb_var("PATH", "wic-tools")

Can you use something similar?

Thanks,
Mathieu

-- 
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com



  parent reply	other threads:[~2025-10-03 15:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-03 14:45 [PATCH v5 1/2] wic: add --extra-partition-space option to set unused space pierre-loup.gosse
2025-09-03 14:45 ` [PATCH v5 2/2] wic: rename wks flag --extra-space to --extra-filesystem-space pierre-loup.gosse
2025-09-09 14:30   ` [OE-core] " Ross Burton
2025-09-09 14:42     ` Pierre-loup GOSSE
2025-10-03 15:15 ` Mathieu Dubois-Briand [this message]
2025-10-03 15:20   ` [PATCH v5 1/2] wic: add --extra-partition-space option to set unused space Mathieu Dubois-Briand
2025-10-03 21:22     ` [OE-core] " Yoann Congal
2025-10-06  7:18       ` Pierre-loup GOSSE
2025-10-06  8:09         ` Mathieu Dubois-Briand

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=DD8SAYMI039W.2BNRYZDREQTNO@bootlin.com \
    --to=mathieu.dubois-briand@bootlin.com \
    --cc=alex.kanavin@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=pierre-loup.gosse@smile.fr \
    /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