All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Jansa <martin.jansa@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Martin Jansa <Martin.Jansa@gmail.com>
Subject: [PATCH 2/2] kernel-devicetree: install dtb files without -${KERNEL_DTB_NAME} suffix
Date: Thu, 25 May 2023 12:22:18 +0200	[thread overview]
Message-ID: <20230525102218.1613298-2-Martin.Jansa@gmail.com> (raw)
In-Reply-To: <20230525102218.1613298-1-Martin.Jansa@gmail.com>

* we were installing them with -${KERNEL_DTB_NAME} suffix
  and then adding a symlink without this suffix if
  KERNEL_IMAGETYPE_SYMLINK is set:
  if [ "${KERNEL_IMAGETYPE_SYMLINK}" = "1" ] ; then
    ln -sf $dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext $deployDir/$dtb_base_name.$dtb_ext
  fi

  and another one when KERNEL_DTB_LINK_NAME is set:
  if [ -n "${KERNEL_DTB_LINK_NAME}" ] ; then
    ln -sf $dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext $deployDir/$dtb_base_name-${KERNEL_DTB_LINK_NAME}.$dtb_ext
  fi

  but KERNEL_DEVICETREE variable doesn't include this
  -${KERNEL_DTB_NAME} suffix, so everything which uses KERNEL_DEVICETREE
  either needs to add it as well or depend on KERNEL_IMAGETYPE_SYMLINK
  being set, e.g. IMAGE_BOOT_FILES variable used by do_image_wic is
  generated by make_dtb_boot_files function here:
  https://github.com/agherzan/meta-raspberrypi/blob/2ad4dd667affb72bdbbc2d6b5f7b50589f506b31/conf/machine/include/rpi-base.inc#L118
  and do_image_wic fails without KERNEL_IMAGETYPE_SYMLINK:
  | WARNING: bootloader config not specified, using defaults
  |
  | ERROR: _exec_cmd: install -m 0644 -D deploy/images/raspberrypi4-64/bcm2711-rpi-4-b.dtb image/1.0-r1/tmp-wic/boot.1/bcm2711-rpi-4-b.dtb returned '1' instead of 0
  | output: install: cannot stat 'deploy/images/raspberrypi4-64/bcm2711-rpi-4-b.dtb': No such file or directory

  we can fix the function to append -${KERNEL_DTB_NAME} or we can
  change this to install without suffix and then add ${KERNEL_DTB_NAME}
  link only when KERNEL_DTB_NAME is set (${MACHINE} by default)

* now it looks strange to have both KERNEL_DTB_LINK_NAME and KERNEL_DTB_NAME
  symlinks, but keep it for backwards compatibility and it will make
  more sense again together with the rest of [YOCTO #12937] where version
  specific *_LINK_NAME links are created as hardlinks in separate do_deploy_links
  task.

[YOCTO #12937]

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 meta/classes-recipe/kernel-devicetree.bbclass | 28 ++++++++++++-------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/meta/classes-recipe/kernel-devicetree.bbclass b/meta/classes-recipe/kernel-devicetree.bbclass
index b3bae32f9e..7ccf4b76c8 100644
--- a/meta/classes-recipe/kernel-devicetree.bbclass
+++ b/meta/classes-recipe/kernel-devicetree.bbclass
@@ -100,28 +100,36 @@ do_deploy:append() {
 		if "${@'false' if oe.types.boolean(d.getVar('KERNEL_DTBVENDORED')) else 'true'}"; then
 			dtb=$dtb_base_name.$dtb_ext
 		fi
-		install -m 0644 ${D}/${KERNEL_DTBDEST}/$dtb $deployDir/$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext
-		if [ "${KERNEL_IMAGETYPE_SYMLINK}" = "1" ] ; then
-			ln -sf $dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext $deployDir/$dtb_base_name.$dtb_ext
+		install -m 0644 ${D}/${KERNEL_DTBDEST}/$dtb $deployDir/$dtb_base_name.$dtb_ext
+		if [ -n "${KERNEL_DTB_NAME}" ] ; then
+			ln -sf $dtb_base_name.$dtb_ext $deployDir/$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext
 		fi
 		if [ -n "${KERNEL_DTB_LINK_NAME}" ] ; then
-			ln -sf $dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext $deployDir/$dtb_base_name-${KERNEL_DTB_LINK_NAME}.$dtb_ext
+			ln -sf $dtb_base_name.$dtb_ext $deployDir/$dtb_base_name-${KERNEL_DTB_LINK_NAME}.$dtb_ext
 		fi
 		for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
 			if [ "$type" = "zImage" ] && [ "${KERNEL_DEVICETREE_BUNDLE}" = "1" ]; then
 				cat ${D}/${KERNEL_IMAGEDEST}/$type \
-					$deployDir/$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext \
-					> $deployDir/$type-$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT}
+					$deployDir/$dtb_base_name.$dtb_ext \
+					> $deployDir/$type-$dtb_base_name.$dtb_ext${KERNEL_DTB_BIN_EXT}
+				if [ -n "${KERNEL_DTB_NAME}" ]; then
+					ln -sf $type-$dtb_base_name.$dtb_ext${KERNEL_DTB_BIN_EXT} \
+						$deployDir/$type-$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT}
+				fi
 				if [ -n "${KERNEL_DTB_LINK_NAME}" ]; then
-					ln -sf $type-$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT} \
+					ln -sf $type-$dtb_base_name.$dtb_ext${KERNEL_DTB_BIN_EXT} \
 						$deployDir/$type-$dtb_base_name-${KERNEL_DTB_LINK_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT}
 				fi
 				if [ -e "${KERNEL_OUTPUT_DIR}/${type}.initramfs" ]; then
 					cat ${KERNEL_OUTPUT_DIR}/${type}.initramfs \
-						$deployDir/$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext \
-						>  $deployDir/${type}-${INITRAMFS_NAME}-$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT}
+						$deployDir/$dtb_base_name.$dtb_ext \
+						>  $deployDir/${type}-${INITRAMFS_NAME}-$dtb_base_name.$dtb_ext${KERNEL_DTB_BIN_EXT}
+					if [ -n "${KERNEL_DTB_NAME}" ]; then
+						ln -sf ${type}-${INITRAMFS_NAME}-$dtb_base_name.$dtb_ext${KERNEL_DTB_BIN_EXT} \
+							$deployDir/${type}-${INITRAMFS_NAME}-$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT}
+					fi
 					if [ -n "${KERNEL_DTB_LINK_NAME}" ]; then
-						ln -sf ${type}-${INITRAMFS_NAME}-$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT} \
+						ln -sf ${type}-${INITRAMFS_NAME}-$dtb_base_name.$dtb_ext${KERNEL_DTB_BIN_EXT} \
 							$deployDir/${type}-${INITRAMFS_NAME}-$dtb_base_name-${KERNEL_DTB_LINK_NAME}.$dtb_ext${KERNEL_DTB_BIN_EXT}
 					fi
 				fi
-- 
2.40.1



  reply	other threads:[~2023-05-25 10:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-25 10:22 [PATCH 1/2] image-artifact-names: include ${IMAGE_NAME_SUFFIX} directly in both ${IMAGE_NAME} and ${IMAGE_LINK_NAME} Martin Jansa
2023-05-25 10:22 ` Martin Jansa [this message]
2023-05-26 18:09 ` [OE-core] " Alexandre Belloni
2023-05-27  5:21   ` Martin Jansa
2023-05-27  5:49   ` [PATCH] selftest: wic.py respect IMAGE_LINK_NAME Martin Jansa
     [not found]   ` <1762E887A919FB5A.6918@lists.openembedded.org>
2023-06-12 15:35     ` [OE-core] [PATCH 1/2] image-artifact-names: include ${IMAGE_NAME_SUFFIX} directly in both ${IMAGE_NAME} and ${IMAGE_LINK_NAME} Martin Jansa
2023-06-12 16:17       ` Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230525102218.1613298-2-Martin.Jansa@gmail.com \
    --to=martin.jansa@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.