Skip to contentSkip to conversation

meta-toolchain-arago: make SDK/devkit relocatable

PATCH In review Denys Dmytriyenko 2 participants 4 messages Nov 7, 2012 – Nov 8, 2012

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 meta-toolchain-arago: make SDK/devkit relocatable

Implement poor man's relocation technique for self-contained crosssdk binaries

---
In v2 use stub shell scripts instead of aliases, to work in Makefiles

 meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +12 -1
index d2fe982..81bdeed 100644
@@ -4,7 +4,7 @@ TOOLCHAIN_OUTPUTNAME ?= "${SDK_NAME}-${ARMPKGARCH}-${TARGET_OS}-sdk-${SDK_ARCH}"
 
 require recipes-core/meta/meta-toolchain.bb
 
-PR = "r5"
+PR = "r6"
 
 SDKTARGETSYSROOT = "${SDKPATH}/${ARAGO_TARGET_SYS}"
 
@@ -28,6 +28,7 @@ toolchain_create_sdk_env_script () {
 	echo 'export TARGET_SYS=${ARAGO_TARGET_SYS}' >> $script
 	echo 'export TARGET_PREFIX=$TARGET_SYS-' >> $script
 	echo 'export PATH=$SDK_PATH/bin:$PATH' >> $script
+	echo 'export LD_LIBRARY_PATH=$SDK_PATH/lib:$LD_LIBRARY_PATH' >> $script
 	echo 'export CPATH=$SDK_PATH/$TARGET_SYS/usr/include:$CPATH' >> $script
 	echo 'export PKG_CONFIG_SYSROOT_DIR=$SDK_PATH/$TARGET_SYS' >> $script
 	echo 'export PKG_CONFIG_PATH=$SDK_PATH/$TARGET_SYS${libdir}/pkgconfig' >> $script
@@ -55,3 +56,13 @@ toolchain_create_sdk_env_script () {
 	echo 'export OECORE_DISTRO_VERSION="${DISTRO_VERSION}"' >> $script
 	echo 'export OECORE_SDK_VERSION="${SDK_VERSION}"' >> $script
 }
+
+populate_sdk_ipk_append () {
+	cd ${SDK_OUTPUT}/${SDKPATH}/bin
+	binfiles=`find ! -name "${ARAGO_TARGET_SYS}-*" -type f -perm +111 -exec file {} \;|grep -v ":.*ASCII.*text"|cut -d":" -f1|cut -c3-`
+	for i in $binfiles; do
+		mv $i $i.real
+		printf "#!/bin/sh\n\x24SDK_PATH/lib/ld-linux.so.2 \x24SDK_PATH/bin/$i.real \x24\x2a\n" > $i
+		chmod +x $i
+	done
+}
Signature · 1 line
1.8.0
#1 lore raw
Quoted 5 lines · Denys Dmytriyenko

Implement poor man's relocation technique for self-contained crosssdk binaries

---
In v2 use stub shell scripts instead of aliases, to work in Makefiles

Ok, this seems to work fine in shell and in Makefiles too. And it also works when environment-setup is sources before calling make, but not inside the Makefile.

Quoted 41 lines
 meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +12 -1
index d2fe982..81bdeed 100644
@@ -4,7 +4,7 @@ TOOLCHAIN_OUTPUTNAME ?= "${SDK_NAME}-${ARMPKGARCH}-${TARGET_OS}-sdk-${SDK_ARCH}"
 
 require recipes-core/meta/meta-toolchain.bb
 
-PR = "r5"
+PR = "r6"
 
 SDKTARGETSYSROOT = "${SDKPATH}/${ARAGO_TARGET_SYS}"
 
@@ -28,6 +28,7 @@ toolchain_create_sdk_env_script () {
 	echo 'export TARGET_SYS=${ARAGO_TARGET_SYS}' >> $script
 	echo 'export TARGET_PREFIX=$TARGET_SYS-' >> $script
 	echo 'export PATH=$SDK_PATH/bin:$PATH' >> $script
+	echo 'export LD_LIBRARY_PATH=$SDK_PATH/lib:$LD_LIBRARY_PATH' >> $script
 	echo 'export CPATH=$SDK_PATH/$TARGET_SYS/usr/include:$CPATH' >> $script
 	echo 'export PKG_CONFIG_SYSROOT_DIR=$SDK_PATH/$TARGET_SYS' >> $script
 	echo 'export PKG_CONFIG_PATH=$SDK_PATH/$TARGET_SYS${libdir}/pkgconfig' >> $script
@@ -55,3 +56,13 @@ toolchain_create_sdk_env_script () {
 	echo 'export OECORE_DISTRO_VERSION="${DISTRO_VERSION}"' >> $script
 	echo 'export OECORE_SDK_VERSION="${SDK_VERSION}"' >> $script
 }
+
+populate_sdk_ipk_append () {
+	cd ${SDK_OUTPUT}/${SDKPATH}/bin
+	binfiles=`find ! -name "${ARAGO_TARGET_SYS}-*" -type f -perm +111 -exec file {} \;|grep -v ":.*ASCII.*text"|cut -d":" -f1|cut -c3-`
+	for i in $binfiles; do
+		mv $i $i.real
+		printf "#!/bin/sh\n\x24SDK_PATH/lib/ld-linux.so.2 \x24SDK_PATH/bin/$i.real \x24\x2a\n" > $i
+		chmod +x $i
+	done
+}
Signature · 1 line
1.8.0
#2 lore raw

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Dmytriyenko, Denys
Sent: Wednesday, November 07, 2012 3:06 PM
To: [email protected]
Subject: Re: [meta-arago] [PATCHv2] meta-toolchain-arago: make SDK/devkit relocatable

Quoted 6 lines · Denys Dmytriyenko

Implement poor man's relocation technique for self-contained crosssdk binaries

---
In v2 use stub shell scripts instead of aliases, to work in Makefiles

Ok, this seems to work fine in shell and in Makefiles too. And it also works when environment-setup is sources before calling make, but not inside the Makefile.

Franklin:
export LD_LIBRARY_PATH=$SDK_PATH/lib:$LD_LIBRARY_PATH is causing issues. Once I source that file I get a Segmentation fault when calling qmake, make,arm-arago-linux-gnueabi-gcc,ls , etc....
Removing that line from environment-setup gets rid of the Segmentation fault issue but of course qmake and the other executables don't work. I get a "error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory".

Since you got this working is there anything the host machine needs to configure to get this to work?

Quoted 42 lines
 meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb | 13 
++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

a/meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb b/meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb index d2fe982..81bdeed 100644

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +3 -1
@@ -4,7 +4,7 @@ TOOLCHAIN_OUTPUTNAME ?= "${SDK_NAME}-${ARMPKGARCH}-${TARGET_OS}-sdk-${SDK_ARCH}"
 
 require recipes-core/meta/meta-toolchain.bb
 
-PR = "r5"
+PR = "r6"
 
 SDKTARGETSYSROOT = "${SDKPATH}/${ARAGO_TARGET_SYS}"
 
@@ -28,6 +28,7 @@ toolchain_create_sdk_env_script () {
 	echo 'export TARGET_SYS=${ARAGO_TARGET_SYS}' >> $script
 	echo 'export TARGET_PREFIX=$TARGET_SYS-' >> $script
 	echo 'export PATH=$SDK_PATH/bin:$PATH' >> $script
+	echo 'export LD_LIBRARY_PATH=$SDK_PATH/lib:$LD_LIBRARY_PATH' >> 
+$script
 	echo 'export CPATH=$SDK_PATH/$TARGET_SYS/usr/include:$CPATH' >> $script
 	echo 'export PKG_CONFIG_SYSROOT_DIR=$SDK_PATH/$TARGET_SYS' >> $script
 	echo 'export 

PKG_CONFIG_PATH=$SDK_PATH/$TARGET_SYS${libdir}/pkgconfig' >> $script @@ -55,3 +56,13 @@ toolchain_create_sdk_env_script () {

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +10 -1
 	echo 'export OECORE_DISTRO_VERSION="${DISTRO_VERSION}"' >> $script
 	echo 'export OECORE_SDK_VERSION="${SDK_VERSION}"' >> $script  }
+
+populate_sdk_ipk_append () {
+	cd ${SDK_OUTPUT}/${SDKPATH}/bin
+	binfiles=`find ! -name "${ARAGO_TARGET_SYS}-*" -type f -perm +111 -exec file {} \;|grep -v ":.*ASCII.*text"|cut -d":" -f1|cut -c3-`
+	for i in $binfiles; do
+		mv $i $i.real
+		printf "#!/bin/sh\n\x24SDK_PATH/lib/ld-linux.so.2 \x24SDK_PATH/bin/$i.real \x24\x2a\n" > $i
+		chmod +x $i
+	done
+}
--
Quoted 2 lines

1.8.0

_______________________________________________
meta-arago mailing list
[email protected]
http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago

#3 lore raw
Quoted 20 lines · Franklin

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Dmytriyenko, Denys
Sent: Wednesday, November 07, 2012 3:06 PM
To: [email protected]
Subject: Re: [meta-arago] [PATCHv2] meta-toolchain-arago: make SDK/devkit relocatable

Quoted 6 lines · Denys Dmytriyenko

Implement poor man's relocation technique for self-contained crosssdk binaries

---
In v2 use stub shell scripts instead of aliases, to work in Makefiles

Ok, this seems to work fine in shell and in Makefiles too. And it also works when environment-setup is sources before calling make, but not inside the Makefile.

Quoted 8 lines

Franklin:
export LD_LIBRARY_PATH=$SDK_PATH/lib:$LD_LIBRARY_PATH is causing issues. Once I source that file I get a Segmentation fault when calling qmake, make,arm-arago-linux-gnueabi-gcc,ls , etc....
Removing that line from environment-setup gets rid of the Segmentation fault issue but of course qmake and the other executables don't work. I get a "error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory".

Yeah, that explains the segfault Chase was seeing. I didn't see the segfault on regular system apps, like make, ls etc. But it did segfault on Arago toolchain binaries, like arm-arago-linux-gnueabi-gcc etc. It's better to set LD_LIBRARY_PATH variable only for select SDK tools that we have shell stubs for, instead of globally. The fix is now in.

Quoted 2 lines

Since you got this working is there anything the host machine needs to configure to get this to work?

I guess it's rather host system specific...

Quoted 53 lines
Quoted 42 lines
 meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb | 13 
++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

a/meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb b/meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb index d2fe982..81bdeed 100644

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +3 -1
@@ -4,7 +4,7 @@ TOOLCHAIN_OUTPUTNAME ?= "${SDK_NAME}-${ARMPKGARCH}-${TARGET_OS}-sdk-${SDK_ARCH}"
 
 require recipes-core/meta/meta-toolchain.bb
 
-PR = "r5"
+PR = "r6"
 
 SDKTARGETSYSROOT = "${SDKPATH}/${ARAGO_TARGET_SYS}"
 
@@ -28,6 +28,7 @@ toolchain_create_sdk_env_script () {
 	echo 'export TARGET_SYS=${ARAGO_TARGET_SYS}' >> $script
 	echo 'export TARGET_PREFIX=$TARGET_SYS-' >> $script
 	echo 'export PATH=$SDK_PATH/bin:$PATH' >> $script
+	echo 'export LD_LIBRARY_PATH=$SDK_PATH/lib:$LD_LIBRARY_PATH' >> 
+$script
 	echo 'export CPATH=$SDK_PATH/$TARGET_SYS/usr/include:$CPATH' >> $script
 	echo 'export PKG_CONFIG_SYSROOT_DIR=$SDK_PATH/$TARGET_SYS' >> $script
 	echo 'export 

PKG_CONFIG_PATH=$SDK_PATH/$TARGET_SYS${libdir}/pkgconfig' >> $script @@ -55,3 +56,13 @@ toolchain_create_sdk_env_script () {

meta-arago-extras/recipes-core/meta/meta-toolchain-arago.bb +10 -1
 	echo 'export OECORE_DISTRO_VERSION="${DISTRO_VERSION}"' >> $script
 	echo 'export OECORE_SDK_VERSION="${SDK_VERSION}"' >> $script  }
+
+populate_sdk_ipk_append () {
+	cd ${SDK_OUTPUT}/${SDKPATH}/bin
+	binfiles=`find ! -name "${ARAGO_TARGET_SYS}-*" -type f -perm +111 -exec file {} \;|grep -v ":.*ASCII.*text"|cut -d":" -f1|cut -c3-`
+	for i in $binfiles; do
+		mv $i $i.real
+		printf "#!/bin/sh\n\x24SDK_PATH/lib/ld-linux.so.2 \x24SDK_PATH/bin/$i.real \x24\x2a\n" > $i
+		chmod +x $i
+	done
+}
--
Quoted 2 lines

1.8.0

_______________________________________________
meta-arago mailing list
[email protected]
http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago
_______________________________________________
meta-arago mailing list
[email protected]
http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago