[2/2] wic: bootimg-partition: allow empty partition

Message ID 20220130142527.2960188-2-vdidelot@pbsc.com
State New
Headers show
Series [1/2] wic: bootimg-partition: simplify BOOT_IMAGE_FILES logic | expand

Commit Message

Vivien Didelot Jan. 30, 2022, 2:25 p.m. UTC
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(-)

Patch

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)