Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Jamin Lin <jamin_lin@aspeedtech.com>
To: <openembedded-core@lists.openembedded.org>
Cc: <troy_lee@aspeedtech.com>, <jamin_lin@aspeedtech.com>
Subject: [PATCH v1 1/2] uboot-sign: Avoid symlink and install errors when SPL DTB is missing
Date: Fri, 6 Jun 2025 15:19:14 +0800	[thread overview]
Message-ID: <20250606071915.2680182-2-jamin_lin@aspeedtech.com> (raw)
In-Reply-To: <20250606071915.2680182-1-jamin_lin@aspeedtech.com>

Fix potential errors during do_deploy and deploy_spl_dtb when SPL_DTB_BINARY or
SPL_BINARY is not present.

Wrapped install command in deploy_spl_dtb() with a file existence check.
Improved condition in do_deploy to check for actual existence of
${SPL_DIR}/${SPL_DTB_BINARY} instead of only relying on variable non-emptiness.
Prevents "install: missing destination file operand" and invalid symlink
creation.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
 meta/classes-recipe/uboot-sign.bbclass | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/meta/classes-recipe/uboot-sign.bbclass b/meta/classes-recipe/uboot-sign.bbclass
index 73e9ce3f11..6ee1874cd6 100644
--- a/meta/classes-recipe/uboot-sign.bbclass
+++ b/meta/classes-recipe/uboot-sign.bbclass
@@ -275,7 +275,9 @@ deploy_spl_dtb() {
 	fi
 
 	# For backwards compatibility...
-	install -Dm644 ${SPL_BINARY} ${DEPLOYDIR}/${SPL_IMAGE}
+	if [ -e "${SPL_BINARY}" ]; then
+		install -Dm644 ${SPL_BINARY} ${DEPLOYDIR}/${SPL_IMAGE}
+	fi
 }
 
 do_uboot_generate_rsa_keys() {
@@ -600,7 +602,7 @@ do_deploy:prepend() {
 		ln -sf ${UBOOT_FITIMAGE_IMAGE} ${DEPLOYDIR}/${UBOOT_FITIMAGE_SYMLINK}
 	fi
 
-	if [ "${SPL_SIGN_ENABLE}" = "1" -a -n "${SPL_DTB_BINARY}" ] ; then
+	if [ "${SPL_SIGN_ENABLE}" = "1" -a -e "${SPL_DIR}/${SPL_DTB_BINARY}" ] ; then
 		ln -sf ${SPL_DTB_IMAGE} ${DEPLOYDIR}/${SPL_DTB_SYMLINK}
 		ln -sf ${SPL_DTB_IMAGE} ${DEPLOYDIR}/${SPL_DTB_BINARY}
 		ln -sf ${SPL_NODTB_IMAGE} ${DEPLOYDIR}/${SPL_NODTB_SYMLINK}
-- 
2.43.0



  reply	other threads:[~2025-06-06  7:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-06  7:19 [PATCH v1 0/2] uboot-sign: Make SPL DTB public key injection optional Jamin Lin
2025-06-06  7:19 ` Jamin Lin [this message]
2025-06-12 11:10   ` [OE-core] [PATCH v1 1/2] uboot-sign: Avoid symlink and install errors when SPL DTB is missing Freihofer, Adrian
2025-06-13  2:24     ` Jamin Lin
2025-06-06  7:19 ` [PATCH v1 2/2] uboot-sign: Make SPL DTB public key injection optional Jamin Lin
2025-06-12 10:58   ` [OE-core] " Freihofer, Adrian
2025-06-13  2:08     ` Jamin Lin
2025-06-13 12:36       ` Freihofer, Adrian
2025-06-16  3:50         ` Jamin Lin
2025-06-16  9:16           ` Freihofer, Adrian
2025-06-17  8:17             ` Jamin Lin
2025-06-18 10:03               ` Freihofer, Adrian

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=20250606071915.2680182-2-jamin_lin@aspeedtech.com \
    --to=jamin_lin@aspeedtech.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=troy_lee@aspeedtech.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox