Message ID | 20180507121251.13088-2-raphael.freudiger@siemens.com |
---|---|
State | Changes Requested |
Headers | show |
Series | [meta-swupdate,1/3] swupdate_class: split out a base class | expand |
On 07/05/2018 14:12, Raphael Freudiger wrote: > If swupdate is used in an image it will add all files that are fetched to the swupdate file. > Let bitbake do the fetching and only add to the image what is explicitly listed. Which is the use case ? If I do not want files in the SWU, while should I add them to SRC_URI ? I get usually the same goal by tuning SRC_URI. > > Signed-off-by: Raphael Freudiger <raphael.freudiger@siemens.com> > --- > classes/swupdate-base.bbclass | 13 ++++--------- > 1 file changed, 4 insertions(+), 9 deletions(-) > > diff --git a/classes/swupdate-base.bbclass b/classes/swupdate-base.bbclass > index d46375d..29cfe5f 100644 > --- a/classes/swupdate-base.bbclass > +++ b/classes/swupdate-base.bbclass > @@ -67,24 +67,17 @@ python do_swuimage () { > > workdir = d.getVar('WORKDIR', True) > images = (d.getVar('SWUPDATE_IMAGES', True) or "").split() > + extra_images = (d.getVar('SWUPDATE_EXTRA_IMAGES', True) or "").split() Any additional variable must be documented, see doc/source/building-with-yocto.rst. > s = d.getVar('S', True) > shutil.copyfile(os.path.join(workdir, "sw-description"), os.path.join(s, "sw-description")) > - fetch = bb.fetch2.Fetch([], d) > list_for_cpio = ["sw-description"] > > if d.getVar('SWUPDATE_SIGNING', True): > list_for_cpio.append('sw-description.sig') > > - for url in fetch.urls: > - local = fetch.localpath(url) > - filename = os.path.basename(local) > - if (filename != 'sw-description'): > - shutil.copyfile(local, os.path.join(s, "%s" % filename )) > - list_for_cpio.append(filename) > - > # SWUPDATE_IMAGES refers to images in the DEPLOY directory > # If they are not there, additional file can be added > -# by fetching from URLs > +# by fetching from URLs and adding them to SWUPDATE_EXTRA_IMAGES > deploydir = d.getVar('DEPLOY_DIR_IMAGE', True) > imgdeploydir = d.getVar('IMGDEPLOYDIR', True) > swupdate_dir = d.getVar('SWUPDATE_DIR', True) > @@ -112,6 +105,8 @@ python do_swuimage () { > shutil.copyfile(src, dst) > list_for_cpio.append(imagename) > > + list_for_cpio += extra_images > + > for file in list_for_cpio: > if file != 'sw-description' and swupdate_is_hash_needed(s, file): > hash = swupdate_get_sha256(s, file) > Best regards, Stefano Babic
Hi Stefano If you have a separate recipe to build the SWU, I agree. I will check that it works the same there. Basically by setting the new SWUPATE_EXTRA_IMAGES to SRC_URI. In an image not all files that are in the SRC_URI should actually go into the SWU. Some files may be used to generate other fstypes (i.e. wic) or other things needed for the build. I.e. I use a template file to generate the sw-description. But I don't want the template file in the SWU. Regards Raphael > -----Ursprüngliche Nachricht----- > Von: Stefano Babic [mailto:sbabic@denx.de] > Gesendet: Mittwoch, 16. Mai 2018 12:35 > An: Freudiger, Raphael (BT CPS R&D ZG FW CCP); > swupdate@googlegroups.com > Betreff: Re: [swupdate] [meta-swupdate][PATCH 2/3] swupdate_class: do not add > all files that are fetched > > On 07/05/2018 14:12, Raphael Freudiger wrote: > > If swupdate is used in an image it will add all files that are fetched to the > swupdate file. > > Let bitbake do the fetching and only add to the image what is explicitly listed. > > Which is the use case ? If I do not want files in the SWU, while should I add them > to SRC_URI ? I get usually the same goal by tuning SRC_URI. > > > > > Signed-off-by: Raphael Freudiger <raphael.freudiger@siemens.com> > > --- > > classes/swupdate-base.bbclass | 13 ++++--------- > > 1 file changed, 4 insertions(+), 9 deletions(-) > > > > diff --git a/classes/swupdate-base.bbclass > > b/classes/swupdate-base.bbclass index d46375d..29cfe5f 100644 > > --- a/classes/swupdate-base.bbclass > > +++ b/classes/swupdate-base.bbclass > > @@ -67,24 +67,17 @@ python do_swuimage () { > > > > workdir = d.getVar('WORKDIR', True) > > images = (d.getVar('SWUPDATE_IMAGES', True) or "").split() > > + extra_images = (d.getVar('SWUPDATE_EXTRA_IMAGES', True) or > > + "").split() > > Any additional variable must be documented, see doc/source/building-with- > yocto.rst. > > > s = d.getVar('S', True) > > shutil.copyfile(os.path.join(workdir, "sw-description"), os.path.join(s, "sw- > description")) > > - fetch = bb.fetch2.Fetch([], d) > > list_for_cpio = ["sw-description"] > > > > if d.getVar('SWUPDATE_SIGNING', True): > > list_for_cpio.append('sw-description.sig') > > > > - for url in fetch.urls: > > - local = fetch.localpath(url) > > - filename = os.path.basename(local) > > - if (filename != 'sw-description'): > > - shutil.copyfile(local, os.path.join(s, "%s" % filename )) > > - list_for_cpio.append(filename) > > - > > # SWUPDATE_IMAGES refers to images in the DEPLOY directory # If they > > are not there, additional file can be added -# by fetching from URLs > > +# by fetching from URLs and adding them to SWUPDATE_EXTRA_IMAGES > > deploydir = d.getVar('DEPLOY_DIR_IMAGE', True) > > imgdeploydir = d.getVar('IMGDEPLOYDIR', True) > > swupdate_dir = d.getVar('SWUPDATE_DIR', True) @@ -112,6 +105,8 @@ > > python do_swuimage () { > > shutil.copyfile(src, dst) > > list_for_cpio.append(imagename) > > > > + list_for_cpio += extra_images > > + > > for file in list_for_cpio: > > if file != 'sw-description' and swupdate_is_hash_needed(s, file): > > hash = swupdate_get_sha256(s, file) > > > > Best regards, > Stefano Babic > > -- > ============================================================= > ======== > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany > Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de > ============================================================= > ========
Hi Raphael, On 16/05/2018 13:20, Freudiger, Raphael wrote: > Hi Stefano > > If you have a separate recipe to build the SWU, I agree. I will check that it works the same there. Basically by setting the new SWUPATE_EXTRA_IMAGES to SRC_URI. ok, thanks. > > In an image not all files that are in the SRC_URI should actually go into the SWU. > Some files may be used to generate other fstypes (i.e. wic) or other things needed for the build. > I.e. I use a template file to generate the sw-description. But I don't want the template file in the SWU. ok, got it. Is it your template general enough to flow into the project ? Best regards, Stefano > > Regards > Raphael > >> -----Ursprüngliche Nachricht----- >> Von: Stefano Babic [mailto:sbabic@denx.de] >> Gesendet: Mittwoch, 16. Mai 2018 12:35 >> An: Freudiger, Raphael (BT CPS R&D ZG FW CCP); >> swupdate@googlegroups.com >> Betreff: Re: [swupdate] [meta-swupdate][PATCH 2/3] swupdate_class: do not add >> all files that are fetched >> >> On 07/05/2018 14:12, Raphael Freudiger wrote: >>> If swupdate is used in an image it will add all files that are fetched to the >> swupdate file. >>> Let bitbake do the fetching and only add to the image what is explicitly listed. >> >> Which is the use case ? If I do not want files in the SWU, while should I add them >> to SRC_URI ? I get usually the same goal by tuning SRC_URI. >> >>> >>> Signed-off-by: Raphael Freudiger <raphael.freudiger@siemens.com> >>> --- >>> classes/swupdate-base.bbclass | 13 ++++--------- >>> 1 file changed, 4 insertions(+), 9 deletions(-) >>> >>> diff --git a/classes/swupdate-base.bbclass >>> b/classes/swupdate-base.bbclass index d46375d..29cfe5f 100644 >>> --- a/classes/swupdate-base.bbclass >>> +++ b/classes/swupdate-base.bbclass >>> @@ -67,24 +67,17 @@ python do_swuimage () { >>> >>> workdir = d.getVar('WORKDIR', True) >>> images = (d.getVar('SWUPDATE_IMAGES', True) or "").split() >>> + extra_images = (d.getVar('SWUPDATE_EXTRA_IMAGES', True) or >>> + "").split() >> >> Any additional variable must be documented, see doc/source/building-with- >> yocto.rst. >> >>> s = d.getVar('S', True) >>> shutil.copyfile(os.path.join(workdir, "sw-description"), os.path.join(s, "sw- >> description")) >>> - fetch = bb.fetch2.Fetch([], d) >>> list_for_cpio = ["sw-description"] >>> >>> if d.getVar('SWUPDATE_SIGNING', True): >>> list_for_cpio.append('sw-description.sig') >>> >>> - for url in fetch.urls: >>> - local = fetch.localpath(url) >>> - filename = os.path.basename(local) >>> - if (filename != 'sw-description'): >>> - shutil.copyfile(local, os.path.join(s, "%s" % filename )) >>> - list_for_cpio.append(filename) >>> - >>> # SWUPDATE_IMAGES refers to images in the DEPLOY directory # If they >>> are not there, additional file can be added -# by fetching from URLs >>> +# by fetching from URLs and adding them to SWUPDATE_EXTRA_IMAGES >>> deploydir = d.getVar('DEPLOY_DIR_IMAGE', True) >>> imgdeploydir = d.getVar('IMGDEPLOYDIR', True) >>> swupdate_dir = d.getVar('SWUPDATE_DIR', True) @@ -112,6 +105,8 @@ >>> python do_swuimage () { >>> shutil.copyfile(src, dst) >>> list_for_cpio.append(imagename) >>> >>> + list_for_cpio += extra_images >>> + >>> for file in list_for_cpio: >>> if file != 'sw-description' and swupdate_is_hash_needed(s, file): >>> hash = swupdate_get_sha256(s, file) >>> >> >> Best regards, >> Stefano Babic >> >> -- >> ============================================================= >> ======== >> DENX Software Engineering GmbH, Managing Director: Wolfgang Denk >> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany >> Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de >> ============================================================= >> ======== >
diff --git a/classes/swupdate-base.bbclass b/classes/swupdate-base.bbclass index d46375d..29cfe5f 100644 --- a/classes/swupdate-base.bbclass +++ b/classes/swupdate-base.bbclass @@ -67,24 +67,17 @@ python do_swuimage () { workdir = d.getVar('WORKDIR', True) images = (d.getVar('SWUPDATE_IMAGES', True) or "").split() + extra_images = (d.getVar('SWUPDATE_EXTRA_IMAGES', True) or "").split() s = d.getVar('S', True) shutil.copyfile(os.path.join(workdir, "sw-description"), os.path.join(s, "sw-description")) - fetch = bb.fetch2.Fetch([], d) list_for_cpio = ["sw-description"] if d.getVar('SWUPDATE_SIGNING', True): list_for_cpio.append('sw-description.sig') - for url in fetch.urls: - local = fetch.localpath(url) - filename = os.path.basename(local) - if (filename != 'sw-description'): - shutil.copyfile(local, os.path.join(s, "%s" % filename )) - list_for_cpio.append(filename) - # SWUPDATE_IMAGES refers to images in the DEPLOY directory # If they are not there, additional file can be added -# by fetching from URLs +# by fetching from URLs and adding them to SWUPDATE_EXTRA_IMAGES deploydir = d.getVar('DEPLOY_DIR_IMAGE', True) imgdeploydir = d.getVar('IMGDEPLOYDIR', True) swupdate_dir = d.getVar('SWUPDATE_DIR', True) @@ -112,6 +105,8 @@ python do_swuimage () { shutil.copyfile(src, dst) list_for_cpio.append(imagename) + list_for_cpio += extra_images + for file in list_for_cpio: if file != 'sw-description' and swupdate_is_hash_needed(s, file): hash = swupdate_get_sha256(s, file)
If swupdate is used in an image it will add all files that are fetched to the swupdate file. Let bitbake do the fetching and only add to the image what is explicitly listed. Signed-off-by: Raphael Freudiger <raphael.freudiger@siemens.com> --- classes/swupdate-base.bbclass | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)