summaryrefslogtreecommitdiffstats
path: root/meta/files
diff options
context:
space:
mode:
Diffstat (limited to 'meta/files')
-rw-r--r--meta/files/toolchain-shar-relocate.sh20
1 files changed, 19 insertions, 1 deletions
diff --git a/meta/files/toolchain-shar-relocate.sh b/meta/files/toolchain-shar-relocate.sh
index d4bcf0e55d..e491153fc5 100644
--- a/meta/files/toolchain-shar-relocate.sh
+++ b/meta/files/toolchain-shar-relocate.sh
@@ -1,3 +1,8 @@
1if ! xargs --version > /dev/null 2>&1; then
2 echo "xargs is required by the relocation script, please install it firts. Abort!"
3 exit 1
4fi
5
1# fix dynamic loader paths in all ELF SDK binaries 6# fix dynamic loader paths in all ELF SDK binaries
2native_sysroot=$($SUDO_EXEC cat $env_setup_script |grep 'OECORE_NATIVE_SYSROOT='|cut -d'=' -f2|tr -d '"') 7native_sysroot=$($SUDO_EXEC cat $env_setup_script |grep 'OECORE_NATIVE_SYSROOT='|cut -d'=' -f2|tr -d '"')
3dl_path=$($SUDO_EXEC find $native_sysroot/lib -name "ld-linux*") 8dl_path=$($SUDO_EXEC find $native_sysroot/lib -name "ld-linux*")
@@ -7,6 +12,10 @@ if [ "$dl_path" = "" ] ; then
7fi 12fi
8executable_files=$($SUDO_EXEC find $native_sysroot -type f \ 13executable_files=$($SUDO_EXEC find $native_sysroot -type f \
9 \( -perm -0100 -o -perm -0010 -o -perm -0001 \) -printf "'%h/%f' ") 14 \( -perm -0100 -o -perm -0010 -o -perm -0001 \) -printf "'%h/%f' ")
15if [ "x$executable_files" = "x" ]; then
16 echo "SDK relocate failed, could not get executalbe files"
17 exit 1
18fi
10 19
11tdir=`mktemp -d` 20tdir=`mktemp -d`
12if [ x$tdir = x ] ; then 21if [ x$tdir = x ] ; then
@@ -14,7 +23,7 @@ if [ x$tdir = x ] ; then
14 exit 1 23 exit 1
15fi 24fi
16cat <<EOF >> $tdir/relocate_sdk.sh 25cat <<EOF >> $tdir/relocate_sdk.sh
17#!/bin/bash 26#!/bin/sh
18for py in python python2 python3 27for py in python python2 python3
19do 28do
20 PYTHON=\`which \${py} 2>/dev/null\` 29 PYTHON=\`which \${py} 2>/dev/null\`
@@ -53,9 +62,18 @@ done | xargs -n100 file | grep ":.*\(ASCII\|script\|source\).*text" | \
53 -e "s:^#! */usr/bin/perl.*:#! /usr/bin/env perl:g" \ 62 -e "s:^#! */usr/bin/perl.*:#! /usr/bin/env perl:g" \
54 -e "s: /usr/bin/perl: /usr/bin/env perl:g" 63 -e "s: /usr/bin/perl: /usr/bin/env perl:g"
55 64
65if [ $? -ne 0 ]; then
66 echo "Failed to replace perl. Relocate script failed. Abort!"
67 exit 1
68fi
69
56# change all symlinks pointing to @SDKPATH@ 70# change all symlinks pointing to @SDKPATH@
57for l in $($SUDO_EXEC find $native_sysroot -type l); do 71for l in $($SUDO_EXEC find $native_sysroot -type l); do
58 $SUDO_EXEC ln -sfn $(readlink $l|$SUDO_EXEC sed -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:") $l 72 $SUDO_EXEC ln -sfn $(readlink $l|$SUDO_EXEC sed -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:") $l
73 if [ $? -ne 0 ]; then
74 echo "Failed to setup symlinks. Relocate script failed. Abort!"
75 exit 1
76 fi
59done 77done
60 78
61echo done 79echo done