diff mbox

[noMMU] How to generate FLAT executable for busybox?

Message ID 1375076435.4630.2.camel@phoenix
State Not Applicable
Headers show

Commit Message

Axel Lin July 29, 2013, 5:40 a.m. UTC
Hi,
I have BR2_BINFMT_FLAT=y in my setting.
However, the build system still generates ELF executable for busybox.

$ file output/target/bin/busybox
output/target/bin/busybox: setuid ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, stripped

I have below customization in my configs to build noMMU for arm7tdmi:
And then I did:
$ make CFLAGS_busybox="-elf2flt"

Comments

Axel Lin July 29, 2013, 9:27 a.m. UTC | #1
2013/7/29 Axel Lin <axel.lin@ingics.com>:
> Hi,
> I have BR2_BINFMT_FLAT=y in my setting.
> However, the build system still generates ELF executable for busybox.
>
> $ file output/target/bin/busybox
> output/target/bin/busybox: setuid ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, stripped

Hi,
In output/build/busybox-1.21.1/busybox_unstripped.out, I found below messages:

/opt/test/buildroot/buildroot/output/host/usr/lib/gcc/arm-buildroot-uclinux-uclibcgnueabi/4.7.3/../../../../arm-buildroot-uclinux-uclibcgnueabi/bin/ld:
warning: cannot find entry symbol lf2flt; defaulting to
00000000000080ac

This looks like the linker does not understand -elf2flt and treat is
as -e lf2flt.

Any idea how to fix this?

Thanks,
Axel
Axel Lin July 31, 2013, 1:05 p.m. UTC | #2
2013/7/29 Axel Lin <axel.lin@ingics.com>:
> 2013/7/29 Axel Lin <axel.lin@ingics.com>:
>> Hi,
>> I have BR2_BINFMT_FLAT=y in my setting.
>> However, the build system still generates ELF executable for busybox.
>>
>> $ file output/target/bin/busybox
>> output/target/bin/busybox: setuid ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, stripped

Hi,
Just try to figure out if any platform can build FLAT executable.
So I just tested build for blackfin (BR2_bfin).
( I don't have any customization for this blackfin build test,
only run make menuconfig and select blackfin. Test with current git tree. )

I thought I should have a FLAT executable, however it produces ELF executable.
$ file output/target/bin/busybox
output/target/bin/busybox: setuid ELF 32-bit LSB executable, Analog
Devices Blackfin, version 1 (SYSV), statically linked, stripped

BTW, I found BR2_ELF2FLT is invisible for BR2_bfin.

package/elf2flt/Config.in.host:
config BR2_PACKAGE_HOST_ELF2FLT
        bool "Enable elf2flt support?"
        depends on BR2_arm || BR2_sh || BR2_sparc

Does this mean blackfin does not need elf2flt tool?

Regards,
Axel
Thomas Petazzoni July 31, 2013, 1:11 p.m. UTC | #3
Dear Axel Lin,

On Wed, 31 Jul 2013 21:05:56 +0800, Axel Lin wrote:

> Just try to figure out if any platform can build FLAT executable.
> So I just tested build for blackfin (BR2_bfin).
> ( I don't have any customization for this blackfin build test,
> only run make menuconfig and select blackfin. Test with current git tree. )
> 
> I thought I should have a FLAT executable, however it produces ELF executable.
> $ file output/target/bin/busybox
> output/target/bin/busybox: setuid ELF 32-bit LSB executable, Analog
> Devices Blackfin, version 1 (SYSV), statically linked, stripped

Yeah, that's broken.

> BTW, I found BR2_ELF2FLT is invisible for BR2_bfin.
> 
> package/elf2flt/Config.in.host:
> config BR2_PACKAGE_HOST_ELF2FLT
>         bool "Enable elf2flt support?"
>         depends on BR2_arm || BR2_sh || BR2_sparc
> 
> Does this mean blackfin does not need elf2flt tool?

No, it means that the internal toolchain handling of FLAT binaries and
elf2flt is broken.

Thomas
diff mbox

Patch

diff --git a/arch/Config.in b/arch/Config.in
index 0b5b218..a894e17 100644
--- a/arch/Config.in
+++ b/arch/Config.in
@@ -216,7 +216,6 @@  config BR2_GCC_TARGET_MODE
 # Set up target binary format
 choice
 	prompt "Target Binary Format"
-	depends on BR2_bfin || BR2_m68k
 	default BR2_BINFMT_FDPIC
 
 config BR2_BINFMT_ELF
@@ -229,7 +228,6 @@  config BR2_BINFMT_ELF
 
 config BR2_BINFMT_FDPIC
 	bool "FDPIC"
-	depends on BR2_bfin || BR2_m68k
 	help
 	  ELF FDPIC binaries are based on ELF, but allow the individual load
 	  segments of a binary to be located in memory independently of each
@@ -238,7 +236,6 @@  config BR2_BINFMT_FDPIC
 
 config BR2_BINFMT_FLAT
 	bool "FLAT"
-	depends on BR2_bfin || BR2_m68k
 	select BR2_PREFER_STATIC_LIB
 	help
 	  FLAT binary is a relatively simple and lightweight executable format
diff --git a/package/Makefile.in b/package/Makefile.in
index aed28d5..5b89e18 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -24,7 +24,7 @@  MAKE:=$(HOSTMAKE) -j$(PARALLEL_JOBS)
 GNU_TARGET_NAME=$(ARCH)-buildroot-$(TARGET_OS)-$(LIBC)$(ABI)
 
 # Blackfin FLAT needs uclinux
-ifeq ($(BR2_bfin)$(BR2_BINFMT_FLAT),yy)
+ifeq ($(BR2_BINFMT_FLAT),y)
 TARGET_OS=uclinux
 else
 TARGET_OS=linux
diff --git a/package/busybox/busybox-1.21.x.config b/package/busybox/busybox-1.21.x.config
index e46b528..4e692fc 100644
--- a/package/busybox/busybox-1.21.x.config
+++ b/package/busybox/busybox-1.21.x.config
@@ -55,9 +55,9 @@  CONFIG_FEATURE_SYSLOG=y
 #
 # Build Options
 #
-# CONFIG_STATIC is not set
+CONFIG_STATIC=y
 # CONFIG_PIE is not set
-# CONFIG_NOMMU is not set
+CONFIG_NOMMU=y
 # CONFIG_BUILD_LIBBUSYBOX is not set
 # CONFIG_FEATURE_INDIVIDUAL is not set
 # CONFIG_FEATURE_SHARED_BUSYBOX is not set
diff --git a/package/uclibc/uClibc-0.9.33.config b/package/uclibc/uClibc-0.9.33.config
index eb39df6..d0a9c0c 100644
--- a/package/uclibc/uClibc-0.9.33.config
+++ b/package/uclibc/uClibc-0.9.33.config
@@ -65,10 +65,10 @@  FORCE_OPTIONS_FOR_ARCH=y
 # ARCH_BIG_ENDIAN is not set
 # ARCH_WANTS_LITTLE_ENDIAN is not set
 # ARCH_WANTS_BIG_ENDIAN is not set
-ARCH_HAS_MMU=y
-ARCH_USE_MMU=y
+# ARCH_HAS_MMU is not set
+# ARCH_USE_MMU is not set
 UCLIBC_HAS_FLOATS=y
-UCLIBC_HAS_FPU=y
+# UCLIBC_HAS_FPU is not set
 DO_C99_MATH=y
 # DO_XSI_MATH is not set
 # UCLIBC_HAS_FENV is not set