Skip to contentSkip to conversation

How to generate FLAT executable for busybox?

Buildroot Axel Lin 2 participants 4 messages Jul 29, 2013 – Jul 31, 2013

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

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"
arch/Config.in +0 -3
index 0b5b218..a894e17 100644
@@ -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
package/Makefile.in +1 -1
index aed28d5..5b89e18 100644
@@ -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
package/busybox/busybox-1.21.x.config +2 -2
index e46b528..4e692fc 100644
@@ -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
package/uclibc/uClibc-0.9.33.config +3 -3
index eb39df6..d0a9c0c 100644
@@ -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
author
#1 lore raw

2013/7/29 Axel Lin <[email protected]>:

Quoted 6 lines

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

author
#2 lore raw

2013/7/29 Axel Lin <[email protected]>:

Quoted 7 lines

2013/7/29 Axel Lin <[email protected]>:

Quoted 6 lines

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

#3 lore raw

Dear Axel Lin,

Quoted 9 lines · Axel Lin

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.

Quoted 8 lines

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

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