* [PATCH 2/6] wic: extra-partition: Move extra file parsing to a dedicated method
2026-01-13 14:43 [PATCH 1/6] wic: extra-partition: Small code cleanup Adam Duskett
@ 2026-01-13 14:43 ` Adam Duskett
2026-01-13 14:43 ` [PATCH 3/6] wic: extra-partition: Move extra var handling " Adam Duskett
` (3 subsequent siblings)
4 siblings, 0 replies; 14+ messages in thread
From: Adam Duskett @ 2026-01-13 14:43 UTC (permalink / raw)
To: openembedded-core; +Cc: Adam Duskett
For organizational purposes, and to make the following patches
easier to follow, move the extra file parsing to a dedicated
method.
Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
---
| 36 +++++++++++--------
1 file changed, 21 insertions(+), 15 deletions(-)
--git a/scripts/lib/wic/plugins/source/extra_partition.py b/scripts/lib/wic/plugins/source/extra_partition.py
index a1d9aa9a7b..040b6d22ad 100644
--- a/scripts/lib/wic/plugins/source/extra_partition.py
+++ b/scripts/lib/wic/plugins/source/extra_partition.py
@@ -37,20 +37,11 @@ class ExtraPartitionPlugin(SourcePlugin):
image_extra_partition_files_var_name = 'IMAGE_EXTRA_PARTITION_FILES'
@classmethod
- def do_configure_partition(cls, part, source_params, cr, cr_workdir,
- oe_builddir, bootimg_dir, kernel_dir,
- native_sysroot):
+ def _parse_extra_files(cls, part, kernel_dir):
"""
- Called before do_prepare_partition(), list the files to copy
+ Parse the files of which to copy.
"""
- extradir = "%s/extra.%d" % (cr_workdir, part.lineno)
- install_cmd = "install -d %s" % extradir
- exec_cmd(install_cmd)
-
- if not kernel_dir:
- kernel_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
- if not kernel_dir:
- raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
+ deploy_files = []
extra_files = None
for (fmt, id) in (("_uuid-%s", part.uuid), ("_label-%s", part.label), ("_part-name-%s", part.part_name), (None, None)):
@@ -65,10 +56,8 @@ class ExtraPartitionPlugin(SourcePlugin):
if extra_files is None:
raise WicError('No extra files defined, %s unset for entry #%d' % (cls.image_extra_partition_files_var_name, part.lineno))
- logger.info('Extra files: %s', extra_files)
- # list of tuples (src_name, dst_name)
- deploy_files = []
+ logger.info('Extra files: %s', extra_files)
for src_entry in re.findall(r'[\w;\-./*]+', extra_files):
if ';' in src_entry:
dst_entry = tuple(src_entry.split(';'))
@@ -103,6 +92,23 @@ class ExtraPartitionPlugin(SourcePlugin):
else:
cls.install_task.append((src, dst))
+ @classmethod
+ def do_configure_partition(cls, part, source_params, cr, cr_workdir,
+ oe_builddir, bootimg_dir, kernel_dir,
+ native_sysroot):
+ """
+ Called before do_prepare_partition(), list the files to copy
+ """
+ extradir = "%s/extra.%d" % (cr_workdir, part.lineno)
+ install_cmd = "install -d %s" % extradir
+ exec_cmd(install_cmd)
+
+ if not kernel_dir:
+ kernel_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
+ if not kernel_dir:
+ raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
+
+ cls._parse_extra_files(part, kernel_dir)
@classmethod
def do_prepare_partition(cls, part, source_params, cr, cr_workdir,
--
2.52.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 3/6] wic: extra-partition: Move extra var handling to a dedicated method
2026-01-13 14:43 [PATCH 1/6] wic: extra-partition: Small code cleanup Adam Duskett
2026-01-13 14:43 ` [PATCH 2/6] wic: extra-partition: Move extra file parsing to a dedicated method Adam Duskett
@ 2026-01-13 14:43 ` Adam Duskett
2026-01-13 14:43 ` [PATCH 4/6] wic: extra-partition: Rename install_task to extra_files_task Adam Duskett
` (2 subsequent siblings)
4 siblings, 0 replies; 14+ messages in thread
From: Adam Duskett @ 2026-01-13 14:43 UTC (permalink / raw)
To: openembedded-core; +Cc: Adam Duskett
For organizational purposes, and to make the following patches
easier to follow, move the extra file parsing to a dedicated
method.
Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
---
| 25 +++++++++++--------
1 file changed, 15 insertions(+), 10 deletions(-)
--git a/scripts/lib/wic/plugins/source/extra_partition.py b/scripts/lib/wic/plugins/source/extra_partition.py
index 040b6d22ad..d41743ec40 100644
--- a/scripts/lib/wic/plugins/source/extra_partition.py
+++ b/scripts/lib/wic/plugins/source/extra_partition.py
@@ -36,6 +36,20 @@ class ExtraPartitionPlugin(SourcePlugin):
name = 'extra_partition'
image_extra_partition_files_var_name = 'IMAGE_EXTRA_PARTITION_FILES'
+ @classmethod
+ def _get_extra_vars(cls, part, var_name):
+ """Get extra partition directory or file variables"""
+ extra_vars = None
+ for (fmt, id) in (("_uuid-%s", part.uuid), ("_label-%s", part.label), ("_part-name-%s", part.part_name), (None, None)):
+ var = ""
+ if fmt:
+ var = fmt % id
+ thing = var_name + var
+ extra_vars = get_bitbake_var(thing)
+ if extra_vars is not None:
+ break
+ return extra_vars
+
@classmethod
def _parse_extra_files(cls, part, kernel_dir):
"""
@@ -43,16 +57,7 @@ class ExtraPartitionPlugin(SourcePlugin):
"""
deploy_files = []
- 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:
- var = ""
- extra_files = get_bitbake_var(cls.image_extra_partition_files_var_name + var)
- if extra_files is not None:
- break
-
+ extra_files = cls._get_extra_vars(part, cls.image_extra_partition_files_var_name)
if extra_files is None:
raise WicError('No extra files defined, %s unset for entry #%d' % (cls.image_extra_partition_files_var_name, part.lineno))
--
2.52.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 4/6] wic: extra-partition: Rename install_task to extra_files_task
2026-01-13 14:43 [PATCH 1/6] wic: extra-partition: Small code cleanup Adam Duskett
2026-01-13 14:43 ` [PATCH 2/6] wic: extra-partition: Move extra file parsing to a dedicated method Adam Duskett
2026-01-13 14:43 ` [PATCH 3/6] wic: extra-partition: Move extra var handling " Adam Duskett
@ 2026-01-13 14:43 ` Adam Duskett
2026-01-13 14:43 ` [PATCH 5/6] wic: extra-partitions: Make extra-files optional Adam Duskett
2026-01-13 14:43 ` [PATCH 6/6] wic: extra-partitions: extend to support extra directories Adam Duskett
4 siblings, 0 replies; 14+ messages in thread
From: Adam Duskett @ 2026-01-13 14:43 UTC (permalink / raw)
To: openembedded-core; +Cc: Adam Duskett
Rename install_task to extra_files_task for clarity
Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
---
| 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--git a/scripts/lib/wic/plugins/source/extra_partition.py b/scripts/lib/wic/plugins/source/extra_partition.py
index d41743ec40..efe15a4d15 100644
--- a/scripts/lib/wic/plugins/source/extra_partition.py
+++ b/scripts/lib/wic/plugins/source/extra_partition.py
@@ -74,7 +74,7 @@ class ExtraPartitionPlugin(SourcePlugin):
logger.debug('Destination entry: %r', dst_entry)
deploy_files.append(dst_entry)
- cls.install_task = []
+ cls.extra_files_task = []
for deploy_entry in deploy_files:
src, dst = deploy_entry
if '*' in src:
@@ -93,9 +93,9 @@ class ExtraPartitionPlugin(SourcePlugin):
for entry in srcs:
src = os.path.relpath(entry, kernel_dir)
entry_dst_name = entry_name_fn(entry)
- cls.install_task.append((src, entry_dst_name))
+ cls.extra_files_task.append((src, entry_dst_name))
else:
- cls.install_task.append((src, dst))
+ cls.extra_files_task.append((src, dst))
@classmethod
def do_configure_partition(cls, part, source_params, cr, cr_workdir,
@@ -131,7 +131,7 @@ class ExtraPartitionPlugin(SourcePlugin):
if not kernel_dir:
raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
- for task in cls.install_task:
+ for task in cls.extra_files_task:
src_path, dst_path = task
logger.debug('Install %s as %s', src_path, dst_path)
install_cmd = "install -m 0644 -D %s %s" \
--
2.52.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 5/6] wic: extra-partitions: Make extra-files optional
2026-01-13 14:43 [PATCH 1/6] wic: extra-partition: Small code cleanup Adam Duskett
` (2 preceding siblings ...)
2026-01-13 14:43 ` [PATCH 4/6] wic: extra-partition: Rename install_task to extra_files_task Adam Duskett
@ 2026-01-13 14:43 ` Adam Duskett
2026-01-13 15:13 ` Pierre-loup GOSSE
2026-01-13 14:43 ` [PATCH 6/6] wic: extra-partitions: extend to support extra directories Adam Duskett
4 siblings, 1 reply; 14+ messages in thread
From: Adam Duskett @ 2026-01-13 14:43 UTC (permalink / raw)
To: openembedded-core; +Cc: Adam Duskett
There are many use cases where a user may need a blank partition of a given
size and format with no extra files added. Such as an empty data partition.
Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
---
meta/lib/oeqa/selftest/cases/wic.py | 10 ++++++++++
| 20 ++++++++++---------
2 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py
index d7a9b14658..33a6460677 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -1698,6 +1698,16 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot"
self.remove_config(config)
+ # Test with a blank formatted partition of 5M with no extra files
+ with NamedTemporaryFile("w", suffix=".wks") as wks:
+ wks.writelines(['part / --source extra_partition --ondisk sda --fstype=ext4 --label foo --align 4 --size 5M\n'])
+ wks.flush()
+ _, wicimg = self._get_wic(wks.name)
+
+ cmd = "wic ls %s | wc -l" % wicimg
+ result = runCmd(cmd)
+ self.assertEqual('2', result.output, msg="Expect 1 partition, not %s" % result.output)
+
finally:
os.environ['PATH'] = oldpath
--git a/scripts/lib/wic/plugins/source/extra_partition.py b/scripts/lib/wic/plugins/source/extra_partition.py
index efe15a4d15..3abd2bfd4c 100644
--- a/scripts/lib/wic/plugins/source/extra_partition.py
+++ b/scripts/lib/wic/plugins/source/extra_partition.py
@@ -55,11 +55,13 @@ class ExtraPartitionPlugin(SourcePlugin):
"""
Parse the files of which to copy.
"""
+ cls.extra_files_task = []
deploy_files = []
extra_files = cls._get_extra_vars(part, cls.image_extra_partition_files_var_name)
if extra_files is None:
- raise WicError('No extra files defined, %s unset for entry #%d' % (cls.image_extra_partition_files_var_name, part.lineno))
+ logger.debug('No extra files defined, %s unset for entry #%d' % (cls.image_extra_partition_files_var_name, part.lineno))
+ return
logger.info('Extra files: %s', extra_files)
@@ -74,7 +76,6 @@ class ExtraPartitionPlugin(SourcePlugin):
logger.debug('Destination entry: %r', dst_entry)
deploy_files.append(dst_entry)
- cls.extra_files_task = []
for deploy_entry in deploy_files:
src, dst = deploy_entry
if '*' in src:
@@ -131,13 +132,14 @@ class ExtraPartitionPlugin(SourcePlugin):
if not kernel_dir:
raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
- for task in cls.extra_files_task:
- src_path, dst_path = task
- logger.debug('Install %s as %s', src_path, dst_path)
- install_cmd = "install -m 0644 -D %s %s" \
- % (os.path.join(kernel_dir, src_path),
- os.path.join(extradir, dst_path))
- exec_cmd(install_cmd)
+ if cls.extra_files_task:
+ for task in cls.extra_files_task:
+ src_path, dst_path = task
+ logger.debug('Install %s as %s', src_path, dst_path)
+ install_cmd = "install -m 0644 -D %s %s" \
+ % (os.path.join(kernel_dir, src_path),
+ os.path.join(extradir, dst_path))
+ exec_cmd(install_cmd)
logger.debug('Prepare extra partition using rootfs in %s', extradir)
part.prepare_rootfs(cr_workdir, oe_builddir, extradir,
--
2.52.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH 5/6] wic: extra-partitions: Make extra-files optional
2026-01-13 14:43 ` [PATCH 5/6] wic: extra-partitions: Make extra-files optional Adam Duskett
@ 2026-01-13 15:13 ` Pierre-loup GOSSE
2026-01-14 9:26 ` [OE-core] " Adam Duskett
0 siblings, 1 reply; 14+ messages in thread
From: Pierre-loup GOSSE @ 2026-01-13 15:13 UTC (permalink / raw)
To: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 670 bytes --]
Hi Adam,
Thanks for your contribution to the plugin.
>
> There are many use cases where a user may need a blank partition of a
> given
> size and format with no extra files added. Such as an empty data
> partition.
>
A blank partition can already be created without the extra-partition plugin.
Personally, I use the following example line in my WKS file:
part --fstype=ext4 --label data --fixed-size 500M
This command creates a blank 500MB partition with an ext4 filesystem.
In my opinion, the extra plugin should always requires files, similar to the bootimg partition plugin (on which the extra partition plugin is based).
Pierre-Loup,
[-- Attachment #2: Type: text/html, Size: 1004 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [OE-core] [PATCH 5/6] wic: extra-partitions: Make extra-files optional
2026-01-13 15:13 ` Pierre-loup GOSSE
@ 2026-01-14 9:26 ` Adam Duskett
2026-01-14 10:25 ` Pierre-loup GOSSE
0 siblings, 1 reply; 14+ messages in thread
From: Adam Duskett @ 2026-01-14 9:26 UTC (permalink / raw)
To: pierre-loup.gosse; +Cc: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]
Hi Pierre! Thanks for the review!
On Tue, Jan 13, 2026 at 4:13 PM Pierre-loup GOSSE via lists.openembedded.org
<pierre-loup.gosse=smile.fr@lists.openembedded.org> wrote:
> Hi Adam,
>
> Thanks for your contribution to the plugin.
>
>
> There are many use cases where a user may need a blank partition of a given
> size and format with no extra files added. Such as an empty data partition.
>
>
> A blank partition can already be created without the extra-partition
> plugin.
>
> Personally, I use the following example line in my WKS file:
>
> part --fstype=ext4 --label data --fixed-size 500M
>
> This command creates a blank 500MB partition with an ext4 filesystem.
>
> In my opinion, the extra plugin should always requires files, similar to
> the bootimg partition plugin (on which the extra partition plugin is based).
>
>
I'm not seeing the problem with making this optional. A bootimg partition
requires certain files to be present for a system to boot.
An extra partition doesn't.
Adam
> Pierre-Loup,
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#229273):
> https://lists.openembedded.org/g/openembedded-core/message/229273
> Mute This Topic: https://lists.openembedded.org/mt/117243676/10152556
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> adam.duskett@amarulasolutions.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
[-- Attachment #2: Type: text/html, Size: 2839 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [OE-core] [PATCH 5/6] wic: extra-partitions: Make extra-files optional
2026-01-14 9:26 ` [OE-core] " Adam Duskett
@ 2026-01-14 10:25 ` Pierre-loup GOSSE
2026-01-14 10:56 ` Adam Duskett
0 siblings, 1 reply; 14+ messages in thread
From: Pierre-loup GOSSE @ 2026-01-14 10:25 UTC (permalink / raw)
To: Adam Duskett; +Cc: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 2635 bytes --]
Hi Adam,
I'm not seeing the problem with making this optional. A bootimg partition
> requires certain files to be present for a system to boot.
> An extra partition doesn't.
>
My point is, why use the extra-partition plugin without files if omitting
--source already achieves the same result ?
part --source extra-partition --fstype=ext4 --label data --fixed-size
500M
Is equivalent to:
part --fstype=ext4 --label data --fixed-size 500M
If your empty extra partition does not requires files, then there is not
need to use the extra-partition plugin.
This is why I designed the plugin to requires files, or creating
directories as in your patch 6/6. If both are optional, I don't see the
added value of using the extra-partition plugin for this use case.
That said, I'm open to making the plugin more flexible. It could allow no
files or directories, but it should raise a warning or a notice.
Pierre-Loup,
On Wed, Jan 14, 2026 at 10:26 AM Adam Duskett <
adam.duskett@amarulasolutions.com> wrote:
> Hi Pierre! Thanks for the review!
>
> On Tue, Jan 13, 2026 at 4:13 PM Pierre-loup GOSSE via
> lists.openembedded.org <pierre-loup.gosse=smile.fr@lists.openembedded.org>
> wrote:
>
>> Hi Adam,
>>
>> Thanks for your contribution to the plugin.
>>
>>
>> There are many use cases where a user may need a blank partition of a
>> given
>> size and format with no extra files added. Such as an empty data
>> partition.
>>
>>
>> A blank partition can already be created without the extra-partition
>> plugin.
>>
>> Personally, I use the following example line in my WKS file:
>>
>> part --fstype=ext4 --label data --fixed-size 500M
>>
>> This command creates a blank 500MB partition with an ext4 filesystem.
>>
>> In my opinion, the extra plugin should always requires files, similar to
>> the bootimg partition plugin (on which the extra partition plugin is based).
>>
>>
> I'm not seeing the problem with making this optional. A bootimg partition
> requires certain files to be present for a system to boot.
> An extra partition doesn't.
>
> Adam
>
>> Pierre-Loup,
>>
>>
>> -=-=-=-=-=-=-=-=-=-=-=-
>> Links: You receive all messages sent to this group.
>> View/Reply Online (#229273):
>> https://lists.openembedded.org/g/openembedded-core/message/229273
>> Mute This Topic: https://lists.openembedded.org/mt/117243676/10152556
>> Group Owner: openembedded-core+owner@lists.openembedded.org
>> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
>> adam.duskett@amarulasolutions.com]
>> -=-=-=-=-=-=-=-=-=-=-=-
>>
>>
[-- Attachment #2: Type: text/html, Size: 4740 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [OE-core] [PATCH 5/6] wic: extra-partitions: Make extra-files optional
2026-01-14 10:25 ` Pierre-loup GOSSE
@ 2026-01-14 10:56 ` Adam Duskett
2026-01-14 17:13 ` Pierre-loup GOSSE
0 siblings, 1 reply; 14+ messages in thread
From: Adam Duskett @ 2026-01-14 10:56 UTC (permalink / raw)
To: Pierre-loup GOSSE; +Cc: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 3239 bytes --]
Hey Pierre-loup;
On Wed, Jan 14, 2026 at 11:25 AM Pierre-loup GOSSE <
pierre-loup.gosse@smile.fr> wrote:
> Hi Adam,
>
> I'm not seeing the problem with making this optional. A bootimg partition
>> requires certain files to be present for a system to boot.
>> An extra partition doesn't.
>>
>
> My point is, why use the extra-partition plugin without files if omitting
> --source already achieves the same result ?
>
> part --source extra-partition --fstype=ext4 --label data --fixed-size
> 500M
>
> Is equivalent to:
>
> part --fstype=ext4 --label data --fixed-size 500M
>
> If your empty extra partition does not requires files, then there is not
> need to use the extra-partition plugin.
>
That's understood. but does it really matter? Is it hurting anyone or
anything if they use --source extra-partition?
> This is why I designed the plugin to requires files, or creating
> directories as in your patch 6/6. If both are optional, I don't see the
> added value of using the extra-partition plugin for this use case.
>
People see the "extra partition" plugin and assume they can make extra
partitions from it. The plugin isn't named "extra partition with mandatory
files"
>
> That said, I'm open to making the plugin more flexible. It could allow no
> files or directories, but it should raise a warning or a notice.
>
With this patch series, It does throw a notice. For both empty directories
and empty files.
>
> Pierre-Loup,
>
>
> On Wed, Jan 14, 2026 at 10:26 AM Adam Duskett <
> adam.duskett@amarulasolutions.com> wrote:
>
>> Hi Pierre! Thanks for the review!
>>
>> On Tue, Jan 13, 2026 at 4:13 PM Pierre-loup GOSSE via
>> lists.openembedded.org <pierre-loup.gosse=smile.fr@lists.openembedded.org>
>> wrote:
>>
>>> Hi Adam,
>>>
>>> Thanks for your contribution to the plugin.
>>>
>>>
>>> There are many use cases where a user may need a blank partition of a
>>> given
>>> size and format with no extra files added. Such as an empty data
>>> partition.
>>>
>>>
>>> A blank partition can already be created without the extra-partition
>>> plugin.
>>>
>>> Personally, I use the following example line in my WKS file:
>>>
>>> part --fstype=ext4 --label data --fixed-size 500M
>>>
>>> This command creates a blank 500MB partition with an ext4 filesystem.
>>>
>>> In my opinion, the extra plugin should always requires files, similar to
>>> the bootimg partition plugin (on which the extra partition plugin is based).
>>>
>>>
>> I'm not seeing the problem with making this optional. A bootimg partition
>> requires certain files to be present for a system to boot.
>> An extra partition doesn't.
>>
>> Adam
>>
>>> Pierre-Loup,
>>>
>>>
>>> -=-=-=-=-=-=-=-=-=-=-=-
>>> Links: You receive all messages sent to this group.
>>> View/Reply Online (#229273):
>>> https://lists.openembedded.org/g/openembedded-core/message/229273
>>> Mute This Topic: https://lists.openembedded.org/mt/117243676/10152556
>>> Group Owner: openembedded-core+owner@lists.openembedded.org
>>> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
>>> adam.duskett@amarulasolutions.com]
>>> -=-=-=-=-=-=-=-=-=-=-=-
>>>
>>>
[-- Attachment #2: Type: text/html, Size: 6384 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [OE-core] [PATCH 5/6] wic: extra-partitions: Make extra-files optional
2026-01-14 10:56 ` Adam Duskett
@ 2026-01-14 17:13 ` Pierre-loup GOSSE
2026-01-15 13:21 ` Adam Duskett
0 siblings, 1 reply; 14+ messages in thread
From: Pierre-loup GOSSE @ 2026-01-14 17:13 UTC (permalink / raw)
To: Adam Duskett; +Cc: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 4847 bytes --]
Hi,
That's understood. but does it really matter? Is it hurting anyone or
> anything if they use --source extra-partition?
This change could lead to unintended behavior if a user makes a typo in the
variable, for example "fooo" instead of "foo":
IMAGE_EXTRA_PARTITION_FILES_label-fooo = "bar.conf"
part --source extra-partition --fstype=ext4 --label foo
In this case, the user might expect the build to fail. The current version
throws a fatal error, while your version would only notice it with the
debug option, but still accept it.
People see the "extra partition" plugin and assume they can make extra
> partitions from it. The plugin isn't named "extra partition with mandatory
> files"
I understand that the plugin name might create this assumption, and it
could be renamed. However, the plugin's description is clear:
Populates an extra partition with files listed in the
IMAGE_EXTRA_PARTITION_FILES
BitBake variable. Files should be deployed to the DEPLOY_DIR_IMAGE
directory.
Our visions on the plugin differ. From my point of view, since creating a
blank empty partition is already supported by Wic without a plugin (though
perhaps not well-documented, that's another subject), I see no real reason
and a disadvantage in allowing the extra-partition plugin to work without
files (or directories).
Pierre-Loup,
On Wed, Jan 14, 2026 at 11:56 AM Adam Duskett <
adam.duskett@amarulasolutions.com> wrote:
>
> Hey Pierre-loup;
>
>
>
> On Wed, Jan 14, 2026 at 11:25 AM Pierre-loup GOSSE <
> pierre-loup.gosse@smile.fr> wrote:
>
>> Hi Adam,
>>
>> I'm not seeing the problem with making this optional. A bootimg partition
>>> requires certain files to be present for a system to boot.
>>> An extra partition doesn't.
>>>
>>
>> My point is, why use the extra-partition plugin without files if omitting
>> --source already achieves the same result ?
>>
>> part --source extra-partition --fstype=ext4 --label data --fixed-size
>> 500M
>>
>> Is equivalent to:
>>
>> part --fstype=ext4 --label data --fixed-size 500M
>>
>> If your empty extra partition does not requires files, then there is not
>> need to use the extra-partition plugin.
>>
> That's understood. but does it really matter? Is it hurting anyone or
> anything if they use --source extra-partition?
>
>
>> This is why I designed the plugin to requires files, or creating
>> directories as in your patch 6/6. If both are optional, I don't see the
>> added value of using the extra-partition plugin for this use case.
>>
> People see the "extra partition" plugin and assume they can make extra
> partitions from it. The plugin isn't named "extra partition with mandatory
> files"
>
>>
>> That said, I'm open to making the plugin more flexible. It could allow no
>> files or directories, but it should raise a warning or a notice.
>>
> With this patch series, It does throw a notice. For both empty directories
> and empty files.
>
>>
>> Pierre-Loup,
>>
>>
>> On Wed, Jan 14, 2026 at 10:26 AM Adam Duskett <
>> adam.duskett@amarulasolutions.com> wrote:
>>
>>> Hi Pierre! Thanks for the review!
>>>
>>> On Tue, Jan 13, 2026 at 4:13 PM Pierre-loup GOSSE via
>>> lists.openembedded.org <pierre-loup.gosse=
>>> smile.fr@lists.openembedded.org> wrote:
>>>
>>>> Hi Adam,
>>>>
>>>> Thanks for your contribution to the plugin.
>>>>
>>>>
>>>> There are many use cases where a user may need a blank partition of a
>>>> given
>>>> size and format with no extra files added. Such as an empty data
>>>> partition.
>>>>
>>>>
>>>> A blank partition can already be created without the extra-partition
>>>> plugin.
>>>>
>>>> Personally, I use the following example line in my WKS file:
>>>>
>>>> part --fstype=ext4 --label data --fixed-size 500M
>>>>
>>>> This command creates a blank 500MB partition with an ext4 filesystem.
>>>>
>>>> In my opinion, the extra plugin should always requires files, similar
>>>> to the bootimg partition plugin (on which the extra partition plugin is
>>>> based).
>>>>
>>>>
>>> I'm not seeing the problem with making this optional. A bootimg
>>> partition requires certain files to be present for a system to boot.
>>> An extra partition doesn't.
>>>
>>> Adam
>>>
>>>> Pierre-Loup,
>>>>
>>>>
>>>> -=-=-=-=-=-=-=-=-=-=-=-
>>>> Links: You receive all messages sent to this group.
>>>> View/Reply Online (#229273):
>>>> https://lists.openembedded.org/g/openembedded-core/message/229273
>>>> Mute This Topic: https://lists.openembedded.org/mt/117243676/10152556
>>>> Group Owner: openembedded-core+owner@lists.openembedded.org
>>>> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
>>>> adam.duskett@amarulasolutions.com]
>>>> -=-=-=-=-=-=-=-=-=-=-=-
>>>>
>>>>
[-- Attachment #2: Type: text/html, Size: 9027 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [OE-core] [PATCH 5/6] wic: extra-partitions: Make extra-files optional
2026-01-14 17:13 ` Pierre-loup GOSSE
@ 2026-01-15 13:21 ` Adam Duskett
0 siblings, 0 replies; 14+ messages in thread
From: Adam Duskett @ 2026-01-15 13:21 UTC (permalink / raw)
To: Pierre-loup GOSSE; +Cc: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 5464 bytes --]
Hello Pierre-loup;
I submitted a new patch series that:
- Expands the WicError message if files are not present for clarity.
- Extends the functionality of extra-partition to accept a
space-delineated list of directories.
- Errors out if extra files and extra directories are not specified.
Hopefully this is a good compromise for you!
On Wed, Jan 14, 2026 at 6:13 PM Pierre-loup GOSSE <
pierre-loup.gosse@smile.fr> wrote:
> Hi,
>
> That's understood. but does it really matter? Is it hurting anyone or
>> anything if they use --source extra-partition?
>
>
> This change could lead to unintended behavior if a user makes a typo in
> the variable, for example "fooo" instead of "foo":
>
> IMAGE_EXTRA_PARTITION_FILES_label-fooo = "bar.conf"
>
> part --source extra-partition --fstype=ext4 --label foo
>
> In this case, the user might expect the build to fail. The current version
> throws a fatal error, while your version would only notice it with the
> debug option, but still accept it.
>
> People see the "extra partition" plugin and assume they can make extra
>> partitions from it. The plugin isn't named "extra partition with mandatory
>> files"
>
>
> I understand that the plugin name might create this assumption, and it
> could be renamed. However, the plugin's description is clear:
>
> Populates an extra partition with files listed in the
> IMAGE_EXTRA_PARTITION_FILES
> BitBake variable. Files should be deployed to the DEPLOY_DIR_IMAGE
> directory.
>
> Our visions on the plugin differ. From my point of view, since creating a
> blank empty partition is already supported by Wic without a plugin (though
> perhaps not well-documented, that's another subject), I see no real reason
> and a disadvantage in allowing the extra-partition plugin to work without
> files (or directories).
>
> Pierre-Loup,
>
>
> On Wed, Jan 14, 2026 at 11:56 AM Adam Duskett <
> adam.duskett@amarulasolutions.com> wrote:
>
>>
>> Hey Pierre-loup;
>>
>>
>>
>> On Wed, Jan 14, 2026 at 11:25 AM Pierre-loup GOSSE <
>> pierre-loup.gosse@smile.fr> wrote:
>>
>>> Hi Adam,
>>>
>>> I'm not seeing the problem with making this optional. A bootimg
>>>> partition requires certain files to be present for a system to boot.
>>>> An extra partition doesn't.
>>>>
>>>
>>> My point is, why use the extra-partition plugin without files if
>>> omitting --source already achieves the same result ?
>>>
>>> part --source extra-partition --fstype=ext4 --label data
>>> --fixed-size 500M
>>>
>>> Is equivalent to:
>>>
>>> part --fstype=ext4 --label data --fixed-size 500M
>>>
>>> If your empty extra partition does not requires files, then there is not
>>> need to use the extra-partition plugin.
>>>
>> That's understood. but does it really matter? Is it hurting anyone or
>> anything if they use --source extra-partition?
>>
>>
>>> This is why I designed the plugin to requires files, or creating
>>> directories as in your patch 6/6. If both are optional, I don't see the
>>> added value of using the extra-partition plugin for this use case.
>>>
>> People see the "extra partition" plugin and assume they can make extra
>> partitions from it. The plugin isn't named "extra partition with mandatory
>> files"
>>
>>>
>>> That said, I'm open to making the plugin more flexible. It could allow
>>> no files or directories, but it should raise a warning or a notice.
>>>
>> With this patch series, It does throw a notice. For both empty
>> directories and empty files.
>>
>>>
>>> Pierre-Loup,
>>>
>>>
>>> On Wed, Jan 14, 2026 at 10:26 AM Adam Duskett <
>>> adam.duskett@amarulasolutions.com> wrote:
>>>
>>>> Hi Pierre! Thanks for the review!
>>>>
>>>> On Tue, Jan 13, 2026 at 4:13 PM Pierre-loup GOSSE via
>>>> lists.openembedded.org <pierre-loup.gosse=
>>>> smile.fr@lists.openembedded.org> wrote:
>>>>
>>>>> Hi Adam,
>>>>>
>>>>> Thanks for your contribution to the plugin.
>>>>>
>>>>>
>>>>> There are many use cases where a user may need a blank partition of a
>>>>> given
>>>>> size and format with no extra files added. Such as an empty data
>>>>> partition.
>>>>>
>>>>>
>>>>> A blank partition can already be created without the extra-partition
>>>>> plugin.
>>>>>
>>>>> Personally, I use the following example line in my WKS file:
>>>>>
>>>>> part --fstype=ext4 --label data --fixed-size 500M
>>>>>
>>>>> This command creates a blank 500MB partition with an ext4 filesystem.
>>>>>
>>>>> In my opinion, the extra plugin should always requires files, similar
>>>>> to the bootimg partition plugin (on which the extra partition plugin is
>>>>> based).
>>>>>
>>>>>
>>>> I'm not seeing the problem with making this optional. A bootimg
>>>> partition requires certain files to be present for a system to boot.
>>>> An extra partition doesn't.
>>>>
>>>> Adam
>>>>
>>>>> Pierre-Loup,
>>>>>
>>>>>
>>>>> -=-=-=-=-=-=-=-=-=-=-=-
>>>>> Links: You receive all messages sent to this group.
>>>>> View/Reply Online (#229273):
>>>>> https://lists.openembedded.org/g/openembedded-core/message/229273
>>>>> Mute This Topic: https://lists.openembedded.org/mt/117243676/10152556
>>>>> Group Owner: openembedded-core+owner@lists.openembedded.org
>>>>> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
>>>>> [adam.duskett@amarulasolutions.com]
>>>>> -=-=-=-=-=-=-=-=-=-=-=-
>>>>>
>>>>>
[-- Attachment #2: Type: text/html, Size: 9888 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 6/6] wic: extra-partitions: extend to support extra directories
2026-01-13 14:43 [PATCH 1/6] wic: extra-partition: Small code cleanup Adam Duskett
` (3 preceding siblings ...)
2026-01-13 14:43 ` [PATCH 5/6] wic: extra-partitions: Make extra-files optional Adam Duskett
@ 2026-01-13 14:43 ` Adam Duskett
2026-01-13 16:18 ` Pierre-loup GOSSE
4 siblings, 1 reply; 14+ messages in thread
From: Adam Duskett @ 2026-01-13 14:43 UTC (permalink / raw)
To: openembedded-core; +Cc: Adam Duskett
Add the ability to define a semicolon-delminated list of directories
to create on the extra partition.
Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
---
meta/lib/oeqa/selftest/cases/wic.py | 11 ++++++
| 38 +++++++++++++++++++
2 files changed, 49 insertions(+)
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py
index 33a6460677..d365345554 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -1657,10 +1657,14 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot"
def test_extra_partition_plugin(self):
"""Test extra partition plugin"""
config = dedent("""\
+ IMAGE_EXTRA_PARTITION_DIRECTORIES_label-foo = "/test1;/test2/test3"
+ IMAGE_EXTRA_PARTITION_DIRECTORIES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d = "/test1;/test2/test3"
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_DIRECTORIES_label-foo \
+ IMAGE_EXTRA_PARTITION_DIRECTORIES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d \
IMAGE_EXTRA_PARTITION_FILES_label-foo \
IMAGE_EXTRA_PARTITION_FILES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d \
"
@@ -1692,6 +1696,13 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot"
result = runCmd("wic ls %s | wc -l" % wicimg)
self.assertEqual('4', result.output, msg="Expect 3 partitions, not %s" % result.output)
+ for part, extra_dir in enumerate(["test1", "test2"]):
+ result = runCmd("wic ls %s:%d | grep -q \"%s\"" % (wicimg, part + 1, extra_dir))
+ self.assertEqual(0, result.status, msg="Directory '%s' not found in the partition #%d" % (extra_dir, part))
+
+ result = runCmd("wic ls %s:%d/test2 | grep -q \"test3\"" % (wicimg, part + 1))
+ self.assertEqual(0, result.status, msg="Directory test2/test3 not found in the partition #%d" % part)
+
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))
--git a/scripts/lib/wic/plugins/source/extra_partition.py b/scripts/lib/wic/plugins/source/extra_partition.py
index 3abd2bfd4c..fee72df615 100644
--- a/scripts/lib/wic/plugins/source/extra_partition.py
+++ b/scripts/lib/wic/plugins/source/extra_partition.py
@@ -20,13 +20,19 @@ class ExtraPartitionPlugin(SourcePlugin):
- File renaming.
- Suffixes to specify the target partition (by label, UUID, or partname),
enabling multiple extra partitions to coexist.
+ - Extra directories.
For example:
+ IMAGE_EXTRA_PARTITION_DIRECTORIES_label-foo = "/foo;/bar/baz"
+ IMAGE_EXTRA_PARTITION_DIRECTORIES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d = "/foo;/bar/baz"
+
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_DIRECTORIES_label-foo \
+ IMAGE_EXTRA_PARTITION_DIRECTORIES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d \
IMAGE_EXTRA_PARTITION_FILES_label-foo \
IMAGE_EXTRA_PARTITION_FILES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d \
"
@@ -35,6 +41,7 @@ class ExtraPartitionPlugin(SourcePlugin):
name = 'extra_partition'
image_extra_partition_files_var_name = 'IMAGE_EXTRA_PARTITION_FILES'
+ image_extra_partition_dirs_var_name = 'IMAGE_EXTRA_PARTITION_DIRECTORIES'
@classmethod
def _get_extra_vars(cls, part, var_name):
@@ -50,6 +57,30 @@ class ExtraPartitionPlugin(SourcePlugin):
break
return extra_vars
+
+ @classmethod
+ def _parse_extra_directories(cls, part):
+ """
+ Parse the directories of which to copy.
+ """
+ cls.extra_dirs_task = []
+
+ extra_dirs = cls._get_extra_vars(part, cls.image_extra_partition_dirs_var_name)
+ if extra_dirs is None:
+ logger.debug('No extra directories defined, %s unset for entry #%d' % (cls.image_extra_partition_dirs_var_name, part.lineno))
+ return
+
+ logger.info('Extra dirs: %s', extra_dirs)
+ for src_entry in re.findall(r'[\w;\-./*]+', extra_dirs):
+ if ';' in src_entry:
+ dst_entries = src_entry.split(';')
+ if not dst_entries[0] or not dst_entries[1]:
+ raise WicError('Malformed extra dir entry: %s' % src_entry)
+ for dst_entry in dst_entries:
+ cls.extra_dirs_task.append(dst_entry)
+ else:
+ cls.extra_dirs_task.append(src_entry)
+
@classmethod
def _parse_extra_files(cls, part, kernel_dir):
"""
@@ -114,6 +145,7 @@ class ExtraPartitionPlugin(SourcePlugin):
if not kernel_dir:
raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
+ cls._parse_extra_directories(part)
cls._parse_extra_files(part, kernel_dir)
@classmethod
@@ -132,6 +164,12 @@ class ExtraPartitionPlugin(SourcePlugin):
if not kernel_dir:
raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
+ if cls.extra_dirs_task:
+ for task in cls.extra_dirs_task:
+ mkdir_cmd = "mkdir -p %s/%s" % (extradir, task)
+ logger.debug(mkdir_cmd)
+ exec_cmd(mkdir_cmd)
+
if cls.extra_files_task:
for task in cls.extra_files_task:
src_path, dst_path = task
--
2.52.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH 6/6] wic: extra-partitions: extend to support extra directories
2026-01-13 14:43 ` [PATCH 6/6] wic: extra-partitions: extend to support extra directories Adam Duskett
@ 2026-01-13 16:18 ` Pierre-loup GOSSE
2026-01-14 9:28 ` [OE-core] " Adam Duskett
0 siblings, 1 reply; 14+ messages in thread
From: Pierre-loup GOSSE @ 2026-01-13 16:18 UTC (permalink / raw)
To: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 6737 bytes --]
Hi,
On Tue, Jan 13, 2026 at 03:43 PM, Adam Duskett wrote:
>
> Add the ability to define a semicolon-delminated list of directories
> to create on the extra partition.
I think using a semicolon to separate items in IMAGE_EXTRA_PARTITION_DIRECTORIES could be confusing, as it’s already used for tuples in the IMAGE_EXTRA_PARTITION_FILES variable. A space-delimited list might be more intuitive and consistent with how IMAGE_EXTRA_PARTITION_FILES is structured. For example:
IMAGE_EXTRA_PARTITION_DIRECTORIES_label-foo = "/test1 /test2/test3 /test4"
IMAGE_EXTRA_PARTITION_FILES_label-foo = "bar1.conf;foo1.conf bar2.conf bar3;foo3"
What do you think ?
>
> Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
> ---
> meta/lib/oeqa/selftest/cases/wic.py | 11 ++++++
> .../lib/wic/plugins/source/extra_partition.py | 38 +++++++++++++++++++
> 2 files changed, 49 insertions(+)
>
> diff --git a/meta/lib/oeqa/selftest/cases/wic.py
> b/meta/lib/oeqa/selftest/cases/wic.py
> index 33a6460677..d365345554 100644
> --- a/meta/lib/oeqa/selftest/cases/wic.py
> +++ b/meta/lib/oeqa/selftest/cases/wic.py
> @@ -1657,10 +1657,14 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot"
> def test_extra_partition_plugin(self):
> """Test extra partition plugin"""
> config = dedent("""\
> + IMAGE_EXTRA_PARTITION_DIRECTORIES_label-foo = "/test1;/test2/test3"
> +
> IMAGE_EXTRA_PARTITION_DIRECTORIES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d
> = "/test1;/test2/test3"
> 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_DIRECTORIES_label-foo \
> +
> IMAGE_EXTRA_PARTITION_DIRECTORIES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d
> \
> IMAGE_EXTRA_PARTITION_FILES_label-foo \
> IMAGE_EXTRA_PARTITION_FILES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d \
> "
> @@ -1692,6 +1696,13 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot"
> result = runCmd("wic ls %s | wc -l" % wicimg)
> self.assertEqual('4', result.output, msg="Expect 3 partitions, not %s" %
> result.output)
>
> + for part, extra_dir in enumerate(["test1", "test2"]):
> + result = runCmd("wic ls %s:%d | grep -q \"%s\"" % (wicimg, part + 1,
> extra_dir))
> + self.assertEqual(0, result.status, msg="Directory '%s' not found in the
> partition #%d" % (extra_dir, part))
> +
> + result = runCmd("wic ls %s:%d/test2 | grep -q \"test3\"" % (wicimg, part
> + 1))
> + self.assertEqual(0, result.status, msg="Directory test2/test3 not found
> in the partition #%d" % part)
> +
> 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))
> diff --git a/scripts/lib/wic/plugins/source/extra_partition.py
> b/scripts/lib/wic/plugins/source/extra_partition.py
> index 3abd2bfd4c..fee72df615 100644
> --- a/scripts/lib/wic/plugins/source/extra_partition.py
> +++ b/scripts/lib/wic/plugins/source/extra_partition.py
> @@ -20,13 +20,19 @@ class ExtraPartitionPlugin(SourcePlugin):
> - File renaming.
> - Suffixes to specify the target partition (by label, UUID, or partname),
> enabling multiple extra partitions to coexist.
> + - Extra directories.
>
> For example:
>
> + IMAGE_EXTRA_PARTITION_DIRECTORIES_label-foo = "/foo;/bar/baz"
> +
> IMAGE_EXTRA_PARTITION_DIRECTORIES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d
> = "/foo;/bar/baz"
> +
> 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_DIRECTORIES_label-foo \
> +
> IMAGE_EXTRA_PARTITION_DIRECTORIES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d
> \
> IMAGE_EXTRA_PARTITION_FILES_label-foo \
> IMAGE_EXTRA_PARTITION_FILES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d \
> "
> @@ -35,6 +41,7 @@ class ExtraPartitionPlugin(SourcePlugin):
>
> name = 'extra_partition'
> image_extra_partition_files_var_name = 'IMAGE_EXTRA_PARTITION_FILES'
> + image_extra_partition_dirs_var_name =
> 'IMAGE_EXTRA_PARTITION_DIRECTORIES'
>
> @classmethod
> def _get_extra_vars(cls, part, var_name):
> @@ -50,6 +57,30 @@ class ExtraPartitionPlugin(SourcePlugin):
> break
> return extra_vars
>
> +
> + @classmethod
> + def _parse_extra_directories(cls, part):
> + """
> + Parse the directories of which to copy.
> + """
> + cls.extra_dirs_task = []
> +
> + extra_dirs = cls._get_extra_vars(part,
> cls.image_extra_partition_dirs_var_name)
> + if extra_dirs is None:
> + logger.debug('No extra directories defined, %s unset for entry #%d' %
> (cls.image_extra_partition_dirs_var_name, part.lineno))
> + return
> +
> + logger.info('Extra dirs: %s', extra_dirs)
> + for src_entry in re.findall(r'[\w;\-./*]+', extra_dirs):
> + if ';' in src_entry:
> + dst_entries = src_entry.split(';')
> + if not dst_entries[0] or not dst_entries[1]:
> + raise WicError('Malformed extra dir entry: %s' % src_entry)
This raises an error for " foo;", but not for " foo;bar; ".
With a space-delimited list, the src_entry can be directly added to the extra_dirs_task list.
>
> + for dst_entry in dst_entries:
> + cls.extra_dirs_task.append(dst_entry)
> + else:
> + cls.extra_dirs_task.append(src_entry)
> +
> @classmethod
> def _parse_extra_files(cls, part, kernel_dir):
> """
> @@ -114,6 +145,7 @@ class ExtraPartitionPlugin(SourcePlugin):
> if not kernel_dir:
> raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
>
> + cls._parse_extra_directories(part)
> cls._parse_extra_files(part, kernel_dir)
>
> @classmethod
> @@ -132,6 +164,12 @@ class ExtraPartitionPlugin(SourcePlugin):
> if not kernel_dir:
> raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
>
> + if cls.extra_dirs_task:
> + for task in cls.extra_dirs_task:
> + mkdir_cmd = "mkdir -p %s/%s" % (extradir, task)
> + logger.debug(mkdir_cmd)
> + exec_cmd(mkdir_cmd)
> +
> if cls.extra_files_task:
> for task in cls.extra_files_task:
> src_path, dst_path = task
Regarding your patch 5/6, the plugin should indeed be able to create extra directories without requiring extra files. For example to prepare a data partition with only directories.
However, since extra partition plugin was not designed to create empty partitions (omitting --source achieve this), I think the plugin should raise an error if no files or directories are defined.
Pierre-Loup,
[-- Attachment #2: Type: text/html, Size: 7865 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [OE-core] [PATCH 6/6] wic: extra-partitions: extend to support extra directories
2026-01-13 16:18 ` Pierre-loup GOSSE
@ 2026-01-14 9:28 ` Adam Duskett
0 siblings, 0 replies; 14+ messages in thread
From: Adam Duskett @ 2026-01-14 9:28 UTC (permalink / raw)
To: pierre-loup.gosse; +Cc: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 7710 bytes --]
Hi Pierre-Loup!
On Tue, Jan 13, 2026 at 5:18 PM Pierre-loup GOSSE via lists.openembedded.org
<pierre-loup.gosse=smile.fr@lists.openembedded.org> wrote:
> Hi,
>
> On Tue, Jan 13, 2026 at 03:43 PM, Adam Duskett wrote:
>
> Add the ability to define a semicolon-delminated list of directories
> to create on the extra partition.
>
>
> I think using a semicolon to separate items in
> IMAGE_EXTRA_PARTITION_DIRECTORIES could be confusing, as it’s already
> used for tuples in the IMAGE_EXTRA_PARTITION_FILES variable. A
> space-delimited list might be more intuitive and consistent with how
> IMAGE_EXTRA_PARTITION_FILES is structured. For example:
>
> IMAGE_EXTRA_PARTITION_DIRECTORIES_label-foo = "/test1 /test2/test3 /test4"
> IMAGE_EXTRA_PARTITION_FILES_label-foo = "bar1.conf;foo1.conf bar2.conf
> bar3;foo3"
>
> What do you think ?
>
>
Looks good to me. I can send a V2 that separates by space instead. It does
look cleaner!
> Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
> ---
> meta/lib/oeqa/selftest/cases/wic.py | 11 ++++++
> .../lib/wic/plugins/source/extra_partition.py | 38 +++++++++++++++++++
> 2 files changed, 49 insertions(+)
>
> diff --git a/meta/lib/oeqa/selftest/cases/wic.py
> b/meta/lib/oeqa/selftest/cases/wic.py
> index 33a6460677..d365345554 100644
> --- a/meta/lib/oeqa/selftest/cases/wic.py
> +++ b/meta/lib/oeqa/selftest/cases/wic.py
> @@ -1657,10 +1657,14 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot"
> def test_extra_partition_plugin(self):
> """Test extra partition plugin"""
> config = dedent("""\
> + IMAGE_EXTRA_PARTITION_DIRECTORIES_label-foo = "/test1;/test2/test3"
> +
> IMAGE_EXTRA_PARTITION_DIRECTORIES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d
> = "/test1;/test2/test3"
> 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_DIRECTORIES_label-foo \
> +
> IMAGE_EXTRA_PARTITION_DIRECTORIES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d
> \
> IMAGE_EXTRA_PARTITION_FILES_label-foo \
> IMAGE_EXTRA_PARTITION_FILES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d \
> "
> @@ -1692,6 +1696,13 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot"
> result = runCmd("wic ls %s | wc -l" % wicimg)
> self.assertEqual('4', result.output, msg="Expect 3 partitions, not %s" %
> result.output)
>
> + for part, extra_dir in enumerate(["test1", "test2"]):
> + result = runCmd("wic ls %s:%d | grep -q \"%s\"" % (wicimg, part + 1,
> extra_dir))
> + self.assertEqual(0, result.status, msg="Directory '%s' not found in the
> partition #%d" % (extra_dir, part))
> +
> + result = runCmd("wic ls %s:%d/test2 | grep -q \"test3\"" % (wicimg, part
> + 1))
> + self.assertEqual(0, result.status, msg="Directory test2/test3 not found
> in the partition #%d" % part)
> +
> 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))
> diff --git a/scripts/lib/wic/plugins/source/extra_partition.py
> b/scripts/lib/wic/plugins/source/extra_partition.py
> index 3abd2bfd4c..fee72df615 100644
> --- a/scripts/lib/wic/plugins/source/extra_partition.py
> +++ b/scripts/lib/wic/plugins/source/extra_partition.py
> @@ -20,13 +20,19 @@ class ExtraPartitionPlugin(SourcePlugin):
> - File renaming.
> - Suffixes to specify the target partition (by label, UUID, or partname),
> enabling multiple extra partitions to coexist.
> + - Extra directories.
>
> For example:
>
> + IMAGE_EXTRA_PARTITION_DIRECTORIES_label-foo = "/foo;/bar/baz"
> +
> IMAGE_EXTRA_PARTITION_DIRECTORIES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d
> = "/foo;/bar/baz"
> +
> 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_DIRECTORIES_label-foo \
> +
> IMAGE_EXTRA_PARTITION_DIRECTORIES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d
> \
> IMAGE_EXTRA_PARTITION_FILES_label-foo \
> IMAGE_EXTRA_PARTITION_FILES_uuid-e7d0824e-cda3-4bed-9f54-9ef5312d105d \
> "
> @@ -35,6 +41,7 @@ class ExtraPartitionPlugin(SourcePlugin):
>
> name = 'extra_partition'
> image_extra_partition_files_var_name = 'IMAGE_EXTRA_PARTITION_FILES'
> + image_extra_partition_dirs_var_name = 'IMAGE_EXTRA_PARTITION_DIRECTORIES'
>
> @classmethod
> def _get_extra_vars(cls, part, var_name):
> @@ -50,6 +57,30 @@ class ExtraPartitionPlugin(SourcePlugin):
> break
> return extra_vars
>
> +
> + @classmethod
> + def _parse_extra_directories(cls, part):
> + """
> + Parse the directories of which to copy.
> + """
> + cls.extra_dirs_task = []
> +
> + extra_dirs = cls._get_extra_vars(part,
> cls.image_extra_partition_dirs_var_name)
> + if extra_dirs is None:
> + logger.debug('No extra directories defined, %s unset for entry #%d' %
> (cls.image_extra_partition_dirs_var_name, part.lineno))
> + return
> +
> + logger.info('Extra dirs: %s', extra_dirs)
> + for src_entry in re.findall(r'[\w;\-./*]+', extra_dirs):
> + if ';' in src_entry:
> + dst_entries = src_entry.split(';')
> + if not dst_entries[0] or not dst_entries[1]:
> + raise WicError('Malformed extra dir entry: %s' % src_entry)
>
>
> This raises an error for "foo;", but not for "foo;bar;".
> With a space-delimited list, the src_entry can be directly added to the
> extra_dirs_task list.
>
> + for dst_entry in dst_entries:
> + cls.extra_dirs_task.append(dst_entry)
> + else:
> + cls.extra_dirs_task.append(src_entry)
> +
> @classmethod
> def _parse_extra_files(cls, part, kernel_dir):
> """
> @@ -114,6 +145,7 @@ class ExtraPartitionPlugin(SourcePlugin):
> if not kernel_dir:
> raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
>
> + cls._parse_extra_directories(part)
> cls._parse_extra_files(part, kernel_dir)
>
> @classmethod
> @@ -132,6 +164,12 @@ class ExtraPartitionPlugin(SourcePlugin):
> if not kernel_dir:
> raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
>
> + if cls.extra_dirs_task:
> + for task in cls.extra_dirs_task:
> + mkdir_cmd = "mkdir -p %s/%s" % (extradir, task)
> + logger.debug(mkdir_cmd)
> + exec_cmd(mkdir_cmd)
> +
> if cls.extra_files_task:
> for task in cls.extra_files_task:
> src_path, dst_path = task
>
> Regarding your patch 5/6, the plugin should indeed be able to create extra
> directories without requiring extra files. For example to prepare a data
> partition with only directories.
> However, since extra partition plugin was not designed to create empty
> partitions (omitting --source achieve this), I think the plugin should
> raise an error if no files or directories are defined.
>
Again, I don't understand why having the option for directories or files is
a problem. It's an extra partition.
Is it just because there is a different way to have an empty partition as
well?
> Pierre-Loup,
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#229278):
> https://lists.openembedded.org/g/openembedded-core/message/229278
> Mute This Topic: https://lists.openembedded.org/mt/117243677/10152556
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> adam.duskett@amarulasolutions.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
[-- Attachment #2: Type: text/html, Size: 10545 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread