* [PATCH] image.bbclass: copy dtbs into a deploydir/subdirectory based on the image name @ 2024-03-28 7:54 nicusor.huhulea 2024-03-28 16:28 ` Gylstorff Quirin 2024-03-28 17:53 ` Gylstorff Quirin 0 siblings, 2 replies; 9+ messages in thread From: nicusor.huhulea @ 2024-03-28 7:54 UTC (permalink / raw) To: isar-users This fixes the build failures detailed in the https://groups.google.com/g/isar-users/c/Va0Ue-ISYeA and https://groups.google.com/g/isar-users/c/PSGU_AcdPZ8 This adds the MACHINE variable to WICVARS, hence the need to reflect this change in cip-core/scripts/lib/wic/plugins/source/efibootguard-boot.py Signed-off-by: Nicusor Huhulea <nicusor.huhulea@siemens.com> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index 73f1d52c..9b98719b 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -377,16 +377,19 @@ do_copy_boot_files() { fi fi - for file in ${DTB_FILES}; do - dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \ - -iwholename '*linux-image-*/'${file} | head -1)" - - if [ -z "$dtb" -o ! -e "$dtb" ]; then - die "${file} not found" - fi + if [ -n "${DTB_FILES}" ]; then + mkdir -p "${DEPLOYDIR}/${IMAGE_FULLNAME}.dtbs" + for file in ${DTB_FILES}; do + dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \ + -iwholename '*linux-image-*/'${file} | head -1)" + + if [ -z "$dtb" -o ! -e "$dtb" ]; then + die "${file} not found" + fi - cp -f "$dtb" "${DEPLOYDIR}/" - done + cp -f "$dtb" "${DEPLOYDIR}/${IMAGE_FULLNAME}.dtbs" + done + fi } addtask copy_boot_files before do_rootfs_postprocess after do_rootfs_install diff --git a/meta/classes/imagetypes_wic.bbclass b/meta/classes/imagetypes_wic.bbclass index bce881ed..f0f1c438 100644 --- a/meta/classes/imagetypes_wic.bbclass +++ b/meta/classes/imagetypes_wic.bbclass @@ -107,7 +107,7 @@ WICVARS += "\ ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS TRANSLATED_TARGET_ARCH" # Isar specific vars used in our plugins -WICVARS += "DISTRO DISTRO_ARCH" +WICVARS += "DISTRO DISTRO_ARCH MACHINE" python do_rootfs_wicenv () { wicvars = d.getVar('WICVARS') ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] image.bbclass: copy dtbs into a deploydir/subdirectory based on the image name 2024-03-28 7:54 [PATCH] image.bbclass: copy dtbs into a deploydir/subdirectory based on the image name nicusor.huhulea @ 2024-03-28 16:28 ` Gylstorff Quirin 2024-03-28 16:31 ` Gylstorff Quirin 2024-03-28 17:53 ` Gylstorff Quirin 1 sibling, 1 reply; 9+ messages in thread From: Gylstorff Quirin @ 2024-03-28 16:28 UTC (permalink / raw) To: isar-users On 3/28/24 8:54 AM, 'nicusor.huhulea@siemens.com' via isar-users wrote: > This fixes the build failures detailed in the https://groups.google.com/g/isar-users/c/Va0Ue-ISYeA and > https://groups.google.com/g/isar-users/c/PSGU_AcdPZ8 > This adds the MACHINE variable to WICVARS, hence the need to reflect this change in > cip-core/scripts/lib/wic/plugins/source/efibootguard-boot.py > > > Signed-off-by: Nicusor Huhulea <nicusor.huhulea@siemens.com> > > diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass > index 73f1d52c..9b98719b 100644 > --- a/meta/classes/image.bbclass > +++ b/meta/classes/image.bbclass > @@ -377,16 +377,19 @@ do_copy_boot_files() { > fi > fi > > - for file in ${DTB_FILES}; do > - dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \ > - -iwholename '*linux-image-*/'${file} | head -1)" > - > - if [ -z "$dtb" -o ! -e "$dtb" ]; then > - die "${file} not found" > - fi > + if [ -n "${DTB_FILES}" ]; then > + mkdir -p "${DEPLOYDIR}/${IMAGE_FULLNAME}.dtbs" > + for file in ${DTB_FILES}; do > + dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \ > + -iwholename '*linux-image-*/'${file} | head -1)" > + > + if [ -z "$dtb" -o ! -e "$dtb" ]; then > + die "${file} not found" > + fi > > - cp -f "$dtb" "${DEPLOYDIR}/" > - done > + cp -f "$dtb" "${DEPLOYDIR}/${IMAGE_FULLNAME}.dtbs" And what is if we have multi dtbs defined this will overwrite them all. Quirin > + done > + fi > } > addtask copy_boot_files before do_rootfs_postprocess after do_rootfs_install > > diff --git a/meta/classes/imagetypes_wic.bbclass b/meta/classes/imagetypes_wic.bbclass > index bce881ed..f0f1c438 100644 > --- a/meta/classes/imagetypes_wic.bbclass > +++ b/meta/classes/imagetypes_wic.bbclass > @@ -107,7 +107,7 @@ WICVARS += "\ > ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS TRANSLATED_TARGET_ARCH" > > # Isar specific vars used in our plugins > -WICVARS += "DISTRO DISTRO_ARCH" > +WICVARS += "DISTRO DISTRO_ARCH MACHINE" > > python do_rootfs_wicenv () { > wicvars = d.getVar('WICVARS') > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] image.bbclass: copy dtbs into a deploydir/subdirectory based on the image name 2024-03-28 16:28 ` Gylstorff Quirin @ 2024-03-28 16:31 ` Gylstorff Quirin 0 siblings, 0 replies; 9+ messages in thread From: Gylstorff Quirin @ 2024-03-28 16:31 UTC (permalink / raw) To: isar-users On 3/28/24 5:28 PM, 'Gylstorff Quirin' via isar-users wrote: > > > On 3/28/24 8:54 AM, 'nicusor.huhulea@siemens.com' via isar-users wrote: >> This fixes the build failures detailed in the >> https://groups.google.com/g/isar-users/c/Va0Ue-ISYeA and >> https://groups.google.com/g/isar-users/c/PSGU_AcdPZ8 >> This adds the MACHINE variable to WICVARS, hence the need to reflect >> this change in >> cip-core/scripts/lib/wic/plugins/source/efibootguard-boot.py >> >> >> Signed-off-by: Nicusor Huhulea <nicusor.huhulea@siemens.com> >> >> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass >> index 73f1d52c..9b98719b 100644 >> --- a/meta/classes/image.bbclass >> +++ b/meta/classes/image.bbclass >> @@ -377,16 +377,19 @@ do_copy_boot_files() { >> fi >> fi >> - for file in ${DTB_FILES}; do >> - dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \ >> - -iwholename '*linux-image-*/'${file} | head -1)" >> - >> - if [ -z "$dtb" -o ! -e "$dtb" ]; then >> - die "${file} not found" >> - fi >> + if [ -n "${DTB_FILES}" ]; then >> + mkdir -p "${DEPLOYDIR}/${IMAGE_FULLNAME}.dtbs" >> + for file in ${DTB_FILES}; do >> + dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \ >> + -iwholename '*linux-image-*/'${file} | head -1)" >> + >> + if [ -z "$dtb" -o ! -e "$dtb" ]; then >> + die "${file} not found" >> + fi >> - cp -f "$dtb" "${DEPLOYDIR}/" >> - done >> + cp -f "$dtb" "${DEPLOYDIR}/${IMAGE_FULLNAME}.dtbs" > And what is if we have multi dtbs defined this will overwrite them all. sorry overlooked the mkdir. quirin > Quirin >> + done > + fi >> } >> addtask copy_boot_files before do_rootfs_postprocess after >> do_rootfs_install >> diff --git a/meta/classes/imagetypes_wic.bbclass >> b/meta/classes/imagetypes_wic.bbclass >> index bce881ed..f0f1c438 100644 >> --- a/meta/classes/imagetypes_wic.bbclass >> +++ b/meta/classes/imagetypes_wic.bbclass >> @@ -107,7 +107,7 @@ WICVARS += "\ >> ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR >> TARGET_SYS TRANSLATED_TARGET_ARCH" >> # Isar specific vars used in our plugins >> -WICVARS += "DISTRO DISTRO_ARCH" >> +WICVARS += "DISTRO DISTRO_ARCH MACHINE" >> python do_rootfs_wicenv () { >> wicvars = d.getVar('WICVARS') >> > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] image.bbclass: copy dtbs into a deploydir/subdirectory based on the image name 2024-03-28 7:54 [PATCH] image.bbclass: copy dtbs into a deploydir/subdirectory based on the image name nicusor.huhulea 2024-03-28 16:28 ` Gylstorff Quirin @ 2024-03-28 17:53 ` Gylstorff Quirin 2024-03-28 19:05 ` nicusor.huhulea 1 sibling, 1 reply; 9+ messages in thread From: Gylstorff Quirin @ 2024-03-28 17:53 UTC (permalink / raw) To: nicusor.huhulea, isar-users On 3/28/24 8:54 AM, 'nicusor.huhulea@siemens.com' via isar-users wrote: > This fixes the build failures detailed in the https://groups.google.com/g/isar-users/c/Va0Ue-ISYeA and > https://groups.google.com/g/isar-users/c/PSGU_AcdPZ8 > This adds the MACHINE variable to WICVARS, hence the need to reflect this change in > cip-core/scripts/lib/wic/plugins/source/efibootguard-boot.py > > > Signed-off-by: Nicusor Huhulea <nicusor.huhulea@siemens.com> > > diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass > index 73f1d52c..9b98719b 100644 > --- a/meta/classes/image.bbclass > +++ b/meta/classes/image.bbclass > @@ -377,16 +377,19 @@ do_copy_boot_files() { > fi > fi > > - for file in ${DTB_FILES}; do > - dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \ > - -iwholename '*linux-image-*/'${file} | head -1)" > - > - if [ -z "$dtb" -o ! -e "$dtb" ]; then > - die "${file} not found" > - fi > + if [ -n "${DTB_FILES}" ]; then > + mkdir -p "${DEPLOYDIR}/${IMAGE_FULLNAME}.dtbs" > + for file in ${DTB_FILES}; do > + dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \ > + -iwholename '*linux-image-*/'${file} | head -1)" > + > + if [ -z "$dtb" -o ! -e "$dtb" ]; then > + die "${file} not found" > + fi > > - cp -f "$dtb" "${DEPLOYDIR}/" > - done > + cp -f "$dtb" "${DEPLOYDIR}/${IMAGE_FULLNAME}.dtbs" This will break scripts/lib/wic/plugins/source/bootimg-efi.py from bitbake[1]. [1]: https://github.com/openembedded/openembedded-core/blob/master/scripts/lib/wic/plugins/source/bootimg-efi.py Quirin > + done > + fi > } > addtask copy_boot_files before do_rootfs_postprocess after do_rootfs_install > > diff --git a/meta/classes/imagetypes_wic.bbclass b/meta/classes/imagetypes_wic.bbclass > index bce881ed..f0f1c438 100644 > --- a/meta/classes/imagetypes_wic.bbclass > +++ b/meta/classes/imagetypes_wic.bbclass > @@ -107,7 +107,7 @@ WICVARS += "\ > ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS TRANSLATED_TARGET_ARCH" > > # Isar specific vars used in our plugins > -WICVARS += "DISTRO DISTRO_ARCH" > +WICVARS += "DISTRO DISTRO_ARCH MACHINE" > > python do_rootfs_wicenv () { > wicvars = d.getVar('WICVARS') > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] image.bbclass: copy dtbs into a deploydir/subdirectory based on the image name 2024-03-28 17:53 ` Gylstorff Quirin @ 2024-03-28 19:05 ` nicusor.huhulea 2024-04-08 8:12 ` Gylstorff Quirin 0 siblings, 1 reply; 9+ messages in thread From: nicusor.huhulea @ 2024-03-28 19:05 UTC (permalink / raw) To: quirin.gylstorff, isar-users Yes, it will break it without patching it. I'm not sure where this bootimg-efi.py is being used here, as for testing usually I'm using https://github.com/siemens/meta-iot2050 I guess that in this case the equivalent for bootimg-efi.py is https://gitlab.com/cip-project/cip-core/isar-cip-core/-/blob/master/scripts/lib/wic/plugins/source/efibootguard-boot.py which is already patched. Nicu ________________________________________ From: Gylstorff, Quirin (T CED OES-DE) <quirin.gylstorff@siemens.com> Sent: Thursday, March 28, 2024 7:53 PM To: Huhulea, Nicusor Liviu (DI CTO FDS CES LX SVCS); isar-users@googlegroups.com Subject: Re: [PATCH] image.bbclass: copy dtbs into a deploydir/subdirectory based on the image name On 3/28/24 8:54 AM, 'nicusor.huhulea@siemens.com' via isar-users wrote: > This fixes the build failures detailed in the https://groups.google.com/g/isar-users/c/Va0Ue-ISYeA and > https://groups.google.com/g/isar-users/c/PSGU_AcdPZ8 > This adds the MACHINE variable to WICVARS, hence the need to reflect this change in > cip-core/scripts/lib/wic/plugins/source/efibootguard-boot.py > > > Signed-off-by: Nicusor Huhulea <nicusor.huhulea@siemens.com> > > diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass > index 73f1d52c..9b98719b 100644 > --- a/meta/classes/image.bbclass > +++ b/meta/classes/image.bbclass > @@ -377,16 +377,19 @@ do_copy_boot_files() { > fi > fi > > - for file in ${DTB_FILES}; do > - dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \ > - -iwholename '*linux-image-*/'${file} | head -1)" > - > - if [ -z "$dtb" -o ! -e "$dtb" ]; then > - die "${file} not found" > - fi > + if [ -n "${DTB_FILES}" ]; then > + mkdir -p "${DEPLOYDIR}/${IMAGE_FULLNAME}.dtbs" > + for file in ${DTB_FILES}; do > + dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \ > + -iwholename '*linux-image-*/'${file} | head -1)" > + > + if [ -z "$dtb" -o ! -e "$dtb" ]; then > + die "${file} not found" > + fi > > - cp -f "$dtb" "${DEPLOYDIR}/" > - done > + cp -f "$dtb" "${DEPLOYDIR}/${IMAGE_FULLNAME}.dtbs" This will break scripts/lib/wic/plugins/source/bootimg-efi.py from bitbake[1]. [1]: https://github.com/openembedded/openembedded-core/blob/master/scripts/lib/wic/plugins/source/bootimg-efi.py Quirin > + done > + fi > } > addtask copy_boot_files before do_rootfs_postprocess after do_rootfs_install > > diff --git a/meta/classes/imagetypes_wic.bbclass b/meta/classes/imagetypes_wic.bbclass > index bce881ed..f0f1c438 100644 > --- a/meta/classes/imagetypes_wic.bbclass > +++ b/meta/classes/imagetypes_wic.bbclass > @@ -107,7 +107,7 @@ WICVARS += "\ > ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS TRANSLATED_TARGET_ARCH" > > # Isar specific vars used in our plugins > -WICVARS += "DISTRO DISTRO_ARCH" > +WICVARS += "DISTRO DISTRO_ARCH MACHINE" > > python do_rootfs_wicenv () { > wicvars = d.getVar('WICVARS') > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] image.bbclass: copy dtbs into a deploydir/subdirectory based on the image name 2024-03-28 19:05 ` nicusor.huhulea @ 2024-04-08 8:12 ` Gylstorff Quirin 2024-04-12 14:11 ` nicusor.huhulea 0 siblings, 1 reply; 9+ messages in thread From: Gylstorff Quirin @ 2024-04-08 8:12 UTC (permalink / raw) To: Huhulea, Nicusor Liviu (DI CTO FDS CES LX SVCS), isar-users On 3/28/24 8:05 PM, Huhulea, Nicusor Liviu (DI CTO FDS CES LX SVCS) wrote: > Yes, it will break it without patching it. I'm not sure where this bootimg-efi.py is being used here, as for testing usually I'm using https://github.com/siemens/meta-iot2050 It is used indirect with bootimg-efi-isar. Quirin > > I guess that in this case the equivalent for bootimg-efi.py is https://gitlab.com/cip-project/cip-core/isar-cip-core/-/blob/master/scripts/lib/wic/plugins/source/efibootguard-boot.py which is already patched. > > Nicu > > ________________________________________ > From: Gylstorff, Quirin (T CED OES-DE) <quirin.gylstorff@siemens.com> > Sent: Thursday, March 28, 2024 7:53 PM > To: Huhulea, Nicusor Liviu (DI CTO FDS CES LX SVCS); isar-users@googlegroups.com > Subject: Re: [PATCH] image.bbclass: copy dtbs into a deploydir/subdirectory based on the image name > > > > On 3/28/24 8:54 AM, 'nicusor.huhulea@siemens.com' via isar-users wrote: >> This fixes the build failures detailed in the https://groups.google.com/g/isar-users/c/Va0Ue-ISYeA and >> https://groups.google.com/g/isar-users/c/PSGU_AcdPZ8 >> This adds the MACHINE variable to WICVARS, hence the need to reflect this change in >> cip-core/scripts/lib/wic/plugins/source/efibootguard-boot.py >> >> >> Signed-off-by: Nicusor Huhulea <nicusor.huhulea@siemens.com> >> >> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass >> index 73f1d52c..9b98719b 100644 >> --- a/meta/classes/image.bbclass >> +++ b/meta/classes/image.bbclass >> @@ -377,16 +377,19 @@ do_copy_boot_files() { >> fi >> fi >> >> - for file in ${DTB_FILES}; do >> - dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \ >> - -iwholename '*linux-image-*/'${file} | head -1)" >> - >> - if [ -z "$dtb" -o ! -e "$dtb" ]; then >> - die "${file} not found" >> - fi >> + if [ -n "${DTB_FILES}" ]; then >> + mkdir -p "${DEPLOYDIR}/${IMAGE_FULLNAME}.dtbs" >> + for file in ${DTB_FILES}; do >> + dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \ >> + -iwholename '*linux-image-*/'${file} | head -1)" >> + >> + if [ -z "$dtb" -o ! -e "$dtb" ]; then >> + die "${file} not found" >> + fi >> >> - cp -f "$dtb" "${DEPLOYDIR}/" >> - done >> + cp -f "$dtb" "${DEPLOYDIR}/${IMAGE_FULLNAME}.dtbs" > > This will break scripts/lib/wic/plugins/source/bootimg-efi.py from > bitbake[1]. > > [1]: > https://github.com/openembedded/openembedded-core/blob/master/scripts/lib/wic/plugins/source/bootimg-efi.py > > Quirin > >> + done >> + fi >> } >> addtask copy_boot_files before do_rootfs_postprocess after do_rootfs_install >> >> diff --git a/meta/classes/imagetypes_wic.bbclass b/meta/classes/imagetypes_wic.bbclass >> index bce881ed..f0f1c438 100644 >> --- a/meta/classes/imagetypes_wic.bbclass >> +++ b/meta/classes/imagetypes_wic.bbclass >> @@ -107,7 +107,7 @@ WICVARS += "\ >> ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS TRANSLATED_TARGET_ARCH" >> >> # Isar specific vars used in our plugins >> -WICVARS += "DISTRO DISTRO_ARCH" >> +WICVARS += "DISTRO DISTRO_ARCH MACHINE" >> >> python do_rootfs_wicenv () { >> wicvars = d.getVar('WICVARS') >> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] image.bbclass: copy dtbs into a deploydir/subdirectory based on the image name 2024-04-08 8:12 ` Gylstorff Quirin @ 2024-04-12 14:11 ` nicusor.huhulea 2024-04-15 13:11 ` nicusor.huhulea 0 siblings, 1 reply; 9+ messages in thread From: nicusor.huhulea @ 2024-04-12 14:11 UTC (permalink / raw) To: quirin.gylstorff, isar-users updated all the cases where the dtbs path needed to be changed * update the other areas in order to sync with the dtbs directory path Signed-off-by: Nicusor Huhulea <nicusor.huhulea@siemens.com> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index 98741da0..e90f8fde 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -364,16 +364,19 @@ do_copy_boot_files() { fi fi - for file in ${DTB_FILES}; do - dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \ - -iwholename '*linux-image-*/'${file} | head -1)" - - if [ -z "$dtb" -o ! -e "$dtb" ]; then - die "${file} not found" - fi + if [ -n "${DTB_FILES}" ]; then + mkdir -p "${DEPLOYDIR}/${IMAGE_FULLNAME}.dtbs" + for file in ${DTB_FILES}; do + dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \ + -iwholename '*linux-image-*/'${file} | head -1)" + + if [ -z "$dtb" -o ! -e "$dtb" ]; then + die "${file} not found" + fi - cp -f "$dtb" "${DEPLOYDIR}/" - done + cp -f "$dtb" "${DEPLOYDIR}/${IMAGE_FULLNAME}.dtbs" + done + fi } addtask copy_boot_files before do_rootfs_postprocess after do_rootfs_install diff --git a/meta/classes/imagetypes_wic.bbclass b/meta/classes/imagetypes_wic.bbclass index bce881ed..adbde400 100644 --- a/meta/classes/imagetypes_wic.bbclass +++ b/meta/classes/imagetypes_wic.bbclass @@ -107,7 +107,7 @@ WICVARS += "\ ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS TRANSLATED_TARGET_ARCH" # Isar specific vars used in our plugins -WICVARS += "DISTRO DISTRO_ARCH" +WICVARS += "DISTRO DISTRO_ARCH IMAGE_FULLNAME" python do_rootfs_wicenv () { wicvars = d.getVar('WICVARS') diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py index 4bfb70a0..218a7fe7 100644 --- a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py +++ b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py @@ -57,7 +57,9 @@ class BootimgEFIPlugin(SourcePlugin): if dtb: if ';' in dtb: raise WicError("Only one DTB supported, exiting") - cp_cmd = "cp %s/%s %s" % (bootimg_dir, dtb, hdddir) + image_fullname = get_bitbake_var("IMAGE_FULLNAME") + dtbs_dir = os.path.join(bootimg_dir + "/" + image_fullname + ".dtbs") + cp_cmd = "cp %s/%s %s" % (dtbs_dir, dtb, hdddir) exec_cmd(cp_cmd, True) @classmethod @@ -353,8 +355,10 @@ class BootimgEFIPlugin(SourcePlugin): if dtb: if ';' in dtb: raise WicError("Only one DTB supported, exiting") + image_fullname = get_bitbake_var("IMAGE_FULLNAME") + dtbs_dir = os.path.join(deploy_dir + "/" + image_fullname + ".dtbs") dtb_params = '--add-section .dtb=%s/%s --change-section-vma .dtb=0x40000' % \ - (deploy_dir, dtb) + (dtbs_dir, dtb) else: dtb_params = '' diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py index 634a808d..07b177df 100644 --- a/scripts/lib/wic/plugins/source/bootimg-efi.py +++ b/scripts/lib/wic/plugins/source/bootimg-efi.py @@ -51,7 +51,9 @@ class BootimgEFIPlugin(SourcePlugin): if dtb: if ';' in dtb: raise WicError("Only one DTB supported, exiting") - cp_cmd = "cp %s/%s %s" % (bootimg_dir, dtb, hdddir) + image_fullname = get_bitbake_var("IMAGE_FULLNAME") + dtbs_dir = os.path.join(bootimg_dir + "/" + image_fullname + ".dtbs") + cp_cmd = "cp %s/%s %s" % (dtbs_dir, dtb, hdddir) exec_cmd(cp_cmd, True) @classmethod @@ -334,8 +336,10 @@ class BootimgEFIPlugin(SourcePlugin): if dtb: if ';' in dtb: raise WicError("Only one DTB supported, exiting") + image_fullname = get_bitbake_var("IMAGE_FULLNAME") + dtbs_dir = os.path.join(deploy_dir + "/" + image_fullname + ".dtbs") dtb_params = '--add-section .dtb=%s/%s --change-section-vma .dtb=0x40000' % \ - (deploy_dir, dtb) + (dtbs_dir, dtb) else: dtb_params = '' diff --git a/scripts/lib/wic/plugins/source/bootimg-partition.py b/scripts/lib/wic/plugins/source/bootimg-partition.py index 5dbe2558..1ae6216f 100644 --- a/scripts/lib/wic/plugins/source/bootimg-partition.py +++ b/scripts/lib/wic/plugins/source/bootimg-partition.py @@ -180,10 +180,18 @@ class BootimgPartitionPlugin(SourcePlugin): logger.debug('Kernel dir: %s', bootimg_dir) + image_fullname = get_bitbake_var("IMAGE_FULLNAME") + dtbs_dir = os.path.join(kernel_dir + "/" + image_fullname + ".dtbs/") for task in cls.install_task: src_path, dst_path = task - logger.debug('Install %s as %s', src_path, dst_path) + + dtb_file = os.path.join(dtbs_dir + os.path.basename(src_path)) + + if os.path.exists(dtb_file): + src_path = os.path.join(dtbs_dir + src_path) + + logger.debug('Install %s as %s', (src_path, dst_path)) install_cmd = "install -m 0644 -D %s %s" \ % (os.path.join(kernel_dir, src_path), os.path.join(hdddir, dst_path)) ________________________________________ From: Gylstorff, Quirin (T CED OES-DE) <quirin.gylstorff@siemens.com> Sent: Monday, April 8, 2024 11:12 AM To: Huhulea, Nicusor Liviu (DI CTO FDS CES LX SVCS); isar-users@googlegroups.com Subject: Re: [PATCH] image.bbclass: copy dtbs into a deploydir/subdirectory based on the image name On 3/28/24 8:05 PM, Huhulea, Nicusor Liviu (DI CTO FDS CES LX SVCS) wrote: > Yes, it will break it without patching it. I'm not sure where this bootimg-efi.py is being used here, as for testing usually I'm using https://github.com/siemens/meta-iot2050 It is used indirect with bootimg-efi-isar. Quirin > > I guess that in this case the equivalent for bootimg-efi.py is https://gitlab.com/cip-project/cip-core/isar-cip-core/-/blob/master/scripts/lib/wic/plugins/source/efibootguard-boot.py which is already patched. > > Nicu > > ________________________________________ > From: Gylstorff, Quirin (T CED OES-DE) <quirin.gylstorff@siemens.com> > Sent: Thursday, March 28, 2024 7:53 PM > To: Huhulea, Nicusor Liviu (DI CTO FDS CES LX SVCS); isar-users@googlegroups.com > Subject: Re: [PATCH] image.bbclass: copy dtbs into a deploydir/subdirectory based on the image name > > > > On 3/28/24 8:54 AM, 'nicusor.huhulea@siemens.com' via isar-users wrote: >> This fixes the build failures detailed in the https://groups.google.com/g/isar-users/c/Va0Ue-ISYeA and >> https://groups.google.com/g/isar-users/c/PSGU_AcdPZ8 >> This adds the MACHINE variable to WICVARS, hence the need to reflect this change in >> cip-core/scripts/lib/wic/plugins/source/efibootguard-boot.py >> >> >> Signed-off-by: Nicusor Huhulea <nicusor.huhulea@siemens.com> >> >> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass >> index 73f1d52c..9b98719b 100644 >> --- a/meta/classes/image.bbclass >> +++ b/meta/classes/image.bbclass >> @@ -377,16 +377,19 @@ do_copy_boot_files() { >> fi >> fi >> >> - for file in ${DTB_FILES}; do >> - dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \ >> - -iwholename '*linux-image-*/'${file} | head -1)" >> - >> - if [ -z "$dtb" -o ! -e "$dtb" ]; then >> - die "${file} not found" >> - fi >> + if [ -n "${DTB_FILES}" ]; then >> + mkdir -p "${DEPLOYDIR}/${IMAGE_FULLNAME}.dtbs" >> + for file in ${DTB_FILES}; do >> + dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \ >> + -iwholename '*linux-image-*/'${file} | head -1)" >> + >> + if [ -z "$dtb" -o ! -e "$dtb" ]; then >> + die "${file} not found" >> + fi >> >> - cp -f "$dtb" "${DEPLOYDIR}/" >> - done >> + cp -f "$dtb" "${DEPLOYDIR}/${IMAGE_FULLNAME}.dtbs" > > This will break scripts/lib/wic/plugins/source/bootimg-efi.py from > bitbake[1]. > > [1]: > https://github.com/openembedded/openembedded-core/blob/master/scripts/lib/wic/plugins/source/bootimg-efi.py > > Quirin > >> + done >> + fi >> } >> addtask copy_boot_files before do_rootfs_postprocess after do_rootfs_install >> >> diff --git a/meta/classes/imagetypes_wic.bbclass b/meta/classes/imagetypes_wic.bbclass >> index bce881ed..f0f1c438 100644 >> --- a/meta/classes/imagetypes_wic.bbclass >> +++ b/meta/classes/imagetypes_wic.bbclass >> @@ -107,7 +107,7 @@ WICVARS += "\ >> ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS TRANSLATED_TARGET_ARCH" >> >> # Isar specific vars used in our plugins >> -WICVARS += "DISTRO DISTRO_ARCH" >> +WICVARS += "DISTRO DISTRO_ARCH MACHINE" >> >> python do_rootfs_wicenv () { >> wicvars = d.getVar('WICVARS') >> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] image.bbclass: copy dtbs into a deploydir/subdirectory based on the image name 2024-04-12 14:11 ` nicusor.huhulea @ 2024-04-15 13:11 ` nicusor.huhulea 2024-04-15 13:19 ` Jan Kiszka 0 siblings, 1 reply; 9+ messages in thread From: nicusor.huhulea @ 2024-04-15 13:11 UTC (permalink / raw) To: quirin.gylstorff, isar-users Tested this on all the isar and cip-core machines. fix patch formatting too. * update the other areas in order to sync with the dtbs directory path Signed-off-by: Nicusor Huhulea <nicusor.huhulea@siemens.com> --- meta/classes/image.bbclass | 21 +++++++++++-------- meta/classes/imagetypes_wic.bbclass | 2 +- .../wic/plugins/source/bootimg-efi-isar.py | 8 +++++-- scripts/lib/wic/plugins/source/bootimg-efi.py | 8 +++++-- .../wic/plugins/source/bootimg-partition.py | 10 ++++++++- 5 files changed, 34 insertions(+), 15 deletions(-) diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index 98741da0..e90f8fde 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -364,16 +364,19 @@ do_copy_boot_files() { fi fi - for file in ${DTB_FILES}; do - dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \ - -iwholename '*linux-image-*/'${file} | head -1)" - - if [ -z "$dtb" -o ! -e "$dtb" ]; then - die "${file} not found" - fi + if [ -n "${DTB_FILES}" ]; then + mkdir -p "${DEPLOYDIR}/${IMAGE_FULLNAME}.dtbs" + for file in ${DTB_FILES}; do + dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \ + -iwholename '*linux-image-*/'${file} | head -1)" + + if [ -z "$dtb" -o ! -e "$dtb" ]; then + die "${file} not found" + fi - cp -f "$dtb" "${DEPLOYDIR}/" - done + cp -f "$dtb" "${DEPLOYDIR}/${IMAGE_FULLNAME}.dtbs" + done + fi } addtask copy_boot_files before do_rootfs_postprocess after do_rootfs_install diff --git a/meta/classes/imagetypes_wic.bbclass b/meta/classes/imagetypes_wic.bbclass index bce881ed..adbde400 100644 --- a/meta/classes/imagetypes_wic.bbclass +++ b/meta/classes/imagetypes_wic.bbclass @@ -107,7 +107,7 @@ WICVARS += "\ ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS TRANSLATED_TARGET_ARCH" # Isar specific vars used in our plugins -WICVARS += "DISTRO DISTRO_ARCH" +WICVARS += "DISTRO DISTRO_ARCH IMAGE_FULLNAME" python do_rootfs_wicenv () { wicvars = d.getVar('WICVARS') diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py index 4bfb70a0..218a7fe7 100644 --- a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py +++ b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py @@ -57,7 +57,9 @@ class BootimgEFIPlugin(SourcePlugin): if dtb: if ';' in dtb: raise WicError("Only one DTB supported, exiting") - cp_cmd = "cp %s/%s %s" % (bootimg_dir, dtb, hdddir) + image_fullname = get_bitbake_var("IMAGE_FULLNAME") + dtbs_dir = os.path.join(bootimg_dir + "/" + image_fullname + ".dtbs") + cp_cmd = "cp %s/%s %s" % (dtbs_dir, dtb, hdddir) exec_cmd(cp_cmd, True) @classmethod @@ -353,8 +355,10 @@ class BootimgEFIPlugin(SourcePlugin): if dtb: if ';' in dtb: raise WicError("Only one DTB supported, exiting") + image_fullname = get_bitbake_var("IMAGE_FULLNAME") + dtbs_dir = os.path.join(deploy_dir + "/" + image_fullname + ".dtbs") dtb_params = '--add-section .dtb=%s/%s --change-section-vma .dtb=0x40000' % \ - (deploy_dir, dtb) + (dtbs_dir, dtb) else: dtb_params = '' diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py index 634a808d..07b177df 100644 --- a/scripts/lib/wic/plugins/source/bootimg-efi.py +++ b/scripts/lib/wic/plugins/source/bootimg-efi.py @@ -51,7 +51,9 @@ class BootimgEFIPlugin(SourcePlugin): if dtb: if ';' in dtb: raise WicError("Only one DTB supported, exiting") - cp_cmd = "cp %s/%s %s" % (bootimg_dir, dtb, hdddir) + image_fullname = get_bitbake_var("IMAGE_FULLNAME") + dtbs_dir = os.path.join(bootimg_dir + "/" + image_fullname + ".dtbs") + cp_cmd = "cp %s/%s %s" % (dtbs_dir, dtb, hdddir) exec_cmd(cp_cmd, True) @classmethod @@ -334,8 +336,10 @@ class BootimgEFIPlugin(SourcePlugin): if dtb: if ';' in dtb: raise WicError("Only one DTB supported, exiting") + image_fullname = get_bitbake_var("IMAGE_FULLNAME") + dtbs_dir = os.path.join(deploy_dir + "/" + image_fullname + ".dtbs") dtb_params = '--add-section .dtb=%s/%s --change-section-vma .dtb=0x40000' % \ - (deploy_dir, dtb) + (dtbs_dir, dtb) else: dtb_params = '' diff --git a/scripts/lib/wic/plugins/source/bootimg-partition.py b/scripts/lib/wic/plugins/source/bootimg-partition.py index 5dbe2558..1ae6216f 100644 --- a/scripts/lib/wic/plugins/source/bootimg-partition.py +++ b/scripts/lib/wic/plugins/source/bootimg-partition.py @@ -180,10 +180,18 @@ class BootimgPartitionPlugin(SourcePlugin): logger.debug('Kernel dir: %s', bootimg_dir) + image_fullname = get_bitbake_var("IMAGE_FULLNAME") + dtbs_dir = os.path.join(kernel_dir + "/" + image_fullname + ".dtbs/") for task in cls.install_task: src_path, dst_path = task - logger.debug('Install %s as %s', src_path, dst_path) + + dtb_file = os.path.join(dtbs_dir + os.path.basename(src_path)) + + if os.path.exists(dtb_file): + src_path = os.path.join(dtbs_dir + src_path) + + logger.debug('Install %s as %s', (src_path, dst_path)) install_cmd = "install -m 0644 -D %s %s" \ % (os.path.join(kernel_dir, src_path), os.path.join(hdddir, dst_path)) -- 2.39.2 ________________________________________ From: Huhulea, Nicusor Liviu (DI CTO FDS CES LX SVCS) <nicusor.huhulea@siemens.com> Sent: Friday, April 12, 2024 5:11 PM To: Gylstorff, Quirin (T CED OES-DE); isar-users@googlegroups.com Subject: Re: [PATCH] image.bbclass: copy dtbs into a deploydir/subdirectory based on the image name updated all the cases where the dtbs path needed to be changed * update the other areas in order to sync with the dtbs directory path Signed-off-by: Nicusor Huhulea <nicusor.huhulea@siemens.com> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index 98741da0..e90f8fde 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -364,16 +364,19 @@ do_copy_boot_files() { fi fi - for file in ${DTB_FILES}; do - dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \ - -iwholename '*linux-image-*/'${file} | head -1)" - - if [ -z "$dtb" -o ! -e "$dtb" ]; then - die "${file} not found" - fi + if [ -n "${DTB_FILES}" ]; then + mkdir -p "${DEPLOYDIR}/${IMAGE_FULLNAME}.dtbs" + for file in ${DTB_FILES}; do + dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \ + -iwholename '*linux-image-*/'${file} | head -1)" + + if [ -z "$dtb" -o ! -e "$dtb" ]; then + die "${file} not found" + fi - cp -f "$dtb" "${DEPLOYDIR}/" - done + cp -f "$dtb" "${DEPLOYDIR}/${IMAGE_FULLNAME}.dtbs" + done + fi } addtask copy_boot_files before do_rootfs_postprocess after do_rootfs_install diff --git a/meta/classes/imagetypes_wic.bbclass b/meta/classes/imagetypes_wic.bbclass index bce881ed..adbde400 100644 --- a/meta/classes/imagetypes_wic.bbclass +++ b/meta/classes/imagetypes_wic.bbclass @@ -107,7 +107,7 @@ WICVARS += "\ ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS TRANSLATED_TARGET_ARCH" # Isar specific vars used in our plugins -WICVARS += "DISTRO DISTRO_ARCH" +WICVARS += "DISTRO DISTRO_ARCH IMAGE_FULLNAME" python do_rootfs_wicenv () { wicvars = d.getVar('WICVARS') diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py index 4bfb70a0..218a7fe7 100644 --- a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py +++ b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py @@ -57,7 +57,9 @@ class BootimgEFIPlugin(SourcePlugin): if dtb: if ';' in dtb: raise WicError("Only one DTB supported, exiting") - cp_cmd = "cp %s/%s %s" % (bootimg_dir, dtb, hdddir) + image_fullname = get_bitbake_var("IMAGE_FULLNAME") + dtbs_dir = os.path.join(bootimg_dir + "/" + image_fullname + ".dtbs") + cp_cmd = "cp %s/%s %s" % (dtbs_dir, dtb, hdddir) exec_cmd(cp_cmd, True) @classmethod @@ -353,8 +355,10 @@ class BootimgEFIPlugin(SourcePlugin): if dtb: if ';' in dtb: raise WicError("Only one DTB supported, exiting") + image_fullname = get_bitbake_var("IMAGE_FULLNAME") + dtbs_dir = os.path.join(deploy_dir + "/" + image_fullname + ".dtbs") dtb_params = '--add-section .dtb=%s/%s --change-section-vma .dtb=0x40000' % \ - (deploy_dir, dtb) + (dtbs_dir, dtb) else: dtb_params = '' diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py index 634a808d..07b177df 100644 --- a/scripts/lib/wic/plugins/source/bootimg-efi.py +++ b/scripts/lib/wic/plugins/source/bootimg-efi.py @@ -51,7 +51,9 @@ class BootimgEFIPlugin(SourcePlugin): if dtb: if ';' in dtb: raise WicError("Only one DTB supported, exiting") - cp_cmd = "cp %s/%s %s" % (bootimg_dir, dtb, hdddir) + image_fullname = get_bitbake_var("IMAGE_FULLNAME") + dtbs_dir = os.path.join(bootimg_dir + "/" + image_fullname + ".dtbs") + cp_cmd = "cp %s/%s %s" % (dtbs_dir, dtb, hdddir) exec_cmd(cp_cmd, True) @classmethod @@ -334,8 +336,10 @@ class BootimgEFIPlugin(SourcePlugin): if dtb: if ';' in dtb: raise WicError("Only one DTB supported, exiting") + image_fullname = get_bitbake_var("IMAGE_FULLNAME") + dtbs_dir = os.path.join(deploy_dir + "/" + image_fullname + ".dtbs") dtb_params = '--add-section .dtb=%s/%s --change-section-vma .dtb=0x40000' % \ - (deploy_dir, dtb) + (dtbs_dir, dtb) else: dtb_params = '' diff --git a/scripts/lib/wic/plugins/source/bootimg-partition.py b/scripts/lib/wic/plugins/source/bootimg-partition.py index 5dbe2558..1ae6216f 100644 --- a/scripts/lib/wic/plugins/source/bootimg-partition.py +++ b/scripts/lib/wic/plugins/source/bootimg-partition.py @@ -180,10 +180,18 @@ class BootimgPartitionPlugin(SourcePlugin): logger.debug('Kernel dir: %s', bootimg_dir) + image_fullname = get_bitbake_var("IMAGE_FULLNAME") + dtbs_dir = os.path.join(kernel_dir + "/" + image_fullname + ".dtbs/") for task in cls.install_task: src_path, dst_path = task - logger.debug('Install %s as %s', src_path, dst_path) + + dtb_file = os.path.join(dtbs_dir + os.path.basename(src_path)) + + if os.path.exists(dtb_file): + src_path = os.path.join(dtbs_dir + src_path) + + logger.debug('Install %s as %s', (src_path, dst_path)) install_cmd = "install -m 0644 -D %s %s" \ % (os.path.join(kernel_dir, src_path), os.path.join(hdddir, dst_path)) ________________________________________ From: Gylstorff, Quirin (T CED OES-DE) <quirin.gylstorff@siemens.com> Sent: Monday, April 8, 2024 11:12 AM To: Huhulea, Nicusor Liviu (DI CTO FDS CES LX SVCS); isar-users@googlegroups.com Subject: Re: [PATCH] image.bbclass: copy dtbs into a deploydir/subdirectory based on the image name On 3/28/24 8:05 PM, Huhulea, Nicusor Liviu (DI CTO FDS CES LX SVCS) wrote: > Yes, it will break it without patching it. I'm not sure where this bootimg-efi.py is being used here, as for testing usually I'm using https://github.com/siemens/meta-iot2050 It is used indirect with bootimg-efi-isar. Quirin > > I guess that in this case the equivalent for bootimg-efi.py is https://gitlab.com/cip-project/cip-core/isar-cip-core/-/blob/master/scripts/lib/wic/plugins/source/efibootguard-boot.py which is already patched. > > Nicu > > ________________________________________ > From: Gylstorff, Quirin (T CED OES-DE) <quirin.gylstorff@siemens.com> > Sent: Thursday, March 28, 2024 7:53 PM > To: Huhulea, Nicusor Liviu (DI CTO FDS CES LX SVCS); isar-users@googlegroups.com > Subject: Re: [PATCH] image.bbclass: copy dtbs into a deploydir/subdirectory based on the image name > > > > On 3/28/24 8:54 AM, 'nicusor.huhulea@siemens.com' via isar-users wrote: >> This fixes the build failures detailed in the https://groups.google.com/g/isar-users/c/Va0Ue-ISYeA and >> https://groups.google.com/g/isar-users/c/PSGU_AcdPZ8 >> This adds the MACHINE variable to WICVARS, hence the need to reflect this change in >> cip-core/scripts/lib/wic/plugins/source/efibootguard-boot.py >> >> >> Signed-off-by: Nicusor Huhulea <nicusor.huhulea@siemens.com> >> >> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass >> index 73f1d52c..9b98719b 100644 >> --- a/meta/classes/image.bbclass >> +++ b/meta/classes/image.bbclass >> @@ -377,16 +377,19 @@ do_copy_boot_files() { >> fi >> fi >> >> - for file in ${DTB_FILES}; do >> - dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \ >> - -iwholename '*linux-image-*/'${file} | head -1)" >> - >> - if [ -z "$dtb" -o ! -e "$dtb" ]; then >> - die "${file} not found" >> - fi >> + if [ -n "${DTB_FILES}" ]; then >> + mkdir -p "${DEPLOYDIR}/${IMAGE_FULLNAME}.dtbs" >> + for file in ${DTB_FILES}; do >> + dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \ >> + -iwholename '*linux-image-*/'${file} | head -1)" >> + >> + if [ -z "$dtb" -o ! -e "$dtb" ]; then >> + die "${file} not found" >> + fi >> >> - cp -f "$dtb" "${DEPLOYDIR}/" >> - done >> + cp -f "$dtb" "${DEPLOYDIR}/${IMAGE_FULLNAME}.dtbs" > > This will break scripts/lib/wic/plugins/source/bootimg-efi.py from > bitbake[1]. > > [1]: > https://github.com/openembedded/openembedded-core/blob/master/scripts/lib/wic/plugins/source/bootimg-efi.py > > Quirin > >> + done >> + fi >> } >> addtask copy_boot_files before do_rootfs_postprocess after do_rootfs_install >> >> diff --git a/meta/classes/imagetypes_wic.bbclass b/meta/classes/imagetypes_wic.bbclass >> index bce881ed..f0f1c438 100644 >> --- a/meta/classes/imagetypes_wic.bbclass >> +++ b/meta/classes/imagetypes_wic.bbclass >> @@ -107,7 +107,7 @@ WICVARS += "\ >> ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS TRANSLATED_TARGET_ARCH" >> >> # Isar specific vars used in our plugins >> -WICVARS += "DISTRO DISTRO_ARCH" >> +WICVARS += "DISTRO DISTRO_ARCH MACHINE" >> >> python do_rootfs_wicenv () { >> wicvars = d.getVar('WICVARS') >> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] image.bbclass: copy dtbs into a deploydir/subdirectory based on the image name 2024-04-15 13:11 ` nicusor.huhulea @ 2024-04-15 13:19 ` Jan Kiszka 0 siblings, 0 replies; 9+ messages in thread From: Jan Kiszka @ 2024-04-15 13:19 UTC (permalink / raw) To: nicusor.huhulea, quirin.gylstorff, isar-users Please use "git send-email" and start a new thread. Do not send patches as reply of previous postings. On 15.04.24 15:11, 'nicusor.huhulea@siemens.com' via isar-users wrote: > Tested this on all the isar and cip-core machines. > fix patch formatting too. > > * update the other areas in order to sync with the dtbs directory path > A git commit message first of all needs to explain WHY you are doing the change. If the change is complex or took one roat in favor of another, you can also explain the HOW. Just compare your patch to others sent here, specifically to patches by frequent contributors. Jan > Signed-off-by: Nicusor Huhulea <nicusor.huhulea@siemens.com> > --- > meta/classes/image.bbclass | 21 +++++++++++-------- > meta/classes/imagetypes_wic.bbclass | 2 +- > .../wic/plugins/source/bootimg-efi-isar.py | 8 +++++-- > scripts/lib/wic/plugins/source/bootimg-efi.py | 8 +++++-- > .../wic/plugins/source/bootimg-partition.py | 10 ++++++++- > 5 files changed, 34 insertions(+), 15 deletions(-) > > diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass > index 98741da0..e90f8fde 100644 > --- a/meta/classes/image.bbclass > +++ b/meta/classes/image.bbclass > @@ -364,16 +364,19 @@ do_copy_boot_files() { > fi > fi > > - for file in ${DTB_FILES}; do > - dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \ > - -iwholename '*linux-image-*/'${file} | head -1)" > - > - if [ -z "$dtb" -o ! -e "$dtb" ]; then > - die "${file} not found" > - fi > + if [ -n "${DTB_FILES}" ]; then > + mkdir -p "${DEPLOYDIR}/${IMAGE_FULLNAME}.dtbs" > + for file in ${DTB_FILES}; do > + dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \ > + -iwholename '*linux-image-*/'${file} | head -1)" > + > + if [ -z "$dtb" -o ! -e "$dtb" ]; then > + die "${file} not found" > + fi > > - cp -f "$dtb" "${DEPLOYDIR}/" > - done > + cp -f "$dtb" "${DEPLOYDIR}/${IMAGE_FULLNAME}.dtbs" > + done > + fi > } > addtask copy_boot_files before do_rootfs_postprocess after do_rootfs_install > > diff --git a/meta/classes/imagetypes_wic.bbclass b/meta/classes/imagetypes_wic.bbclass > index bce881ed..adbde400 100644 > --- a/meta/classes/imagetypes_wic.bbclass > +++ b/meta/classes/imagetypes_wic.bbclass > @@ -107,7 +107,7 @@ WICVARS += "\ > ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS TRANSLATED_TARGET_ARCH" > > # Isar specific vars used in our plugins > -WICVARS += "DISTRO DISTRO_ARCH" > +WICVARS += "DISTRO DISTRO_ARCH IMAGE_FULLNAME" > > python do_rootfs_wicenv () { > wicvars = d.getVar('WICVARS') > diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py > index 4bfb70a0..218a7fe7 100644 > --- a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py > +++ b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py > @@ -57,7 +57,9 @@ class BootimgEFIPlugin(SourcePlugin): > if dtb: > if ';' in dtb: > raise WicError("Only one DTB supported, exiting") > - cp_cmd = "cp %s/%s %s" % (bootimg_dir, dtb, hdddir) > + image_fullname = get_bitbake_var("IMAGE_FULLNAME") > + dtbs_dir = os.path.join(bootimg_dir + "/" + image_fullname + ".dtbs") > + cp_cmd = "cp %s/%s %s" % (dtbs_dir, dtb, hdddir) > exec_cmd(cp_cmd, True) > > @classmethod > @@ -353,8 +355,10 @@ class BootimgEFIPlugin(SourcePlugin): > if dtb: > if ';' in dtb: > raise WicError("Only one DTB supported, exiting") > + image_fullname = get_bitbake_var("IMAGE_FULLNAME") > + dtbs_dir = os.path.join(deploy_dir + "/" + image_fullname + ".dtbs") > dtb_params = '--add-section .dtb=%s/%s --change-section-vma .dtb=0x40000' % \ > - (deploy_dir, dtb) > + (dtbs_dir, dtb) > else: > dtb_params = '' > > diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py > index 634a808d..07b177df 100644 > --- a/scripts/lib/wic/plugins/source/bootimg-efi.py > +++ b/scripts/lib/wic/plugins/source/bootimg-efi.py > @@ -51,7 +51,9 @@ class BootimgEFIPlugin(SourcePlugin): > if dtb: > if ';' in dtb: > raise WicError("Only one DTB supported, exiting") > - cp_cmd = "cp %s/%s %s" % (bootimg_dir, dtb, hdddir) > + image_fullname = get_bitbake_var("IMAGE_FULLNAME") > + dtbs_dir = os.path.join(bootimg_dir + "/" + image_fullname + ".dtbs") > + cp_cmd = "cp %s/%s %s" % (dtbs_dir, dtb, hdddir) > exec_cmd(cp_cmd, True) > > @classmethod > @@ -334,8 +336,10 @@ class BootimgEFIPlugin(SourcePlugin): > if dtb: > if ';' in dtb: > raise WicError("Only one DTB supported, exiting") > + image_fullname = get_bitbake_var("IMAGE_FULLNAME") > + dtbs_dir = os.path.join(deploy_dir + "/" + image_fullname + ".dtbs") > dtb_params = '--add-section .dtb=%s/%s --change-section-vma .dtb=0x40000' % \ > - (deploy_dir, dtb) > + (dtbs_dir, dtb) > else: > dtb_params = '' > > diff --git a/scripts/lib/wic/plugins/source/bootimg-partition.py b/scripts/lib/wic/plugins/source/bootimg-partition.py > index 5dbe2558..1ae6216f 100644 > --- a/scripts/lib/wic/plugins/source/bootimg-partition.py > +++ b/scripts/lib/wic/plugins/source/bootimg-partition.py > @@ -180,10 +180,18 @@ class BootimgPartitionPlugin(SourcePlugin): > > logger.debug('Kernel dir: %s', bootimg_dir) > > + image_fullname = get_bitbake_var("IMAGE_FULLNAME") > + dtbs_dir = os.path.join(kernel_dir + "/" + image_fullname + ".dtbs/") > > for task in cls.install_task: > src_path, dst_path = task > - logger.debug('Install %s as %s', src_path, dst_path) > + > + dtb_file = os.path.join(dtbs_dir + os.path.basename(src_path)) > + > + if os.path.exists(dtb_file): > + src_path = os.path.join(dtbs_dir + src_path) > + > + logger.debug('Install %s as %s', (src_path, dst_path)) > install_cmd = "install -m 0644 -D %s %s" \ > % (os.path.join(kernel_dir, src_path), > os.path.join(hdddir, dst_path)) > -- > 2.39.2 > > ________________________________________ > From: Huhulea, Nicusor Liviu (DI CTO FDS CES LX SVCS) <nicusor.huhulea@siemens.com> > Sent: Friday, April 12, 2024 5:11 PM > To: Gylstorff, Quirin (T CED OES-DE); isar-users@googlegroups.com > Subject: Re: [PATCH] image.bbclass: copy dtbs into a deploydir/subdirectory based on the image name > > updated all the cases where the dtbs path needed to be changed > > > * update the other areas in order to sync with the dtbs directory path > > Signed-off-by: Nicusor Huhulea <nicusor.huhulea@siemens.com> > > diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass > index 98741da0..e90f8fde 100644 > --- a/meta/classes/image.bbclass > +++ b/meta/classes/image.bbclass > @@ -364,16 +364,19 @@ do_copy_boot_files() { > fi > fi > > - for file in ${DTB_FILES}; do > - dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \ > - -iwholename '*linux-image-*/'${file} | head -1)" > - > - if [ -z "$dtb" -o ! -e "$dtb" ]; then > - die "${file} not found" > - fi > + if [ -n "${DTB_FILES}" ]; then > + mkdir -p "${DEPLOYDIR}/${IMAGE_FULLNAME}.dtbs" > + for file in ${DTB_FILES}; do > + dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \ > + -iwholename '*linux-image-*/'${file} | head -1)" > + > + if [ -z "$dtb" -o ! -e "$dtb" ]; then > + die "${file} not found" > + fi > > - cp -f "$dtb" "${DEPLOYDIR}/" > - done > + cp -f "$dtb" "${DEPLOYDIR}/${IMAGE_FULLNAME}.dtbs" > + done > + fi > } > addtask copy_boot_files before do_rootfs_postprocess after do_rootfs_install > > diff --git a/meta/classes/imagetypes_wic.bbclass b/meta/classes/imagetypes_wic.bbclass > index bce881ed..adbde400 100644 > --- a/meta/classes/imagetypes_wic.bbclass > +++ b/meta/classes/imagetypes_wic.bbclass > @@ -107,7 +107,7 @@ WICVARS += "\ > ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS TRANSLATED_TARGET_ARCH" > > # Isar specific vars used in our plugins > -WICVARS += "DISTRO DISTRO_ARCH" > +WICVARS += "DISTRO DISTRO_ARCH IMAGE_FULLNAME" > > python do_rootfs_wicenv () { > wicvars = d.getVar('WICVARS') > diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py > index 4bfb70a0..218a7fe7 100644 > --- a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py > +++ b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py > @@ -57,7 +57,9 @@ class BootimgEFIPlugin(SourcePlugin): > if dtb: > if ';' in dtb: > raise WicError("Only one DTB supported, exiting") > - cp_cmd = "cp %s/%s %s" % (bootimg_dir, dtb, hdddir) > + image_fullname = get_bitbake_var("IMAGE_FULLNAME") > + dtbs_dir = os.path.join(bootimg_dir + "/" + image_fullname + ".dtbs") > + cp_cmd = "cp %s/%s %s" % (dtbs_dir, dtb, hdddir) > exec_cmd(cp_cmd, True) > > @classmethod > @@ -353,8 +355,10 @@ class BootimgEFIPlugin(SourcePlugin): > if dtb: > if ';' in dtb: > raise WicError("Only one DTB supported, exiting") > + image_fullname = get_bitbake_var("IMAGE_FULLNAME") > + dtbs_dir = os.path.join(deploy_dir + "/" + image_fullname + ".dtbs") > dtb_params = '--add-section .dtb=%s/%s --change-section-vma .dtb=0x40000' % \ > - (deploy_dir, dtb) > + (dtbs_dir, dtb) > else: > dtb_params = '' > > diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py > index 634a808d..07b177df 100644 > --- a/scripts/lib/wic/plugins/source/bootimg-efi.py > +++ b/scripts/lib/wic/plugins/source/bootimg-efi.py > @@ -51,7 +51,9 @@ class BootimgEFIPlugin(SourcePlugin): > if dtb: > if ';' in dtb: > raise WicError("Only one DTB supported, exiting") > - cp_cmd = "cp %s/%s %s" % (bootimg_dir, dtb, hdddir) > + image_fullname = get_bitbake_var("IMAGE_FULLNAME") > + dtbs_dir = os.path.join(bootimg_dir + "/" + image_fullname + ".dtbs") > + cp_cmd = "cp %s/%s %s" % (dtbs_dir, dtb, hdddir) > exec_cmd(cp_cmd, True) > > @classmethod > @@ -334,8 +336,10 @@ class BootimgEFIPlugin(SourcePlugin): > if dtb: > if ';' in dtb: > raise WicError("Only one DTB supported, exiting") > + image_fullname = get_bitbake_var("IMAGE_FULLNAME") > + dtbs_dir = os.path.join(deploy_dir + "/" + image_fullname + ".dtbs") > dtb_params = '--add-section .dtb=%s/%s --change-section-vma .dtb=0x40000' % \ > - (deploy_dir, dtb) > + (dtbs_dir, dtb) > else: > dtb_params = '' > > diff --git a/scripts/lib/wic/plugins/source/bootimg-partition.py b/scripts/lib/wic/plugins/source/bootimg-partition.py > index 5dbe2558..1ae6216f 100644 > --- a/scripts/lib/wic/plugins/source/bootimg-partition.py > +++ b/scripts/lib/wic/plugins/source/bootimg-partition.py > @@ -180,10 +180,18 @@ class BootimgPartitionPlugin(SourcePlugin): > > logger.debug('Kernel dir: %s', bootimg_dir) > > + image_fullname = get_bitbake_var("IMAGE_FULLNAME") > + dtbs_dir = os.path.join(kernel_dir + "/" + image_fullname + ".dtbs/") > > for task in cls.install_task: > src_path, dst_path = task > - logger.debug('Install %s as %s', src_path, dst_path) > + > + dtb_file = os.path.join(dtbs_dir + os.path.basename(src_path)) > + > + if os.path.exists(dtb_file): > + src_path = os.path.join(dtbs_dir + src_path) > + > + logger.debug('Install %s as %s', (src_path, dst_path)) > install_cmd = "install -m 0644 -D %s %s" \ > % (os.path.join(kernel_dir, src_path), > os.path.join(hdddir, dst_path)) > > > ________________________________________ > From: Gylstorff, Quirin (T CED OES-DE) <quirin.gylstorff@siemens.com> > Sent: Monday, April 8, 2024 11:12 AM > To: Huhulea, Nicusor Liviu (DI CTO FDS CES LX SVCS); isar-users@googlegroups.com > Subject: Re: [PATCH] image.bbclass: copy dtbs into a deploydir/subdirectory based on the image name > > > > On 3/28/24 8:05 PM, Huhulea, Nicusor Liviu (DI CTO FDS CES LX SVCS) wrote: >> Yes, it will break it without patching it. I'm not sure where this bootimg-efi.py is being used here, as for testing usually I'm using https://github.com/siemens/meta-iot2050 > > It is used indirect with bootimg-efi-isar. > Quirin >> >> I guess that in this case the equivalent for bootimg-efi.py is https://gitlab.com/cip-project/cip-core/isar-cip-core/-/blob/master/scripts/lib/wic/plugins/source/efibootguard-boot.py which is already patched. >> >> Nicu >> >> ________________________________________ >> From: Gylstorff, Quirin (T CED OES-DE) <quirin.gylstorff@siemens.com> >> Sent: Thursday, March 28, 2024 7:53 PM >> To: Huhulea, Nicusor Liviu (DI CTO FDS CES LX SVCS); isar-users@googlegroups.com >> Subject: Re: [PATCH] image.bbclass: copy dtbs into a deploydir/subdirectory based on the image name >> >> >> >> On 3/28/24 8:54 AM, 'nicusor.huhulea@siemens.com' via isar-users wrote: >>> This fixes the build failures detailed in the https://groups.google.com/g/isar-users/c/Va0Ue-ISYeA and >>> https://groups.google.com/g/isar-users/c/PSGU_AcdPZ8 >>> This adds the MACHINE variable to WICVARS, hence the need to reflect this change in >>> cip-core/scripts/lib/wic/plugins/source/efibootguard-boot.py >>> >>> >>> Signed-off-by: Nicusor Huhulea <nicusor.huhulea@siemens.com> >>> >>> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass >>> index 73f1d52c..9b98719b 100644 >>> --- a/meta/classes/image.bbclass >>> +++ b/meta/classes/image.bbclass >>> @@ -377,16 +377,19 @@ do_copy_boot_files() { >>> fi >>> fi >>> >>> - for file in ${DTB_FILES}; do >>> - dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \ >>> - -iwholename '*linux-image-*/'${file} | head -1)" >>> - >>> - if [ -z "$dtb" -o ! -e "$dtb" ]; then >>> - die "${file} not found" >>> - fi >>> + if [ -n "${DTB_FILES}" ]; then >>> + mkdir -p "${DEPLOYDIR}/${IMAGE_FULLNAME}.dtbs" >>> + for file in ${DTB_FILES}; do >>> + dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \ >>> + -iwholename '*linux-image-*/'${file} | head -1)" >>> + >>> + if [ -z "$dtb" -o ! -e "$dtb" ]; then >>> + die "${file} not found" >>> + fi >>> >>> - cp -f "$dtb" "${DEPLOYDIR}/" >>> - done >>> + cp -f "$dtb" "${DEPLOYDIR}/${IMAGE_FULLNAME}.dtbs" >> >> This will break scripts/lib/wic/plugins/source/bootimg-efi.py from >> bitbake[1]. >> >> [1]: >> https://github.com/openembedded/openembedded-core/blob/master/scripts/lib/wic/plugins/source/bootimg-efi.py >> >> Quirin >> >>> + done >>> + fi >>> } >>> addtask copy_boot_files before do_rootfs_postprocess after do_rootfs_install >>> >>> diff --git a/meta/classes/imagetypes_wic.bbclass b/meta/classes/imagetypes_wic.bbclass >>> index bce881ed..f0f1c438 100644 >>> --- a/meta/classes/imagetypes_wic.bbclass >>> +++ b/meta/classes/imagetypes_wic.bbclass >>> @@ -107,7 +107,7 @@ WICVARS += "\ >>> ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS TRANSLATED_TARGET_ARCH" >>> >>> # Isar specific vars used in our plugins >>> -WICVARS += "DISTRO DISTRO_ARCH" >>> +WICVARS += "DISTRO DISTRO_ARCH MACHINE" >>> >>> python do_rootfs_wicenv () { >>> wicvars = d.getVar('WICVARS') >>> > -- Siemens AG, Technology Linux Expert Center ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-04-15 13:19 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2024-03-28 7:54 [PATCH] image.bbclass: copy dtbs into a deploydir/subdirectory based on the image name nicusor.huhulea 2024-03-28 16:28 ` Gylstorff Quirin 2024-03-28 16:31 ` Gylstorff Quirin 2024-03-28 17:53 ` Gylstorff Quirin 2024-03-28 19:05 ` nicusor.huhulea 2024-04-08 8:12 ` Gylstorff Quirin 2024-04-12 14:11 ` nicusor.huhulea 2024-04-15 13:11 ` nicusor.huhulea 2024-04-15 13:19 ` Jan Kiszka
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox