From patchwork Fri May 3 10:39:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sonic Zhang X-Patchwork-Id: 241269 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id 6FA7A2C008F for ; Fri, 3 May 2013 20:43:28 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 8983C31B7E; Fri, 3 May 2013 10:43:25 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id N-RK5O62LkF5; Fri, 3 May 2013 10:43:21 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 8F20F273B3; Fri, 3 May 2013 10:43:21 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id DBF098F753 for ; Fri, 3 May 2013 10:43:26 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 4B04D87DF6 for ; Fri, 3 May 2013 10:43:19 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 084GAXCgdLYg for ; Fri, 3 May 2013 10:43:17 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from co9outboundpool.messaging.microsoft.com (co9ehsobe005.messaging.microsoft.com [207.46.163.28]) by whitealder.osuosl.org (Postfix) with ESMTPS id D7D0487DA4 for ; Fri, 3 May 2013 10:43:17 +0000 (UTC) Received: from mail126-co9-R.bigfish.com (10.236.132.249) by CO9EHSOBE026.bigfish.com (10.236.130.89) with Microsoft SMTP Server id 14.1.225.23; Fri, 3 May 2013 10:43:17 +0000 Received: from mail126-co9 (localhost [127.0.0.1]) by mail126-co9-R.bigfish.com (Postfix) with ESMTP id 7F847B402B5; Fri, 3 May 2013 10:43:17 +0000 (UTC) X-Forefront-Antispam-Report: CIP:137.71.25.55; KIP:(null); UIP:(null); IPV:NLI; H:nwd2mta1.analog.com; RD:nwd2mail10.analog.com; EFVD:NLI X-SpamScore: 23 X-BigFish: VS23(zzzz1f42h1fc6h1ee6h1ce5h1fdah1202h1fd0h1e76h1d1ah1cabh1d2ahzz8275bh11f642sz2ei87h2a8h668h839hd24he5bh1288h12a5h12a9h12bdh12e5h1354h137ah139eh13b6h13eah1441h1504h1537h15a8h162dh1631h1758h17eeh1898h18e1h1946h19b5h1b0ah1d0ch1d2eh1d3fhff4m1355m129fi1155h) Received-SPF: neutral (mail126-co9: 137.71.25.55 is neither permitted nor denied by domain of gmail.com) client-ip=137.71.25.55; envelope-from=sonic.adi@gmail.com; helo=nwd2mta1.analog.com ; 1.analog.com ; X-FB-DOMAIN-IP-MATCH: fail Received: from mail126-co9 (localhost.localdomain [127.0.0.1]) by mail126-co9 (MessageSwitch) id 1367577747202138_15815; Fri, 3 May 2013 10:42:27 +0000 (UTC) Received: from CO9EHSMHS029.bigfish.com (unknown [10.236.132.234]) by mail126-co9.bigfish.com (Postfix) with ESMTP id AC5FBC4006D; Fri, 3 May 2013 10:42:12 +0000 (UTC) Received: from nwd2mta1.analog.com (137.71.25.55) by CO9EHSMHS029.bigfish.com (10.236.130.39) with Microsoft SMTP Server (TLS) id 14.1.225.23; Fri, 3 May 2013 10:42:12 +0000 Received: from NWD2HUBCAS6.ad.analog.com (nwd2hubcas6.ad.analog.com [10.64.72.159]) by nwd2mta1.analog.com (8.13.8/8.13.8) with ESMTP id r43AfUJ2002307 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Fri, 3 May 2013 03:41:31 -0700 Received: from zeus.spd.analog.com (10.64.82.11) by NWD2HUBCAS6.ad.analog.com (10.64.72.159) with Microsoft SMTP Server id 14.3.123.3; Fri, 3 May 2013 06:41:08 -0400 Received: from linux.site ([10.99.22.20]) by zeus.spd.analog.com (8.14.6/8.14.6) with ESMTP id r43Af6D6011650; Fri, 3 May 2013 06:41:06 -0400 Received: from localhost.localdomain (unknown [10.99.22.72]) by linux.site (Postfix) with ESMTP id D277142D68B5; Thu, 2 May 2013 21:14:05 -0600 (MDT) From: Sonic Zhang To: Thomas Petazzoni , Arnout Vandecappelle , Date: Fri, 3 May 2013 18:39:39 +0800 Message-ID: <1367577580-3518-6-git-send-email-sonic.adi@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1367577580-3518-1-git-send-email-sonic.adi@gmail.com> References: <1367577580-3518-1-git-send-email-sonic.adi@gmail.com> MIME-Version: 1.0 Cc: Sonic Zhang , buildroot-devel@blackfin.uclinux.org Subject: [Buildroot] [PATCH v7 6/7] arch: toolchain: Install blackfin FDPIC and FLAT libraries in external toolchain makefile. X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net From: Sonic Zhang Reserve all 3 blackfin toolchain folders under the TOOLCHAIN_EXTERNAL_DIR. Set current blackfin toolchain bin folder to the toolchain prefix subfolder. Install FDPIC and FLAT library in target ext-toolchain-installed. Signed-off-by: Sonic Zhang --- v7-changes: - Revert merging the options of the same name and add descriptions. Only 2 options work in SHARED flat binary format case. v6-changes: - Move options of installing blackfin toolchain libraries into external toolchain Config.in. - Fix typo error. - Merge the options of the same name and add descriptions. v5-changes: - Update comments. v3-changes: - Remove arch specific makefiles. - Reserve all 3 blackfin toolchain folders under the TOOLCHAIN_EXTERNAL_DIR. - Set current blackfin toolchain bin folder to the toolchain prefix subfolder. - Move FDPIC and FLAT library installation target from blackfin makefile to the ext-toolchain-installed target in external toolchain makefile. v2-changes: - Remove useless Macro __uClinux__ v1-changes: - Create arch makefile. - Create blackfin makefile. - Add FDPIC and FLAT library options and makefile targets to install libraries for different binary formats into the same rootfs image. - update the TARGET_EXCEPTIONS variable in support/scripts/graph-depends for new custom targets --- toolchain/toolchain-external/Config.in | 34 ++++++++++++++++++++++ toolchain/toolchain-external/ext-tool.mk | 46 ++++++++++++++++++++++------- 2 files changed, 69 insertions(+), 11 deletions(-) diff --git a/toolchain/toolchain-external/Config.in b/toolchain/toolchain-external/Config.in index 6cf29aa..05df3f4 100644 --- a/toolchain/toolchain-external/Config.in +++ b/toolchain/toolchain-external/Config.in @@ -887,5 +887,39 @@ config BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS endif # BR2_TOOLCHAIN_EXTERNAL_CUSTOM +# When the FDPIC shared binary format is used, the corresponding libraries are +# always installed. When a different binary format is used, we offer the option +# of installing the FDPIC shared libraries. +config BR2_BFIN_INSTALL_FDPIC_SHARED + bool "Install FDPIC shared libraries" + depends on BR2_bfin && !BR2_BINFMT_FDPIC + help + The Linux kernel supports running both FDPIC and FLAT applications + concurrently if the binary format specific libraries are installed + properly. This option allows developer to install FDPIC libraries + into a buildroot rootfs image built with binary format that is not + FDPIC. + +# When the FLAT shared binary format is used, we force the installation +# of the corresponding libraries. When a different binary format is +# used, we offer the option of installing the FLAT shared libraries. +config BR2_BFIN_INSTALL_FLAT_SHARED + default y if BR2_BINFMT_FLAT_SHARED + help + The Linux kernel supports running both FDPIC and FLAT applications + concurrently if the binary format specific libraries are installed + properly. This option always installs FLAT libraries into a + buildroot rootfs image built with binary format shared FLAT. + +config BR2_BFIN_INSTALL_FLAT_SHARED + bool "Install FLAT shared libraries" + depends on BR2_bfin && !BR2_BINFMT_FLAT_SHARED + help + The Linux kernel supports running both FDPIC and FLAT applications + concurrently if the binary format specific libraries are installed + properly. This option allows developer to install FLAT libraries + into a buildroot rootfs image built with binary format that is not + shared FLAT. + endif # BR2_TOOLCHAIN_EXTERNAL diff --git a/toolchain/toolchain-external/ext-tool.mk b/toolchain/toolchain-external/ext-tool.mk index 57ea266..dbada0e 100644 --- a/toolchain/toolchain-external/ext-tool.mk +++ b/toolchain/toolchain-external/ext-tool.mk @@ -115,8 +115,12 @@ ifeq ($(TOOLCHAIN_EXTERNAL_DIR),) # if no path set, figure it out from path TOOLCHAIN_EXTERNAL_BIN:=$(shell dirname $(shell which $(TOOLCHAIN_EXTERNAL_PREFIX)-gcc)) else +ifeq ($(BR2_bfin),y) +TOOLCHAIN_EXTERNAL_BIN:=$(TOOLCHAIN_EXTERNAL_DIR)/$(TOOLCHAIN_EXTERNAL_PREFIX)/bin +else TOOLCHAIN_EXTERNAL_BIN:=$(TOOLCHAIN_EXTERNAL_DIR)/bin endif +endif TOOLCHAIN_EXTERNAL_CROSS=$(TOOLCHAIN_EXTERNAL_BIN)/$(TOOLCHAIN_EXTERNAL_PREFIX)- TOOLCHAIN_EXTERNAL_CC=$(TOOLCHAIN_EXTERNAL_CROSS)gcc @@ -312,17 +316,6 @@ $(TOOLCHAIN_EXTERNAL_DIR)/.extracted: $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_1) $ $(TAR) $(TAR_STRIP_COMPONENTS)=3 --hard-dereference -C $(@D) $(TAR_OPTIONS) - $(INFLATE$(suffix $(TOOLCHAIN_EXTERNAL_SOURCE_2))) $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_2) | \ $(TAR) $(TAR_STRIP_COMPONENTS)=3 --hard-dereference -C $(@D) $(TAR_OPTIONS) - -ifeq ($(TOOLCHAIN_EXTERNAL_PREFIX),bfin-uclinux) - rm -rf $(TOOLCHAIN_EXTERNAL_DIR)/bfin-linux-uclibc - mv $(TOOLCHAIN_EXTERNAL_DIR)/bfin-uclinux $(TOOLCHAIN_EXTERNAL_DIR)/tmp - mv $(TOOLCHAIN_EXTERNAL_DIR)/tmp/* $(TOOLCHAIN_EXTERNAL_DIR)/ - rmdir $(TOOLCHAIN_EXTERNAL_DIR)/tmp -else - rm -rf $(TOOLCHAIN_EXTERNAL_DIR)/bfin-uclinux - mv $(TOOLCHAIN_EXTERNAL_DIR)/bfin-linux-uclibc $(TOOLCHAIN_EXTERNAL_DIR)/tmp - mv $(TOOLCHAIN_EXTERNAL_DIR)/tmp/* $(TOOLCHAIN_EXTERNAL_DIR)/ - rmdir $(TOOLCHAIN_EXTERNAL_DIR)/tmp -endif $(Q)touch $@ else # Download and extraction of a toolchain @@ -417,6 +410,37 @@ $(STAMP_DIR)/ext-toolchain-installed: $(STAMP_DIR)/ext-toolchain-checked @echo "External toolchain doesn't support --sysroot. Cannot use." ; \ exit 1 ; \ fi ; \ + if test x"$(BR2_BFIN_INSTALL_FDPIC_SHARED)" == x"y" ; then \ + $(call MESSAGE,"Install external toolchain FDPIC libraries to target...") ; \ + FDPIC_EXTERNAL_CC=$(dir $(TOOLCHAIN_EXTERNAL_CC))/../../bfin-linux-uclibc/bin/bfin-linux-uclibc-gcc ; \ + FDPIC_LIBC_A_LOCATION=`readlink -f $$(LANG=C $${FDPIC_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS) -print-file-name=libc.a)` ; \ + FDPIC_SYSROOT_DIR=`echo $${FDPIC_LIBC_A_LOCATION} | sed -r -e 's:usr/lib(64)?/(.*/)?libc\.a::'` ; \ + FDPIC_LIB_DIR=`echo $${FDPIC_LIBC_A_LOCATION} | sed -r -e 's:.*/usr/(lib(64)?)/(.*/)?libc.a:\1:'` ; \ + FDPIC_SUPPORT_LIB_DIR="" ; \ + if test `find $${FDPIC_SYSROOT_DIR} -name 'libstdc++.a' | wc -l` -eq 0 ; then \ + FDPIC_LIBSTDCPP_A_LOCATION=$$(LANG=C $${FDPIC_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS) -print-file-name=libstdc++.a) ; \ + if [ -e "$${FDPIC_LIBSTDCPP_A_LOCATION}" ]; then \ + FDPIC_SUPPORT_LIB_DIR=`readlink -f $${FDPIC_LIBSTDCPP_A_LOCATION} | sed -r -e 's:libstdc\+\+\.a::'` ; \ + fi ; \ + fi ; \ + for libs in $(LIB_EXTERNAL_LIBS); do \ + $(call copy_toolchain_lib_root,$${FDPIC_SYSROOT_DIR},$${FDPIC_SUPPORT_LIB_DIR},$${FDPIC_LIB_DIR},$$libs,/lib); \ + done ; \ + for libs in $(USR_LIB_EXTERNAL_LIBS); do \ + $(call copy_toolchain_lib_root,$${FDPIC_SYSROOT_DIR},$${FDPIC_SUPPORT_LIB_DIR},$${FDPIC_LIB_DIR},$$libs,/usr/lib); \ + done ; \ + fi ; \ + if test x"$(BR2_BFIN_INSTALL_FLAT_SHARED)" == x"y" ; then \ + $(call MESSAGE,"Install external toolchain FLAT libraries to target...") ; \ + FLAT_EXTERNAL_CC=$(dir $(TOOLCHAIN_EXTERNAL_CC))../../bfin-uclinux/bin/bfin-uclinux-gcc ; \ + FLAT_LIBC_A_LOCATION=`$${FLAT_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS) -mid-shared-library -print-file-name=libc`; \ + if [ -f $${FLAT_LIBC_A_LOCATION} -a ! -h $${FLAT_LIBC_A_LOCATION} ] ; then \ +# The flat libraries are found and linked according to the index in \ +# name "libN.so". Index 1 is reserved for the standard C library. \ +# Customer libraries can use 4 and above. \ + $(INSTALL) -D $${FLAT_LIBC_A_LOCATION} $(TARGET_DIR)/lib/lib1.so; \ + fi ; \ + fi ; \ ARCH_LIBC_A_LOCATION=`readlink -f $$(LANG=C $(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS) -print-file-name=libc.a)` ; \ ARCH_SYSROOT_DIR=`echo $${ARCH_LIBC_A_LOCATION} | sed -r -e 's:usr/lib(64)?/(.*/)?libc\.a::'` ; \ ARCH_LIB_DIR=`echo $${ARCH_LIBC_A_LOCATION} | sed -r -e 's:.*/usr/(lib(64)?)/(.*/)?libc.a:\1:'` ; \