Skip to contentSkip to conversation

poky: kirkstone: eSDK: fix build-in eSDK environment file generation

PATCH NAK Alberto Merciai 2 participants 2 messages Nov 22, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 poky: kirkstone: eSDK: fix build-in eSDK environment file generation

From: amerciai <[email protected]>

- Following Setting up the Extensible SDK environment directly in a Yocto build
https://docs.yoctoproject.org/4.0.14/sdk-manual/extensible.html#setting-up-the-extensible-sdk-environment-directly-in-a-yocto-build
The generated environment file does not point to the
correct sysroot folder, then the end user is not able
to cross-compile by sourcing the file.

- The same for kirkstone-4.0.10

- By analyzing
https://lore.kernel.org/all/[email protected]/T/#m7eadf6c722410f5b233ebba9fc700a895af9f052
I found that changes apllied to
meta/classes/toolchain-scripts.bbclass
solve the issue.

meta/classes/toolchain-scripts.bbclass +15 -7
index d735d434e6..ec50a1efa0 100644
@@ -70,15 +70,23 @@ toolchain_create_tree_env_script () {
 	script=${TMPDIR}/environment-setup-${REAL_MULTIMACH_TARGET_SYS}
 	rm -f $script
 	touch $script
+	echo 'standalone_sysroot_target="${STAGING_DIR}/${MACHINE}"' >> $script
+	echo 'standalone_sysroot_native="${STAGING_DIR}/${BUILD_ARCH}"' >> $script
 	echo 'orig=`pwd`; cd ${COREBASE}; . ./oe-init-build-env ${TOPDIR}; cd $orig' >> $script
-	echo 'export PATH=${STAGING_DIR_NATIVE}/usr/bin:${STAGING_BINDIR_TOOLCHAIN}:$PATH' >> $script
-	echo 'export PKG_CONFIG_SYSROOT_DIR=${PKG_CONFIG_SYSROOT_DIR}' >> $script
-	echo 'export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}' >> $script
+
+	echo 'export PATH=$standalone_sysroot_native/${bindir_native}:$standalone_sysroot_native/${bindir_native}/${TARGET_SYS}:$PATH' >> $script
+	echo 'export PKG_CONFIG_SYSROOT_DIR=$standalone_sysroot_target' >> $script
+	echo 'export PKG_CONFIG_PATH=$standalone_sysroot_target'"$libdir"'/pkgconfig:$standalone_sysroot_target'"$prefix"'/share/pkgconfig' >> $script
+
 	echo 'export CONFIG_SITE="${CONFIG_SITE}"' >> $script
-	echo 'export SDKTARGETSYSROOT=${STAGING_DIR_TARGET}' >> $script
-	echo 'export OECORE_NATIVE_SYSROOT="${STAGING_DIR_NATIVE}"' >> $script
-	echo 'export OECORE_TARGET_SYSROOT="${STAGING_DIR_TARGET}"' >> $script
-	echo 'export OECORE_ACLOCAL_OPTS="-I ${STAGING_DIR_NATIVE}/usr/share/aclocal"' >> $script
+
+	echo 'export SDKTARGETSYSROOT=$standalone_sysroot_target' >> $script
+	echo 'export OECORE_NATIVE_SYSROOT=$standalone_sysroot_native' >> $script
+	echo 'export OECORE_TARGET_SYSROOT=$standalone_sysroot_target' >> $script
+	echo 'export OECORE_ACLOCAL_OPTS="-I $standalone_sysroot_native/usr/share/aclocal"' >> $script
+	echo 'export OECORE_BASELIB="${baselib}"' >> $script
+	echo 'export OECORE_TARGET_ARCH="${TARGET_ARCH}"' >>$script
+	echo 'export OECORE_TARGET_OS="${TARGET_OS}"' >>$script
 
 	toolchain_shared_env_script
 }
Signature · 1 line
2.34.1
#1 lore raw

There is still no description of how to observe the issue, no answer to my question, and I did not suggest any of this at any point (I had to go and check - some of my old patches were used as a reference, this is not the same as Suggested-by).

NACK.

Alex

Quoted 58 lines · Alberto Merciai

From: amerciai <[email protected]>

- Following Setting up the Extensible SDK environment directly in a Yocto build
https://docs.yoctoproject.org/4.0.14/sdk-manual/extensible.html#setting-up-the-extensible-sdk-environment-directly-in-a-yocto-build
The generated environment file does not point to the
correct sysroot folder, then the end user is not able
to cross-compile by sourcing the file.

- The same for kirkstone-4.0.10

- By analyzing
https://lore.kernel.org/all/[email protected]/T/#m7eadf6c722410f5b233ebba9fc700a895af9f052
I found that changes apllied to
meta/classes/toolchain-scripts.bbclass
solve the issue.

meta/classes/toolchain-scripts.bbclass +15 -8
index d735d434e6..ec50a1efa0 100644
@@ -70,15 +70,23 @@ toolchain_create_tree_env_script () {
        script=${TMPDIR}/environment-setup-${REAL_MULTIMACH_TARGET_SYS}
        rm -f $script
        touch $script
+       echo 'standalone_sysroot_target="${STAGING_DIR}/${MACHINE}"' >> $script
+       echo 'standalone_sysroot_native="${STAGING_DIR}/${BUILD_ARCH}"' >> $script
        echo 'orig=`pwd`; cd ${COREBASE}; . ./oe-init-build-env ${TOPDIR}; cd $orig' >> $script
-       echo 'export PATH=${STAGING_DIR_NATIVE}/usr/bin:${STAGING_BINDIR_TOOLCHAIN}:$PATH' >> $script
-       echo 'export PKG_CONFIG_SYSROOT_DIR=${PKG_CONFIG_SYSROOT_DIR}' >> $script
-       echo 'export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}' >> $script
+
+       echo 'export PATH=$standalone_sysroot_native/${bindir_native}:$standalone_sysroot_native/${bindir_native}/${TARGET_SYS}:$PATH' >> $script
+       echo 'export PKG_CONFIG_SYSROOT_DIR=$standalone_sysroot_target' >> $script
+       echo 'export PKG_CONFIG_PATH=$standalone_sysroot_target'"$libdir"'/pkgconfig:$standalone_sysroot_target'"$prefix"'/share/pkgconfig' >> $script
+
        echo 'export CONFIG_SITE="${CONFIG_SITE}"' >> $script
-       echo 'export SDKTARGETSYSROOT=${STAGING_DIR_TARGET}' >> $script
-       echo 'export OECORE_NATIVE_SYSROOT="${STAGING_DIR_NATIVE}"' >> $script
-       echo 'export OECORE_TARGET_SYSROOT="${STAGING_DIR_TARGET}"' >> $script
-       echo 'export OECORE_ACLOCAL_OPTS="-I ${STAGING_DIR_NATIVE}/usr/share/aclocal"' >> $script
+
+       echo 'export SDKTARGETSYSROOT=$standalone_sysroot_target' >> $script
+       echo 'export OECORE_NATIVE_SYSROOT=$standalone_sysroot_native' >> $script
+       echo 'export OECORE_TARGET_SYSROOT=$standalone_sysroot_target' >> $script
+       echo 'export OECORE_ACLOCAL_OPTS="-I $standalone_sysroot_native/usr/share/aclocal"' >> $script
+       echo 'export OECORE_BASELIB="${baselib}"' >> $script
+       echo 'export OECORE_TARGET_ARCH="${TARGET_ARCH}"' >>$script
+       echo 'export OECORE_TARGET_OS="${TARGET_OS}"' >>$script
 
        toolchain_shared_env_script
 }
--

2.34.1