diff mbox series

image_types_wic: Introduce wicenv image type

Message ID 20260421-wicenv-v1-1-75450eff8364@pbarker.dev
State Accepted, archived
Commit e4d49702f21fb75444d58f419432649a04e351c9
Headers show
Series image_types_wic: Introduce wicenv image type | expand

Commit Message

Paul Barker April 21, 2026, 8:10 p.m. UTC
Now that wic is an external tool, using it outside of the normal Yocto
build workflow will become more common. So, we need a way for users to
specify that they want the .env file used by wic to be placed into
${DEPLOY_DIR_IMAGE}.

With this change, if you intend to use wic externally, you should
specify:

    IMAGE_FSTYPES += "wicenv"

As we now have a separate IMAGE_CMD for this, we no longer need to
deploy the .env file in do_rootfs_wicenv.

Signed-off-by: Paul Barker <paul@pbarker.dev>
Cc: Trevor Woerner <twoerner@gmail.com>
---
 meta/classes-recipe/image_types_wic.bbclass | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)


---
base-commit: 9a83f0878b6bacbc7b322cfec076b4e79ad7b8fb
change-id: 20260421-wicenv-5790c9066508

Best regards,
--  
Paul Barker
diff mbox series

Patch

diff --git a/meta/classes-recipe/image_types_wic.bbclass b/meta/classes-recipe/image_types_wic.bbclass
index aa0680561b9a..ea8c1c94ca2f 100644
--- a/meta/classes-recipe/image_types_wic.bbclass
+++ b/meta/classes-recipe/image_types_wic.bbclass
@@ -224,11 +224,13 @@  python do_rootfs_wicenv () {
             if value:
                 envf.write('%s="%s"\n' % (var, value.strip()))
     envf.close()
-    # Copy .env file to deploy directory for later use with stand alone wic
-    depdir = d.getVar('IMGDEPLOYDIR')
-    bb.utils.copyfile(os.path.join(outdir, basename) + '.env', os.path.join(depdir, basename) + '.env')
 }
 addtask do_flush_pseudodb after do_rootfs before do_image do_image_qa
-addtask do_rootfs_wicenv after do_image before do_image_wic
+addtask do_rootfs_wicenv after do_image before do_image_wic do_image_wicenv
 do_rootfs_wicenv[vardeps] += "${WICVARS}"
 do_rootfs_wicenv[prefuncs] = 'set_image_size'
+
+IMAGE_CMD:wicenv () {
+	cp "${STAGING_DIR}/${MACHINE}/imgdata/${IMAGE_BASENAME}.env" \
+	   "${IMGDEPLOYDIR}/${IMAGE_BASENAME}.env"
+}