Skip to contentSkip to conversation

elf2flt blues

Buildroot New Erland Lewin 4 participants 6 messages Mar 15, 2012 – Mar 18, 2012

lore
Share & tools
lore
#0 lore raw

Hello,

I'm trying to build buildroot for the Olimex LPC2478-STK development card<http://www.olimex.com/dev/lpc-2478stk.html>(with an arm7TDMI core), for a patched Linux-2.6.24 kernel that came with the card.

I'm having lots of problems, and would really appreciate it if someone could point me in the right direction.

I managed to build buildroot, but then it failed to execute on the board, and I think it because the kernel only supports BFLT, not ELF.

So I selected 'elf2flt support?' in the Buildroot 2012.02 configurator. Should I have to do something else to have elf2flt automatically run during linking?

I have a problem linking elf2flt:

gcc -g -O2 -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\"

Quoted 7 lines
(quoted diff) +0 -7
-DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\"
-DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1
-DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1
-DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_UNISTD_H=1
-DHAVE_BFD_H=1  -DTARGET_arm -I/bfd/
-I/home/erl/src/LPC2478/buildroot-2012.02/output/build/binutils-2.21.1/include/
-lz -o flthdr
Quoted 6 lines

/home/erl/src/LPC2478/buildroot-2012.02/output/toolchain/elf2flt/flthdr.c /bfd/libbfd.a /libiberty/libiberty.a
gcc: /bfd/libbfd.a: No such file or directory
gcc: /libiberty/libiberty.a: No such file or directory
gcc: /bfd/libbfd.a: No such file or directory
gcc: /libiberty/libiberty.a: No such file or directory

elf2flt was configured with:

rm -rf config.cache; \

Quoted 11 lines

LDFLAGS=-lz \
/home/erl/src/LPC2478/buildroot-2012.02/output/toolchain/elf2flt/configure
\
--with-bfd-include-dir=/bfd/ \
--with-binutils-include-dir=/home/erl/src/LPC2478/buildroot-2012.02/output/build/binutils-2.21.1/include/ \
--target=arm-unknown-linux-uclibcgnueabi \
--with-libbfd=/bfd/libbfd.a \
--with-libiberty=/libiberty/libiberty.a \

--prefix=/home/erl/src/LPC2478/buildroot-2012.02/output/host/usr/arm-unknown-linux-uclibcgnueabi/sysroot/usr

I see that I have four different versions of libbfd.a:

./output/target/usr/lib/libbfd.a ./output/build/binutils-2.21.1/bfd/libbfd.a ./output/build/host-binutils-2.21.1/bfd/libbfd.a ./output/host/usr/arm-unknown-linux-uclibcgnueabi/sysroot/usr/lib/libbfd.a

I try to rerun configure manually with:

./configure '--with-libbfd=../../build/host-binutils-2.21.1/bfd/libbfd.a'

Quoted 4 lines

'--with-bfd-include-dir=../../build/host-binutils-2.21.1/bfd' '--with-libiberty=../../host/usr/lib/libiberty.a' '--prefix=/home/erl/src/LPC2478/buildroot-2012.02/output/host/usr/arm-unknown-linux-uclibcgnueabi/sysroot/usr' 'LDFLAGS=-lz' 'target_alias=arm-unknown-linux-uclibcgnueabi'

Note that I also seem to have had to add a target_alias flag.

I succeed in building elf2flt. When I try to run it manually on my busybox executable, I get:

$ ./elf2flt -v ../../target/bin/busybox -o ./busybox
Quoted 1 line

../../target/bin/busybox: Input file contains no relocation info

After googling, I think I have to build all apps with the '-r' flag to gcc to add relocation info (see
http://www.mail-archive.com/uclinux-dev at uclinux.org/msg00659.html).

I'm not sure where to add the '-r' in the buildroot configurator, so I added it after '-pipe' in BR2_TARGET_OPTIMIZATION.

I then get an error building busybox:

/home/erl/src/LPC2478/buildroot-2012.02/output/host/usr/lib/gcc/arm-unknown-linux-uclibcgnueabi/4.5.3/../../../../arm-unknown-linux-uclibcgnueabi/bin/ld:

Quoted 1 line

gc-sections requires either an entry or an undefined symbol

I commented out -gc-sections from scripts/trylink and rebuilt.

I now get errors building binutils:

Quoted 10 lines

/home/erl/src/LPC2478/buildroot-2012.02/output/host/usr/bin/arm-unknown-linux-uclibcgnueabi-gcc

(quoted diff) +0 -2
-c -DHAVE_CONFIG_H -pipe -r -Os   -I. -I./../include  -W -Wall
-Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic  -fPIC

./pex-common.c -o pic/pex-common.o; \
else true; fi
./physmem.c: In function 'physmem_total':
./physmem.c:96:23: error: storage size of 'pss' isn't known ./physmem.c:97:5: warning: implicit declaration of function 'pstat_getstatic'
./physmem.c:96:23: warning: unused variable 'pss'

Quoted 8 lines

./physmem.c: In function 'physmem_available':
./physmem.c:200:23: error: storage size of 'pss' isn't known ./physmem.c:201:24: error: storage size of 'psd' isn't known ./physmem.c:203:2: warning: implicit declaration of function 'pstat_getdynamic'
./physmem.c:201:24: warning: unused variable 'psd' ./physmem.c:200:23: warning: unused variable 'pss' make[3]: *** [physmem.o] Error 1

I think I'll start over and rebuild it from scratch (the third time). I'd appreciate any hints.

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20120315/35e6fbe6/attachment-0001.html>

#1 lore raw

PATCH 1/1 elf2flt: fix after conversion of binutils to package infrastructure

When binutils was converted to the package infrastructure (commit 009407e6b), the variable that elf2flt uses to find the binutils libraries disappeared. So use HOST_BINUTILS_DIR instead of BINUTILS_DIR1.

---
Note that elf2flt has been broken for one and a half years now before anybody has complained about it...

Probably it should be converted to autotargets as well. However, I don't know how to test if the resulting tool still works.

 toolchain/elf2flt/elf2flt.mk |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
toolchain/elf2flt/elf2flt.mk +5 -5
index e74a655..84a2c01 100644
@@ -21,12 +21,12 @@ $(ELF2FLT_DIR)/.configured: $(ELF2FLT_DIR)/.patched
 	(cd $(ELF2FLT_DIR); rm -rf config.cache; \
 		LDFLAGS=-lz \
 		$(ELF2FLT_DIR)/configure $(QUIET) \
-		--with-bfd-include-dir=$(BINUTILS_DIR1)/bfd/ \
-		--with-binutils-include-dir=$(BINUTILS_DIR)/include/ \
+		--with-bfd-include-dir=$(HOST_BINUTILS_DIR)/bfd/ \
+		--with-binutils-include-dir=$(HOST_BINUTILS_DIR)/include/ \
 		--target=$(REAL_GNU_TARGET_NAME) \
-		--with-libbfd=$(BINUTILS_DIR1)/bfd/libbfd.a \
-		--with-libiberty=$(BINUTILS_DIR1)/libiberty/libiberty.a \
-		--prefix=$(STAGING_DIR)/usr)
+		--with-libbfd=$(HOST_BINUTILS_DIR)/bfd/libbfd.a \
+		--with-libiberty=$(HOST_BINUTILS_DIR)/libiberty/libiberty.a \
+		--prefix=$(HOST_DIR)/usr)
 	touch $@
 
 $(ELF2FLT_DIR)/$(ELF2FLT_BINARY): $(ELF2FLT_DIR)/.configured
Signature · 1 line
tg: (ccb44fd..) t/elf2flt (depends on: master)
#2 lore raw

PATCH 1/1 elf2flt: fix after conversion of binutils to package infrastructure

Le Sun, 18 Mar 2012 16:35:58 +0100,
"Arnout Vandecappelle (Essensium/Mind)" <[email protected]> a ?crit :

Quoted 2 lines

Probably it should be converted to autotargets as well. However, I don't know how to test if the resulting tool still works.

I have started setting up an environment for a noMMU ARM kernel and userspace that runs under the SkyEye emulator. I intend to clean this up and make it available as a defconfig so that we have at least one noMMU environment we can use for testing.

So far I have something that boots into a Busybox userspace, but it is built with the Soucery CodeBench uClinux toolchain. I think I will clean it up as is, we can see later if the internal toolchain backend works to build a correct toolchain for this usecase.

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
#3 lore raw

PATCH 1/1 elf2flt: fix after conversion of binutils to package infrastructure

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hi,

Quoted 2 lines
Quoted 2 lines

Probably it should be converted to autotargets as well. However, I don't know how to test if the resulting tool still works.

Thomas> I have started setting up an environment for a noMMU ARM kernel and Thomas> userspace that runs under the SkyEye emulator. I intend to clean this Thomas> up and make it available as a defconfig so that we have at least one Thomas> noMMU environment we can use for testing.

Thomas> So far I have something that boots into a Busybox userspace, but it is Thomas> built with the Soucery CodeBench uClinux toolchain. I think I will Thomas> clean it up as is, we can see later if the internal toolchain backend Thomas> works to build a correct toolchain for this usecase.

Great, sounds good. I don't have any experience with skyeye, any specific reasons to use that instead of qemu?

Signature · 1 line
Bye, Peter Korsgaard
#4 lore raw

PATCH 1/1 elf2flt: fix after conversion of binutils to package infrastructure

Hello,

Le Sun, 18 Mar 2012 20:47:14 +0100,
Peter Korsgaard <[email protected]> a ?crit :

Quoted 2 lines

Great, sounds good. I don't have any experience with skyeye, any specific reasons to use that instead of qemu?

I might have missed something, but I haven't found any of the ARM platforms emulated by Qemu to be noMMU platforms. I have tried to build a kernel for the Versatile platform with MMU disabled, but the build fails. It seems that the kernel does not support to be built for any platform with MMU disabled, though I might be wrong. If anyone knows about one of the ARM platforms supported by Qemu to be supported in a noMMU variant by the kernel, that would be nice.

I have also started to build a m68k kernel. This one starts booting in Qemu, but the boot hangs with an "attempted to kill idle" panic.

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 1/1 elf2flt: fix after conversion of binutils to package infrastructure

In reply to Arnout Vandecappelle (Essensium/Mind)
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnout" == Arnout Vandecappelle (Essensium/Mind) <[email protected]> writes:

Arnout> When binutils was converted to the package infrastructure (commit Arnout> 009407e6b), the variable that elf2flt uses to find the binutils Arnout> libraries disappeared. So use HOST_BINUTILS_DIR instead of Arnout> BINUTILS_DIR1.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard