From: Alexander Dahl <ada@thorsis.com>
To: ptxdist@pengutronix.de
Cc: Michael Riesch <michael.riesch@wolfvision.net>
Subject: [ptxdist] [PATCH 4/4] ptxd_make_world_inject: Introduce separate destination directory
Date: Wed, 24 Apr 2024 16:31:09 +0200 [thread overview]
Message-ID: <20240424143109.277373-5-ada@thorsis.com> (raw)
In-Reply-To: <20240424143109.277373-1-ada@thorsis.com>
Setting the optional <PKG>_INJECT_DEST now allows to give a different
target for putting the binary blobs into. When building out-of-tree
some bootloaders like U-Boot expect injected files in the build dir, not
in the source dir. Backwards compatibility is ensured, the source dir
is still the default, the new inject dest is optional and in case set it
overwrites the default.
For using this in u-boot package, on top of the things already done to
use the inject mechanism in general, add this line to
'rules/u-boot.make' for example:
U_BOOT_INJECT_DEST := $(U_BOOT_BUILD_DIR)
Signed-off-by: Alexander Dahl <ada@thorsis.com>
---
rules/post/ptxd_make_world_inject.make | 3 ++-
scripts/lib/ptxd_make_world_inject.sh | 22 ++++++++++++++++++----
2 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/rules/post/ptxd_make_world_inject.make b/rules/post/ptxd_make_world_inject.make
index eabcdd052..509d480ba 100644
--- a/rules/post/ptxd_make_world_inject.make
+++ b/rules/post/ptxd_make_world_inject.make
@@ -9,7 +9,8 @@
world/inject/env = \
$(call world/env, $(1)) \
pkg_inject_path="$(call ptx/escape,$($(1)_INJECT_PATH))" \
- pkg_inject_files="$(call ptx/escape,$($(1)_INJECT_FILES))"
+ pkg_inject_files="$(call ptx/escape,$($(1)_INJECT_FILES))" \
+ pkg_inject_dest="$(call ptx/escape,$($(1)_INJECT_DEST))"
world/inject = \
$(call world/inject/env,$(strip $(1))) \
diff --git a/scripts/lib/ptxd_make_world_inject.sh b/scripts/lib/ptxd_make_world_inject.sh
index b74e464c6..90bd8b684 100644
--- a/scripts/lib/ptxd_make_world_inject.sh
+++ b/scripts/lib/ptxd_make_world_inject.sh
@@ -7,10 +7,15 @@
#
ptxd_make_inject() {
- local source target
+ local dest source target
+
+ dest="${pkg_dir}"
+ if [ -n "${pkg_inject_dest}" ]; then
+ dest="${pkg_inject_dest}"
+ fi
source="$(echo ${inject_file} | cut -d ":" -f 1)"
- target="${pkg_dir}/$(echo ${inject_file} | cut -d ":" -f 2)"
+ target="${dest}/$(echo ${inject_file} | cut -d ":" -f 2)"
if [[ "${source}" =~ ^/.* ]]; then
ptxd_bailout "'${source}' must not be an absolute path!" \
@@ -32,8 +37,17 @@ export -f ptxd_make_inject
ptxd_make_world_inject() {
ptxd_make_world_init || return
- if [ -z "${pkg_dir}" ]; then
- ptxd_bailout "<PKG>_DIR empty, no destination to inject to."
+ if [ -z "${pkg_inject_dest}" ] && [ -z "${pkg_dir}" ]; then
+ ptxd_bailout "No destination to inject to." \
+ "Set either <PKG>_DIR or <PKG>_INJECT_DEST to have a valid destination!"
+ fi
+
+ if [ -n "${pkg_inject_dest}" ]; then
+ if [ "${pkg_build_dir}" = "${pkg_inject_dest}" ] && [ "${pkg_build_oot}" = "YES" ]; then
+ ptxd_warning "<PKG>_INJECT_DEST is set to <PKG>_BUILD_DIR and <PKG>_BUILD_OOT is set to 'YES'." \
+ "If you called world/inject before world/prepare your files will be removed after injecting."
+ fi
+ mkdir -p -- "${pkg_inject_dest}"
fi
for inject_file in ${pkg_inject_files}; do
--
2.39.2
next prev parent reply other threads:[~2024-04-24 14:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-24 14:31 [ptxdist] [PATCH 0/4] ptxd_make_world_inject: Spring cleanup and optional dest dir Alexander Dahl
2024-04-24 14:31 ` [ptxdist] [PATCH 1/4] ptxd_make_world_inject: Remove useless test Alexander Dahl
2024-04-24 14:31 ` [ptxdist] [PATCH 2/4] ptxd_make_world_inject: Use <PKG>_DIR directly Alexander Dahl
2024-04-24 14:31 ` [ptxdist] [PATCH 3/4] ptxd_make_world_inject: Escape inject path and files Alexander Dahl
2024-04-24 14:31 ` Alexander Dahl [this message]
2024-05-03 9:48 ` [ptxdist] [PATCH 4/4] ptxd_make_world_inject: Introduce separate destination directory Michael Olbrich
2024-05-03 10:08 ` Alexander Dahl
2024-05-03 15:31 ` Michael Olbrich
2024-05-03 16:05 ` Alexander Dahl
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=20240424143109.277373-5-ada@thorsis.com \
--to=ada@thorsis.com \
--cc=michael.riesch@wolfvision.net \
--cc=ptxdist@pengutronix.de \
/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