Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Jason Wessel <jason.wessel@windriver.com>
To: <openembedded-core@lists.openembedded.org>
Subject: [PATCH 1/4] image_types_wic.bbclass: Copy the .wks and .env files to deploy image dir
Date: Thu, 8 Aug 2019 05:55:06 -0700	[thread overview]
Message-ID: <20190808125509.120784-1-jason.wessel@windriver.com> (raw)

When using a .wks.in file, the only place that the generated .wks file
exists in the tmp/work area.  A copy should be left behind in the
deploy directory so that you can easily run the wic tool to
re-generate or modify a new image without running bitbake.  Custom
.wks.in files can reference any number of bitbake variables, so it is
important to save the result.

below is an example of using the generated .wks file in the deploy
area.  The full name of my generated .wks file was
core-image-minimal-ostree-uboot-ab.wks, but since you usually only
have a single .wks file per image you can use a wild card like:

  cd tmp*/deploy/images/*
  wic create --vars . -e core-image-minimal -s -m core-image-minimal-*.wks

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
---
 meta/classes/image_types_wic.bbclass | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/meta/classes/image_types_wic.bbclass b/meta/classes/image_types_wic.bbclass
index 519aeb1b04..ce94138b3c 100644
--- a/meta/classes/image_types_wic.bbclass
+++ b/meta/classes/image_types_wic.bbclass
@@ -77,6 +77,11 @@ python do_write_wks_template () {
     wks_file = d.getVar('WKS_FULL_PATH')
     with open(wks_file, 'w') as f:
         f.write(template_body)
+    f.close()
+    # Copy the finalized wks file to the deploy directory for later use
+    depdir = d.getVar('DEPLOY_DIR_IMAGE')
+    basename = d.getVar('IMAGE_BASENAME')
+    bb.utils.copyfile(wks_file, "%s/%s" % (depdir, basename + '-' + os.path.basename(wks_file)))
 }
 
 python () {
@@ -127,6 +132,10 @@ python do_rootfs_wicenv () {
             value = d.getVar(var)
             if value:
                 envf.write('%s="%s"\n' % (var, value.strip()))
+    envf.close()
+    # Copy to deploy directory for later use with stand alone wic
+    depdir = d.getVar('DEPLOY_DIR_IMAGE')
+    bb.utils.copyfile(os.path.join(outdir, basename) + '.env', os.path.join(depdir, basename) + '.env')
 }
 addtask do_rootfs_wicenv after do_image before do_image_wic
 do_rootfs_wicenv[vardeps] += "${WICVARS}"
-- 
2.21.0



             reply	other threads:[~2019-08-08 12:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-08 12:55 Jason Wessel [this message]
2019-08-08 12:55 ` [PATCH 2/4] wic: Add partition type for msdos partition tables Jason Wessel
2019-08-08 12:55 ` [PATCH 3/4] wic: Make disk partition size consistently computed Jason Wessel
2019-08-08 12:55 ` [PATCH 4/4] dpkg: Provide update-alternative for start-stop-daemon Jason Wessel
2019-08-08 16:45 ` [PATCH 1/4] image_types_wic.bbclass: Copy the .wks and .env files to deploy image dir Jason Wessel
2019-08-08 18:42 ` Richard Purdie
2019-08-08 20:09   ` Jason Wessel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190808125509.120784-1-jason.wessel@windriver.com \
    --to=jason.wessel@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox