From patchwork Fri Apr 12 10:18:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sonic Zhang X-Patchwork-Id: 236021 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 329462C009F for ; Fri, 12 Apr 2013 20:19:33 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 5B70F10BB0D; Fri, 12 Apr 2013 10:19:15 +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 5MXJ3nhq8Sah; Fri, 12 Apr 2013 10:19:07 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id C5C3210BC12; Fri, 12 Apr 2013 10:18:46 +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 28FA38F7AC for ; Fri, 12 Apr 2013 10:19:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id B79FE8E864 for ; Fri, 12 Apr 2013 10:18:59 +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 ridM0MBgisKU for ; Fri, 12 Apr 2013 10:18:58 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from co9outboundpool.messaging.microsoft.com (co9ehsobe002.messaging.microsoft.com [207.46.163.25]) by whitealder.osuosl.org (Postfix) with ESMTPS id 5A04B8CFF3 for ; Fri, 12 Apr 2013 10:18:58 +0000 (UTC) Received: from mail110-co9-R.bigfish.com (10.236.132.237) by CO9EHSOBE019.bigfish.com (10.236.130.82) with Microsoft SMTP Server id 14.1.225.23; Fri, 12 Apr 2013 10:18:57 +0000 Received: from mail110-co9 (localhost [127.0.0.1]) by mail110-co9-R.bigfish.com (Postfix) with ESMTP id 6482642034D; Fri, 12 Apr 2013 10:18:57 +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 (mail110-co9: 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 mail110-co9 (localhost.localdomain [127.0.0.1]) by mail110-co9 (MessageSwitch) id 1365761935441736_25548; Fri, 12 Apr 2013 10:18:55 +0000 (UTC) Received: from CO9EHSMHS030.bigfish.com (unknown [10.236.132.239]) by mail110-co9.bigfish.com (Postfix) with ESMTP id 683A520074; Fri, 12 Apr 2013 10:18:55 +0000 (UTC) Received: from nwd2mta2.analog.com (137.71.25.57) by CO9EHSMHS030.bigfish.com (10.236.130.40) with Microsoft SMTP Server (TLS) id 14.1.225.23; Fri, 12 Apr 2013 10:18:54 +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 r3CBgjLR018275 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Fri, 12 Apr 2013 07:42: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; Fri, 12 Apr 2013 06:17:42 -0400 Received: from linux.site ([10.99.22.20]) by zeus.spd.analog.com (8.14.6/8.14.6) with ESMTP id r3CAHeUp003436; Fri, 12 Apr 2013 06:17:41 -0400 Received: from localhost.localdomain (unknown [10.99.22.72]) by linux.site (Postfix) with ESMTP id 159C042CE48E; Thu, 11 Apr 2013 20:50:34 -0600 (MDT) From: Sonic Zhang To: Thomas Petazzoni , Arnout Vandecappelle , Date: Fri, 12 Apr 2013 18:18:28 +0800 Message-ID: <1365761909-15305-6-git-send-email-sonic.adi@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1365761909-15305-1-git-send-email-sonic.adi@gmail.com> References: <1365761909-15305-1-git-send-email-sonic.adi@gmail.com> MIME-Version: 1.0 Cc: Sonic Zhang , buildroot-devel@blackfin.uclinux.org Subject: [Buildroot] [PATCH v5 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 --- v5-change: - 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 --- arch/Config.in.bfin | 22 ++++++++++++++ toolchain/toolchain-external/ext-tool.mk | 46 ++++++++++++++++++++++------- 2 files changed, 57 insertions(+), 11 deletions(-) diff --git a/arch/Config.in.bfin b/arch/Config.in.bfin index f755c8d..917282d 100644 --- a/arch/Config.in.bfin +++ b/arch/Config.in.bfin @@ -62,6 +62,28 @@ config BR2_bf561 bool "bf561" endchoice +config BR2_BFIN_INSTALL_FDPIC_SHARED + bool "Install FDPIC shared libraries" + depends on !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. + +config BR2_BFIN_INSTALL_FLAT_SHARED + depends on BR2_BINFMT_FLAT_SHARED + default y + +config BR2_BFIN_INSTALL_FLAT_SHARED + bool "Install FLAT shared libraries" + depends on !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. + config BR2_ARCH default "bfin" diff --git a/toolchain/toolchain-external/ext-tool.mk b/toolchain/toolchain-external/ext-tool.mk index 27fd296..23824ab 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:'` ; \