diff mbox series

Re: [meta-swupdate] Building mete-tegra-demo distro.

Message ID CAAs-_kbDVGAcS1f26ihSvQ-YPkLBE8f7zJzTyJhWe_qEsRU=0A@mail.gmail.com
State New
Headers show
Series Re: [meta-swupdate] Building mete-tegra-demo distro. | expand

Commit Message

Anders Gnistrup June 6, 2024, 6:34 a.m. UTC
Minor update and a cleanup.
But there are still some issues.

When I try to install an image it is installed, but the installer emits an
error:
[INFO ] : SWUPDATE running :  [lua_handlers_init] : External Lua handler(s)
not found.
[INFO ] : SWUPDATE running :  Installation in progress
[INFO ] : SWUPDATE running :  [lua_handlers_init] : External Lua handler(s)
not found.
[INFO ] : SWUPDATE running :  [lua_handlers_init] : External Lua handler(s)
not found.

I have to manually set the active boot partition using nvbootctrl
set-active-boot-sloot
After  a reboot the correct boot slot is booting. But the lua backend
should take care of it.
Anyone have a hint for this?

From effee362ce2c196b91d7fe5a905ec26e52727b8e Mon Sep 17 00:00:00 2001
From: Anders Gnistrup <agn@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          | 17 +++++++++--------
 classes-recipe/swupdate-image.bbclass           |  3 ++-
 classes-recipe/swupdate.bbclass                 |  3 ++-
 .../swupdate-lualoader_1.0.bb                   |  4 ++--
 4 files changed, 15 insertions(+), 12 deletions(-)

 SRC_URI = "file://swupdate_handlers.lua"

@@ -10,7 +10,7 @@ inherit pkgconfig

 do_install() {
     LUAVER=$(pkg-config --modversion lua | grep -o '^[0-9]\+\.[0-9]\+')
-    install -D -m 0644 ${WORKDIR}/swupdate_handlers.lua
${D}${libdir}/lua/$LUAVER/swupdate_handlers.lua
+    install -D -m 0644 ${UNPACKDIR}/swupdate_handlers.lua
${D}${libdir}/lua/$LUAVER/swupdate_handlers.lua
     sed -e 's,@libdir@,${libdir},g' \
         -i ${D}${libdir}/lua/$LUAVER/swupdate_handlers.lua

--
2.40.1

On Wed, Jun 5, 2024 at 8:35 AM Anders Gnistrup <a.gnistrup@gmail.com> wrote:

> Hello
>
> 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
> 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.
> 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 <agn@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
>
diff mbox series

Patch

diff --git a/classes-recipe/swupdate-common.bbclass
b/classes-recipe/swupdate-common.bbclass
index
ad3c0a02393688d9bdeeba19c2912a1419775db0..366aec8a3c3d2d12988ed127b4b432b3d221ac8a
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)
@@ -277,7 +277,7 @@  def swupdate_add_artifacts(d, list_for_cpio):
     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 "")
@@ -299,11 +299,13 @@  def swupdate_add_artifacts(d, list_for_cpio):
                     bb.fatal("swupdate cannot find image file: %s" %
os.path.join(deploydir, imagebase + fstype))
         else:  # Allow also complete entries like "image.ext4.gz" in
SWUPDATE_IMAGES
             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,10 +322,9 @@  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')

diff --git a/classes-recipe/swupdate-image.bbclass
b/classes-recipe/swupdate-image.bbclass
index
e9c67a6ff1a54bf1d9c0c33729a51484978566f3..22df58070aadc0b025377e8f8f8ea99946b86eab
100644
--- a/classes-recipe/swupdate-image.bbclass
+++ b/classes-recipe/swupdate-image.bbclass
@@ -13,7 +13,8 @@ 
 inherit swupdate-common
 inherit image-artifact-names

-S = "${WORKDIR}/${PN}"
+S = "${WORKDIR}/sources"
+UNPACKDIR = "${S}"

 SRC_URI += "file://sw-description"
 SWUPDATE_IMAGES += "${IMAGE_LINK_NAME}"
diff --git a/classes-recipe/swupdate.bbclass
b/classes-recipe/swupdate.bbclass
index
3656b1cb9d8bd55a9561feeffb9f19711846a4e4..ae000854f7728b429f1403b014c83330f51e8e3e
100644
--- a/classes-recipe/swupdate.bbclass
+++ b/classes-recipe/swupdate.bbclass
@@ -36,7 +36,8 @@ 
 inherit swupdate-common
 inherit image-artifact-names

-S = "${WORKDIR}/${PN}"
+S = "${WORKDIR}/sources"
+UNPACKDIR = "${S}"

 IMAGE_DEPENDS ?= ""

diff --git a/recipes-lua/swupdate-lualoader/swupdate-lualoader_1.0.bb
b/recipes-lua/swupdate-lualoader/swupdate-lualoader_1.0.bb
index
044cad2171387ffd25536ef88c83c13dac339644..5da4c6424530aca1077bf01d7d8fda6b52e58011
100644
--- a/recipes-lua/swupdate-lualoader/swupdate-lualoader_1.0.bb
+++ b/recipes-lua/swupdate-lualoader/swupdate-lualoader_1.0.bb
@@ -2,7 +2,7 @@  SUMMARY = "Loader for swupdate"
 LICENSE = "MIT"
 SECTION = "devel/lua"
 DEPENDS = "lua"
-LIC_FILES_CHKSUM =
"file://${WORKDIR}/swupdate_handlers.lua;md5=354cf4af377edd962d2e8d78085d3ed7;beginline=1;endline=19"
+LIC_FILES_CHKSUM =
"file://${UNPACKDIR}/swupdate_handlers.lua;md5=354cf4af377edd962d2e8d78085d3ed7;beginline=1;endline=19"