* [Buildroot] [PATCH v3 1/2] package: Makefile.in: Add target compilation flags for NOMMU architecture. @ 2013-03-22 9:01 Sonic Zhang 2013-03-22 9:01 ` [Buildroot] [PATCH v3 2/2] buildroot: target: Add Blackfin architecture support Sonic Zhang 2013-03-22 14:29 ` [Buildroot] [PATCH v3 1/2] package: Makefile.in: Add target compilation flags for NOMMU architecture Thomas Petazzoni 0 siblings, 2 replies; 21+ messages in thread From: Sonic Zhang @ 2013-03-22 9:01 UTC (permalink / raw) To: buildroot From: Sonic Zhang <sonic.zhang@analog.com> v2-changes: - Use double-dollar to cite ($(2)_FLAT_STACKSIZE) v1-changes: - Add BR2_TARGET_ABI_FLAT option - Add NOMMU compiling macro - Add FLAT ABI specific link flags - Add stack size to FLAT link flags if macro <PKG>_FLAT_STACKSIZE is defined. Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> --- arch/Config.in | 3 +++ package/Makefile.in | 8 ++++++++ package/pkg-autotools.mk | 5 +++++ package/pkg-generic.mk | 5 +++++ 4 files changed, 21 insertions(+), 0 deletions(-) diff --git a/arch/Config.in b/arch/Config.in index 472b10c..120c67e 100644 --- a/arch/Config.in +++ b/arch/Config.in @@ -174,6 +174,9 @@ config BR2_GCC_TARGET_ABI config BR2_GCC_TARGET_CPU string +config BR2_TARGET_ABI_FLAT + bool + if BR2_arm || BR2_armeb source "arch/Config.in.arm" endif diff --git a/package/Makefile.in b/package/Makefile.in index a8bf36b..acfd9c8 100644 --- a/package/Makefile.in +++ b/package/Makefile.in @@ -103,6 +103,14 @@ TARGET_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_ABI) $(TARGET_OPTIMIZATION) $(TARGET TARGET_CXXFLAGS = $(TARGET_CFLAGS) TARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS)) +ifeq ($(BR2_TARGET_ABI_FLAT),y) +TARGET_LDFLAGS += -Wl,-elf2flt +endif + +ifneq ($(BR2_USE_MMU), y) +TARGET_CFLAGS += -D__NOMMU__ +endif + ifeq ($(BR2_TOOLCHAIN_BUILDROOT)$(BR2_TOOLCHAIN_CTNG),y) TARGET_CROSS=$(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)- else diff --git a/package/pkg-autotools.mk b/package/pkg-autotools.mk index 890506b..09bdc7b 100644 --- a/package/pkg-autotools.mk +++ b/package/pkg-autotools.mk @@ -82,6 +82,11 @@ $(2)_CLEAN_OPT ?= clean $(2)_UNINSTALL_STAGING_OPT ?= DESTDIR=$$(STAGING_DIR) uninstall $(2)_UNINSTALL_TARGET_OPT ?= DESTDIR=$$(TARGET_DIR) uninstall +ifeq ($(BR2_TARGET_ABI_FLAT),y) + ifneq ($$($(2)_FLAT_STACKSIZE),) + $(2)_CONF_ENV += LDFLAGS="$(TARGET_LDFLAGS) -Wl,-elf2flt=-s$$($(2)_FLAT_STACKSIZE)" + endif +endif # # Configure step. Only define it if not already defined by the package diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk index 57b0fd0..5ce32f9 100644 --- a/package/pkg-generic.mk +++ b/package/pkg-generic.mk @@ -303,6 +303,11 @@ endif $(2)_REDISTRIBUTE ?= YES +ifeq ($(BR2_TARGET_ABI_FLAT),y) + ifneq ($$($(2)_FLAT_STACKSIZE),) + $(2)_FLAT_LDFLAGS = -Wl,-elf2flt=-s$$($(2)_FLAT_STACKSIZE) + endif +endif $(2)_DEPENDENCIES ?= $(filter-out $(1),$(patsubst host-host-%,host-%,$(addprefix host-,$($(3)_DEPENDENCIES)))) -- 1.7.0.4 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH v3 2/2] buildroot: target: Add Blackfin architecture support. 2013-03-22 9:01 [Buildroot] [PATCH v3 1/2] package: Makefile.in: Add target compilation flags for NOMMU architecture Sonic Zhang @ 2013-03-22 9:01 ` Sonic Zhang 2013-03-22 14:54 ` Thomas Petazzoni 2013-03-26 7:25 ` Arnout Vandecappelle 2013-03-22 14:29 ` [Buildroot] [PATCH v3 1/2] package: Makefile.in: Add target compilation flags for NOMMU architecture Thomas Petazzoni 1 sibling, 2 replies; 21+ messages in thread From: Sonic Zhang @ 2013-03-22 9:01 UTC (permalink / raw) To: buildroot From: Sonic Zhang <sonic.zhang@analog.com> v3-changes: - Put space around variable assignments. v2-changes: - Create arch makefile. v1-changes: - Create blackfin makefile. - Add blackfin target ABI options. - Add blackfin cpu options and shared library installation options. - Add blackfin cpu revision options and mcpu link flags - Add blackfin FLAT specific makefile flags. - Add shared library installation options and makefile targets to install shared libraries into rootfs image. - Copy extra blackfin toolchain FDPIC shared libraries to target fs Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> --- Makefile | 2 + arch/Config.in.bfin | 117 +++++++++++++++++++++++++++++++++++++++++++++++++ arch/Makefile.in | 5 ++ arch/Makefile.in.bfin | 50 +++++++++++++++++++++ 4 files changed, 174 insertions(+), 0 deletions(-) create mode 100644 arch/Makefile.in create mode 100644 arch/Makefile.in.bfin diff --git a/Makefile b/Makefile index 7f0822f..c2f43a4 100644 --- a/Makefile +++ b/Makefile @@ -329,6 +329,8 @@ ifneq ($(PACKAGE_OVERRIDE_FILE),) -include $(PACKAGE_OVERRIDE_FILE) endif +include arch/Makefile.in + include package/*/*.mk include boot/common.mk diff --git a/arch/Config.in.bfin b/arch/Config.in.bfin index 0b137ae..0750b86 100644 --- a/arch/Config.in.bfin +++ b/arch/Config.in.bfin @@ -7,10 +7,127 @@ config BR2_BFIN_FDPIC config BR2_BFIN_FLAT bool "FLAT" select BR2_PREFER_STATIC_LIB +config BR2_BFIN_FLAT_SEP_DATA + bool "FLAT (Separate data)" + select BR2_PREFER_STATIC_LIB +config BR2_BFIN_SHARED_FLAT + bool "Shared FLAT" + select BR2_PREFER_STATIC_LIB +endchoice + +choice + prompt "Target CPU" + depends on BR2_bfin + default BR2_bf609 + help + Specify target CPU +config BR2_bf606 + bool "bf606" +config BR2_bf607 + bool "bf607" +config BR2_bf608 + bool "bf608" +config BR2_bf609 + bool "bf609" +config BR2_bf512 + bool "bf512" +config BR2_bf514 + bool "bf514" +config BR2_bf516 + bool "bf516" +config BR2_bf518 + bool "bf518" +config BR2_bf522 + bool "bf522" +config BR2_bf523 + bool "bf523" +config BR2_bf524 + bool "bf524" +config BR2_bf525 + bool "bf525" +config BR2_bf526 + bool "bf526" +config BR2_bf527 + bool "bf527" +config BR2_bf531 + bool "bf531" +config BR2_bf532 + bool "bf532" +config BR2_bf533 + bool "bf533" +config BR2_bf534 + bool "bf534" +config BR2_bf536 + bool "bf536" +config BR2_bf537 + bool "bf537" +config BR2_bf538 + bool "bf538" +config BR2_bf539 + bool "bf539" +config BR2_bf542 + bool "bf542" +config BR2_bf544 + bool "bf544" +config BR2_bf547 + bool "bf547" +config BR2_bf548 + bool "bf548" +config BR2_bf549 + bool "bf549" +config BR2_bf561 + bool "bf561" endchoice +config BR2_TARGET_CPU_REVISION + string "Target CPU revision" + +config BR2_BFIN_INSTALL_ELF_SHARED + depends on BR2_bfin && !BR2_BFIN_FDPIC + bool "Install ELF shared libraries" + default y + +config BR2_BFIN_INSTALL_FLAT_SHARED + depends on BR2_bfin + bool "Install FLAT shared libraries" if !BR2_BFIN_SHARED_FLAT + default y + config BR2_ARCH default "bfin" config BR2_ENDIAN default "LITTLE" + +config BR2_GCC_TARGET_CPU + default bf606 if BR2_bf606 + default bf607 if BR2_bf607 + default bf608 if BR2_bf608 + default bf609 if BR2_bf609 + default bf512 if BR2_bf512 + default bf514 if BR2_bf514 + default bf516 if BR2_bf516 + default bf518 if BR2_bf518 + default bf522 if BR2_bf522 + default bf523 if BR2_bf523 + default bf524 if BR2_bf524 + default bf525 if BR2_bf525 + default bf526 if BR2_bf526 + default bf527 if BR2_bf527 + default bf531 if BR2_bf531 + default bf532 if BR2_bf532 + default bf533 if BR2_bf533 + default bf534 if BR2_bf534 + default bf536 if BR2_bf536 + default bf537 if BR2_bf537 + default bf538 if BR2_bf538 + default bf539 if BR2_bf539 + default bf542 if BR2_bf542 + default bf544 if BR2_bf544 + default bf547 if BR2_bf547 + default bf548 if BR2_bf548 + default bf549 if BR2_bf549 + default bf561 if BR2_bf561 + +config BR2_TARGET_ABI_FLAT + default n if BR2_BFIN_FDPIC + default y diff --git a/arch/Makefile.in b/arch/Makefile.in new file mode 100644 index 0000000..d791118 --- /dev/null +++ b/arch/Makefile.in @@ -0,0 +1,5 @@ +# The architecture specific Makefile.in.$ARCH should be included only +# when the arch macro is selected. +ifeq ($(BR2_bfin),y) +include arch/Makefile.in.bfin +endif diff --git a/arch/Makefile.in.bfin b/arch/Makefile.in.bfin new file mode 100644 index 0000000..e16532a --- /dev/null +++ b/arch/Makefile.in.bfin @@ -0,0 +1,50 @@ +TARGETS-y = +TARGETS-$(BR2_BFIN_INSTALL_ELF_SHARED) += romfs.shared.libs.elf +TARGETS-$(BR2_BFIN_INSTALL_FLAT_SHARED) += romfs.shared.libs.flat +TARGETS += $(TARGETS-y) + +ifeq ($(BR2_BFIN_FDPIC),y) +USR_LIB_EXTERNAL_LIBS += libgfortran.so libgomp.so libmudflap.so libmudflapth.so libobjc.so +endif + +CROSS_COMPILE_SHARED_ELF ?= bfin-linux-uclibc- +romfs.shared.libs.elf: + set -e; \ + t=`$(CROSS_COMPILE_SHARED_ELF)gcc $(CPUFLAGS) -print-file-name=libc.a`; \ + t=`dirname $$t`/../..; \ + for i in $$t/lib/*so*; do \ + i=`readlink -f "$$i"`; \ + soname=`$(CROSS_COMPILE_SHARED_ELF)readelf -d "$$i" | sed -n '/(SONAME)/s:.*[[]\(.*\)[]].*:\1:p'`; \ + $(INSTALL) -D $$i $(TARGET_DIR)/lib/$$soname; \ + done + +CROSS_COMPILE_SHARED_FLAT ?= bfin-uclinux- +romfs.shared.libs.flat: + set -e; \ + t=`$(CROSS_COMPILE_SHARED_FLAT)gcc $(CPUFLAGS) -mid-shared-library -print-file-name=libc`; \ + if [ -f $$t -a ! -h $$t ] ; then \ + $(INSTALL) -D $$t $(TARGET_DIR)/lib/lib1.so; \ + fi + +ifeq ($(BR2_TARGET_CPU_REVISION),) +TARGET_CPU = -mcpu=$(BR2_GCC_TARGET_CPU) +else +TARGET_CPU = -mcpu=$(BR2_GCC_TARGET_CPU)-$(BR2_TARGET_CPU_REVISION) +endif +TARGET_CFLAGS += $(call qstrip,$(TARGET_CPU)) + +ifneq ($(BR2_USE_MMU), y) +TARGET_CFLAGS += -D__uClinux__ +endif + +ifeq ($(BR2_BFIN_FLAT_SEP_DATA),y) +TARGET_LDFLAGS += -msep-data +TARGET_CFLAGS += -msep-data +TARGET_CXXFLAGS += -msep-data +endif + +ifeq ($(BR2_BFIN_SHARED_FLAT), y) +TARGET_LDFLAGS += -mid-shared-library -mshared-library-id=0 +TARGET_CFLAGS += -mid-shared-library -mshared-library-id=0 +TARGET_CXXFLAGS += -mid-shared-library -mshared-library-id=0 +endif -- 1.7.0.4 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH v3 2/2] buildroot: target: Add Blackfin architecture support. 2013-03-22 9:01 ` [Buildroot] [PATCH v3 2/2] buildroot: target: Add Blackfin architecture support Sonic Zhang @ 2013-03-22 14:54 ` Thomas Petazzoni 2013-03-25 11:33 ` Sonic Zhang 2013-03-26 7:25 ` Arnout Vandecappelle 1 sibling, 1 reply; 21+ messages in thread From: Thomas Petazzoni @ 2013-03-22 14:54 UTC (permalink / raw) To: buildroot Dear Sonic Zhang, Please add a commit log explaining all what you're doing. Your changes are quite architecture-specific and touch the core of Buildroot, but there are also not comments and no commit log. Also your changelog should be below the --- and not before, otherwise it ends up in the commit log forever. On Fri, 22 Mar 2013 17:01:42 +0800, Sonic Zhang wrote: > diff --git a/Makefile b/Makefile > index 7f0822f..c2f43a4 100644 > --- a/Makefile > +++ b/Makefile > @@ -329,6 +329,8 @@ ifneq ($(PACKAGE_OVERRIDE_FILE),) > -include $(PACKAGE_OVERRIDE_FILE) > endif > > +include arch/Makefile.in I must admit I am not entirely happy with having Blackfin-specific Makefiles, but it's true that we already have some architecture-specific crap in package/Makefile.in that we could more cleanly spread in arch/Makefile.in.<arch>. > diff --git a/arch/Config.in.bfin b/arch/Config.in.bfin > index 0b137ae..0750b86 100644 > --- a/arch/Config.in.bfin > +++ b/arch/Config.in.bfin > @@ -7,10 +7,127 @@ config BR2_BFIN_FDPIC > config BR2_BFIN_FLAT > bool "FLAT" > select BR2_PREFER_STATIC_LIB > +config BR2_BFIN_FLAT_SEP_DATA > + bool "FLAT (Separate data)" > + select BR2_PREFER_STATIC_LIB > +config BR2_BFIN_SHARED_FLAT > + bool "Shared FLAT" > + select BR2_PREFER_STATIC_LIB > +endchoice I don't think we should have Blackfin-specific options. As I suggested in the review of PATCH 1/2, we should probably have global BR2_BINFMT_<foo> options. > +config BR2_TARGET_CPU_REVISION > + string "Target CPU revision" Help text needed. > +config BR2_BFIN_INSTALL_ELF_SHARED > + depends on BR2_bfin && !BR2_BFIN_FDPIC Confused: why in the FDPIC case you would not install the ELF shared libraries? > + bool "Install ELF shared libraries" > + default y Help text needed. > +config BR2_BFIN_INSTALL_FLAT_SHARED > + depends on BR2_bfin > + bool "Install FLAT shared libraries" if !BR2_BFIN_SHARED_FLAT > + default y Help text needed. > + > config BR2_ARCH > default "bfin" > > config BR2_ENDIAN > default "LITTLE" > + > +config BR2_GCC_TARGET_CPU > + default bf606 if BR2_bf606 > + default bf607 if BR2_bf607 > + default bf608 if BR2_bf608 > + default bf609 if BR2_bf609 > + default bf512 if BR2_bf512 > + default bf514 if BR2_bf514 > + default bf516 if BR2_bf516 > + default bf518 if BR2_bf518 > + default bf522 if BR2_bf522 > + default bf523 if BR2_bf523 > + default bf524 if BR2_bf524 > + default bf525 if BR2_bf525 > + default bf526 if BR2_bf526 > + default bf527 if BR2_bf527 > + default bf531 if BR2_bf531 > + default bf532 if BR2_bf532 > + default bf533 if BR2_bf533 > + default bf534 if BR2_bf534 > + default bf536 if BR2_bf536 > + default bf537 if BR2_bf537 > + default bf538 if BR2_bf538 > + default bf539 if BR2_bf539 > + default bf542 if BR2_bf542 > + default bf544 if BR2_bf544 > + default bf547 if BR2_bf547 > + default bf548 if BR2_bf548 > + default bf549 if BR2_bf549 > + default bf561 if BR2_bf561 > + > +config BR2_TARGET_ABI_FLAT > + default n if BR2_BFIN_FDPIC > + default y To be refactored with the BR2_BINFMT_<foo> stuff. > diff --git a/arch/Makefile.in b/arch/Makefile.in > new file mode 100644 > index 0000000..d791118 > --- /dev/null > +++ b/arch/Makefile.in > @@ -0,0 +1,5 @@ > +# The architecture specific Makefile.in.$ARCH should be included only > +# when the arch macro is selected. > +ifeq ($(BR2_bfin),y) > +include arch/Makefile.in.bfin > +endif Ok. > diff --git a/arch/Makefile.in.bfin b/arch/Makefile.in.bfin > new file mode 100644 > index 0000000..e16532a > --- /dev/null > +++ b/arch/Makefile.in.bfin > @@ -0,0 +1,50 @@ > +TARGETS-y = Isn't that dangerous if someone else is using TARGETS-y ? > +TARGETS-$(BR2_BFIN_INSTALL_ELF_SHARED) += romfs.shared.libs.elf > +TARGETS-$(BR2_BFIN_INSTALL_FLAT_SHARED) += romfs.shared.libs.flat What's the relation with "romfs" ? Also, we more or less name all our targets target-<something>, so it would be good to follow this convention. Also remember to update the TARGET_EXCEPTIONS variable in support/scripts/graph-depends when you add more of such custom targets. > +TARGETS += $(TARGETS-y) > + > +ifeq ($(BR2_BFIN_FDPIC),y) > +USR_LIB_EXTERNAL_LIBS += libgfortran.so libgomp.so libmudflap.so libmudflapth.so libobjc.so > +endif This is totally unrelated to Blackfin, and therefore has no reason to be here and to depend on BR2_BFIN_FDPIC. > +CROSS_COMPILE_SHARED_ELF ?= bfin-linux-uclibc- No reason to be here. Please use $(TARGET_CC) and $(TARGET_READELF) below. > +romfs.shared.libs.elf: > + set -e; \ > + t=`$(CROSS_COMPILE_SHARED_ELF)gcc $(CPUFLAGS) -print-file-name=libc.a`; \ > + t=`dirname $$t`/../..; \ > + for i in $$t/lib/*so*; do \ > + i=`readlink -f "$$i"`; \ > + soname=`$(CROSS_COMPILE_SHARED_ELF)readelf -d "$$i" | sed -n '/(SONAME)/s:.*[[]\(.*\)[]].*:\1:p'`; \ > + $(INSTALL) -D $$i $(TARGET_DIR)/lib/$$soname; \ > + done Isn't this done already by the external toolchain logic? Some documentation/comments on what you're doing here would be good. I'm trying to understand if it's really Blackfin-specific, if it's specific to the usage of external toolchains or would apply to the internal toolchain backend as well, etc. > +CROSS_COMPILE_SHARED_FLAT ?= bfin-uclinux- TARGET_CC to be used below. > +romfs.shared.libs.flat: > + set -e; \ > + t=`$(CROSS_COMPILE_SHARED_FLAT)gcc $(CPUFLAGS) -mid-shared-library -print-file-name=libc`; \ > + if [ -f $$t -a ! -h $$t ] ; then \ > + $(INSTALL) -D $$t $(TARGET_DIR)/lib/lib1.so; \ > + fi > + > +ifeq ($(BR2_TARGET_CPU_REVISION),) > +TARGET_CPU = -mcpu=$(BR2_GCC_TARGET_CPU) > +else > +TARGET_CPU = -mcpu=$(BR2_GCC_TARGET_CPU)-$(BR2_TARGET_CPU_REVISION) > +endif > +TARGET_CFLAGS += $(call qstrip,$(TARGET_CPU)) This will not work for the external toolchain wrapper logic. The external toolchain wrapper logic (in toolchain/toolchain-external/ext-tool.mk) takes the value of BR2_GCC_TARGET_CPU and encodes it as a -mcpu in the external toolchain wrapper. We want this to be part of the external toolchain wrapper instead of TARGET_CFLAGS so that people directly using the external toolchain from host/usr/bin/ go through the wrapper, and end up having the same mcpu/march/mtune options as the Buildroot build. > +ifneq ($(BR2_USE_MMU), y) > +TARGET_CFLAGS += -D__uClinux__ > +endif Why do you have this one here in a Blackfin-specific area, and the -D__NOMMU__ in PATCH 1/2 in an architecture-generic area? > +ifeq ($(BR2_BFIN_FLAT_SEP_DATA),y) > +TARGET_LDFLAGS += -msep-data > +TARGET_CFLAGS += -msep-data > +TARGET_CXXFLAGS += -msep-data > +endif > + > +ifeq ($(BR2_BFIN_SHARED_FLAT), y) > +TARGET_LDFLAGS += -mid-shared-library -mshared-library-id=0 > +TARGET_CFLAGS += -mid-shared-library -mshared-library-id=0 > +TARGET_CXXFLAGS += -mid-shared-library -mshared-library-id=0 > +endif I think those options are used to select which multilib variant to use in the toolchain. Therefore, they should be encoded into the external toolchain wrapper and not just passed in TARGET_LDFLAGS, TARGET_CFLAGS and TARGET_CXXFLAGS. Best regards, Thomas -- Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com ^ permalink raw reply [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH v3 2/2] buildroot: target: Add Blackfin architecture support. 2013-03-22 14:54 ` Thomas Petazzoni @ 2013-03-25 11:33 ` Sonic Zhang 2013-03-25 11:47 ` Thomas De Schampheleire 0 siblings, 1 reply; 21+ messages in thread From: Sonic Zhang @ 2013-03-25 11:33 UTC (permalink / raw) To: buildroot Hi Thomas, On Fri, Mar 22, 2013 at 10:54 PM, Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote: > Dear Sonic Zhang, > > Please add a commit log explaining all what you're doing. Your changes > are quite architecture-specific and touch the core of Buildroot, but > there are also not comments and no commit log. > > Also your changelog should be below the --- and not before, otherwise > it ends up in the commit log forever. > > On Fri, 22 Mar 2013 17:01:42 +0800, Sonic Zhang wrote: > >> diff --git a/Makefile b/Makefile >> index 7f0822f..c2f43a4 100644 >> --- a/Makefile >> +++ b/Makefile >> @@ -329,6 +329,8 @@ ifneq ($(PACKAGE_OVERRIDE_FILE),) >> -include $(PACKAGE_OVERRIDE_FILE) >> endif >> >> +include arch/Makefile.in > > I must admit I am not entirely happy with having Blackfin-specific > Makefiles, but it's true that we already have some > architecture-specific crap in package/Makefile.in that we could more > cleanly spread in arch/Makefile.in.<arch>. > >> diff --git a/arch/Config.in.bfin b/arch/Config.in.bfin >> index 0b137ae..0750b86 100644 >> --- a/arch/Config.in.bfin >> +++ b/arch/Config.in.bfin >> @@ -7,10 +7,127 @@ config BR2_BFIN_FDPIC >> config BR2_BFIN_FLAT >> bool "FLAT" >> select BR2_PREFER_STATIC_LIB >> +config BR2_BFIN_FLAT_SEP_DATA >> + bool "FLAT (Separate data)" >> + select BR2_PREFER_STATIC_LIB >> +config BR2_BFIN_SHARED_FLAT >> + bool "Shared FLAT" >> + select BR2_PREFER_STATIC_LIB >> +endchoice > > I don't think we should have Blackfin-specific options. As I suggested > in the review of PATCH 1/2, we should probably have global > BR2_BINFMT_<foo> options. > OK. I will move these macro to arch/Config.in >> +config BR2_TARGET_CPU_REVISION >> + string "Target CPU revision" > > Help text needed. > OK. >> +config BR2_BFIN_INSTALL_ELF_SHARED >> + depends on BR2_bfin && !BR2_BFIN_FDPIC > > Confused: why in the FDPIC case you would not install the ELF shared > libraries? > Blackfin Linux kernel supports running both FDPIC and FLAT applications concurrently if the binary format specific libraries installed properly. This option allow developer to install FDPIC libraries into a buildroot rootfs image built with binary format macro other than BR2_BINFMT_FDPIC. It doesn't take effect if BR2_BINMAT_FDPIC is configured. >> + bool "Install ELF shared libraries" >> + default y > > Help text needed. > OK. >> +config BR2_BFIN_INSTALL_FLAT_SHARED >> + depends on BR2_bfin >> + bool "Install FLAT shared libraries" if !BR2_BFIN_SHARED_FLAT >> + default y > > Help text needed. > >> + >> config BR2_ARCH >> default "bfin" >> >> config BR2_ENDIAN >> default "LITTLE" >> + >> +config BR2_GCC_TARGET_CPU >> + default bf606 if BR2_bf606 >> + default bf607 if BR2_bf607 >> + default bf608 if BR2_bf608 >> + default bf609 if BR2_bf609 >> + default bf512 if BR2_bf512 >> + default bf514 if BR2_bf514 >> + default bf516 if BR2_bf516 >> + default bf518 if BR2_bf518 >> + default bf522 if BR2_bf522 >> + default bf523 if BR2_bf523 >> + default bf524 if BR2_bf524 >> + default bf525 if BR2_bf525 >> + default bf526 if BR2_bf526 >> + default bf527 if BR2_bf527 >> + default bf531 if BR2_bf531 >> + default bf532 if BR2_bf532 >> + default bf533 if BR2_bf533 >> + default bf534 if BR2_bf534 >> + default bf536 if BR2_bf536 >> + default bf537 if BR2_bf537 >> + default bf538 if BR2_bf538 >> + default bf539 if BR2_bf539 >> + default bf542 if BR2_bf542 >> + default bf544 if BR2_bf544 >> + default bf547 if BR2_bf547 >> + default bf548 if BR2_bf548 >> + default bf549 if BR2_bf549 >> + default bf561 if BR2_bf561 >> + >> +config BR2_TARGET_ABI_FLAT >> + default n if BR2_BFIN_FDPIC >> + default y > > To be refactored with the BR2_BINFMT_<foo> stuff. > OK. >> diff --git a/arch/Makefile.in b/arch/Makefile.in >> new file mode 100644 >> index 0000000..d791118 >> --- /dev/null >> +++ b/arch/Makefile.in >> @@ -0,0 +1,5 @@ >> +# The architecture specific Makefile.in.$ARCH should be included only >> +# when the arch macro is selected. >> +ifeq ($(BR2_bfin),y) >> +include arch/Makefile.in.bfin >> +endif > > Ok. > >> diff --git a/arch/Makefile.in.bfin b/arch/Makefile.in.bfin >> new file mode 100644 >> index 0000000..e16532a >> --- /dev/null >> +++ b/arch/Makefile.in.bfin >> @@ -0,0 +1,50 @@ >> +TARGETS-y = > > Isn't that dangerous if someone else is using TARGETS-y ? Yes, this line can be removed. > >> +TARGETS-$(BR2_BFIN_INSTALL_ELF_SHARED) += romfs.shared.libs.elf >> +TARGETS-$(BR2_BFIN_INSTALL_FLAT_SHARED) += romfs.shared.libs.flat > > What's the relation with "romfs" ? > > Also, we more or less name all our targets target-<something>, so it > would be good to follow this convention. Also remember to update > the TARGET_EXCEPTIONS variable in support/scripts/graph-depends when > you add more of such custom targets. > OK. >> +TARGETS += $(TARGETS-y) >> + >> +ifeq ($(BR2_BFIN_FDPIC),y) >> +USR_LIB_EXTERNAL_LIBS += libgfortran.so libgomp.so libmudflap.so libmudflapth.so libobjc.so >> +endif > > This is totally unrelated to Blackfin, and therefore has no reason to > be here and to depend on BR2_BFIN_FDPIC. > Where should I put these library names to ? >> +CROSS_COMPILE_SHARED_ELF ?= bfin-linux-uclibc- > > No reason to be here. Please use $(TARGET_CC) and $(TARGET_READELF) > below. There are 2 individual Blackfin toolchain binaries for FDPIC and FLAT format. The prefix names are different. And as I explained ahead, the target is to install libraries of a different binary format with different toolchain prefix name in current $(TARGET_CC) and $(TARGET_READELF). So, this macro can not be removed. >> +romfs.shared.libs.elf: >> + set -e; \ >> + t=`$(CROSS_COMPILE_SHARED_ELF)gcc $(CPUFLAGS) -print-file-name=libc.a`; \ >> + t=`dirname $$t`/../..; \ >> + for i in $$t/lib/*so*; do \ >> + i=`readlink -f "$$i"`; \ >> + soname=`$(CROSS_COMPILE_SHARED_ELF)readelf -d "$$i" | sed -n '/(SONAME)/s:.*[[]\(.*\)[]].*:\1:p'`; \ >> + $(INSTALL) -D $$i $(TARGET_DIR)/lib/$$soname; \ >> + done > > Isn't this done already by the external toolchain logic? Some > documentation/comments on what you're doing here would be good. I'm > trying to understand if it's really Blackfin-specific, if it's specific > to the usage of external toolchains or would apply to the internal > toolchain backend as well, etc. > No. Refer to my explanation ahead. >> +CROSS_COMPILE_SHARED_FLAT ?= bfin-uclinux- > > TARGET_CC to be used below. > Ditto. >> +romfs.shared.libs.flat: >> + set -e; \ >> + t=`$(CROSS_COMPILE_SHARED_FLAT)gcc $(CPUFLAGS) -mid-shared-library -print-file-name=libc`; \ >> + if [ -f $$t -a ! -h $$t ] ; then \ >> + $(INSTALL) -D $$t $(TARGET_DIR)/lib/lib1.so; \ >> + fi >> + >> +ifeq ($(BR2_TARGET_CPU_REVISION),) >> +TARGET_CPU = -mcpu=$(BR2_GCC_TARGET_CPU) >> +else >> +TARGET_CPU = -mcpu=$(BR2_GCC_TARGET_CPU)-$(BR2_TARGET_CPU_REVISION) >> +endif >> +TARGET_CFLAGS += $(call qstrip,$(TARGET_CPU)) > > This will not work for the external toolchain wrapper logic. The > external toolchain wrapper logic (in > toolchain/toolchain-external/ext-tool.mk) takes the value of > BR2_GCC_TARGET_CPU and encodes it as a -mcpu in the external toolchain > wrapper. We want this to be part of the external toolchain wrapper > instead of TARGET_CFLAGS so that people directly using the external > toolchain from host/usr/bin/ go through the wrapper, and end up having > the same mcpu/march/mtune options as the Buildroot build. > OK >> +ifneq ($(BR2_USE_MMU), y) >> +TARGET_CFLAGS += -D__uClinux__ >> +endif > > Why do you have this one here in a Blackfin-specific area, and the > -D__NOMMU__ in PATCH 1/2 in an architecture-generic area? This is a blackfin specific hack for old applications. Can be removed in patch for upstream. > >> +ifeq ($(BR2_BFIN_FLAT_SEP_DATA),y) >> +TARGET_LDFLAGS += -msep-data >> +TARGET_CFLAGS += -msep-data >> +TARGET_CXXFLAGS += -msep-data >> +endif >> + >> +ifeq ($(BR2_BFIN_SHARED_FLAT), y) >> +TARGET_LDFLAGS += -mid-shared-library -mshared-library-id=0 >> +TARGET_CFLAGS += -mid-shared-library -mshared-library-id=0 >> +TARGET_CXXFLAGS += -mid-shared-library -mshared-library-id=0 >> +endif > > I think those options are used to select which multilib variant to use > in the toolchain. Therefore, they should be encoded into the external > toolchain wrapper and not just passed in TARGET_LDFLAGS, TARGET_CFLAGS > and TARGET_CXXFLAGS. > OK. Regards, Sonic ^ permalink raw reply [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH v3 2/2] buildroot: target: Add Blackfin architecture support. 2013-03-25 11:33 ` Sonic Zhang @ 2013-03-25 11:47 ` Thomas De Schampheleire 2013-03-26 8:16 ` Sonic Zhang 0 siblings, 1 reply; 21+ messages in thread From: Thomas De Schampheleire @ 2013-03-25 11:47 UTC (permalink / raw) To: buildroot Hi Sonic, On Mon, Mar 25, 2013 at 12:33 PM, Sonic Zhang <sonic.adi@gmail.com> wrote: > Hi Thomas, > > On Fri, Mar 22, 2013 at 10:54 PM, Thomas Petazzoni > <thomas.petazzoni@free-electrons.com> wrote: > > Dear Sonic Zhang, > > > > Please add a commit log explaining all what you're doing. Your changes > > are quite architecture-specific and touch the core of Buildroot, but > > there are also not comments and no commit log. > > > > Also your changelog should be below the --- and not before, otherwise > > it ends up in the commit log forever. > > > > On Fri, 22 Mar 2013 17:01:42 +0800, Sonic Zhang wrote: > > > >> diff --git a/Makefile b/Makefile > >> index 7f0822f..c2f43a4 100644 > >> --- a/Makefile > >> +++ b/Makefile > >> @@ -329,6 +329,8 @@ ifneq ($(PACKAGE_OVERRIDE_FILE),) > >> -include $(PACKAGE_OVERRIDE_FILE) > >> endif > >> > >> +include arch/Makefile.in > > > > I must admit I am not entirely happy with having Blackfin-specific > > Makefiles, but it's true that we already have some > > architecture-specific crap in package/Makefile.in that we could more > > cleanly spread in arch/Makefile.in.<arch>. > > > >> diff --git a/arch/Config.in.bfin b/arch/Config.in.bfin > >> index 0b137ae..0750b86 100644 > >> --- a/arch/Config.in.bfin > >> +++ b/arch/Config.in.bfin > >> @@ -7,10 +7,127 @@ config BR2_BFIN_FDPIC > >> config BR2_BFIN_FLAT > >> bool "FLAT" > >> select BR2_PREFER_STATIC_LIB > >> +config BR2_BFIN_FLAT_SEP_DATA > >> + bool "FLAT (Separate data)" > >> + select BR2_PREFER_STATIC_LIB > >> +config BR2_BFIN_SHARED_FLAT > >> + bool "Shared FLAT" > >> + select BR2_PREFER_STATIC_LIB > >> +endchoice > > > > I don't think we should have Blackfin-specific options. As I suggested > > in the review of PATCH 1/2, we should probably have global > > BR2_BINFMT_<foo> options. > > > > OK. I will move these macro to arch/Config.in > > >> +config BR2_TARGET_CPU_REVISION > >> + string "Target CPU revision" > > > > Help text needed. > > > > OK. > > >> +config BR2_BFIN_INSTALL_ELF_SHARED > >> + depends on BR2_bfin && !BR2_BFIN_FDPIC > > > > Confused: why in the FDPIC case you would not install the ELF shared > > libraries? > > > > Blackfin Linux kernel supports running both FDPIC and FLAT > applications concurrently if the binary format specific libraries > installed properly. This option allow developer to install FDPIC > libraries into a buildroot rootfs image built with binary format macro > other than BR2_BINFMT_FDPIC. It doesn't take effect if > BR2_BINMAT_FDPIC is configured. > > >> + bool "Install ELF shared libraries" > >> + default y > > > > Help text needed. > > > > OK. > > >> +config BR2_BFIN_INSTALL_FLAT_SHARED > >> + depends on BR2_bfin > >> + bool "Install FLAT shared libraries" if !BR2_BFIN_SHARED_FLAT > >> + default y > > > > Help text needed. > > > >> + > >> config BR2_ARCH > >> default "bfin" > >> > >> config BR2_ENDIAN > >> default "LITTLE" > >> + > >> +config BR2_GCC_TARGET_CPU > >> + default bf606 if BR2_bf606 > >> + default bf607 if BR2_bf607 > >> + default bf608 if BR2_bf608 > >> + default bf609 if BR2_bf609 > >> + default bf512 if BR2_bf512 > >> + default bf514 if BR2_bf514 > >> + default bf516 if BR2_bf516 > >> + default bf518 if BR2_bf518 > >> + default bf522 if BR2_bf522 > >> + default bf523 if BR2_bf523 > >> + default bf524 if BR2_bf524 > >> + default bf525 if BR2_bf525 > >> + default bf526 if BR2_bf526 > >> + default bf527 if BR2_bf527 > >> + default bf531 if BR2_bf531 > >> + default bf532 if BR2_bf532 > >> + default bf533 if BR2_bf533 > >> + default bf534 if BR2_bf534 > >> + default bf536 if BR2_bf536 > >> + default bf537 if BR2_bf537 > >> + default bf538 if BR2_bf538 > >> + default bf539 if BR2_bf539 > >> + default bf542 if BR2_bf542 > >> + default bf544 if BR2_bf544 > >> + default bf547 if BR2_bf547 > >> + default bf548 if BR2_bf548 > >> + default bf549 if BR2_bf549 > >> + default bf561 if BR2_bf561 > >> + > >> +config BR2_TARGET_ABI_FLAT > >> + default n if BR2_BFIN_FDPIC > >> + default y > > > > To be refactored with the BR2_BINFMT_<foo> stuff. > > > > OK. > > >> diff --git a/arch/Makefile.in b/arch/Makefile.in > >> new file mode 100644 > >> index 0000000..d791118 > >> --- /dev/null > >> +++ b/arch/Makefile.in > >> @@ -0,0 +1,5 @@ > >> +# The architecture specific Makefile.in.$ARCH should be included only > >> +# when the arch macro is selected. > >> +ifeq ($(BR2_bfin),y) > >> +include arch/Makefile.in.bfin > >> +endif > > > > Ok. > > > >> diff --git a/arch/Makefile.in.bfin b/arch/Makefile.in.bfin > >> new file mode 100644 > >> index 0000000..e16532a > >> --- /dev/null > >> +++ b/arch/Makefile.in.bfin > >> @@ -0,0 +1,50 @@ > >> +TARGETS-y = > > > > Isn't that dangerous if someone else is using TARGETS-y ? > > Yes, this line can be removed. > > > > >> +TARGETS-$(BR2_BFIN_INSTALL_ELF_SHARED) += romfs.shared.libs.elf > >> +TARGETS-$(BR2_BFIN_INSTALL_FLAT_SHARED) += romfs.shared.libs.flat > > > > What's the relation with "romfs" ? > > > > Also, we more or less name all our targets target-<something>, so it > > would be good to follow this convention. Also remember to update > > the TARGET_EXCEPTIONS variable in support/scripts/graph-depends when > > you add more of such custom targets. > > > > OK. > > >> +TARGETS += $(TARGETS-y) > >> + > >> +ifeq ($(BR2_BFIN_FDPIC),y) > >> +USR_LIB_EXTERNAL_LIBS += libgfortran.so libgomp.so libmudflap.so > libmudflapth.so libobjc.so > >> +endif > > > > This is totally unrelated to Blackfin, and therefore has no reason to > > be here and to depend on BR2_BFIN_FDPIC. > > > > Where should I put these library names to ? > > >> +CROSS_COMPILE_SHARED_ELF ?= bfin-linux-uclibc- > > > > No reason to be here. Please use $(TARGET_CC) and $(TARGET_READELF) > > below. > > There are 2 individual Blackfin toolchain binaries for FDPIC and FLAT > format. The prefix names are different. And as I explained ahead, the > target is to install libraries of a different binary format with > different toolchain prefix name in current $(TARGET_CC) and > $(TARGET_READELF). So, this macro can not be removed. > Currently all compilations are using TARGET_CC and such, which expands to $(TARGET_CROSS)gcc. TARGET_CROSS in turn is derived as: ifeq ($(BR2_TOOLCHAIN_BUILDROOT)$(BR2_TOOLCHAIN_CTNG),y) TARGET_CROSS=$(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)- else TARGET_CROSS=$(HOST_DIR)/usr/bin/$(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PREFIX))- endif If you need to have different prefixes, isn't it possible to hook into one of these variables, instead of creating a new variable CROSS_COMPILE_SHARED_ELF/FLAT ? Depending on the elf/flat choice, you would then for example set BR2_TOOLCHAIN_EXTERNAL_PREFIX (possible from kconfig directly) (but this would work only for external toolchains), or override TARGET_CROSS. With such a change, you can reuse TARGET_CC and TARGET_READELF. Best regards, Thomas -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130325/9d257eae/attachment-0001.html> ^ permalink raw reply [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH v3 2/2] buildroot: target: Add Blackfin architecture support. 2013-03-25 11:47 ` Thomas De Schampheleire @ 2013-03-26 8:16 ` Sonic Zhang 2013-03-26 8:41 ` Thomas Petazzoni 0 siblings, 1 reply; 21+ messages in thread From: Sonic Zhang @ 2013-03-26 8:16 UTC (permalink / raw) To: buildroot Hi Thomas, On Mon, Mar 25, 2013 at 7:47 PM, Thomas De Schampheleire <patrickdepinguin+buildroot@gmail.com> wrote: > Hi Sonic, > > On Mon, Mar 25, 2013 at 12:33 PM, Sonic Zhang <sonic.adi@gmail.com> wrote: >> >> Hi Thomas, >> >> On Fri, Mar 22, 2013 at 10:54 PM, Thomas Petazzoni >> <thomas.petazzoni@free-electrons.com> wrote: >> > Dear Sonic Zhang, >> > >> > Please add a commit log explaining all what you're doing. Your changes >> > are quite architecture-specific and touch the core of Buildroot, but >> > there are also not comments and no commit log. >> > >> > Also your changelog should be below the --- and not before, otherwise >> > it ends up in the commit log forever. >> > >> > On Fri, 22 Mar 2013 17:01:42 +0800, Sonic Zhang wrote: >> > >> >> diff --git a/Makefile b/Makefile >> >> index 7f0822f..c2f43a4 100644 >> >> --- a/Makefile >> >> +++ b/Makefile >> >> @@ -329,6 +329,8 @@ ifneq ($(PACKAGE_OVERRIDE_FILE),) >> >> -include $(PACKAGE_OVERRIDE_FILE) >> >> endif >> >> >> >> +include arch/Makefile.in >> > >> > I must admit I am not entirely happy with having Blackfin-specific >> > Makefiles, but it's true that we already have some >> > architecture-specific crap in package/Makefile.in that we could more >> > cleanly spread in arch/Makefile.in.<arch>. >> > >> >> diff --git a/arch/Config.in.bfin b/arch/Config.in.bfin >> >> index 0b137ae..0750b86 100644 >> >> --- a/arch/Config.in.bfin >> >> +++ b/arch/Config.in.bfin >> >> @@ -7,10 +7,127 @@ config BR2_BFIN_FDPIC >> >> config BR2_BFIN_FLAT >> >> bool "FLAT" >> >> select BR2_PREFER_STATIC_LIB >> >> +config BR2_BFIN_FLAT_SEP_DATA >> >> + bool "FLAT (Separate data)" >> >> + select BR2_PREFER_STATIC_LIB >> >> +config BR2_BFIN_SHARED_FLAT >> >> + bool "Shared FLAT" >> >> + select BR2_PREFER_STATIC_LIB >> >> +endchoice >> > >> > I don't think we should have Blackfin-specific options. As I suggested >> > in the review of PATCH 1/2, we should probably have global >> > BR2_BINFMT_<foo> options. >> > >> >> OK. I will move these macro to arch/Config.in >> >> >> +config BR2_TARGET_CPU_REVISION >> >> + string "Target CPU revision" >> > >> > Help text needed. >> > >> >> OK. >> >> >> +config BR2_BFIN_INSTALL_ELF_SHARED >> >> + depends on BR2_bfin && !BR2_BFIN_FDPIC >> > >> > Confused: why in the FDPIC case you would not install the ELF shared >> > libraries? >> > >> >> Blackfin Linux kernel supports running both FDPIC and FLAT >> applications concurrently if the binary format specific libraries >> installed properly. This option allow developer to install FDPIC >> libraries into a buildroot rootfs image built with binary format macro >> other than BR2_BINFMT_FDPIC. It doesn't take effect if >> BR2_BINMAT_FDPIC is configured. >> >> >> + bool "Install ELF shared libraries" >> >> + default y >> > >> > Help text needed. >> > >> >> OK. >> >> >> +config BR2_BFIN_INSTALL_FLAT_SHARED >> >> + depends on BR2_bfin >> >> + bool "Install FLAT shared libraries" if !BR2_BFIN_SHARED_FLAT >> >> + default y >> > >> > Help text needed. >> > >> >> + >> >> config BR2_ARCH >> >> default "bfin" >> >> >> >> config BR2_ENDIAN >> >> default "LITTLE" >> >> + >> >> +config BR2_GCC_TARGET_CPU >> >> + default bf606 if BR2_bf606 >> >> + default bf607 if BR2_bf607 >> >> + default bf608 if BR2_bf608 >> >> + default bf609 if BR2_bf609 >> >> + default bf512 if BR2_bf512 >> >> + default bf514 if BR2_bf514 >> >> + default bf516 if BR2_bf516 >> >> + default bf518 if BR2_bf518 >> >> + default bf522 if BR2_bf522 >> >> + default bf523 if BR2_bf523 >> >> + default bf524 if BR2_bf524 >> >> + default bf525 if BR2_bf525 >> >> + default bf526 if BR2_bf526 >> >> + default bf527 if BR2_bf527 >> >> + default bf531 if BR2_bf531 >> >> + default bf532 if BR2_bf532 >> >> + default bf533 if BR2_bf533 >> >> + default bf534 if BR2_bf534 >> >> + default bf536 if BR2_bf536 >> >> + default bf537 if BR2_bf537 >> >> + default bf538 if BR2_bf538 >> >> + default bf539 if BR2_bf539 >> >> + default bf542 if BR2_bf542 >> >> + default bf544 if BR2_bf544 >> >> + default bf547 if BR2_bf547 >> >> + default bf548 if BR2_bf548 >> >> + default bf549 if BR2_bf549 >> >> + default bf561 if BR2_bf561 >> >> + >> >> +config BR2_TARGET_ABI_FLAT >> >> + default n if BR2_BFIN_FDPIC >> >> + default y >> > >> > To be refactored with the BR2_BINFMT_<foo> stuff. >> > >> >> OK. >> >> >> diff --git a/arch/Makefile.in b/arch/Makefile.in >> >> new file mode 100644 >> >> index 0000000..d791118 >> >> --- /dev/null >> >> +++ b/arch/Makefile.in >> >> @@ -0,0 +1,5 @@ >> >> +# The architecture specific Makefile.in.$ARCH should be included only >> >> +# when the arch macro is selected. >> >> +ifeq ($(BR2_bfin),y) >> >> +include arch/Makefile.in.bfin >> >> +endif >> > >> > Ok. >> > >> >> diff --git a/arch/Makefile.in.bfin b/arch/Makefile.in.bfin >> >> new file mode 100644 >> >> index 0000000..e16532a >> >> --- /dev/null >> >> +++ b/arch/Makefile.in.bfin >> >> @@ -0,0 +1,50 @@ >> >> +TARGETS-y = >> > >> > Isn't that dangerous if someone else is using TARGETS-y ? >> >> Yes, this line can be removed. >> >> > >> >> +TARGETS-$(BR2_BFIN_INSTALL_ELF_SHARED) += romfs.shared.libs.elf >> >> +TARGETS-$(BR2_BFIN_INSTALL_FLAT_SHARED) += romfs.shared.libs.flat >> > >> > What's the relation with "romfs" ? >> > >> > Also, we more or less name all our targets target-<something>, so it >> > would be good to follow this convention. Also remember to update >> > the TARGET_EXCEPTIONS variable in support/scripts/graph-depends when >> > you add more of such custom targets. >> > >> >> OK. >> >> >> +TARGETS += $(TARGETS-y) >> >> + >> >> +ifeq ($(BR2_BFIN_FDPIC),y) >> >> +USR_LIB_EXTERNAL_LIBS += libgfortran.so libgomp.so libmudflap.so >> >> libmudflapth.so libobjc.so >> >> +endif >> > >> > This is totally unrelated to Blackfin, and therefore has no reason to >> > be here and to depend on BR2_BFIN_FDPIC. >> > >> >> Where should I put these library names to ? >> >> >> +CROSS_COMPILE_SHARED_ELF ?= bfin-linux-uclibc- >> > >> > No reason to be here. Please use $(TARGET_CC) and $(TARGET_READELF) >> > below. >> >> There are 2 individual Blackfin toolchain binaries for FDPIC and FLAT >> format. The prefix names are different. And as I explained ahead, the >> target is to install libraries of a different binary format with >> different toolchain prefix name in current $(TARGET_CC) and >> $(TARGET_READELF). So, this macro can not be removed. > > > Currently all compilations are using TARGET_CC and such, which expands to > $(TARGET_CROSS)gcc. > TARGET_CROSS in turn is derived as: > > ifeq ($(BR2_TOOLCHAIN_BUILDROOT)$(BR2_TOOLCHAIN_CTNG),y) > TARGET_CROSS=$(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)- > else > TARGET_CROSS=$(HOST_DIR)/usr/bin/$(call > qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PREFIX))- > endif > > > If you need to have different prefixes, isn't it possible to hook into one > of these variables, instead of creating a new variable > CROSS_COMPILE_SHARED_ELF/FLAT ? > Depending on the elf/flat choice, you would then for example set > BR2_TOOLCHAIN_EXTERNAL_PREFIX (possible from kconfig directly) (but this > would work only for external toolchains), or override TARGET_CROSS. > With such a change, you can reuse TARGET_CC and TARGET_READELF. I do set BR2_TOOLCHAIN_EXTERNAL_PREFIX to bfin-uclinux via kconfig to build the complete packages in buildroot. Meanwhile, I would like to install FDPIC libraries as well from the bfin-linux-uclibc toolchain folder, which is different from the bfin-uclinux I set to BR2_TOOLCHAIN_EXTERNAL_PREFIX. Blackfin toolchain bfin-linux-uclibc and bfin-uclinux are located in different path. Regards, Sonic ^ permalink raw reply [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH v3 2/2] buildroot: target: Add Blackfin architecture support. 2013-03-26 8:16 ` Sonic Zhang @ 2013-03-26 8:41 ` Thomas Petazzoni 2013-03-26 9:36 ` Sonic Zhang 0 siblings, 1 reply; 21+ messages in thread From: Thomas Petazzoni @ 2013-03-26 8:41 UTC (permalink / raw) To: buildroot Dear Sonic Zhang, On Tue, 26 Mar 2013 16:16:07 +0800, Sonic Zhang wrote: > > If you need to have different prefixes, isn't it possible to hook into one > > of these variables, instead of creating a new variable > > CROSS_COMPILE_SHARED_ELF/FLAT ? > > Depending on the elf/flat choice, you would then for example set > > BR2_TOOLCHAIN_EXTERNAL_PREFIX (possible from kconfig directly) (but this > > would work only for external toolchains), or override TARGET_CROSS. > > With such a change, you can reuse TARGET_CC and TARGET_READELF. > > I do set BR2_TOOLCHAIN_EXTERNAL_PREFIX to bfin-uclinux via kconfig to > build the complete packages in buildroot. Meanwhile, I would like to > install FDPIC libraries as well from the bfin-linux-uclibc toolchain > folder, which is different from the bfin-uclinux I set to > BR2_TOOLCHAIN_EXTERNAL_PREFIX. > > Blackfin toolchain bfin-linux-uclibc and bfin-uclinux are located in > different path. But the current external toolchain logic in toolchain/toolchain-external/ext-tool.mk only extracts either the bfin-uclinux sysroot *or* the bfin-linux-uclibc sysroot, so you in practice don't have both at the same time, at least with the current Buildroot. So presumably this would also need to be changed, right? Thanks, Thomas -- Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com ^ permalink raw reply [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH v3 2/2] buildroot: target: Add Blackfin architecture support. 2013-03-26 8:41 ` Thomas Petazzoni @ 2013-03-26 9:36 ` Sonic Zhang 2013-03-26 10:08 ` Thomas Petazzoni 0 siblings, 1 reply; 21+ messages in thread From: Sonic Zhang @ 2013-03-26 9:36 UTC (permalink / raw) To: buildroot Ho Thomas, On Tue, Mar 26, 2013 at 4:41 PM, Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote: > Dear Sonic Zhang, > > On Tue, 26 Mar 2013 16:16:07 +0800, Sonic Zhang wrote: > >> > If you need to have different prefixes, isn't it possible to hook into one >> > of these variables, instead of creating a new variable >> > CROSS_COMPILE_SHARED_ELF/FLAT ? >> > Depending on the elf/flat choice, you would then for example set >> > BR2_TOOLCHAIN_EXTERNAL_PREFIX (possible from kconfig directly) (but this >> > would work only for external toolchains), or override TARGET_CROSS. >> > With such a change, you can reuse TARGET_CC and TARGET_READELF. >> >> I do set BR2_TOOLCHAIN_EXTERNAL_PREFIX to bfin-uclinux via kconfig to >> build the complete packages in buildroot. Meanwhile, I would like to >> install FDPIC libraries as well from the bfin-linux-uclibc toolchain >> folder, which is different from the bfin-uclinux I set to >> BR2_TOOLCHAIN_EXTERNAL_PREFIX. >> >> Blackfin toolchain bfin-linux-uclibc and bfin-uclinux are located in >> different path. > > But the current external toolchain logic in > toolchain/toolchain-external/ext-tool.mk only extracts either the > bfin-uclinux sysroot *or* the bfin-linux-uclibc sysroot, so you in > practice don't have both at the same time, at least with the current > Buildroot. So presumably this would also need to be changed, right? Yes, that's why the installation target copy library files from the original toolchain folder other than the sysroot. Regards, Sonic ^ permalink raw reply [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH v3 2/2] buildroot: target: Add Blackfin architecture support. 2013-03-26 9:36 ` Sonic Zhang @ 2013-03-26 10:08 ` Thomas Petazzoni 0 siblings, 0 replies; 21+ messages in thread From: Thomas Petazzoni @ 2013-03-26 10:08 UTC (permalink / raw) To: buildroot Dear Sonic Zhang, On Tue, 26 Mar 2013 17:36:24 +0800, Sonic Zhang wrote: > > But the current external toolchain logic in > > toolchain/toolchain-external/ext-tool.mk only extracts either the > > bfin-uclinux sysroot *or* the bfin-linux-uclibc sysroot, so you in > > practice don't have both at the same time, at least with the current > > Buildroot. So presumably this would also need to be changed, right? > > Yes, that's why the installation target copy library files from the > original toolchain folder other than the sysroot. That doesn't work: when bfin-linux-uclibc is used, then the bfin-uclinux toolchain is *NOT* installed. Your current code makes the assumption that this toolchain is installed system-wide, but that's not what we want in a Buildroot context. But ok, it's not an impossible problem: we can tune the external toolchain logic so that it installs both sysroot when the user wants both the FDPIC and FLAT stuff. Best regards, Thomas -- Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com ^ permalink raw reply [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH v3 2/2] buildroot: target: Add Blackfin architecture support. 2013-03-22 9:01 ` [Buildroot] [PATCH v3 2/2] buildroot: target: Add Blackfin architecture support Sonic Zhang 2013-03-22 14:54 ` Thomas Petazzoni @ 2013-03-26 7:25 ` Arnout Vandecappelle 2013-03-26 8:15 ` Thomas Petazzoni 1 sibling, 1 reply; 21+ messages in thread From: Arnout Vandecappelle @ 2013-03-26 7:25 UTC (permalink / raw) To: buildroot On 22/03/13 10:01, Sonic Zhang wrote: > From: Sonic Zhang <sonic.zhang@analog.com> [snip] Hi Sonic, Looks like you again choose a difficult patch set to try to upstream... After reading all the comments in this thread, I propose to split up the patch set as follows in order to get some progress on it. 1. Add blackfin CPU choice. This patch adds a Target CPU configuration option and uses it to select a -m option for gcc. 2. Introduce target CPU revision. Adds the possibility (in the general infrastructure, not blackfin-specific) to have a free-form CPU revision string and append it to the target CPU. Only Blackfin actually uses this option. 3. Introduce BINFMT_FLAT. Just introduce the symbol and add options in blackfin to select it. 4. Introduce package-specific BINFMT_FLAT options. I.e. <PKG>_FLAT_STACKSIZE 5. Introduce blackfin-specific Makefile Probably needs more work. 6. Introduce NOMMU symbol Probably needs more work. Regards, Arnout -- Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F ^ permalink raw reply [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH v3 2/2] buildroot: target: Add Blackfin architecture support. 2013-03-26 7:25 ` Arnout Vandecappelle @ 2013-03-26 8:15 ` Thomas Petazzoni 2013-03-28 8:20 ` Sonic Zhang 0 siblings, 1 reply; 21+ messages in thread From: Thomas Petazzoni @ 2013-03-26 8:15 UTC (permalink / raw) To: buildroot Dear Arnout Vandecappelle, On Tue, 26 Mar 2013 08:25:11 +0100, Arnout Vandecappelle wrote: > Looks like you again choose a difficult patch set to try to upstream... > > After reading all the comments in this thread, I propose to split up > the patch set as follows in order to get some progress on it. > > 1. Add blackfin CPU choice. > This patch adds a Target CPU configuration option and uses it to select a > -m option for gcc. > > 2. Introduce target CPU revision. > Adds the possibility (in the general infrastructure, not > blackfin-specific) to have a free-form CPU revision string and append it > to the target CPU. Only Blackfin actually uses this option. > > 3. Introduce BINFMT_FLAT. > Just introduce the symbol and add options in blackfin to select it. I don't think we should introduce just BINFMT_FLAT, but also BINFMT_FDPIC (we already have a FDPIC symbol) and BINFMT_ELF, for completeness. So I would rephrase this item into "Introduce BINFMT_* symbols and refactor the existing usage to use BINFMT_FDPIC/BINFMT_ELF". > 4. Introduce package-specific BINFMT_FLAT options. > I.e. <PKG>_FLAT_STACKSIZE > > 5. Introduce blackfin-specific Makefile > Probably needs more work. > > 6. Introduce NOMMU symbol > Probably needs more work. I fully agree with Arnout's proposal here. Let's do it step by step, so that we discuss one issue after the other, and gets things merged progressively. Sonic, would you mind reworking your patch set to split it as Arnout is suggesting? Best regards, Thomas -- Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com ^ permalink raw reply [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH v3 2/2] buildroot: target: Add Blackfin architecture support. 2013-03-26 8:15 ` Thomas Petazzoni @ 2013-03-28 8:20 ` Sonic Zhang 2013-03-28 8:56 ` Thomas Petazzoni 0 siblings, 1 reply; 21+ messages in thread From: Sonic Zhang @ 2013-03-28 8:20 UTC (permalink / raw) To: buildroot Hi Thomas and Arnout, On Tue, Mar 26, 2013 at 4:15 PM, Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote: > Dear Arnout Vandecappelle, > > On Tue, 26 Mar 2013 08:25:11 +0100, Arnout Vandecappelle wrote: > >> Looks like you again choose a difficult patch set to try to upstream... >> >> After reading all the comments in this thread, I propose to split up >> the patch set as follows in order to get some progress on it. >> >> 1. Add blackfin CPU choice. >> This patch adds a Target CPU configuration option and uses it to select a >> -m option for gcc. >> >> 2. Introduce target CPU revision. >> Adds the possibility (in the general infrastructure, not >> blackfin-specific) to have a free-form CPU revision string and append it >> to the target CPU. Only Blackfin actually uses this option. >> >> 3. Introduce BINFMT_FLAT. >> Just introduce the symbol and add options in blackfin to select it. > > I don't think we should introduce just BINFMT_FLAT, but also > BINFMT_FDPIC (we already have a FDPIC symbol) and BINFMT_ELF, for > completeness. So I would rephrase this item into "Introduce BINFMT_* > symbols and refactor the existing usage to use BINFMT_FDPIC/BINFMT_ELF". > >> 4. Introduce package-specific BINFMT_FLAT options. >> I.e. <PKG>_FLAT_STACKSIZE >> >> 5. Introduce blackfin-specific Makefile >> Probably needs more work. >> >> 6. Introduce NOMMU symbol >> Probably needs more work. > > I fully agree with Arnout's proposal here. Let's do it step by step, so > that we discuss one issue after the other, and gets things merged > progressively. > > Sonic, would you mind reworking your patch set to split it as Arnout is > suggesting? > Could you comment on the reworked patch set? Regards, Sonic ^ permalink raw reply [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH v3 2/2] buildroot: target: Add Blackfin architecture support. 2013-03-28 8:20 ` Sonic Zhang @ 2013-03-28 8:56 ` Thomas Petazzoni 2013-03-29 9:50 ` Sonic Zhang 0 siblings, 1 reply; 21+ messages in thread From: Thomas Petazzoni @ 2013-03-28 8:56 UTC (permalink / raw) To: buildroot Dear Sonic Zhang, On Thu, 28 Mar 2013 16:20:14 +0800, Sonic Zhang wrote: > > Sonic, would you mind reworking your patch set to split it as Arnout is > > suggesting? > > Could you comment on the reworked patch set? Yes, sure. I've already looked at it. It looks a lot better, but I (of course) still have some comments. Will try to send some review soon, but I'll be on vacation until next Wednesday, with very limited time to do any sort of coding/reviewing. Thanks! Thomas -- Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com ^ permalink raw reply [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH v3 2/2] buildroot: target: Add Blackfin architecture support. 2013-03-28 8:56 ` Thomas Petazzoni @ 2013-03-29 9:50 ` Sonic Zhang 0 siblings, 0 replies; 21+ messages in thread From: Sonic Zhang @ 2013-03-29 9:50 UTC (permalink / raw) To: buildroot Hi Thomas, On Thu, Mar 28, 2013 at 4:56 PM, Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote: > Dear Sonic Zhang, > > On Thu, 28 Mar 2013 16:20:14 +0800, Sonic Zhang wrote: > >> > Sonic, would you mind reworking your patch set to split it as Arnout is >> > suggesting? >> >> Could you comment on the reworked patch set? > > Yes, sure. I've already looked at it. It looks a lot better, but I (of > course) still have some comments. Will try to send some review soon, > but I'll be on vacation until next Wednesday, with very limited time to > do any sort of coding/reviewing. > I just sent out the v2 patch set to fix some typo error. Please comment on the v2 after you are back. Regards, Sonic ^ permalink raw reply [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH v3 1/2] package: Makefile.in: Add target compilation flags for NOMMU architecture. 2013-03-22 9:01 [Buildroot] [PATCH v3 1/2] package: Makefile.in: Add target compilation flags for NOMMU architecture Sonic Zhang 2013-03-22 9:01 ` [Buildroot] [PATCH v3 2/2] buildroot: target: Add Blackfin architecture support Sonic Zhang @ 2013-03-22 14:29 ` Thomas Petazzoni 2013-03-22 17:28 ` Thomas De Schampheleire ` (2 more replies) 1 sibling, 3 replies; 21+ messages in thread From: Thomas Petazzoni @ 2013-03-22 14:29 UTC (permalink / raw) To: buildroot Dear Sonic Zhang, On Fri, 22 Mar 2013 17:01:41 +0800, Sonic Zhang wrote: > From: Sonic Zhang <sonic.zhang@analog.com> Thanks for getting back to us with Blackfin-related changes! > +config BR2_TARGET_ABI_FLAT > + bool I don't think FLAT is an ABI, it's a binary format. For example, on ARM, you can have ELF or FLAT binaries, that follow either the OABI or EABI. True, OABI is deprecated, but it still clearly points the fact that FLAT is *not* an ABI, but a binary format. Therefore, I think we should introduce config options like: config BR2_BINFMT_ELF bool config BR2_BINFMT_FDPIC bool config BR2_BINFMT_FLAT bool probably with a choice list or something. > if BR2_arm || BR2_armeb > source "arch/Config.in.arm" > endif > diff --git a/package/Makefile.in b/package/Makefile.in > index a8bf36b..acfd9c8 100644 > --- a/package/Makefile.in > +++ b/package/Makefile.in > @@ -103,6 +103,14 @@ TARGET_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_ABI) $(TARGET_OPTIMIZATION) $(TARGET > TARGET_CXXFLAGS = $(TARGET_CFLAGS) > TARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS)) > > +ifeq ($(BR2_TARGET_ABI_FLAT),y) > +TARGET_LDFLAGS += -Wl,-elf2flt > +endif This will have to use some BR2_BINFMT_FLAT config option, as per the discussion above. > +ifneq ($(BR2_USE_MMU), y) > +TARGET_CFLAGS += -D__NOMMU__ > +endif I'm still not entirely happy with that. This define is completely non-standard, I am not sure we want to have this at the global level. autotools-based packages should be fixed to check if fork() is available or not. For other packages, this special flag can be introduced on a per-package basis. But it's true that maybe a good number of packages will need that. Not sure here. What do others think? > + > ifeq ($(BR2_TOOLCHAIN_BUILDROOT)$(BR2_TOOLCHAIN_CTNG),y) > TARGET_CROSS=$(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)- > else > diff --git a/package/pkg-autotools.mk b/package/pkg-autotools.mk > index 890506b..09bdc7b 100644 > --- a/package/pkg-autotools.mk > +++ b/package/pkg-autotools.mk > @@ -82,6 +82,11 @@ $(2)_CLEAN_OPT ?= clean > $(2)_UNINSTALL_STAGING_OPT ?= DESTDIR=$$(STAGING_DIR) uninstall > $(2)_UNINSTALL_TARGET_OPT ?= DESTDIR=$$(TARGET_DIR) uninstall > > +ifeq ($(BR2_TARGET_ABI_FLAT),y) > + ifneq ($$($(2)_FLAT_STACKSIZE),) > + $(2)_CONF_ENV += LDFLAGS="$(TARGET_LDFLAGS) -Wl,-elf2flt=-s$$($(2)_FLAT_STACKSIZE)" > + endif > +endif Ok. This needs an update in the documentation, detailing the new <pkg>_FLAT_STACKSIZE option. > # > # Configure step. Only define it if not already defined by the package > diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk > index 57b0fd0..5ce32f9 100644 > --- a/package/pkg-generic.mk > +++ b/package/pkg-generic.mk > @@ -303,6 +303,11 @@ endif > > $(2)_REDISTRIBUTE ?= YES > > +ifeq ($(BR2_TARGET_ABI_FLAT),y) > + ifneq ($$($(2)_FLAT_STACKSIZE),) > + $(2)_FLAT_LDFLAGS = -Wl,-elf2flt=-s$$($(2)_FLAT_STACKSIZE) > + endif > +endif How is this one supposed to work? Who will use <pkg>_FLAT_LDFLAGS? Best regards, Thomas -- Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com ^ permalink raw reply [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH v3 1/2] package: Makefile.in: Add target compilation flags for NOMMU architecture. 2013-03-22 14:29 ` [Buildroot] [PATCH v3 1/2] package: Makefile.in: Add target compilation flags for NOMMU architecture Thomas Petazzoni @ 2013-03-22 17:28 ` Thomas De Schampheleire 2013-03-25 7:11 ` Arnout Vandecappelle 2013-03-25 7:50 ` Sonic Zhang 2 siblings, 0 replies; 21+ messages in thread From: Thomas De Schampheleire @ 2013-03-22 17:28 UTC (permalink / raw) To: buildroot Hi, On Fri, Mar 22, 2013 at 3:29 PM, Thomas Petazzoni < thomas.petazzoni@free-electrons.com> wrote: > Dear Sonic Zhang, > > On Fri, 22 Mar 2013 17:01:41 +0800, Sonic Zhang wrote: > > From: Sonic Zhang <sonic.zhang@analog.com> > > Thanks for getting back to us with Blackfin-related changes! > > > +config BR2_TARGET_ABI_FLAT > > + bool > > I don't think FLAT is an ABI, it's a binary format. > > For example, on ARM, you can have ELF or FLAT binaries, that follow > either the OABI or EABI. True, OABI is deprecated, but it still clearly > points the fact that FLAT is *not* an ABI, but a binary format. > > Therefore, I think we should introduce config options like: > > config BR2_BINFMT_ELF > bool > > config BR2_BINFMT_FDPIC > bool > > config BR2_BINFMT_FLAT > bool > > probably with a choice list or something. > > > if BR2_arm || BR2_armeb > > source "arch/Config.in.arm" > > endif > > diff --git a/package/Makefile.in b/package/Makefile.in > > index a8bf36b..acfd9c8 100644 > > --- a/package/Makefile.in > > +++ b/package/Makefile.in > > @@ -103,6 +103,14 @@ TARGET_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_ABI) > $(TARGET_OPTIMIZATION) $(TARGET > > TARGET_CXXFLAGS = $(TARGET_CFLAGS) > > TARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS)) > > > > +ifeq ($(BR2_TARGET_ABI_FLAT),y) > > +TARGET_LDFLAGS += -Wl,-elf2flt > > +endif > > This will have to use some BR2_BINFMT_FLAT config option, as per the > discussion above. > > > +ifneq ($(BR2_USE_MMU), y) > > +TARGET_CFLAGS += -D__NOMMU__ > > +endif > > I'm still not entirely happy with that. This define is completely > non-standard, I am not sure we want to have this at the global level. > autotools-based packages should be fixed to check if fork() is > available or not. For other packages, this special flag can be > introduced on a per-package basis. But it's true that maybe a good > number of packages will need that. Not sure here. What do others think? > Isn't this conceptually at the same level as settings like LARGEFILE, WCHAR, etc. In the case of LARGEFILE, a variable DISABLE_LARGEFILE is provided (expanding to --disable-largefile), that packages can use to set the necessary config options in a common way. Package infrastructures like autotools-package can also use this. This reasoning would then indeed suggest against such a global option, and instead only provide a way to set this flag on a per-package basis or in an infrastructure. Best regards, Thomas -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130322/52fa0831/attachment.html> ^ permalink raw reply [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH v3 1/2] package: Makefile.in: Add target compilation flags for NOMMU architecture. 2013-03-22 14:29 ` [Buildroot] [PATCH v3 1/2] package: Makefile.in: Add target compilation flags for NOMMU architecture Thomas Petazzoni 2013-03-22 17:28 ` Thomas De Schampheleire @ 2013-03-25 7:11 ` Arnout Vandecappelle 2013-03-25 7:50 ` Sonic Zhang 2 siblings, 0 replies; 21+ messages in thread From: Arnout Vandecappelle @ 2013-03-25 7:11 UTC (permalink / raw) To: buildroot On 22/03/13 15:29, Thomas Petazzoni wrote: > Dear Sonic Zhang, > > On Fri, 22 Mar 2013 17:01:41 +0800, Sonic Zhang wrote: [snip] >> +ifneq ($(BR2_USE_MMU), y) >> +TARGET_CFLAGS += -D__NOMMU__ >> +endif > > I'm still not entirely happy with that. This define is completely > non-standard, I am not sure we want to have this at the global level. > autotools-based packages should be fixed to check if fork() is > available or not. For other packages, this special flag can be > introduced on a per-package basis. But it's true that maybe a good > number of packages will need that. Not sure here. What do others think? Since this is a non-standard flag, it would go together with some patch that adds the possibility of NOMMU builds. I would say that it's a good idea to have an explicit extra -DNOMMU in those .mk files. As to the large number of packages using it: it should anyway only be used for make-based packages (autotools and cmake should have different ways to detect NOMMU). So the number of packages using it wouldn't be that large. And finally, that do this that we have already (irda-utils and portmap) call it NO_FORK. Regards, Arnout [snip] -- Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F ^ permalink raw reply [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH v3 1/2] package: Makefile.in: Add target compilation flags for NOMMU architecture. 2013-03-22 14:29 ` [Buildroot] [PATCH v3 1/2] package: Makefile.in: Add target compilation flags for NOMMU architecture Thomas Petazzoni 2013-03-22 17:28 ` Thomas De Schampheleire 2013-03-25 7:11 ` Arnout Vandecappelle @ 2013-03-25 7:50 ` Sonic Zhang 2013-03-25 7:57 ` Sonic Zhang 2013-03-25 7:58 ` Thomas Petazzoni 2 siblings, 2 replies; 21+ messages in thread From: Sonic Zhang @ 2013-03-25 7:50 UTC (permalink / raw) To: buildroot Hi Thomas, On Fri, Mar 22, 2013 at 10:29 PM, Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote: > Dear Sonic Zhang, > > On Fri, 22 Mar 2013 17:01:41 +0800, Sonic Zhang wrote: >> From: Sonic Zhang <sonic.zhang@analog.com> > > Thanks for getting back to us with Blackfin-related changes! > >> +config BR2_TARGET_ABI_FLAT >> + bool > > I don't think FLAT is an ABI, it's a binary format. > > For example, on ARM, you can have ELF or FLAT binaries, that follow > either the OABI or EABI. True, OABI is deprecated, but it still clearly > points the fact that FLAT is *not* an ABI, but a binary format. > > Therefore, I think we should introduce config options like: > > config BR2_BINFMT_ELF > bool > > config BR2_BINFMT_FDPIC > bool > > config BR2_BINFMT_FLAT > bool > > probably with a choice list or something. > OK. >> if BR2_arm || BR2_armeb >> source "arch/Config.in.arm" >> endif >> diff --git a/package/Makefile.in b/package/Makefile.in >> index a8bf36b..acfd9c8 100644 >> --- a/package/Makefile.in >> +++ b/package/Makefile.in >> @@ -103,6 +103,14 @@ TARGET_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_ABI) $(TARGET_OPTIMIZATION) $(TARGET >> TARGET_CXXFLAGS = $(TARGET_CFLAGS) >> TARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS)) >> >> +ifeq ($(BR2_TARGET_ABI_FLAT),y) >> +TARGET_LDFLAGS += -Wl,-elf2flt >> +endif > > This will have to use some BR2_BINFMT_FLAT config option, as per the > discussion above. > OK. >> +ifneq ($(BR2_USE_MMU), y) >> +TARGET_CFLAGS += -D__NOMMU__ >> +endif > > I'm still not entirely happy with that. This define is completely > non-standard, I am not sure we want to have this at the global level. > autotools-based packages should be fixed to check if fork() is > available or not. For other packages, this special flag can be > introduced on a per-package basis. But it's true that maybe a good > number of packages will need that. Not sure here. What do others think? > Macro __NOMMU__ is not used only for fork/vfork. There are some difference between MMU and NOMMU application. For example: - exit(n) should be replaced by _exit(n) in child process. - Large buffer or array shouldn't be defined on stack. - calloc() should be replaced by malloc(). All these changes to MMU application should be protected by macro __NOMMU__ >> + >> ifeq ($(BR2_TOOLCHAIN_BUILDROOT)$(BR2_TOOLCHAIN_CTNG),y) >> TARGET_CROSS=$(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)- >> else >> diff --git a/package/pkg-autotools.mk b/package/pkg-autotools.mk >> index 890506b..09bdc7b 100644 >> --- a/package/pkg-autotools.mk >> +++ b/package/pkg-autotools.mk >> @@ -82,6 +82,11 @@ $(2)_CLEAN_OPT ?= clean >> $(2)_UNINSTALL_STAGING_OPT ?= DESTDIR=$$(STAGING_DIR) uninstall >> $(2)_UNINSTALL_TARGET_OPT ?= DESTDIR=$$(TARGET_DIR) uninstall >> >> +ifeq ($(BR2_TARGET_ABI_FLAT),y) >> + ifneq ($$($(2)_FLAT_STACKSIZE),) >> + $(2)_CONF_ENV += LDFLAGS="$(TARGET_LDFLAGS) -Wl,-elf2flt=-s$$($(2)_FLAT_STACKSIZE)" >> + endif >> +endif > > Ok. This needs an update in the documentation, detailing the new > <pkg>_FLAT_STACKSIZE option. > >> # >> # Configure step. Only define it if not already defined by the package >> diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk >> index 57b0fd0..5ce32f9 100644 >> --- a/package/pkg-generic.mk >> +++ b/package/pkg-generic.mk >> @@ -303,6 +303,11 @@ endif >> >> $(2)_REDISTRIBUTE ?= YES >> >> +ifeq ($(BR2_TARGET_ABI_FLAT),y) >> + ifneq ($$($(2)_FLAT_STACKSIZE),) >> + $(2)_FLAT_LDFLAGS = -Wl,-elf2flt=-s$$($(2)_FLAT_STACKSIZE) >> + endif >> +endif > > How is this one supposed to work? Who will use <pkg>_FLAT_LDFLAGS? If the generic package wants to be built into FLAT binary, it should append this package specific link flag <pkg>_FLAT_LDFLAGS to the build command line in its makefile. This flag can't be added to TARGET_LDFLAGS, because it is package specific. Regards, Sonic ^ permalink raw reply [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH v3 1/2] package: Makefile.in: Add target compilation flags for NOMMU architecture. 2013-03-25 7:50 ` Sonic Zhang @ 2013-03-25 7:57 ` Sonic Zhang 2013-03-25 7:58 ` Thomas Petazzoni 1 sibling, 0 replies; 21+ messages in thread From: Sonic Zhang @ 2013-03-25 7:57 UTC (permalink / raw) To: buildroot On Mon, Mar 25, 2013 at 3:50 PM, Sonic Zhang <sonic.adi@gmail.com> wrote: > Hi Thomas, > > On Fri, Mar 22, 2013 at 10:29 PM, Thomas Petazzoni > <thomas.petazzoni@free-electrons.com> wrote: >> Dear Sonic Zhang, >> >> On Fri, 22 Mar 2013 17:01:41 +0800, Sonic Zhang wrote: >>> From: Sonic Zhang <sonic.zhang@analog.com> >> >> Thanks for getting back to us with Blackfin-related changes! >> >>> +config BR2_TARGET_ABI_FLAT >>> + bool >> >> I don't think FLAT is an ABI, it's a binary format. >> >> For example, on ARM, you can have ELF or FLAT binaries, that follow >> either the OABI or EABI. True, OABI is deprecated, but it still clearly >> points the fact that FLAT is *not* an ABI, but a binary format. >> >> Therefore, I think we should introduce config options like: >> >> config BR2_BINFMT_ELF >> bool >> >> config BR2_BINFMT_FDPIC >> bool >> >> config BR2_BINFMT_FLAT >> bool >> >> probably with a choice list or something. >> > > OK. > >>> if BR2_arm || BR2_armeb >>> source "arch/Config.in.arm" >>> endif >>> diff --git a/package/Makefile.in b/package/Makefile.in >>> index a8bf36b..acfd9c8 100644 >>> --- a/package/Makefile.in >>> +++ b/package/Makefile.in >>> @@ -103,6 +103,14 @@ TARGET_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_ABI) $(TARGET_OPTIMIZATION) $(TARGET >>> TARGET_CXXFLAGS = $(TARGET_CFLAGS) >>> TARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS)) >>> >>> +ifeq ($(BR2_TARGET_ABI_FLAT),y) >>> +TARGET_LDFLAGS += -Wl,-elf2flt >>> +endif >> >> This will have to use some BR2_BINFMT_FLAT config option, as per the >> discussion above. >> > > OK. > >>> +ifneq ($(BR2_USE_MMU), y) >>> +TARGET_CFLAGS += -D__NOMMU__ >>> +endif >> >> I'm still not entirely happy with that. This define is completely >> non-standard, I am not sure we want to have this at the global level. >> autotools-based packages should be fixed to check if fork() is >> available or not. For other packages, this special flag can be >> introduced on a per-package basis. But it's true that maybe a good >> number of packages will need that. Not sure here. What do others think? >> > > Macro __NOMMU__ is not used only for fork/vfork. There are some > difference between MMU and NOMMU application. For example: > - exit(n) should be replaced by _exit(n) in child process. > - Large buffer or array shouldn't be defined on stack. > - calloc() should be replaced by malloc(). More difference: - Multi-process application should be converted into multi-thread application other than vfork if these processes are running concurrently. - Frequent memory allocation and free code should be converted to allocate a big memory poll at the beginning of the application or replaced by nedmalloc API. Regards, Sonic ^ permalink raw reply [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH v3 1/2] package: Makefile.in: Add target compilation flags for NOMMU architecture. 2013-03-25 7:50 ` Sonic Zhang 2013-03-25 7:57 ` Sonic Zhang @ 2013-03-25 7:58 ` Thomas Petazzoni 2013-03-25 8:51 ` Sonic Zhang 1 sibling, 1 reply; 21+ messages in thread From: Thomas Petazzoni @ 2013-03-25 7:58 UTC (permalink / raw) To: buildroot Dear Sonic Zhang, Thanks for following up on this discussion! On Mon, 25 Mar 2013 15:50:49 +0800, Sonic Zhang wrote: > > For example, on ARM, you can have ELF or FLAT binaries, that follow > > either the OABI or EABI. True, OABI is deprecated, but it still clearly > > points the fact that FLAT is *not* an ABI, but a binary format. > > > > Therefore, I think we should introduce config options like: > > > > config BR2_BINFMT_ELF > > bool > > > > config BR2_BINFMT_FDPIC > > bool > > > > config BR2_BINFMT_FLAT > > bool > > > > probably with a choice list or something. > > > > OK. It would be good if this BR2_BINFMT_<foo> thing was introduced as a separate patch. It can be part of the same patch series, but it would be could to see it introduced separately from the Blackfin additions. > >> +ifneq ($(BR2_USE_MMU), y) > >> +TARGET_CFLAGS += -D__NOMMU__ > >> +endif > > > > I'm still not entirely happy with that. This define is completely > > non-standard, I am not sure we want to have this at the global level. > > autotools-based packages should be fixed to check if fork() is > > available or not. For other packages, this special flag can be > > introduced on a per-package basis. But it's true that maybe a good > > number of packages will need that. Not sure here. What do others think? > > > > Macro __NOMMU__ is not used only for fork/vfork. There are some > difference between MMU and NOMMU application. For example: > - exit(n) should be replaced by _exit(n) in child process. > - Large buffer or array shouldn't be defined on stack. > - calloc() should be replaced by malloc(). > > All these changes to MMU application should be protected by macro __NOMMU__ The issue I have is that this __NOMMU__ define is, as far as I know, entirely non-standard. So whenever you will send a patch for a package that introduces some #ifdef __NOMMU__ ... #endif clause, we'll have no way of pushing it upstream. Have you managed to pushed upstream noMMU related changes that are guarded using __NOMMU__ ? > >> # Configure step. Only define it if not already defined by the package > >> diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk > >> index 57b0fd0..5ce32f9 100644 > >> --- a/package/pkg-generic.mk > >> +++ b/package/pkg-generic.mk > >> @@ -303,6 +303,11 @@ endif > >> > >> $(2)_REDISTRIBUTE ?= YES > >> > >> +ifeq ($(BR2_TARGET_ABI_FLAT),y) > >> + ifneq ($$($(2)_FLAT_STACKSIZE),) > >> + $(2)_FLAT_LDFLAGS = -Wl,-elf2flt=-s$$($(2)_FLAT_STACKSIZE) > >> + endif > >> +endif > > > > How is this one supposed to work? Who will use <pkg>_FLAT_LDFLAGS? > > If the generic package wants to be built into FLAT binary, it should > append this package specific link flag <pkg>_FLAT_LDFLAGS to the build > command line in its makefile. This flag can't be added to > TARGET_LDFLAGS, because it is package specific. Hum, right, but then it means that we should modify *all* our packages so that they add $(<pkg>_FLAT_LDFLAGS) to their LDFLAGS ? Having to change the recipe of all packages doesn't seem easy to do. Maybe with enough $ signs we can delay the expansion of TARGET_LDFLAGS so that we can use a package specific variable in it. Makefile experts? Arnout? :-) Best regards, Thomas -- Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com ^ permalink raw reply [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH v3 1/2] package: Makefile.in: Add target compilation flags for NOMMU architecture. 2013-03-25 7:58 ` Thomas Petazzoni @ 2013-03-25 8:51 ` Sonic Zhang 0 siblings, 0 replies; 21+ messages in thread From: Sonic Zhang @ 2013-03-25 8:51 UTC (permalink / raw) To: buildroot Hi Thomas, On Mon, Mar 25, 2013 at 3:58 PM, Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote: > Dear Sonic Zhang, > > Thanks for following up on this discussion! > > On Mon, 25 Mar 2013 15:50:49 +0800, Sonic Zhang wrote: > >> > For example, on ARM, you can have ELF or FLAT binaries, that follow >> > either the OABI or EABI. True, OABI is deprecated, but it still clearly >> > points the fact that FLAT is *not* an ABI, but a binary format. >> > >> > Therefore, I think we should introduce config options like: >> > >> > config BR2_BINFMT_ELF >> > bool >> > >> > config BR2_BINFMT_FDPIC >> > bool >> > >> > config BR2_BINFMT_FLAT >> > bool >> > >> > probably with a choice list or something. >> > >> >> OK. > > It would be good if this BR2_BINFMT_<foo> thing was introduced as a > separate patch. It can be part of the same patch series, but it would > be could to see it introduced separately from the Blackfin additions. > No problem. >> >> +ifneq ($(BR2_USE_MMU), y) >> >> +TARGET_CFLAGS += -D__NOMMU__ >> >> +endif >> > >> > I'm still not entirely happy with that. This define is completely >> > non-standard, I am not sure we want to have this at the global level. >> > autotools-based packages should be fixed to check if fork() is >> > available or not. For other packages, this special flag can be >> > introduced on a per-package basis. But it's true that maybe a good >> > number of packages will need that. Not sure here. What do others think? >> > >> >> Macro __NOMMU__ is not used only for fork/vfork. There are some >> difference between MMU and NOMMU application. For example: >> - exit(n) should be replaced by _exit(n) in child process. >> - Large buffer or array shouldn't be defined on stack. >> - calloc() should be replaced by malloc(). >> >> All these changes to MMU application should be protected by macro __NOMMU__ > > The issue I have is that this __NOMMU__ define is, as far as I know, > entirely non-standard. So whenever you will send a patch for a package > that introduces some #ifdef __NOMMU__ ... #endif clause, we'll have no > way of pushing it upstream. > Busybox uses macro ENABLE_NOMMU. Linux kernel uses macro CONFIG_MMU. Blackfin buildroot distribution uses __NOMMU__. Which one do you prefer? We are fine to unify the NOMMU macro name. > Have you managed to pushed upstream noMMU related changes that are > guarded using __NOMMU__ ? > Because no major Linux distributions support NOMMU architecture except for the blackfin one and the resource shortage in ADI Linux team, we have never tried to push the NOMMU patch to upstream packages. >> >> # Configure step. Only define it if not already defined by the package >> >> diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk >> >> index 57b0fd0..5ce32f9 100644 >> >> --- a/package/pkg-generic.mk >> >> +++ b/package/pkg-generic.mk >> >> @@ -303,6 +303,11 @@ endif >> >> >> >> $(2)_REDISTRIBUTE ?= YES >> >> >> >> +ifeq ($(BR2_TARGET_ABI_FLAT),y) >> >> + ifneq ($$($(2)_FLAT_STACKSIZE),) >> >> + $(2)_FLAT_LDFLAGS = -Wl,-elf2flt=-s$$($(2)_FLAT_STACKSIZE) >> >> + endif >> >> +endif >> > >> > How is this one supposed to work? Who will use <pkg>_FLAT_LDFLAGS? >> >> If the generic package wants to be built into FLAT binary, it should >> append this package specific link flag <pkg>_FLAT_LDFLAGS to the build >> command line in its makefile. This flag can't be added to >> TARGET_LDFLAGS, because it is package specific. > > Hum, right, but then it means that we should modify *all* our packages > so that they add $(<pkg>_FLAT_LDFLAGS) to their LDFLAGS ? Having to > change the recipe of all packages doesn't seem easy to do. Maybe with > enough $ signs we can delay the expansion of TARGET_LDFLAGS so that we > can use a package specific variable in it. Makefile experts? Arnout? :-) The default FLAT stack size is 4K bytes without the package specific link flag. If the package doesn't need more than 4K byte stack, nothing needs to be changed to its makefile. Regards, Sonic ^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2013-03-29 9:50 UTC | newest] Thread overview: 21+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-03-22 9:01 [Buildroot] [PATCH v3 1/2] package: Makefile.in: Add target compilation flags for NOMMU architecture Sonic Zhang 2013-03-22 9:01 ` [Buildroot] [PATCH v3 2/2] buildroot: target: Add Blackfin architecture support Sonic Zhang 2013-03-22 14:54 ` Thomas Petazzoni 2013-03-25 11:33 ` Sonic Zhang 2013-03-25 11:47 ` Thomas De Schampheleire 2013-03-26 8:16 ` Sonic Zhang 2013-03-26 8:41 ` Thomas Petazzoni 2013-03-26 9:36 ` Sonic Zhang 2013-03-26 10:08 ` Thomas Petazzoni 2013-03-26 7:25 ` Arnout Vandecappelle 2013-03-26 8:15 ` Thomas Petazzoni 2013-03-28 8:20 ` Sonic Zhang 2013-03-28 8:56 ` Thomas Petazzoni 2013-03-29 9:50 ` Sonic Zhang 2013-03-22 14:29 ` [Buildroot] [PATCH v3 1/2] package: Makefile.in: Add target compilation flags for NOMMU architecture Thomas Petazzoni 2013-03-22 17:28 ` Thomas De Schampheleire 2013-03-25 7:11 ` Arnout Vandecappelle 2013-03-25 7:50 ` Sonic Zhang 2013-03-25 7:57 ` Sonic Zhang 2013-03-25 7:58 ` Thomas Petazzoni 2013-03-25 8:51 ` Sonic Zhang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox