From patchwork Thu Apr 18 10:06:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sonic Zhang X-Patchwork-Id: 237593 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id 1D0182C01D3 for ; Thu, 18 Apr 2013 20:07:49 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id C9B7310BB7E; Thu, 18 Apr 2013 10:07:30 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3f5BojbjO-E6; Thu, 18 Apr 2013 10:07:18 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id D9BFE10BB55; Thu, 18 Apr 2013 10:07:15 +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 E6B6F8F74B for ; Thu, 18 Apr 2013 10:07:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 619938D36D for ; Thu, 18 Apr 2013 10:07:29 +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 myg8GsMnDbE2 for ; Thu, 18 Apr 2013 10:07:27 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from co1outboundpool.messaging.microsoft.com (co1ehsobe001.messaging.microsoft.com [216.32.180.184]) by whitealder.osuosl.org (Postfix) with ESMTPS id AD96E8D36F for ; Thu, 18 Apr 2013 10:07:27 +0000 (UTC) Received: from mail114-co1-R.bigfish.com (10.243.78.244) by CO1EHSOBE036.bigfish.com (10.243.66.101) with Microsoft SMTP Server id 14.1.225.23; Thu, 18 Apr 2013 10:07:26 +0000 Received: from mail114-co1 (localhost [127.0.0.1]) by mail114-co1-R.bigfish.com (Postfix) with ESMTP id 88919A60168; Thu, 18 Apr 2013 10:07:26 +0000 (UTC) X-Forefront-Antispam-Report: CIP:137.71.25.57; KIP:(null); UIP:(null); IPV:NLI; H:nwd2mta2.analog.com; RD:nwd2mail11.analog.com; EFVD:NLI X-SpamScore: 23 X-BigFish: VS23(zzzz1f42h1fc6h1ee6h1ce5h1fdah1202h1fd0h1e76h1d1ah1cabh1d2ahzz8275bh11f642sz2ei87h2a8h668h839hd24he5bh1288h12a5h12a9h12bdh12e5h1354h137ah139eh13b6h13eah1441h1504h1537h15a8h162dh1631h1758h17eeh1898h18e1h1946h19b5h1b0ahff4m1355m129fi1155h) Received-SPF: neutral (mail114-co1: 137.71.25.57 is neither permitted nor denied by domain of gmail.com) client-ip=137.71.25.57; envelope-from=sonic.adi@gmail.com; helo=nwd2mta2.analog.com ; 2.analog.com ; X-FB-DOMAIN-IP-MATCH: fail Received: from mail114-co1 (localhost.localdomain [127.0.0.1]) by mail114-co1 (MessageSwitch) id 1366279643675314_29364; Thu, 18 Apr 2013 10:07:23 +0000 (UTC) Received: from CO1EHSMHS015.bigfish.com (unknown [10.243.78.254]) by mail114-co1.bigfish.com (Postfix) with ESMTP id 9EFF9CC004B; Thu, 18 Apr 2013 10:07:23 +0000 (UTC) Received: from nwd2mta2.analog.com (137.71.25.57) by CO1EHSMHS015.bigfish.com (10.243.66.25) with Microsoft SMTP Server (TLS) id 14.1.225.23; Thu, 18 Apr 2013 10:07:23 +0000 Received: from NWD2HUBCAS6.ad.analog.com (nwd2hubcas6.ad.analog.com [10.64.72.159]) by nwd2mta2.analog.com (8.13.8/8.13.8) with ESMTP id r3IBViKJ000334 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Thu, 18 Apr 2013 07:31:45 -0400 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; Thu, 18 Apr 2013 06:06:19 -0400 Received: from linux.site ([10.99.22.20]) by zeus.spd.analog.com (8.14.6/8.14.6) with ESMTP id r3IA6HG3019636; Thu, 18 Apr 2013 06:06:18 -0400 Received: from localhost.localdomain (unknown [10.99.22.72]) by linux.site (Postfix) with ESMTP id 311E642CE4E7; Wed, 17 Apr 2013 20:39:19 -0600 (MDT) From: Sonic Zhang To: Thomas Petazzoni , Arnout Vandecappelle , Date: Thu, 18 Apr 2013 18:06:31 +0800 Message-ID: <1366279592-9055-6-git-send-email-sonic.adi@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1366279592-9055-1-git-send-email-sonic.adi@gmail.com> References: <1366279592-9055-1-git-send-email-sonic.adi@gmail.com> MIME-Version: 1.0 Cc: Sonic Zhang , buildroot-devel@blackfin.uclinux.org Subject: [Buildroot] [PATCH v6 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 --- 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 | 25 ++++++++++++++++ toolchain/toolchain-external/ext-tool.mk | 46 ++++++++++++++++++++++------- 2 files changed, 60 insertions(+), 11 deletions(-) diff --git a/toolchain/toolchain-external/Config.in b/toolchain/toolchain-external/Config.in index 6cf29aa..c4d17e0 100644 --- a/toolchain/toolchain-external/Config.in +++ b/toolchain/toolchain-external/Config.in @@ -887,5 +887,30 @@ 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 + bool "Install FLAT shared libraries" + depends on BR2_bfin && !BR2_BINFMT_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 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:'` ; \