Skip to contentSkip to conversation

buildtools-tarball: unset OECORE_NATIVE_SYSROOT

PATCH In review [email protected] 2 participants 5 messages Jul 30, 2013 – Aug 2, 2013

lore
Share & tools
lore
#0 lore raw

cover buildtools-tarball: unset OECORE_NATIVE_SYSROOT

From: Chen Qi <[email protected]>

The following changes since commit 67864ca79da08df752487a3a4e1a975546da123d:

systemd: Remove systemd_unitdir if systemd is not in distro features (2013-07-24 11:35:39 +0100)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib ChenQi/buildtools-env
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/buildtools-env

Chen Qi (1):
buildtools-tarball: unset OECORE_NATIVE_SYSROOT

 meta/recipes-core/meta/buildtools-tarball.bb |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 buildtools-tarball: unset OECORE_NATIVE_SYSROOT

From: Chen Qi <[email protected]>

When building a qemu image inside the environment created by the buildtools-tarball, the qemu image cannot be started, as the runqemu script uses the tunctl binary which cannot be found inside the sysroot directory of the buildtools-tarball.

The buildtools-tarball is inherently a tool set instead of a fully functional SDK, so leaving the OECORE_NATIVE_SYSROOT variable in the environment will mess things up.

However, we do need a line of 'OECORE_NATIVE_SYSROOT=xxx' in the environment setup script so that the SDK can be extracted and relocated correctly.

That's why this patch unsets the variable instead of removing it from the environment setup script.

[YOCTO #4939]

---
 meta/recipes-core/meta/buildtools-tarball.bb |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
meta/recipes-core/meta/buildtools-tarball.bb +5 -1
index 9771497..1f8f142 100644
@@ -59,7 +59,11 @@ create_sdk_files_append () {
 	script=${1:-${SDK_OUTPUT}/${SDKPATH}/environment-setup-${SDK_SYS}}
 	touch $script
 	echo 'export PATH=${SDKPATHNATIVE}${bindir_nativesdk}:$PATH' >> $script
+	# OECORE_NATIVE_SYSROOT variable needs to be in $script so that the
+	# relocate script can find the ld-linux.so.
 	echo 'export OECORE_NATIVE_SYSROOT="${SDKPATHNATIVE}"' >> $script
-
+	# buildtools-tarball is inherently a tool set instead of a fully functional SDK.
+	# Leaving OECORE_NATIVE_SYSROOT in environment will mess things up.
+	echo 'unset OECORE_NATIVE_SYSROOT' >> $script
 	toolchain_create_sdk_version ${SDK_OUTPUT}/${SDKPATH}/version-${SDK_SYS}
 }
Signature · 1 line
1.7.9.5
#2 lore raw
Quoted 7 lines · On 07/29/2013 06:50 PM, [email protected] wrote:

From: Chen Qi <[email protected]>

When building a qemu image inside the environment created by the buildtools-tarball, the qemu image cannot be started, as the runqemu script uses the tunctl binary which cannot be found inside the sysroot directory of the buildtools-tarball.

Quoted 7 lines

The buildtools-tarball is inherently a tool set instead of a fully functional SDK, so leaving the OECORE_NATIVE_SYSROOT variable in the environment will mess things up.

However, we do need a line of 'OECORE_NATIVE_SYSROOT=xxx' in the environment setup script so that the SDK can be extracted and relocated correctly.

Where is this being processed, can could be done as a since comment in the the environment-setup script instead of exporting and unseting it?

Sau!

Quoted 28 lines

That's why this patch unsets the variable instead of removing it from the environment setup script.

[YOCTO #4939]

---
  meta/recipes-core/meta/buildtools-tarball.bb |    6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
meta/recipes-core/meta/buildtools-tarball.bb +5 -1
index 9771497..1f8f142 100644
@@ -59,7 +59,11 @@ create_sdk_files_append () {
  	script=${1:-${SDK_OUTPUT}/${SDKPATH}/environment-setup-${SDK_SYS}}
  	touch $script
  	echo 'export PATH=${SDKPATHNATIVE}${bindir_nativesdk}:$PATH' >> $script
+	# OECORE_NATIVE_SYSROOT variable needs to be in $script so that the
+	# relocate script can find the ld-linux.so.
  	echo 'export OECORE_NATIVE_SYSROOT="${SDKPATHNATIVE}"' >> $script
-
+	# buildtools-tarball is inherently a tool set instead of a fully functional SDK.
+	# Leaving OECORE_NATIVE_SYSROOT in environment will mess things up.
+	echo 'unset OECORE_NATIVE_SYSROOT' >> $script
  	toolchain_create_sdk_version ${SDK_OUTPUT}/${SDKPATH}/version-${SDK_SYS}
  }
author
#3 lore raw
Quoted 8 lines · Saul Wold
Quoted 7 lines · On 07/29/2013 06:50 PM, [email protected] wrote:

From: Chen Qi <[email protected]>

When building a qemu image inside the environment created by the buildtools-tarball, the qemu image cannot be started, as the runqemu script uses the tunctl binary which cannot be found inside the sysroot directory of the buildtools-tarball.

Quoted 9 lines
Quoted 7 lines

The buildtools-tarball is inherently a tool set instead of a fully functional SDK, so leaving the OECORE_NATIVE_SYSROOT variable in the environment will mess things up.

However, we do need a line of 'OECORE_NATIVE_SYSROOT=xxx' in the environment setup script so that the SDK can be extracted and relocated correctly.

Where is this being processed, can could be done as a since comment in the the environment-setup script instead of exporting and unseting it?

meta/classes/populate_sdk_base.bbclass

The self-extraction script needs to get the location of native sysroot. And it does so by grep 'OECORE_NATIVE_SYSROOT=' expression in $env_setup_script.

Please see more details below (code snippet from populate_sdk_base.bbclass).

chenqi@pek-qchen1-d1:~/poky$ grep -i oecore_native_sysroot meta/classes/populate_sdk_base.bbclass
native_sysroot=$($SUDO_EXEC cat $env_setup_script |grep 'OECORE_NATIVE_SYSROOT='|cut -d'=' -f2|tr -d '"')
chenqi@pek-qchen1-d1:~/poky$ grep -i -w native_sysroot meta/classes/populate_sdk_base.bbclass
native_sysroot=$($SUDO_EXEC cat $env_setup_script |grep 'OECORE_NATIVE_SYSROOT='|cut -d'=' -f2|tr -d '"')
dl_path=$($SUDO_EXEC find $native_sysroot/lib -name "ld-linux*")
executable_files=$($SUDO_EXEC find $native_sysroot -type f -perm /111)
$SUDO_EXEC find $native_sysroot -type f -exec file '{}' \;|grep ":.*\(ASCII\|script\|source\).*text"|cut -d':' -f1|$SUDO_EXEC xargs sed -i -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g"
for l in $($SUDO_EXEC find $native_sysroot -type l); do
# find out all perl scripts in $native_sysroot and modify them replacing the
for perl_script in $($SUDO_EXEC grep "^#!.*perl" -rl $native_sysroot); do

Best Regards,
Chen Qi

Quoted 34 lines

Sau!

Quoted 31 lines

That's why this patch unsets the variable instead of removing it from the environment setup script.

[YOCTO #4939]

---
  meta/recipes-core/meta/buildtools-tarball.bb |    6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
meta/recipes-core/meta/buildtools-tarball.bb +0 -0
index 9771497..1f8f142 100644
@@ -59,7 +59,11 @@ create_sdk_files_append () {
 script=${1:-${SDK_OUTPUT}/${SDKPATH}/environment-setup-${SDK_SYS}}
      touch $script
      echo 'export PATH=${SDKPATHNATIVE}${bindir_nativesdk}:$PATH' >> 

$script

meta/recipes-core/meta/buildtools-tarball.bb +3 -1
+    # OECORE_NATIVE_SYSROOT variable needs to be in $script so that the
+    # relocate script can find the ld-linux.so.
      echo 'export OECORE_NATIVE_SYSROOT="${SDKPATHNATIVE}"' >> $script
-
+    # buildtools-tarball is inherently a tool set instead of a fully 

functional SDK.

meta/recipes-core/meta/buildtools-tarball.bb +2 -0
+    # Leaving OECORE_NATIVE_SYSROOT in environment will mess things up.
+    echo 'unset OECORE_NATIVE_SYSROOT' >> $script
      toolchain_create_sdk_version 

${SDK_OUTPUT}/${SDKPATH}/version-${SDK_SYS}
}

author
#4 lore raw
In reply to Saul Wold
Quoted 8 lines · Saul Wold
Quoted 7 lines · On 07/29/2013 06:50 PM, [email protected] wrote:

From: Chen Qi <[email protected]>

When building a qemu image inside the environment created by the buildtools-tarball, the qemu image cannot be started, as the runqemu script uses the tunctl binary which cannot be found inside the sysroot directory of the buildtools-tarball.

Quoted 9 lines
Quoted 7 lines

The buildtools-tarball is inherently a tool set instead of a fully functional SDK, so leaving the OECORE_NATIVE_SYSROOT variable in the environment will mess things up.

However, we do need a line of 'OECORE_NATIVE_SYSROOT=xxx' in the environment setup script so that the SDK can be extracted and relocated correctly.

Where is this being processed, can could be done as a since comment in the the environment-setup script instead of exporting and unseting it?

Ah.... I got what you mean.
It's something like:

meta/recipes-core/meta/buildtools-tarball.bb +0 -0
@@ -59,7 +59,7 @@ create_sdk_files_append () {

script=${1:-${SDK_OUTPUT}/${SDKPATH}/environment-setup-${SDK_SYS}}

        touch $script
        echo 'export PATH=${SDKPATHNATIVE}${bindir_nativesdk}:$PATH' >> 

$script
- echo 'export OECORE_NATIVE_SYSROOT="${SDKPATHNATIVE}"' >> $script
+ echo '#OECORE_NATIVE_SYSROOT="${SDKPATHNATIVE}"' >> $script

toolchain_create_sdk_version
${SDK_OUTPUT}/${SDKPATH}/version-${SDK_SYS}
}

I'll test this and send out a V2 if it works.

Thanks,
Chen Qi

Quoted 34 lines

Sau!

Quoted 31 lines

That's why this patch unsets the variable instead of removing it from the environment setup script.

[YOCTO #4939]

---
  meta/recipes-core/meta/buildtools-tarball.bb |    6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
meta/recipes-core/meta/buildtools-tarball.bb +0 -0
index 9771497..1f8f142 100644
@@ -59,7 +59,11 @@ create_sdk_files_append () {
 script=${1:-${SDK_OUTPUT}/${SDKPATH}/environment-setup-${SDK_SYS}}
      touch $script
      echo 'export PATH=${SDKPATHNATIVE}${bindir_nativesdk}:$PATH' >> 

$script

meta/recipes-core/meta/buildtools-tarball.bb +3 -1
+    # OECORE_NATIVE_SYSROOT variable needs to be in $script so that the
+    # relocate script can find the ld-linux.so.
      echo 'export OECORE_NATIVE_SYSROOT="${SDKPATHNATIVE}"' >> $script
-
+    # buildtools-tarball is inherently a tool set instead of a fully 

functional SDK.

meta/recipes-core/meta/buildtools-tarball.bb +2 -0
+    # Leaving OECORE_NATIVE_SYSROOT in environment will mess things up.
+    echo 'unset OECORE_NATIVE_SYSROOT' >> $script
      toolchain_create_sdk_version 

${SDK_OUTPUT}/${SDKPATH}/version-${SDK_SYS}
}