All of lore.kernel.org
 help / color / mirror / Atom feed
* [OE-Core][PATCH 1/2] wic: bootimg-partition: simplify BOOT_IMAGE_FILES logic
@ 2022-01-30 14:25 Vivien Didelot
  2022-01-30 14:25 ` [OE-Core][PATCH 2/2] wic: bootimg-partition: allow empty partition Vivien Didelot
  0 siblings, 1 reply; 2+ messages in thread
From: Vivien Didelot @ 2022-01-30 14:25 UTC (permalink / raw)
  To: Openembedded-core; +Cc: Vivien Didelot

bootimg-partition fills a partition for the files specified with the
IMAGE_BOOT_FILES variable, optionally suffixed with _label-<label>
or _uuid-<uuid>. Simplify the variables lookup to make this logic
clearer to read.

Signed-off-by: Vivien Didelot <vdidelot@pbsc.com>
---
 scripts/lib/wic/plugins/source/bootimg-partition.py | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/scripts/lib/wic/plugins/source/bootimg-partition.py b/scripts/lib/wic/plugins/source/bootimg-partition.py
index 5dbe2558d2..f22364766a 100644
--- a/scripts/lib/wic/plugins/source/bootimg-partition.py
+++ b/scripts/lib/wic/plugins/source/bootimg-partition.py
@@ -48,13 +48,9 @@ class BootimgPartitionPlugin(SourcePlugin):
                 raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
 
         boot_files = None
-        for (fmt, id) in (("_uuid-%s", part.uuid), ("_label-%s", part.label), (None, None)):
-            if fmt:
-                var = fmt % id
-            else:
-                var = ""
-
-            boot_files = get_bitbake_var("IMAGE_BOOT_FILES" + var)
+        vars = ("IMAGE_BOOT_FILES_uuid-%s" % part.uuid, "IMAGE_BOOT_FILES_label-%s" % part.label, "IMAGE_BOOT_FILES")
+        for var in vars:
+            boot_files = get_bitbake_var(var)
             if boot_files is not None:
                 break
 
-- 
2.35.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [OE-Core][PATCH 2/2] wic: bootimg-partition: allow empty partition
  2022-01-30 14:25 [OE-Core][PATCH 1/2] wic: bootimg-partition: simplify BOOT_IMAGE_FILES logic Vivien Didelot
@ 2022-01-30 14:25 ` Vivien Didelot
  0 siblings, 0 replies; 2+ messages in thread
From: Vivien Didelot @ 2022-01-30 14:25 UTC (permalink / raw)
  To: Openembedded-core; +Cc: Vivien Didelot

It is possible to use the bootimg-partition source plugin to fill an
optional boot partition, e.g. for data files or for kernel artifacts,
in case they aren't embedded in the root filesystem. In these scenarios
such partition may be empty, which is correct.

Instead of erroring out, just warn the user. While at it, make
it clearer how to populate such partition, by mentioning the
IMAGE_BOOT_FILES{,_uuid-<uuid>,_label-<label>} variables, as well as
their presence in WICVARS, which isn't obvious for a new user.

Signed-off-by: Vivien Didelot <vdidelot@pbsc.com>
---
 scripts/lib/wic/plugins/source/bootimg-partition.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/lib/wic/plugins/source/bootimg-partition.py b/scripts/lib/wic/plugins/source/bootimg-partition.py
index f22364766a..d7d9842b8c 100644
--- a/scripts/lib/wic/plugins/source/bootimg-partition.py
+++ b/scripts/lib/wic/plugins/source/bootimg-partition.py
@@ -55,7 +55,8 @@ class BootimgPartitionPlugin(SourcePlugin):
                 break
 
         if boot_files is None:
-            raise WicError('No boot files defined, IMAGE_BOOT_FILES unset for entry #%d' % part.lineno)
+            logger.warn('No boot files defined for entry #%d, %s unset or not in WICVARS.' % (part.lineno, ', '.join(vars)))
+            return
 
         logger.debug('Boot files: %s', boot_files)
 
-- 
2.35.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-30 19:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-30 14:25 [OE-Core][PATCH 1/2] wic: bootimg-partition: simplify BOOT_IMAGE_FILES logic Vivien Didelot
2022-01-30 14:25 ` [OE-Core][PATCH 2/2] wic: bootimg-partition: allow empty partition Vivien Didelot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.