Skip to contentSkip to conversation

toolchain-scripts.bbclass: customize prompt string for SDKs

PATCH New kai 1 participant 2 messages Mar 1, 2021 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

kai

author
#1 lore raw

PATCH v3 1/2 toolchain-scripts.bbclass: customize prompt string for SDKs

From: Kai Kang <[email protected]>

Introduce a new variable SDK_PS1 to customize prompt string for SDKs when source script environment-setup-script. If variable SDK_PS1 is not set or empty, nothing changed. Otherwise new PS1 with the value of SDK_PS1 is used after source the sdk environment file.

---
 meta/classes/toolchain-scripts.bbclass | 3 +++
 1 file changed, 3 insertions(+)
meta/classes/toolchain-scripts.bbclass +3 -0
index db1d3215ef..67a812cb02 100644
@@ -8,6 +8,8 @@ TARGET_CC_ARCH_append_libc-musl = " -mmusl"
 # default debug prefix map isn't valid in the SDK
 DEBUG_PREFIX_MAP = ""
 
+EXPORT_SDK_PS1 = "${@ 'export PS1=\'%s\'' % d.getVar('SDK_PS1') if d.getVar('SDK_PS1') else ''}"
+
 # This function creates an environment-setup-script for use in a deployable SDK
 toolchain_create_sdk_env_script () {
 	# Create environment setup script.  Remember that $SDKTARGETSYSROOT should
@@ -39,6 +41,7 @@ toolchain_create_sdk_env_script () {
 	echo '    return 1' >> $script
 	echo 'fi' >> $script
 
+	echo "${EXPORT_SDK_PS1}" >> $script
 	echo 'export SDKTARGETSYSROOT='"$sysroot" >> $script
 	EXTRAPATH=""
 	for i in ${CANADIANEXTRAOS}; do
Signature · 1 line
2.17.1
author
#2 lore raw

PATCH v3 2/2 local.conf.sample.extended: sample value for SDk_PS1

From: Kai Kang <[email protected]>

Provides a sample default value for SDk_PS1 in
local.conf.sample.extended. It will look like:

poky-glibc-x86_64--cortexa57-qemuarm64-pokysdk:$

---
 meta-poky/conf/local.conf.sample.extended | 5 +++++
 1 file changed, 5 insertions(+)
meta-poky/conf/local.conf.sample.extended +5 -0
index ba1d0973b5..c241caa869 100644
@@ -390,3 +390,8 @@ DISTRO_FEATURES_remove = "x11"
 #
 #require conf/distro/include/lto.inc
 #DISTRO_FEATURES_append = " lto"
+
+#
+# Set PS1 for SDK
+#
+#SDK_PS1 ?= "${SDK_NAME}${SDK_VENDOR}:\$ "
Signature · 1 line
2.17.1