@@ -57,6 +57,48 @@ which is included in the SWU file.
Encrypted private keys are not currently supported since a secure
mechanism must exist to provide the passphrase.
+SWU image contents
+----------
+By default the SWU image will include all files fetched by the Yocto
+fetcher as specified in recipe SRC_URI variable. If this behaviour is not
+suitable, an explicit list of file inclusions can be specified by
+setting `SWUPDATE_LIST_FOR_CPIO` to a list of source file paths to be
+included in the SWU image.
+
+This may be useful in cases where additional build steps are
+introduced prior to the swuimage task to pre-process fetched source files
+or files are generated as part of the recipe for inclusion in the SWU
+image.
+
+e.g.
+
+Let's assume an additional pre-processing step is required to
+inject some content to sw-description before its inclusion in the SWU.
+
+A Yocto recipe may include a configuration like the following:
+
+...
+
+SRC_URI := "\
+ file://sw-description.conf" \
+ file://my-version-file \
+"
+
+inherit swupdate
+
+python do_swuimage_prepend () {
+ # Preprocess sw-description.conf, injecting version information
+ # from my-version-file to produce sw-description.
+ # Generate another file 'foo' for inclusion in SWU.
+}
+
+# Explicit list of additional files to include in SWU archive.
+# Prevent sw-description.conf and my-version-file from being included
+# in the archive by using an explicit list of file inclusions.
+# sw-description is included by default.
+SWUPDATE_LIST_FOR_CPIO = "${WORKDIR}/foo"
+
+
Maintainer
----------
@@ -74,8 +74,16 @@ python do_swuimage () {
if d.getVar('SWUPDATE_SIGNING', True):
list_for_cpio.append('sw-description.sig')
- for url in fetch.urls:
- local = fetch.localpath(url)
+ # Default to obtaining list of additional cpio members from fetch sources.
+ # The SWUPDATE_LIST_FOR_CPIO can be used to override the default list
+ # to specify a custom set of cpio members.
+ swupdate_list_for_cpio = d.getVar('SWUPDATE_LIST_FOR_CPIO', True)
+ if swupdate_list_for_cpio is None:
+ swupdate_list_for_cpio = [fetch.localpath(url) for url in fetch.urls]
+ else:
+ swupdate_list_for_cpio = swupdate_list_for_cpio.split()
+
+ for local in swupdate_list_for_cpio:
filename = os.path.basename(local)
if (filename != 'sw-description'):
shutil.copyfile(local, os.path.join(s, "%s" % filename ))
By default, swupdate.bbclass includes all files fetched by the Yocto recipe in the SWU cpio archive. This change adds a new variable SWUPDATE_LIST_FOR_CPIO which, when specified, allows for explicit control of which additional files are added to the SWU image This is useful when the default fetch file list isn't suitable for inclusion in the SWU image. Signed-off-by: Austin Phillips <austin.phillips@planetinnovation.com.au> --- README | 42 ++++++++++++++++++++++++++++++++++++++++++ classes/swupdate.bbclass | 12 ++++++++++-- 2 files changed, 52 insertions(+), 2 deletions(-)