Skip to contentSkip to conversation

arch: toolchain: Install blackfin FDPIC and FLAT libraries in external toolchain makefile.

PATCH New Sonic Zhang 2 participants 7 messages May 6, 2013 – May 14, 2013

lore
Share & tools
lore
#0 lore raw

PATCH v8 6/7 arch: toolchain: Install blackfin FDPIC and FLAT libraries in external toolchain makefile.

From: Sonic Zhang <[email protected]>

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.

---
v8-changes:
- Append the if condition to the bool line other than the depends line. In this case, 2 options of the same name are not necessary.

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   |   27 +++++++++++++++++
 toolchain/toolchain-external/ext-tool.mk |   46 ++++++++++++++++++++++-------
 2 files changed, 62 insertions(+), 11 deletions(-)
toolchain/toolchain-external/Config.in +27 -0
index a93ada3..1386ae7 100644
@@ -920,5 +920,32 @@ config BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY
 	  Copy the gdbserver provided by the external toolchain to the
 	  target.
 
+# 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" if !BR2_BINFMT_FLAT_SHARED
+	depends on BR2_bfin
+	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
 
toolchain/toolchain-external/ext-tool.mk +35 -11

66 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#1 lore raw

PATCH v8 6/7 arch: toolchain: Install blackfin FDPIC and FLAT libraries in external toolchain makefile.

Hi Thomas,

Quoted 149 lines · Sonic Zhang

From: Sonic Zhang <[email protected]>

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.

---
v8-changes:
- Append the if condition to the bool line other than the depends line. In this case, 2 options of the same name are not necessary.

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   |   27 +++++++++++++++++
 toolchain/toolchain-external/ext-tool.mk |   46 ++++++++++++++++++++++-------
 2 files changed, 62 insertions(+), 11 deletions(-)
toolchain/toolchain-external/Config.in +27 -0
index a93ada3..1386ae7 100644
@@ -920,5 +920,32 @@ config BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY
          Copy the gdbserver provided by the external toolchain to the
          target.
 
+# 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" if !BR2_BINFMT_FLAT_SHARED
+       depends on BR2_bfin
+       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
 
toolchain/toolchain-external/ext-tool.mk +29 -11
index bf2bee8..6f1fbe0 100644
@@ -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
@@ -318,17 +322,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
@@ -423,6 +416,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 \

toolchain/toolchain-external/ext-tool.mk $(STAMP_DIR)/ext-toolchain-installed: $(STAMP_DIR)/ext-toolchain-checked

Quoted 10 lines
toolchain/toolchain-external/ext-tool.mk +6 -1
+# 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:'` ; \
--

May I have your Acked-by for the last 2 bfin arch support patches?

Regards,

Sonic

#2 lore raw

PATCH v8 7/7 package: Introduce NOMMU symbol

In reply to Sonic Zhang

From: Sonic Zhang <[email protected]>

Introduce NOMMU symbol __NOMMU__

---
v6-changes:
- Remove space between comma and y.
- Restore endif after rebase.

---
 package/Makefile.in |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
package/Makefile.in +4 -0
index a449089..55d725d 100644
@@ -107,6 +107,10 @@ ifeq ($(BR2_BINFMT_FLAT),y)
 TARGET_LDFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE))
 endif
 
+ifneq ($(BR2_USE_MMU),y)
+TARGET_CFLAGS += -D__NOMMU__
+endif
+
 ifeq ($(BR2_BINFMT_FLAT_SHARED),y)
 TARGET_LDFLAGS += -mid-shared-library -mshared-library-id=0
 TARGET_CFLAGS += -mid-shared-library -mshared-library-id=0
Signature · 1 line
1.7.0.4
#3 lore raw

PATCH v8 7/7 package: Introduce NOMMU symbol

Hi Thomas,

Quoted 20 lines · Sonic Zhang

From: Sonic Zhang <[email protected]>

Introduce NOMMU symbol __NOMMU__

---
v6-changes:
- Remove space between comma and y.
- Restore endif after rebase.

---
 package/Makefile.in |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
package/Makefile.in +0 -0
index a449089..55d725d 100644
@@ -107,6 +107,10 @@ ifeq ($(BR2_BINFMT_FLAT),y)
 TARGET_LDFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE))

package/Makefile.in ifeq ($(BR2_BINFMT_FLAT),y)

Quoted 10 lines
package/Makefile.in +4 -1
 endif
 
+ifneq ($(BR2_USE_MMU),y)
+TARGET_CFLAGS += -D__NOMMU__
+endif
+
 ifeq ($(BR2_BINFMT_FLAT_SHARED),y)
 TARGET_LDFLAGS += -mid-shared-library -mshared-library-id=0
 TARGET_CFLAGS += -mid-shared-library -mshared-library-id=0
--

May I have your Acked-by for the last 2 bfin arch support patches?

Regards,

Sonic

#4 lore raw

PATCH v8 7/7 package: Introduce NOMMU symbol

Dear Sonic Zhang,

Quoted 8 lines · Sonic Zhang
Quoted 8 lines
package/Makefile.in +0 -0
index a449089..55d725d 100644
@@ -107,6 +107,10 @@ ifeq ($(BR2_BINFMT_FLAT),y)
 TARGET_LDFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE))
 endif
 
Quoted 10 lines

package/Makefile.in ifeq ($(BR2_BINFMT_FLAT),y)

Quoted 8 lines
package/Makefile.in +4 -1
+ifneq ($(BR2_USE_MMU),y)
+TARGET_CFLAGS += -D__NOMMU__
+endif
+
 ifeq ($(BR2_BINFMT_FLAT_SHARED),y)
 TARGET_LDFLAGS += -mid-shared-library -mshared-library-id=0
 TARGET_CFLAGS += -mid-shared-library -mshared-library-id=0
--

May I have your Acked-by for the last 2 bfin arch support patches?

For the 2013.05 cycle, it is now too late to get functional patches in, Peter is now only taking fixes. Though we can continue the work and get them merged in -next.

Regarding this patch specifically (PATCH 7/7), I have never been happy with it, because I don't like the idea of passing globally this -D__NOMMU__ symbol all around, while it's not a standard symbol.

I've asked Peter, and he agrees with this position. Therefore, what we would like to see is -D__NOMMU__ added only to those packages that actually need it.

Regarding PATCH 6/7, since the 2013.05 cycle is over for new patches, I was hoping to find some time to look and it and refactor it. But I believe I'll just test it once again, give my Acked-by: so it gets merged, and then later on find the time to refactor it.

Would this be ok for you?

Also, while we're at it, I've just launched a new version of our autobuilders infrastructure (see
http://lists.busybox.net/pipermail/buildroot/2013-May/072143.html).
Would you be interested in receiving a daily e-mail that contains only the list of Blackfin related build failures?

Best regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#5 lore raw

PATCH v8 7/7 package: Introduce NOMMU symbol

Hi Thomas,

Quoted 27 lines · Thomas Petazzoni

Dear Sonic Zhang,

Quoted 8 lines · Sonic Zhang
Quoted 8 lines
package/Makefile.in +0 -0
index a449089..55d725d 100644
@@ -107,6 +107,10 @@ ifeq ($(BR2_BINFMT_FLAT),y)
 TARGET_LDFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE))
 endif
 
Quoted 10 lines

package/Makefile.in ifeq ($(BR2_BINFMT_FLAT),y)

Quoted 8 lines
package/Makefile.in +4 -1
+ifneq ($(BR2_USE_MMU),y)
+TARGET_CFLAGS += -D__NOMMU__
+endif
+
 ifeq ($(BR2_BINFMT_FLAT_SHARED),y)
 TARGET_LDFLAGS += -mid-shared-library -mshared-library-id=0
 TARGET_CFLAGS += -mid-shared-library -mshared-library-id=0
--

May I have your Acked-by for the last 2 bfin arch support patches?

For the 2013.05 cycle, it is now too late to get functional patches in, Peter is now only taking fixes. Though we can continue the work and get them merged in -next.

Quoted 8 lines

Regarding this patch specifically (PATCH 7/7), I have never been happy with it, because I don't like the idea of passing globally this -D__NOMMU__ symbol all around, while it's not a standard symbol.

I've asked Peter, and he agrees with this position. Therefore, what we would like to see is -D__NOMMU__ added only to those packages that actually need it.

OK. This is fine to me.

Quoted 7 lines

Regarding PATCH 6/7, since the 2013.05 cycle is over for new patches, I was hoping to find some time to look and it and refactor it. But I believe I'll just test it once again, give my Acked-by: so it gets merged, and then later on find the time to refactor it.

Would this be ok for you?

Yes, having your Acked-by for -next tree is good enough.

Quoted 5 lines

Also, while we're at it, I've just launched a new version of our autobuilders infrastructure (see
http://lists.busybox.net/pipermail/buildroot/2013-May/072143.html).
Would you be interested in receiving a daily e-mail that contains only the list of Blackfin related build failures?

I am find to receive these notify email by my gmail account.

Regards,

Sonic

#6 lore raw

PATCH v8 7/7 package: Introduce NOMMU symbol

Dear Sonic Zhang,

Quoted 8 lines · Sonic Zhang
Quoted 8 lines

For the 2013.05 cycle, it is now too late to get functional patches in, Peter is now only taking fixes. Though we can continue the work and get them merged in -next.

Regarding this patch specifically (PATCH 7/7), I have never been happy with it, because I don't like the idea of passing globally this -D__NOMMU__ symbol all around, while it's not a standard symbol.

Quoted 5 lines
Quoted 3 lines

I've asked Peter, and he agrees with this position. Therefore, what we would like to see is -D__NOMMU__ added only to those packages that actually need it.

OK. This is fine to me.

Thanks. Of course, this is our current position. Depending on how many packages are affected, and how things turn out to work, we may decide otherwise in the future. But for now, we'd prefer to have it on a per-package basis to really understand which packages are affected by that.

Quoted 8 lines
Quoted 6 lines

Regarding PATCH 6/7, since the 2013.05 cycle is over for new patches, I was hoping to find some time to look and it and refactor it. But I believe I'll just test it once again, give my Acked-by: so it gets merged, and then later on find the time to refactor it.

Would this be ok for you?

Yes, having your Acked-by for -next tree is good enough.

Ok, so I'll work on testing your patch as is.

Quoted 7 lines
Quoted 5 lines

Also, while we're at it, I've just launched a new version of our autobuilders infrastructure (see
http://lists.busybox.net/pipermail/buildroot/2013-May/072143.html).
Would you be interested in receiving a daily e-mail that contains only the list of Blackfin related build failures?

I am find to receive these notify email by my gmail account.

Ok, will do so.

Thanks,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com