[oe] [PATCH] sane-toolchain-eglibc.inc: Set TARGET_OS = linux-gnuspe for e500

Khem Raj raj.khem at gmail.com
Sun Aug 30 09:22:50 UTC 2009


On (30/08/09 09:29), Phil Blundell wrote:
> On Sun, 2009-08-30 at 09:10 +0100, Phil Blundell wrote:
> > On Sat, 2009-08-29 at 18:22 -0700, Khem Raj wrote:
> > > We can override only for powerpc second time around. So changing it
> > to 
> > > 
> > > TARGET_OS_powerpc =
> > > "linux${@['','-gnuspe'][bb.data.getVar('TARGET_ARCH',d,1) in ['ppc',
> > > 'powerpc'] and bb.data.getVar('MACHINE',d) in ['calamari',
> > 'tqm8540']]}"
> > > 
> > > will that be ok ?
> > 
> > That's better, but it still doesn't seem terribly elegant.  I also
> > remain slightly unconvinced that the eglibc-specific file is,
> > conceptually, the right place for this logic. 
> 
> Actually, there is still a bigger problem with this change: it will
> cause the ABI to change in a semi-random way depending on the selected
> MACHINE and this will screw up people who are trying to do multimachine
> builds.
> 
> For example, if I set MACHINE=calamari and then bitbake micro-image, it
> will select linux-gnuspe and I will presumably get the SPE ABI.  But
> then, if I set MACHINE=efika, say, and build another package in the same
> tree, it'll now select regular linux and the ABI will change, although
> this won't be reflected in the naming of the output packages: they'll
> all just be named "powerpc".  Worse, if eglibc itself happens to be
> version-bumped while I am building for efika, my C library will be
> quietly recompiled with a different ABI and, presumably, lose in a
> fairly serious way.

based upon your idea in last email. Here is something I put together
seems to work. It will need testing ofcourse

What do you think about this one ?

Thanks

-Khem
-------------- next part --------------
diff --git a/conf/distro/include/sane-toolchain-eglibc.inc b/conf/distro/include/sane-toolchain-eglibc.inc
index 006f1d6..4c5f44f 100644
--- a/conf/distro/include/sane-toolchain-eglibc.inc
+++ b/conf/distro/include/sane-toolchain-eglibc.inc
@@ -3,10 +3,6 @@
 # eglibc:
 # [23:00] oxo: glibc (any version) on sparc does not like (repeat me) "-Os"
 
-TARGET_OS = "linux${@['','-gnueabi'][bb.data.getVar('TARGET_ARCH',d,1) in ['arm', 'armeb'] and bb.data.getVar('MACHINE',d) not in ['collie','h3600', 'h3800', 'simpad', 'htcwallaby']]}"
-
-TARGET_OS_powerpc = "linux${@['','-gnuspe'][bb.data.getVar('TARGET_ARCH',d,1) in ['ppc', 'powerpc'] and bb.data.getVar('MACHINE',d) in ['calamari', 'tqm8540']]}"
-
 FULL_OPTIMIZATION = "-fexpensive-optimizations -fomit-frame-pointer -frename-registers -Os"
 FULL_OPTIMIZATION_pn-perl = "-fexpensive-optimizations -fomit-frame-pointer -frename-registers -O1"
 FULL_OPTIMIZATION_sparc = "-fexpensive-optimizations -fomit-frame-pointer -frename-registers -O2"
diff --git a/conf/distro/include/sane-toolchain-glibc.inc b/conf/distro/include/sane-toolchain-glibc.inc
index f3da7c3..f029c6f 100644
--- a/conf/distro/include/sane-toolchain-glibc.inc
+++ b/conf/distro/include/sane-toolchain-glibc.inc
@@ -2,8 +2,6 @@
 
 # glibc:
 
-TARGET_OS = "linux${@['','-gnueabi'][bb.data.getVar('TARGET_ARCH',d,1) in ['arm', 'armeb'] and bb.data.getVar('MACHINE',d) not in ['collie','h3600', 'h3800', 'simpad', 'htcwallaby']]}"
-
 #mess with compiler flags to use -Os instead of -O2
 #Please see http://free-electrons.com/doc/embedded_linux_optimizations/img47.html for some more info
 # perl has some problems, see http://bugs.openembedded.net/show_bug.cgi?id=1616
diff --git a/conf/distro/include/sane-toolchain-uclibc.inc b/conf/distro/include/sane-toolchain-uclibc.inc
index 04935fe..3069820 100644
--- a/conf/distro/include/sane-toolchain-uclibc.inc
+++ b/conf/distro/include/sane-toolchain-uclibc.inc
@@ -15,9 +15,6 @@ USE_NLS_glib-2.0 = "yes"
 USE_NLS_glib-2.0-native = "yes"
 USE_NLS_gcc-cross = "no"
 
-TARGET_OS_UC = "linux${@['-uclibc','-uclibcgnueabi'][bb.data.getVar('TARGET_ARCH',d,1) in ['arm', 'armeb'] and bb.data.getVar('MACHINE',d) not in ['collie','h3600', 'h3800', 'simpad', 'htcwallaby']]}"
-TARGET_OS = "${@['${TARGET_OS_UC}', 'uclinux-uclibc'][bb.data.getVar('TARGET_ARCH',d)  in ['bfin']]}"
-
 #mess with compiler flags to use -Os instead of -O2
 #Please see http://free-electrons.com/doc/embedded_linux_optimizations/img47.html for some more info
 FULL_OPTIMIZATION = "-fexpensive-optimizations -fomit-frame-pointer -frename-registers -Os"
diff --git a/conf/distro/include/sane-toolchain.inc b/conf/distro/include/sane-toolchain.inc
index cebe77b..7279936 100644
--- a/conf/distro/include/sane-toolchain.inc
+++ b/conf/distro/include/sane-toolchain.inc
@@ -137,6 +137,38 @@ ENABLE_BINARY_LOCALE_GENERATION_armv7a = "0"
 #qemu has taken a dislike to armeb as well
 ENABLE_BINARY_LOCALE_GENERATION_armeb = "0"
 
+python detect_arm_abi () {
+	if bb.data.getVar("TARGET_ARCH", d, 1) in [ 'arm', 'armeb' ]:          
+		if bb.data.getVar('MACHINE',d) in ['collie','h3600', 'h3800', 'simpad', 'htcwallaby']:
+			return "oabi"
+		return "eabi"
+	else
+		return ""
+}
+
+python compute_os_portion_of_target_triplet () {
+
+	if bb.data.getVar('TARGET_ARCH',d,1) in ['bfin']:
+		os_suffix = "uclinux"
+	else
+  		os_suffix = "linux"
+
+	arm_abi	= detect_arm_abi(d)
+  	if bb.data.getVar("LIBC", d, 1) == "uclibc":
+    		libc_suffix = "uclibc"
+	else
+		libc_suffix = "gnu"
+	
+  	if arm_abi == "eabi":
+    		abi_suffix = "eabi"
+  	if bb.data.getVar('TARGET_ARCH',d,1) in ['ppc', 'powerpc'] and
+	bb.data.getVar('MACHINE',d) in ['calamari', 'tqm8540'] and 
+	bb.data.getVar('DISTRO_FEATURES',d) in ['spe']:
+    		abi_suffix = "spe"
+    	target_os = "%s-%s%s" % (os_suffix, libc_suffix, abi_suffix)
+	return target_os
+}
 # This is needed to get a correct PACKAGE_ARCH for packages that have PACKAGE_ARCH = ${MACHINE_ARCH}
-ARM_ABI ?= "${@['','oabi'][bb.data.getVar('MACHINE',d) in ['collie','h3600', 'h3800', 'simpad', 'htcwallaby']]}"
+ARM_ABI ?= "${@detect_arm_abi(d,1)}"
+TARGET_OS ?= "${@compute_os_portion_of_target_triplet (d, 1)}"
 include conf/distro/include/sane-toolchain-${ARM_ABI}.inc


More information about the Openembedded-devel mailing list