Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Harish.Sadineni@windriver.com
To: openembedded-core@lists.openembedded.org
Cc: Sundeep.Kokkonda@windriver.com
Subject: [PATCH v2 2/3] toolchain-scripts: source target-specific environment setup scripts
Date: Fri,  7 Aug 2026 02:31:15 -0700	[thread overview]
Message-ID: <20260807093116.3680514-2-Harish.Sadineni@windriver.com> (raw)
In-Reply-To: <20260807093116.3680514-1-Harish.Sadineni@windriver.com>

From: Harish Sadineni <Harish.Sadineni@windriver.com>

YOCTO [#15061]

Export `OECORE_TARGET_SYS` in the generated SDK and tree environment
setup scripts, and source any `*.sh` files from
`environment-setup.d/${TARGET_SYS}` in addition to the existing
`environment-setup.d` directory.

This complements the rust-cross-canadian changes, where Rust
environment setup scripts are installed under a target-specific
directory. By sourcing only the scripts that match the active target,
the SDK avoids loading environment settings for other target variants,
such as mixing 32-bit and 64-bit configurations in multilib SDKs.

Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
 meta/classes-recipe/toolchain-scripts.bbclass | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/meta/classes-recipe/toolchain-scripts.bbclass b/meta/classes-recipe/toolchain-scripts.bbclass
index d94dcdee39..f0f599959d 100644
--- a/meta/classes-recipe/toolchain-scripts.bbclass
+++ b/meta/classes-recipe/toolchain-scripts.bbclass
@@ -76,6 +76,7 @@ toolchain_create_sdk_env_script () {
 	echo 'export OECORE_MESON_HOST_CPU_FAMILY="${@meson_cpu_family('TARGET_ARCH', d)}"' >>$script
 	echo 'export OECORE_MESON_HOST_CPU="${TARGET_ARCH}"' >>$script
 	echo 'export OECORE_MESON_HOST_ENDIAN="${@meson_endian('TARGET', d)}"' >>$script
+	echo 'export OECORE_TARGET_SYS="${TARGET_SYS}"' >> $script
 
 	echo 'unset command_not_found_handle' >> $script
 
@@ -110,6 +111,7 @@ toolchain_create_tree_env_script () {
 	echo 'export OECORE_MESON_HOST_CPU_FAMILY="${@meson_cpu_family('TARGET_ARCH', d)}"' >>$script
 	echo 'export OECORE_MESON_HOST_CPU="${TARGET_ARCH}"' >>$script
 	echo 'export OECORE_MESON_HOST_ENDIAN="${@meson_endian('TARGET', d)}"' >>$script
+        echo 'export OECORE_TARGET_SYS="${TARGET_SYS}"' >> $script
 
 	toolchain_shared_env_script
 
@@ -172,6 +174,12 @@ if [ -d "\$OECORE_NATIVE_SYSROOT/environment-setup.d" ]; then
 	    . \$envfile
     done
 fi
+if [ -d "\$OECORE_NATIVE_SYSROOT/environment-setup.d/\$OECORE_TARGET_SYS" ]; then
+    for envfile in \$OECORE_NATIVE_SYSROOT/environment-setup.d/\$OECORE_TARGET_SYS/*.sh; do
+            . \$envfile
+    done
+fi
+
 EOF
 }
 
-- 
2.51.0



  reply	other threads:[~2026-08-07  9:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07  9:31 [PATCH v2 1/3] rust-cross-canadian: install target-specific env scripts and fix rustlib lookup Harish.Sadineni
2026-08-07  9:31 ` Harish.Sadineni [this message]
2026-08-07  9:31 ` [PATCH v2 3/3] oeqa/sdk/cases/rust.py: Expand test to verify cargo build builds for target Harish.Sadineni

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=20260807093116.3680514-2-Harish.Sadineni@windriver.com \
    --to=harish.sadineni@windriver.com \
    --cc=Sundeep.Kokkonda@windriver.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox