From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Mon, 06 May 2024 12:51:37 +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 1s3vwX-005wEU-0U for lore@lore.pengutronix.de; Mon, 06 May 2024 12:51:37 +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 1s3vwW-0000Ez-Mu; Mon, 06 May 2024 12:51:36 +0200 Received: from mail.thorsis.com ([217.92.40.78]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s3vvw-0008OF-4u for ptxdist@pengutronix.de; Mon, 06 May 2024 12:51:02 +0200 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id A98211487F9D; Mon, 6 May 2024 12:50:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thorsis.com; s=dkim; t=1714992659; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=kCWsTxja+FHCW29GnmwWieycse4gY/WrQD2yoJvEf8g=; b=k0pLYnQPfsDdogokoMmkXk180Yhty0tJk4NjWlWFAM+cDD06C9BiMvJJzt3NjU7XguM/9G fT99XKbrSia1jqw4KMGlUdouy+qNWM95+BgcRKy9qpYvTmXpMe8p/FB7hD3ChAfiFUaqgm Hx9r/jFsPH/5jMumm/sSeE/ZlUC8IJCyDWXbt7P0sgo18uelaywKAWPk3OA/DsiP2zfrwU E8T9G5LZXEjeGMakXt7+2HvQWzKZDsI4IQn8tqCU+mWxZ6ApGz4wqmrirSkUJWe8AByRLq nnqXgLeOPsrOPswijGIdYpHeEt04eCU9SMvGyit2FXoJ/j85OqHHMDYkp9QrCw== From: Alexander Dahl To: ptxdist@pengutronix.de Date: Mon, 6 May 2024 12:50:51 +0200 Message-Id: <20240506105051.323546-5-ada@thorsis.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240506105051.323546-1-ada@thorsis.com> References: <20240506105051.323546-1-ada@thorsis.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Last-TLS-Session-Version: TLSv1.3 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on metis.whiteo.stw.pengutronix.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=4.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Subject: [ptxdist] [PATCH v2 4/4] ptxd_make_world_inject: Introduce new variable _INJECT_OOT 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: 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 Setting the new variable to 'YES' allows to inject into _BUILD_DIR instead of _DIR as before. 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 old inject mechanism in general, add this line to 'rules/u-boot.make' for example: U_BOOT_INJECT_OOT := YES Signed-off-by: Alexander Dahl --- Notes: v2: - dropped the previous approach with the more flexible _INJECT_DEST - reworked the whole logic to use new _INJECT_OOT variable v1: - implicit rules/post/ptxd_make_world_inject.make | 3 ++- scripts/lib/ptxd_make_world_inject.sh | 23 ++++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/rules/post/ptxd_make_world_inject.make b/rules/post/ptxd_make_world_inject.make index eabcdd052..1e3979a2f 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_oot="$(call ptx/escape,$($(1)_INJECT_OOT))" 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..e8e94fbe6 100644 --- a/scripts/lib/ptxd_make_world_inject.sh +++ b/scripts/lib/ptxd_make_world_inject.sh @@ -10,7 +10,7 @@ ptxd_make_inject() { local source target source="$(echo ${inject_file} | cut -d ":" -f 1)" - target="${pkg_dir}/$(echo ${inject_file} | cut -d ":" -f 2)" + target="${inject_dest}/$(echo ${inject_file} | cut -d ":" -f 2)" if [[ "${source}" =~ ^/.* ]]; then ptxd_bailout "'${source}' must not be an absolute path!" \ @@ -32,8 +32,25 @@ 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_oot}" ]; then + pkg_inject_oot=NO + fi + + case "${pkg_inject_oot}" in + "YES") inject_dest="${pkg_build_dir}" ;; + "NO") inject_dest="${pkg_dir}" ;; + *) ptxd_bailout "_INJECT_OOT: please set to YES or NO" ;; + esac + + if [ "${pkg_build_oot:-NO}" = 'NO' ] && [ "${pkg_inject_oot}" != 'NO' ]; then + ptxd_warning "_BUILD_OOT and _INJECT_OOT contradict each other." \ + "Using $(ptxd_print_path ${inject_dest}) as inject destination anyways." + fi + + if [ ! -d "${inject_dest}" ]; then + ptxd_bailout " inject destination dir missing." \ + "Correct placement of world/inject depends on _BUILD_OOT and _INJECT_OOT." \ + "Check order of calls in prepare stage!" fi for inject_file in ${pkg_inject_files}; do -- 2.39.2