[1/3] Revert "prefix DTB files with PN in deploy dir"

Message ID 20260423121941.1704827-1-wzh@ilbers.de
State Under Review
Headers show
Series [1/3] Revert "prefix DTB files with PN in deploy dir" | expand

Commit Message

Zhihang Wei April 23, 2026, 12:19 p.m. UTC
This reverts commit 8c34bb25b800d2d0d32a5154f87252a199cd902e.

The approach of prefixing DTB filenames has proven difficult to adopt
for some downstream users. Additionally, a general solution is needed
not only for DTBs but also for other artifacts that could cause
conflicts in multiconfig builds. Therefore, the patch is reverted.

This revert may re-introduce the do_copy_boot_files error for
DTBs with identical names belonging to different multiconfig targets.

Signed-off-by: Zhihang Wei <wzh@ilbers.de>
---
 RECIPE-API-CHANGELOG.md                       | 20 -------------------
 meta/classes-recipe/image.bbclass             |  6 ++----
 meta/classes-recipe/imagetypes_wic.bbclass    |  2 +-
 .../wic/plugins/source/bootimg-efi-isar.py    |  3 +--
 4 files changed, 4 insertions(+), 27 deletions(-)

Patch

diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
index 856da5de..0e6a3172 100644
--- a/RECIPE-API-CHANGELOG.md
+++ b/RECIPE-API-CHANGELOG.md
@@ -981,23 +981,3 @@  fragment, this can be specified via adding `${S}/path/to/fragment.cfg` to
 `KERNEL_CONFIG_FRAGMENTS`. If a fragment was checked out into ${WORKDIR} as
 part of a repository, a tarball, or some other directory structure, just
 specify it relative to ${WORKDIR} in `KERNEL_CONFIG_FRAGMENTS`.
-
-Changes in next
----------------
-
-### Prefix DTB file names when deploying
-
-DTB files are now placed in the ${DEPLOY_DIR_IMAGE} with a prefix of
-${PN}-${DISTRO}. During wic imaging, the prefix is removed again, so no changes
-to downstream wks files are needed (i.e. `dtb=my-device-tree.dtb` is not
-affected by this change). Custom imaging plugins need to be adapted to this
-change by removing the prefix from the filename. For that, the variable
-DTB_PREFIX is exported as bitbake var into wic environment.
-
-This fixes errors when building different distros with the same machine,
-whereby previously the following error occured:
-
-do_copy_boot_files: The recipe isar-image-base is trying to install
-files into a shared area when those files already exists. It happens
-when some files have the same names (e.g., dtb files) for different
-distros.
diff --git a/meta/classes-recipe/image.bbclass b/meta/classes-recipe/image.bbclass
index 9b5dd23e..26a4ec06 100644
--- a/meta/classes-recipe/image.bbclass
+++ b/meta/classes-recipe/image.bbclass
@@ -379,8 +379,7 @@  EOF
 KERNEL_IMG = "${PP_DEPLOY}/${KERNEL_IMAGE}"
 INITRD_IMG = "${PP_DEPLOY}/${INITRD_DEPLOY_FILE}"
 # only one dtb file supported, pick the first
-DTB_PREFIX = "${PN}-${DISTRO}."
-DTB_IMG = "${PP_DEPLOY}/${DTB_PREFIX}${@os.path.basename((d.getVar('DTB_FILES').split() or [''])[0])}"
+DTB_IMG = "${PP_DEPLOY}/${@(d.getVar('DTB_FILES').split() or [''])[0]}"
 
 do_copy_boot_files[cleandirs] += "${DEPLOYDIR}"
 do_copy_boot_files[sstate-inputdirs] = "${DEPLOYDIR}"
@@ -403,8 +402,7 @@  do_copy_boot_files() {
             die "${file} not found"
         fi
 
-        dtb_name=$(basename "$dtb")
-        cp -f "$dtb" "${DEPLOYDIR}/${DTB_PREFIX}$dtb_name"
+        cp -f "$dtb" "${DEPLOYDIR}/"
     done
 }
 addtask copy_boot_files before do_rootfs_postprocess after do_rootfs_install
diff --git a/meta/classes-recipe/imagetypes_wic.bbclass b/meta/classes-recipe/imagetypes_wic.bbclass
index c0813223..dd6c501d 100644
--- a/meta/classes-recipe/imagetypes_wic.bbclass
+++ b/meta/classes-recipe/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 KERNEL_FILE MACHINE DTB_PREFIX"
+WICVARS += "DISTRO DISTRO_ARCH KERNEL_FILE MACHINE"
 
 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 32b220fa..6bc78d42 100644
--- a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
+++ b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
@@ -57,8 +57,7 @@  class BootimgEFIPlugin(SourcePlugin):
         if dtb:
             if ';' in dtb:
                 raise WicError("Only one DTB supported, exiting")
-            dtb_file = "%s%s" % (get_bitbake_var("DTB_PREFIX"), dtb)
-            cp_cmd = "cp %s/%s %s/%s" % (bootimg_dir, dtb_file, hdddir, dtb)
+            cp_cmd = "cp %s/%s %s" % (bootimg_dir, dtb, hdddir)
             exec_cmd(cp_cmd, True)
 
     @classmethod