wic: extra-partitions: new variable to be combined with sourceparams
cover wic: extra-partitions: new variable to be combined with sourceparams
The current extra_partition plugin uses predictable variable names (the configuration must predict the image partition label or uuid). This has two inconveniences:
- an extra partition that has a specific label (or uuid) is doomed with the associated variable. The partition cannot be configured unless the label (or uuid) is changed.
- two partitions with same label from distincts .wks cannot have different content.
The first commit increases the tests. It now tests several files can be included and that the file system type can be specified. It also simplifies the 'wic ls' command by removing unneeded pipes.
The second commit allows the new suffix _sourceparams_foo to be appended to IMAGE_EXTRA_PARTITION_FILES. This variable will be preferred whenever the .wks specifies a name in the --sourceparams option.
For example:
an image may define:
IMAGE_EXTRA_PARTITION_FILES_sourceparams_foo = "bar.conf"
and the .wks line have line:
part --source extra_partition --sourceparams "name=foo"
---
Louis Rannou (2):
oeqa/selftest: wic: improve extra-partition plugin tests
wic: extra-partition: introduce variable matching sourceparams
meta/lib/oeqa/selftest/cases/wic.py | 55 ++++++++++++++++------- scripts/lib/wic/plugins/source/extra_partition.py | 24 +++++++--- 2 files changed, 57 insertions(+), 22 deletions(-)
---
base-commit: 0ed4776533145c901611d7f4f942490e33481335
change-id: 20260107-extrafiles-ad9a25529b20
Best regards,
Signature · 1 line
Louis Rannou <[email protected]>
PATCH 1/2 oeqa/selftest: wic: improve extra-partition plugin tests
Increase the number of inputs to check several files can be copied. Change the partition type to GPT in order to avoid logical partitions.
Test various file systems and check the wic image partitions match.
Simplify 'wic ls' commands (remove pipes) and use '-n' to specify wic-tools sysroot and avoid host contamination.
Also dedent the code just after the wic image is built to close the .wks temporary file when its goal is achieved.
--- meta/lib/oeqa/selftest/cases/wic.py | 47 +++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 15 deletions(-)
meta/lib/oeqa/selftest/cases/wic.py +32 -15
@@ -1658,7 +1658,7 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot" """Test extra partition plugin""" config = dedent("""\ IMAGE_EXTRA_PARTITION_FILES_label-foo = "bar.conf;foo.conf" - IMAGE_EXTRA_PARTITION_FILES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d = "bar.conf;foobar.conf" + IMAGE_EXTRA_PARTITION_FILES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d = "bar.conf;foobar.conf bar2.conf;foobar2.conf bar3.conf bar4.conf" IMAGE_EXTRA_PARTITION_FILES = "foo/*" WICVARS:append = "\ IMAGE_EXTRA_PARTITION_FILES_label-foo \
@@ -1668,36 +1668,53 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot" self.append_config(config) deploy_dir = get_bb_var('DEPLOY_DIR_IMAGE') + sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools') - testfile = open(os.path.join(deploy_dir, "bar.conf"), "w") - testfile.write("test") - testfile.close() + # Write test files + for testfilename in ["bar.conf", "bar2.conf", "bar3.conf", "bar4.conf"]: + testfile = open(os.path.join(deploy_dir, testfilename), "w") + testfile.write("test %s" % testfilename) + testfile.close() + # Create directory foo/ and testfiles within os.mkdir(os.path.join(deploy_dir, "foo")) - testfile = open(os.path.join(deploy_dir, "foo", "bar.conf"), "w") - testfile.write("test") - testfile.close() + for testfilename in ["bar.conf", "bar2.conf"]: + testfile = open(os.path.join(deploy_dir, "foo", testfilename), "w") + testfile.write("test %s" % testfilename) + testfile.close() oldpath = os.environ['PATH'] os.environ['PATH'] = get_bb_var("PATH", "wic-tools") try: with NamedTemporaryFile("w", suffix=".wks") as wks: - wks.writelines(['part / --source extra_partition --ondisk sda --fstype=ext4 --label foo --align 4 --size 5M\n', - 'part / --source extra_partition --ondisk sda --fstype=ext4 --uuid e7d0824e-cda3-4bed-9f54-9ef5312d105d --align 4 --size 5M\n', + wks.writelines(['part / --source extra_partition --ondisk sda --label foo --align 4 --size 5M\n', + 'part / --source extra_partition --ondisk sda --fstype=vfat --uuid e7d0824e-cda3-4bed-9f54-9ef5312d105d --align 4 --size 5M\n', 'part / --source extra_partition --ondisk sda --fstype=ext4 --label bar --align 4 --size 5M\n']) wks.flush() _, wicimg = self._get_wic(wks.name) - result = runCmd("wic ls %s | wc -l" % wicimg) - self.assertEqual('4', result.output, msg="Expect 3 partitions, not %s" % result.output) + result = runCmd("wic ls %s -n %s" % (wicimg, sysroot)) + partls = result.output.split('\n')[1:] - for part, file in enumerate(["foo.conf", "foobar.conf", "bar.conf"]): - result = runCmd("wic ls %s:%d | grep -q \"%s\"" % (wicimg, part + 1, file)) - self.assertEqual(0, result.status, msg="File '%s' not found in the partition #%d" % (file, part)) + # Assert the number of partitions is correct + self.assertEqual(3, len(partls), msg="Expect 3 partitions, not %s" % result.output) - self.remove_config(config) + # Fstype column from 'wic ls' should be fstype as given in the part command + for part_id, part_fs in enumerate(["fat16", "fat16", "ext4"]): + self.assertIn(part_fs, partls[part_id]) + # For each partition, assert expected files exist + for part, part_glob in enumerate([ + ["foo.conf"], + ["foobar.conf", "foobar2.conf", "bar3.conf", "bar4.conf"], + ["bar.conf", "bar2.conf"], + ]): + for part_file in part_glob: + result = runCmd("wic ls %s:%d/%s -n %s" % (wicimg, part + 1, part_file, sysroot)) + self.assertEqual(0, result.status, msg="File '%s' not found in the partition #%d" % (part_file, part)) + + self.remove_config(config) finally: os.environ['PATH'] = oldpath
Signature · 1 line
2.43.0
PATCH 2/2 wic: extra-partition: introduce variable matching sourceparams
In reply to Louis RannouThe current extra_partition plugin uses predictable variable names (the configuration must predict the image partition label or uuid). This has two inconveniences:
- an extra partition that has a specific label (or uuid) is doomed with the associated variable. The partition cannot be configured unless the label (or uuid) is changed.
- two partitions with same label from distincts .wks cannot have different content.
This allows the new suffix _sourceparams_foo to be appended to IMAGE_EXTRA_PARTITION_FILES. This variable will be preferred whenever the .wks specifies a name in the --sourceparams option.
For example:
an image may define:
IMAGE_EXTRA_PARTITION_FILES_sourceparams_foo = "bar.conf"
and the .wks line have line:
part --source extra_partition --sourceparams "name=foo"
--- meta/lib/oeqa/selftest/cases/wic.py | 16 ++++++++++----- scripts/lib/wic/plugins/source/extra_partition.py | 24 +++++++++++++++++------ 2 files changed, 29 insertions(+), 11 deletions(-)
meta/lib/oeqa/selftest/cases/wic.py +11 -5
@@ -1657,6 +1657,7 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot" def test_extra_partition_plugin(self): """Test extra partition plugin""" config = dedent("""\ + IMAGE_EXTRA_PARTITION_FILES_sourceparams-foo = "bar.conf" IMAGE_EXTRA_PARTITION_FILES_label-foo = "bar.conf;foo.conf" IMAGE_EXTRA_PARTITION_FILES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d = "bar.conf;foobar.conf bar2.conf;foobar2.conf bar3.conf bar4.conf" IMAGE_EXTRA_PARTITION_FILES = "foo/*"
@@ -1688,9 +1689,13 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot" try: with NamedTemporaryFile("w", suffix=".wks") as wks: - wks.writelines(['part / --source extra_partition --ondisk sda --label foo --align 4 --size 5M\n', - 'part / --source extra_partition --ondisk sda --fstype=vfat --uuid e7d0824e-cda3-4bed-9f54-9ef5312d105d --align 4 --size 5M\n', - 'part / --source extra_partition --ondisk sda --fstype=ext4 --label bar --align 4 --size 5M\n']) + wks.writelines([ + 'part / --source extra_partition --ondisk sda --sourceparams "name=foo" --align 4 --size 5M\n', + 'part / --source extra_partition --ondisk sda --label foo --align 4 --size 5M\n', + 'part / --source extra_partition --ondisk sda --fstype=vfat --uuid e7d0824e-cda3-4bed-9f54-9ef5312d105d --align 4 --size 5M\n', + 'part / --source extra_partition --ondisk sda --fstype=ext4 --label bar --align 4 --size 5M\n', + 'bootloader --ptable gpt\n', + ]) wks.flush() _, wicimg = self._get_wic(wks.name)
@@ -1698,14 +1703,15 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot" partls = result.output.split('\n')[1:] # Assert the number of partitions is correct - self.assertEqual(3, len(partls), msg="Expect 3 partitions, not %s" % result.output) + self.assertEqual(4, len(partls), msg="Expect 4 partitions, not %s" % result.output) # Fstype column from 'wic ls' should be fstype as given in the part command - for part_id, part_fs in enumerate(["fat16", "fat16", "ext4"]): + for part_id, part_fs in enumerate(["fat16", "fat16", "fat16", "ext4"]): self.assertIn(part_fs, partls[part_id]) # For each partition, assert expected files exist for part, part_glob in enumerate([ + ["bar.conf"], ["foo.conf"], ["foobar.conf", "foobar2.conf", "bar3.conf", "bar4.conf"], ["bar.conf", "bar2.conf"],
scripts/lib/wic/plugins/source/extra_partition.py +18 -6
@@ -18,15 +18,17 @@ class ExtraPartitionPlugin(SourcePlugin): The plugin supports: - Glob pattern matching for file selection. - File renaming. - - Suffixes to specify the target partition (by label, UUID, or partname), - enabling multiple extra partitions to coexist. + - Suffixes to specify the target partition (by params-name, label, UUID, + or partname), enabling multiple extra partitions to coexist. For example: + IMAGE_EXTRA_PARTITION_FILES_sourceparams-name = "bar.conf;foo.conf" IMAGE_EXTRA_PARTITION_FILES_label-foo = "bar.conf;foo.conf" IMAGE_EXTRA_PARTITION_FILES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d = "bar.conf;foobar.conf" IMAGE_EXTRA_PARTITION_FILES = "foo/*" WICVARS:append = "\ + IMAGE_EXTRA_PARTITION_FILES_sourceparams-name \ IMAGE_EXTRA_PARTITION_FILES_label-foo \ IMAGE_EXTRA_PARTITION_FILES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d \ "
@@ -53,11 +55,21 @@ class ExtraPartitionPlugin(SourcePlugin): raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting") extra_files = None - for (fmt, id) in (("_uuid-%s", part.uuid), ("_label-%s", part.label), ("_part-name-%s", part.part_name), (None, None)): - if fmt: - var = fmt % id - else: + for (fmt, part_id) in ( + ("_sourceparams-%s", source_params.get("name")), + ("_uuid-%s", part.uuid), + ("_label-%s", part.label), + ("_part-name-%s", part.part_name), + (None, None) + ): + if fmt is None: var = "" + elif part_id is not None: + var = fmt % part_id + else: + continue + + logger.debug("Looking for extra files in %s" % cls.image_extra_partition_files_var_name + var) extra_files = get_bitbake_var(cls.image_extra_partition_files_var_name + var) if extra_files is not None: break
Signature · 1 line
2.43.0
Re: [PATCH 2/2] wic: extra-partition: introduce variable matching sourceparams
Hi Louis,
Thanks for your patches.
I am not sure to understand your first point.
- an extra partition that has a specific label (or uuid) is doomed with the
Quoted 2 lines
associated variable. The partition cannot be configured unless the label (or uuid) is changed.
From my comprehension, an extra partition that has a name ( --sourceparams="name=foo") is also doomed with the associated variable ( IMAGE_EXTRA_PARTITION_FILES_sourceparams_foo). So, this does not resolve the issue for me.
Let me know if I misunderstood your point.
- two partitions with same label from distincts .wks cannot have different
Quoted 1 line
content.
I agree. I think this is currently possible if you set the variable based on the WKS file, but this adds unnecessary complexity to the configuration.
For example:
Quoted 4 lines
an image may define:
IMAGE_EXTRA_PARTITION_FILES_sourceparams_foo= "bar.conf"
and the .wks line have line:part --source extra_partition --sourceparams "name=foo"
Since the source parameter is "name", perhaps the suffix "name" instead of "sourceparams" would be more intuitive ? For example, IMAGE_EXTRA_PARTITION_FILES_name_foo.
I think it is great to have another way to select the partition independently of the label, uuid or partname.
Thanks,
Pierre-Loup
Quoted 158 lines · On Wed, Jan 7, 2026 at 11:41 AM Louis Rannou via B4 Relay <…
From: Louis Rannou <[email protected]>
The current
extra_partitionplugin uses predictable variable names (the configuration must predict the image partition label or uuid). This has two inconveniences:- an extra partition that has a specific label (or uuid) is doomed with the associated variable. The partition cannot be configured unless the label (or uuid) is changed.
- two partitions with same label from distincts .wks cannot have different content.This allows the new suffix
_sourceparams_footo be appended toIMAGE_EXTRA_PARTITION_FILES. This variable will be preferred whenever the .wks specifies a name in the --sourceparams option.For example:
an image may define:
IMAGE_EXTRA_PARTITION_FILES_sourceparams_foo= "bar.conf"
and the .wks line have line:part --source extra_partition --sourceparams "name=foo"Signed-off-by Louis Rannou <[email protected]>--- meta/lib/oeqa/selftest/cases/wic.py | 16 ++++++++++----- scripts/lib/wic/plugins/source/extra_partition.py | 24 +++++++++++++++++------ 2 files changed, 29 insertions(+), 11 deletions(-)meta/lib/oeqa/selftest/cases/wic.py +1
-0@@ -1657,6 +1657,7 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot" def test_extra_partition_plugin(self): """Test extra partition plugin""" config = dedent("""\ + IMAGE_EXTRA_PARTITION_FILES_sourceparams-foo = "bar.conf" IMAGE_EXTRA_PARTITION_FILES_label-foo = "bar.conf;foo.conf" IMAGE_EXTRA_PARTITION_FILES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d ="bar.conf;foobar.conf bar2.conf;foobar2.conf bar3.conf bar4.conf"
IMAGE_EXTRA_PARTITION_FILES= "foo/*"meta/lib/oeqa/selftest/cases/wic.py +0
-2@@ -1688,9 +1689,13 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot" try: with NamedTemporaryFile("w", suffix=".wks") as wks: - wks.writelines(['part / --source extra_partition --ondisk sda --label foo --align 4 --size 5M\n', - 'part / --source extra_partition --ondisksda --fstype=vfat --uuid e7d0824e-cda3-4bed-9f54-9ef5312d105d --align 4 --size 5M\n',
- 'part / --sourceextra_partition--ondisk
sda --fstype=ext4 --label bar --align 4 --size 5M\n'])meta/lib/oeqa/selftest/cases/wic.py +3
-1+ wks.writelines([ + 'part / --source extra_partition --ondisk sda --sourceparams "name=foo" --align 4 --size 5M\n', + 'part / --source extra_partition --ondisk sda --labelfoo --align 4 --size 5M\n',
+ 'part / --sourceextra_partition--ondisk sda
--fstype=vfat --uuid e7d0824e-cda3-4bed-9f54-9ef5312d105d --align 4 --size 5M\n',meta/lib/oeqa/selftest/cases/wic.py +4
-2+ 'part / --source extra_partition --ondisk sda --fstype=ext4 --label bar --align 4 --size 5M\n', + 'bootloader --ptable gpt\n', + ]) wks.flush() _, wicimg = self._get_wic(wks.name)@@ -1698,14 +1703,15 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot" partls = result.output.split('\n')[1:] # Assert the number of partitions is correct - self.assertEqual(3, len(partls), msg="Expect 3 partitions, not %s" % result.output) + self.assertEqual(4, len(partls), msg="Expect 4 partitions, not %s" % result.output) # Fstype column from 'wic ls' should be fstype as given inthe part command
meta/lib/oeqa/selftest/cases/wic.py +1
-1- for part_id, part_fs in enumerate(["fat16", "fat16", "ext4"]): + for part_id, part_fs in enumerate(["fat16", "fat16", "fat16","ext4"]):
self.assertIn(part_fs, partls[part_id])# For each partition, assert expected files exist for part,
part_globin enumerate([meta/lib/oeqa/selftest/cases/wic.py +1
-0+ ["bar.conf"], ["foo.conf"], ["foobar.conf", "foobar2.conf", "bar3.conf", "bar4.conf"], ["bar.conf", "bar2.conf"],scripts/lib/wic/plugins/source/extra_partition.py +3
-2@@ -18,15 +18,17 @@ class ExtraPartitionPlugin(SourcePlugin): The plugin supports: - Glob pattern matching for file selection. - File renaming. - - Suffixes to specify the target partition (by label, UUID, or partname), - enabling multiple extra partitions to coexist. + - Suffixes to specify the target partition (by params-name, label, UUID, + or partname), enabling multiple extra partitions to coexist. For example: + IMAGE_EXTRA_PARTITION_FILES_sourceparams-name ="bar.conf;foo.conf"
IMAGE_EXTRA_PARTITION_FILES_label-foo = "bar.conf;foo.conf"IMAGE_EXTRA_PARTITION_FILES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d =
"bar.conf;foobar.conf"
IMAGE_EXTRA_PARTITION_FILES= "foo/*" WICVARS:append = "\scripts/lib/wic/plugins/source/extra_partition.py +1
-1+ IMAGE_EXTRA_PARTITION_FILES_sourceparams-name \ IMAGE_EXTRA_PARTITION_FILES_label-foo \ IMAGE_EXTRA_PARTITION_FILES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d \ "@@ -53,11 +55,21 @@ class ExtraPartitionPlugin(SourcePlugin): raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting") extra_files = None - for (fmt, id) in (("_uuid-%s", part.uuid), ("_label-%s",part.label), ("_part-name-%s", part.part_name), (None, None)):
scripts/lib/wic/plugins/source/extra_partition.py +14
-3- if fmt: - var = fmt % id - else: + for (fmt, part_id) in ( + ("_sourceparams-%s", source_params.get("name")), + ("_uuid-%s", part.uuid), + ("_label-%s", part.label), + ("_part-name-%s", part.part_name), + (None, None) + ): + if fmt is None: var = "" + elif part_id is not None: + var = fmt % part_id + else: + continue + + logger.debug("Looking for extra files in %s" %cls.image_extra_partition_files_var_name + var)
extra_files=get_bitbake_var(cls.image_extra_partition_files_var_name + var)
ifextra_filesis not None:
break--
2.43.0
Re: [PATCH 2/2] wic: extra-partition: introduce variable matching sourceparams
Hello Pierre-Loup,
Thanks for the review
Quoted 7 lines
I am not sure to understand your first point.
- an extra partition that has a specific label (or uuid) is doomed with the
Quoted 2 lines
associated variable. The partition cannot be configured unless the label (or uuid) is changed.
Quoted 5 lines
From my comprehension, an extra partition that has a name ( --sourceparams="name=foo") is also doomed with the associated variable (
IMAGE_EXTRA_PARTITION_FILES_sourceparams_foo). So, this does not resolve the issue for me.
Let me know if I misunderstood your point.
Here the name can be customized without impacting the final image. While most of the time you wish the label to keep standard (data, config, home... but not my_specific_name). Then if you need your partition to have label data, you will not be able to select an other variable than IMAGE_EXTRA_PARTITION_FILES_label-data.
Quoted 15 lines
- two partitions with same label from distincts .wks cannot have different
Quoted 1 line
content.
I agree. I think this is currently possible if you set the variable based on the WKS file, but this adds unnecessary complexity to the configuration.
For example:
Quoted 4 lines
an image may define:
IMAGE_EXTRA_PARTITION_FILES_sourceparams_foo= "bar.conf"
and the .wks line have line:part --source extra_partition --sourceparams "name=foo"
Quoted 3 lines
Since the source parameter is "name", perhaps the suffix "name" instead of "sourceparams" would be more intuitive ? For example,
IMAGE_EXTRA_PARTITION_FILES_name_foo.
Fine for me !
Quoted 171 lines
I think it is great to have another way to select the partition independently of the label, uuid or partname.
Thanks,
Pierre-Loup
Quoted 158 lines · On Wed, Jan 7, 2026 at 11:41 AM Louis Rannou via B4 Relay <…
From: Louis Rannou <[email protected]>
The current
extra_partitionplugin uses predictable variable names (the configuration must predict the image partition label or uuid). This has two inconveniences:- an extra partition that has a specific label (or uuid) is doomed with the associated variable. The partition cannot be configured unless the label (or uuid) is changed.
- two partitions with same label from distincts .wks cannot have different content.This allows the new suffix
_sourceparams_footo be appended toIMAGE_EXTRA_PARTITION_FILES. This variable will be preferred whenever the .wks specifies a name in the --sourceparams option.For example:
an image may define:
IMAGE_EXTRA_PARTITION_FILES_sourceparams_foo= "bar.conf"
and the .wks line have line:part --source extra_partition --sourceparams "name=foo"Signed-off-by Louis Rannou <[email protected]>--- meta/lib/oeqa/selftest/cases/wic.py | 16 ++++++++++----- scripts/lib/wic/plugins/source/extra_partition.py | 24 +++++++++++++++++------ 2 files changed, 29 insertions(+), 11 deletions(-)meta/lib/oeqa/selftest/cases/wic.py +1
-0@@ -1657,6 +1657,7 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot" def test_extra_partition_plugin(self): """Test extra partition plugin""" config = dedent("""\ + IMAGE_EXTRA_PARTITION_FILES_sourceparams-foo = "bar.conf" IMAGE_EXTRA_PARTITION_FILES_label-foo = "bar.conf;foo.conf" IMAGE_EXTRA_PARTITION_FILES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d ="bar.conf;foobar.conf bar2.conf;foobar2.conf bar3.conf bar4.conf"
IMAGE_EXTRA_PARTITION_FILES= "foo/*"meta/lib/oeqa/selftest/cases/wic.py +0
-2@@ -1688,9 +1689,13 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot" try: with NamedTemporaryFile("w", suffix=".wks") as wks: - wks.writelines(['part / --source extra_partition --ondisk sda --label foo --align 4 --size 5M\n', - 'part / --source extra_partition --ondisksda --fstype=vfat --uuid e7d0824e-cda3-4bed-9f54-9ef5312d105d --align 4 --size 5M\n',
- 'part / --sourceextra_partition--ondisk
sda --fstype=ext4 --label bar --align 4 --size 5M\n'])meta/lib/oeqa/selftest/cases/wic.py +3
-1+ wks.writelines([ + 'part / --source extra_partition --ondisk sda --sourceparams "name=foo" --align 4 --size 5M\n', + 'part / --source extra_partition --ondisk sda --labelfoo --align 4 --size 5M\n',
+ 'part / --sourceextra_partition--ondisk sda
--fstype=vfat --uuid e7d0824e-cda3-4bed-9f54-9ef5312d105d --align 4 --size 5M\n',meta/lib/oeqa/selftest/cases/wic.py +4
-2+ 'part / --source extra_partition --ondisk sda --fstype=ext4 --label bar --align 4 --size 5M\n', + 'bootloader --ptable gpt\n', + ]) wks.flush() _, wicimg = self._get_wic(wks.name)@@ -1698,14 +1703,15 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot" partls = result.output.split('\n')[1:] # Assert the number of partitions is correct - self.assertEqual(3, len(partls), msg="Expect 3 partitions, not %s" % result.output) + self.assertEqual(4, len(partls), msg="Expect 4 partitions, not %s" % result.output) # Fstype column from 'wic ls' should be fstype as given inthe part command
meta/lib/oeqa/selftest/cases/wic.py +1
-1- for part_id, part_fs in enumerate(["fat16", "fat16", "ext4"]): + for part_id, part_fs in enumerate(["fat16", "fat16", "fat16","ext4"]):
self.assertIn(part_fs, partls[part_id])# For each partition, assert expected files exist for part,
part_globin enumerate([meta/lib/oeqa/selftest/cases/wic.py +1
-0+ ["bar.conf"], ["foo.conf"], ["foobar.conf", "foobar2.conf", "bar3.conf", "bar4.conf"], ["bar.conf", "bar2.conf"],scripts/lib/wic/plugins/source/extra_partition.py +3
-2@@ -18,15 +18,17 @@ class ExtraPartitionPlugin(SourcePlugin): The plugin supports: - Glob pattern matching for file selection. - File renaming. - - Suffixes to specify the target partition (by label, UUID, or partname), - enabling multiple extra partitions to coexist. + - Suffixes to specify the target partition (by params-name, label, UUID, + or partname), enabling multiple extra partitions to coexist. For example: + IMAGE_EXTRA_PARTITION_FILES_sourceparams-name ="bar.conf;foo.conf"
IMAGE_EXTRA_PARTITION_FILES_label-foo = "bar.conf;foo.conf"IMAGE_EXTRA_PARTITION_FILES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d =
"bar.conf;foobar.conf"
IMAGE_EXTRA_PARTITION_FILES= "foo/*" WICVARS:append = "\scripts/lib/wic/plugins/source/extra_partition.py +1
-1+ IMAGE_EXTRA_PARTITION_FILES_sourceparams-name \ IMAGE_EXTRA_PARTITION_FILES_label-foo \ IMAGE_EXTRA_PARTITION_FILES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d \ "@@ -53,11 +55,21 @@ class ExtraPartitionPlugin(SourcePlugin): raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting") extra_files = None - for (fmt, id) in (("_uuid-%s", part.uuid), ("_label-%s",part.label), ("_part-name-%s", part.part_name), (None, None)):
scripts/lib/wic/plugins/source/extra_partition.py +14
-3- if fmt: - var = fmt % id - else: + for (fmt, part_id) in ( + ("_sourceparams-%s", source_params.get("name")), + ("_uuid-%s", part.uuid), + ("_label-%s", part.label), + ("_part-name-%s", part.part_name), + (None, None) + ): + if fmt is None: var = "" + elif part_id is not None: + var = fmt % part_id + else: + continue + + logger.debug("Looking for extra files in %s" %cls.image_extra_partition_files_var_name + var)
extra_files=get_bitbake_var(cls.image_extra_partition_files_var_name + var)
ifextra_filesis not None:
break--
2.43.0