[elbe-devel] [PATCH 05/13] toolchain-extract.sh: add some sections

Manuel Traut manut at linutronix.de
Mon Jan 29 14:02:35 CET 2018


Some sections are auto-generated during a poky build. These parts are
inserted at placeholders by bitbake.

Because things are more static in elbe, the relevant parts are copied
from a bitbake generated
poky-glibc-x86_64-core-image-minimal-i586-toolchain-2.4.1.sh
script.

Signed-off-by: Manuel Traut <manut at linutronix.de>
---
 elbepack/makofiles/toolchain-shar-extract.sh.mako | 52 ++++++++++++++++++++++-
 1 file changed, 51 insertions(+), 1 deletion(-)

diff --git a/elbepack/makofiles/toolchain-shar-extract.sh.mako b/elbepack/makofiles/toolchain-shar-extract.sh.mako
index 83a4ed27..126ea587 100644
--- a/elbepack/makofiles/toolchain-shar-extract.sh.mako
+++ b/elbepack/makofiles/toolchain-shar-extract.sh.mako
@@ -274,7 +274,57 @@ if [ -n "$real_env_setup_script" ] ; then
 	env_setup_script="$real_env_setup_script"
 fi
 
- at SDK_POST_INSTALL_COMMAND@
+if ! xargs --version > /dev/null 2>&1; then
+        echo "xargs is required by the relocation script, please install it first. Abort!"
+        exit 1
+fi
+
+# fix dynamic loader paths in all ELF SDK binaries
+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*")
+if [ "$dl_path" = "" ] ; then
+        echo "SDK could not be set up. Relocate script unable to find ld-linux.so. Abort!"
+        exit 1
+fi
+executable_files=$($SUDO_EXEC find $native_sysroot -type f \
+        \( -perm -0100 -o -perm -0010 -o -perm -0001 \) -printf "'%h/%f' ")
+if [ "x$executable_files" = "x" ]; then
+   echo "SDK relocate failed, could not get executalbe files"
+   exit 1
+fi
+
+tdir=`mktemp -d`
+if [ x$tdir = x ] ; then
+   echo "SDK relocate failed, could not create a temporary directory"
+   exit 1
+fi
+cat <<EOF >> $tdir/relocate_sdk.sh
+#!/bin/sh
+for py in python python2 python3
+do
+        PYTHON=\`which \${py} 2>/dev/null\`
+        if [ \$? -eq 0 ]; then
+                break;
+        fi
+done
+
+if [ x\${PYTHON} = "x"  ]; then
+        echo "SDK could not be relocated.  No python found."
+        exit 1
+fi
+\${PYTHON} ${env_setup_script%/*}/relocate_sdk.py $target_sdk_dir $dl_path $executable_files
+EOF
+
+$SUDO_EXEC mv $tdir/relocate_sdk.sh ${env_setup_script%/*}/relocate_sdk.sh
+$SUDO_EXEC chmod 755 ${env_setup_script%/*}/relocate_sdk.sh
+rm -rf $tdir
+if [ $relocate = 1 ] ; then
+        $SUDO_EXEC ${env_setup_script%/*}/relocate_sdk.sh
+        if [ $? -ne 0 ]; then
+                echo "SDK could not be set up. Relocate script failed. Abort!"
+                exit 1
+        fi
+fi
 
 # delete the relocating script, so that user is forced to re-run the installer
 # if he/she wants another location for the sdk
-- 
2.15.1




More information about the elbe-devel mailing list