I have managed to build the meta-tegra-demo distro for the target jetson-orin-nano-devkit-nvme, including the meta-swupdate layer. But, I had to make some changes regarding yocto 5.1 handling of some errors in meta-swupdate
This introduced some changes in classes-recipe/swupdate-common.bbclass where it was assumed that workdir=S.
2) It seems that device tree's is now saved in a subdirectory in the unpacked source folder but the function swupdate_add_artifacts in classes-recipe/swupdate-common.bbclass assumes that the file dir is "flat".
I can optimize the commit but it could be that some work is in progress. At least this commit can be used as a base.
From 240c4e020961a9836f168a20b1e5b55c79ba8f6c Mon Sep 17 00:00:00 2001
From: Anders Gnistrup <
a...@trackman.com>
Date: Wed, 5 Jun 2024 08:13:22 +0200
Subject: [PATCH] Fix for yocto 5.1
Using S = ${WORKDIR} is no longer supported
This introduced some changes in classes-recipe/swupdate-common.bbclass
where it was assumed that workdir=S
It seems that device tree's is now saved in a subdirectory in the
unpacked source folder but the function swupdate_add_artifacts in
classes-recipe/swupdate-common.bbclass assumes that the file dir is flat
---
classes-recipe/swupdate-common.bbclass | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/classes-recipe/swupdate-common.bbclass b/classes-recipe/swupdate-common.bbclass
index ad3c0a02393688d9bdeeba19c2912a1419775db0..62e8a06edd32a8fd2d0a2b14a9115922b4190e14 100644
--- a/classes-recipe/swupdate-common.bbclass
+++ b/classes-recipe/swupdate-common.bbclass
@@ -169,7 +169,7 @@ def prepare_sw_description(d):
import shutil
import subprocess
- s = d.getVar('S', True)
+ s = d.getVar('UNPACKDIR', True)
swupdate_expand_bitbake_variables(d, s)
swupdate_write_sha256(s)
@@ -228,7 +228,7 @@ def prepare_sw_description(d):
def swupdate_add_src_uri(d, list_for_cpio):
import shutil
- s = d.getVar('S', True)
+ s = d.getVar('UNPACKDIR', True)
exclude = (d.getVar("SWUPDATE_SRC_URI_EXCLUDE") or "").split()
fetch = bb.fetch2.Fetch([], d)
@@ -276,11 +276,13 @@ def swupdate_add_artifacts(d, list_for_cpio):
# Search for images listed in SWUPDATE_IMAGES in the DEPLOY directory.
images = (d.getVar('SWUPDATE_IMAGES', True) or "").split()
deploydir = d.getVar('DEPLOY_DIR_IMAGE', True)
+
imgdeploydir = d.getVar('SWUDEPLOYDIR', True)
- s = d.getVar('S', True)
+ s = d.getVar('UNPACKDIR', True)
for image in images:
fstypes = (d.getVarFlag("SWUPDATE_IMAGES_FSTYPES", image, True) or "").split()
encrypted = (d.getVarFlag("SWUPDATE_IMAGES_ENCRYPTED", image, True) or "")
+ #bb.warn("Looking in image=%s fstypes=%s encrypted=%s" % (image, fstypes, encrypted))
if fstypes:
noappend_machine = d.getVarFlag("SWUPDATE_IMAGES_NOAPPEND_MACHINE", image, True)
if noappend_machine == "0": # Search for a file explicitly with MACHINE
@@ -291,19 +293,24 @@ def swupdate_add_artifacts(d, list_for_cpio):
imagebases = [ image + '-' + d.getVar('MACHINE', True), image ]
for fstype in fstypes:
image_found = False
+ bb.warn("Looking in fstype=%s" % (fstype))
for imagebase in imagebases:
+ bb.warn("Looking in imagebase + fstype = %s + %s" % (imagebase, fstype))
image_found = add_image_to_swu(d, deploydir, imagebase + fstype, s, encrypted, list_for_cpio)
if image_found:
break
if not image_found:
- bb.fatal("swupdate cannot find image file: %s" % os.path.join(deploydir, imagebase + fstype))
+ bb.fatal("swupdate cannot find dsfzxf image file: %s" % os.path.join(deploydir, imagebase + fstype))
else: # Allow also complete entries like "image.ext4.gz" in SWUPDATE_IMAGES
+ bb.warn("add_image_to_swu deploydir=%s image=%s" % (deploydir, image))
if not add_image_to_swu(d, deploydir, image, s, encrypted, list_for_cpio):
- bb.fatal("swupdate cannot find %s image file" % image)
+ devicetreedir = os.path.join(deploydir ,"devicetree")
+ if not add_image_to_swu(d, devicetreedir, image, s, encrypted, list_for_cpio):
+ bb.fatal("swupdate cannot find %s image file" % image)
def swupdate_create_cpio(d, swudeploydir, list_for_cpio):
- s = d.getVar('S', True)
+ s = d.getVar('UNPACKDIR', True)
os.chdir(s)
updateimage = d.getVar('IMAGE_NAME', True) + '.swu'
line = 'for i in ' + ' '.join(list_for_cpio) + '; do echo $i;done | cpio -ov -H crc --reproducible > ' + os.path.join(swudeploydir, updateimage)
@@ -320,13 +327,13 @@ python do_swuimage () {
list_for_cpio = ["sw-description"]
workdir = d.getVar('WORKDIR', True)
- s = d.getVar('S', True)
+ unpackdir = d.getVar('UNPACKDIR', True)
imgdeploydir = d.getVar('SWUDEPLOYDIR', True)
- shutil.copyfile(os.path.join(workdir, "sw-description"), os.path.join(s, "sw-description"))
-
+ shutil.copyfile(os.path.join(unpackdir, "sw-description"), os.path.join(workdir, "sw-description"))
if d.getVar('SWUPDATE_SIGNING', True):
list_for_cpio.append('sw-description.sig')
+ bb.warn("workdir=%s" % (workdir))
# Add artifacts added via SRC_URI
if not d.getVar('INHIBIT_SWUPDATE_ADD_SRC_URI', True):
swupdate_add_src_uri(d, list_for_cpio)
--
2.40.1