From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Fri, 03 May 2024 11:49:03 +0200 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1s2pXL-00H383-2m for lore@lore.pengutronix.de; Fri, 03 May 2024 11:49:03 +0200 Received: from localhost ([127.0.0.1] helo=metis.whiteo.stw.pengutronix.de) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1s2pXL-0000ui-7Y; Fri, 03 May 2024 11:49:03 +0200 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s2pXB-0000uW-Ao; Fri, 03 May 2024 11:48:53 +0200 Received: from [2a0a:edc0:0:1101:1d::54] (helo=dude05.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s2pXA-00Fg5I-PZ; Fri, 03 May 2024 11:48:52 +0200 Received: from mol by dude05.red.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1s2pXA-0054xq-2O; Fri, 03 May 2024 11:48:52 +0200 Date: Fri, 3 May 2024 11:48:52 +0200 From: Michael Olbrich To: Alexander Dahl Message-ID: Mail-Followup-To: Alexander Dahl , ptxdist@pengutronix.de, Michael Riesch References: <20240424143109.277373-1-ada@thorsis.com> <20240424143109.277373-5-ada@thorsis.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240424143109.277373-5-ada@thorsis.com> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain Subject: Re: [ptxdist] [PATCH 4/4] ptxd_make_world_inject: Introduce separate destination directory X-BeenThere: ptxdist@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Cc: ptxdist@pengutronix.de, Michael Riesch Sender: "ptxdist" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: ptxdist-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false On Wed, Apr 24, 2024 at 04:31:09PM +0200, Alexander Dahl wrote: > Setting the optional _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) Can you add a patch for u-boot? > > Signed-off-by: Alexander Dahl > --- > 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 This should be in ptxd_make_world_inject(). It remains the same for all files. > > 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 "_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 _DIR or _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 This gives a warning even in the good case, right? I think we should require that pkg_inject_dest already exists at this point and fail if it does not. Michael > + ptxd_warning "_INJECT_DEST is set to _BUILD_DIR and _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 > > > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |