2010年6月21日 星期一

buildroot-2010.05

Building gmp-4.2.4

configure:32896: checking for flex
configure:32912: found /path_to_my_toolchain/usr/bin/flex
configure:32922: result: flex
configure:32935: checking for yywrap in -lfl
configure:32965: /path_to_my_toolchain/usr/bin/arm-unknown-linux-uclibcgnueabi-gcc -O3 -pipe -Os -mtune=arm1136jf-s -march=armv6j -mabi=aapcs-linux -mfpu=vfp -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I/path_to_my_toolchain/usr/include -I/path_to_my_toolchain/include --sysroot=/path_to_my_toolchain/ -isysroot /path_to_my_toolchain -o conftest -O3 -fomit-frame-pointer conftest.c -lfl >&5
configure:32971: $? = 0
configure:32975: test -z
|| test ! -s conftest.err
configure:32978: $? = 0
configure:32981: test -s conftest
configure:32984: $? = 0
configure:32997: result: yes
configure:33075: checking lex output file root
configure:33086: flex conftest.l
/home/prj/vega_trunk/other/buildroot-2010.05/buildroot-2010.05/output/toolchain/gmp-4.2.4/configure: line 33087: /path_to_my_toolchain/usr/bin/flex: cannot execute binary file
It seems configure have found the flex for target, which is wrong. Making buildroot with following command would relieve the situation.
LEX=/usr/bin/flex make


samba runtime issue
Build and boot the bootpImage with the prebuilt rootfs.tar. smbd -D and nmbd -D exhausted memory, and crashed with segmentation fault or oom
[ 8.510000] Freeing init memory: 156K
[ 415.820000] pgd = cf8a8000
[ 415.830000] [be545ff0] *pgd=0a175031, *pte=00000000, *ppte=00000000
[ 415.850000]
[ 415.850000] Pid: 376, comm: smbd
[ 415.860000] CPU: 0 Not tainted (2.6.31.1-cavm1 #104)
[ 415.870000] PC is at 0x400017c0
[ 415.880000] LR is at 0x400029b8
[ 415.890000] pc : [<400017c0>] lr : [<400029b8>] psr: 60000010
[ 415.890000] sp : be545fd8 ip : be546120 fp : be54611c
[ 415.900000] r10: 0a57d960 r9 : 40003f99 r8 : 0000b7dc
[ 415.910000] r7 : 00000001 r6 : 40003f97 r5 : be546934 r4 : be54611f
[ 415.920000] r3 : 00000000 r2 : be546120 r1 : be5469c4 r0 : 00000000
[ 415.930000] Flags: nZCv IRQs on FIQs on Mode USER_32 ISA ARM Segment user
[ 415.940000] Control: 00c5787d Table: 0f8a800a DAC: 00000015
[ 821.240000] pgd = cd790000
[ 821.250000] [be4b7fc0] *pgd=0ccba031, *pte=00000000, *ppte=00000000
[ 821.260000]
[ 821.270000] Pid: 377, comm: nmbd
[ 821.280000] CPU: 0 Not tainted (2.6.31.1-cavm1 #104)
[ 821.290000] PC is at 0x400017c0
[ 821.300000] LR is at 0x400029b8
[ 821.310000] pc : [<400017c0>] lr : [<400029b8>] psr: 60000010
[ 821.310000] sp : be4b7fa8 ip : be4b80f0 fp : be4b80ec
[ 821.320000] r10: 0a227918 r9 : 40003f99 r8 : 0000b7dc
[ 821.330000] r7 : 00000001 r6 : 40003f97 r5 : be4b8904 r4 : be4b80ef
[ 821.340000] r3 : 00000000 r2 : be4b80f0 r1 : be4b8994 r0 : 00000000
[ 821.350000] Flags: nZCv IRQs on FIQs on Mode USER_32 ISA ARM Segment user
[ 821.360000] Control: 00c5787d Table: 0d79000a DAC: 00000015

Welcome to Buildroot
buildroot login:
Running "smbd -D& watch -n 1 free;" can observe that the free memory keep reducing and fault until free memory become 0. nmbd behave the same. The time to fault depends on how many free memory you have.

"strace smbd -D" sees repeating following message:
open("/usr/lib/charset/CP850.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/CP850.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/CP850.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/CP850.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/X11R6/lib/CP850.so", O_RDONLY) = -1 ENOENT (No such file or directory)
gettimeofday({1082, 728256}, NULL) = 0
open("/etc/TZ", O_RDONLY) = 3
read(3, "MST7MDT\n"..., 68) = 8
close(3) = 0
gettimeofday({1082, 728942}, NULL) = 0
open("/etc/TZ", O_RDONLY) = 3
read(3, "MST7MDT\n"..., 68) = 8
close(3) = 0
open("/etc/TZ", O_RDONLY) = 3
read(3, "MST7MDT\n"..., 68) = 8
close(3) = 0
open("/etc/TZ", O_RDONLY) = 3
read(3, "MST7MDT\n"..., 68) = 8
close(3) = 0
geteuid32() = 0
write(5, "[1969/12/31 17:18:02, 0] lib/cha"..., 56) = 56
geteuid32() = 0
write(5, " init_iconv: Conversion from UTF"..., 59) = 59
gettimeofday({1082, 731490}, NULL) = 0
open("/etc/TZ", O_RDONLY) = 3
read(3, "MST7MDT\n"..., 68) = 8
close(3) = 0
gettimeofday({1082, 732175}, NULL) = 0
open("/etc/TZ", O_RDONLY) = 3
read(3, "MST7MDT\n"..., 68) = 8
close(3) = 0
open("/etc/TZ", O_RDONLY) = 3
read(3, "MST7MDT\n"..., 68) = 8
close(3) = 0
open("/etc/TZ", O_RDONLY) = 3
read(3, "MST7MDT\n"..., 68) = 8
close(3) = 0
geteuid32() = 0
write(5, "[1969/12/31 17:18:02, 0] lib/cha"..., 56) = 56
geteuid32() = 0
write(5, " init_iconv: Attempting to repla"..., 72) = 72
Copying the CP850.so to /usr/lib would relieve the situation.

"smbd -i -S" shows message repeating:
init_iconv: Conversion from CP850 to UTF-8 not supported
init_iconv: Attempting to replace with conversion from ASCII to ASCII
init_iconv: Conversion from CP850 to ASCII not supported
init_iconv: Attempting to replace with conversion from ASCII to ASCII
init_iconv: Conversion from CP850 to UTF8 not supported
init_iconv: Attempting to replace with conversion from ASCII to ASCII
init_iconv: Conversion from CP850 to UTF-16BE not supported
init_iconv: Attempting to replace with conversion from ASCII to UTF-16BE
init_iconv: Conversion from UTF8 to CP850 not supported

Solution
On buildroot-2010.05, BR2_ENABLE_LOCALE(i18n) prevent BR2_PACKAGE_LIBICONV from being selected. As a result, libiconv is not included, so samba have to use itself's iconv, which would need CP850.so to be present. But CP850.so isn't installed by buildroot (deleted). For some reason, it would consume all the memory and fault until there is no more.
Either add libiconv, or add CP850.so should relieve this situation.


Build roofs with code sourcery arm-2009q1
CC libxt_connlimit.oo
In file included from libxt_CLASSIFY.c:11:
/opt/staging/usr/include/linux/pkt_sched.h:516: error: expected specifier-qualifier-list before 'u32'
make[3]: *** [libxt_CLASSIFY.oo] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: Leaving directory `/buildroot-2010.05/buildroot-2010.05/output/build/iptables-1.4.7/extensions'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/buildroot-2010.05/buildroot-2010.05/output/build/iptables-1.4.7'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/buildroot-2010.05/buildroot-2010.05/output/build/iptables-1.4.7'
make: *** [/buildroot-2010.05/buildroot-2010.05/output/build/iptables-1.4.7/.stamp_built] Error 2
make: Leaving directory `/buildroot-2010.05/buildroot-2010.05'
Command exited with non-zero status 2


Edit the /opt/staging/usr/include/linux/pkt_sched.h with following change:
diff -Naur pkt_sched.h orig
--- pkt_sched.h 2010-07-02 20:33:01.240976559 +0800
+++ orig 2010-07-02 20:32:57.472976778 +0800
@@ -513,7 +513,7 @@

struct tc_drr_stats
{
- __u32 deficit;
+ u32 deficit;
};

#endif

and make again...


Add oprofile got error like following:
checking for bfd_openr in -lbfd... no
configure: error: bfd library not found
make: *** [/buildroot-2010.05/output/build/oprofile-0.9.4/.stamp_configured] Error 1

config.log shows:
configure:22369: checking for bfd_openr in -lbfd
configure:22404: /opt/arm-linux-le-uclibc-gcc-4.3.3-2010.05/usr/bin/arm-unknown-linux-uclibcgnueabi-gcc -O3 -pipe -Os -mtune=arm1136jf-s -march=armv6j -mabi=aapcs-linux -mfpu=vfp -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I/opt/arm-linux-le-uclibc-gcc-4.3.3-2010.05/usr/include -I/opt/arm-linux-le-uclibc-gcc-4.3.3-2010.05/include --sysroot=/opt/arm-linux-le-uclibc-gcc-4.3.3-2010.05/ -isysroot /opt/arm-linux-le-uclibc-gcc-4.3.3-2010.05 -o conftest -O3 -pipe -Os -mtune=arm1136jf-s -march=armv6j -mabi=aapcs-linux -mfpu=vfp -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I/opt/arm-linux-le-uclibc-gcc-4.3.3-2010.05/usr/include -I/opt/arm-linux-le-uclibc-gcc-4.3.3-2010.05/include --sysroot=/opt/arm-linux-le-uclibc-gcc-4.3.3-2010.05/ -isysroot /opt/arm-linux-le-uclibc-gcc-4.3.3-2010.05 -I/buildroot-2010.05/output/build/binutils-2.20.1-target/bfd -I/buildroot-2010.05/output/toolchain/binutils-2.20.1/include -L/opt/arm-linux-le-uclibc-gcc-4.3.3-2010.05/lib -L/opt/arm-linux-le-uclibc-gcc-4.3.3-2010.05/usr/lib --sysroot=/opt/arm-linux-le-uclibc-gcc-4.3.3-2010.05/ -L/buildroot-2010.05/output/build/binutils-2.20.1-target/bfd conftest.c -lbfd -liberty -lpopt -ldl >&5
/opt/arm-linux-le-uclibc-gcc-4.3.3-2010.05/usr/bin/../lib/gcc/arm-unknown-linux-uclibcgnueabi/4.3.3/../../../../arm-unknown-linux-uclibcgnueabi/bin/ld: skipping incompatible /opt/arm-linux-le-uclibc-gcc-4.3.3-2010.05/usr/lib/libiberty.a when searching for -liberty
/buildroot-2010.05/output/build/binutils-2.20.1-target/bfd/libbfd.a(compress.o): In function `bfd_uncompress_section_contents':
/buildroot-2010.05/output/toolchain/binutils-2.20.1/bfd/compress.c:96: undefined reference to `inflateInit_'
/buildroot-2010.05/output/toolchain/binutils-2.20.1/bfd/compress.c:103: undefined reference to `inflate'
/buildroot-2010.05/output/toolchain/binutils-2.20.1/bfd/compress.c:106: undefined reference to `inflateReset'
/buildroot-2010.05/output/toolchain/binutils-2.20.1/bfd/compress.c:108: undefined reference to `inflateEnd'
collect2: ld returned 1 exit status

Fixed by:
--- package/oprofile/oprofile.mk.old 2010-07-20 14:54:04.490219166 +0800
+++ package/oprofile/oprofile.mk 2010-07-20 14:54:10.635230378 +0800
@@ -8,7 +8,7 @@
--with-extra-includes="$(BUILD_DIR)/binutils-$(BR2_BINUTILS_VERSION)-target/bfd \
-I$(TOOLCHAIN_DIR)/binutils-$(BR2_BINUTILS_VERSION)/include" \
--with-extra-libs=$(BUILD_DIR)/binutils-$(BR2_BINUTILS_VERSION)-target/bfd \
- --with-kernel-support
+ --with-kernel-support LIBS=-lz

OPROFILE_BINARIES := utils/ophelp
OPROFILE_BINARIES += pp/opannotate pp/oparchive pp/opgprof pp/opreport opjitconv/opjitconv



build oprofile with buildroot, but using external toolchain (CodeSourcery arm2009q1)
--2010-07-20 16:07:11-- http://buildroot.net/downloads/sources//binutils-.tar.bz2
Resolving buildroot.net... 140.211.167.224
Connecting to buildroot.net|140.211.167.224|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://sources.buildroot.net//binutils-.tar.bz2 [following]
--2010-07-20 16:07:12-- http://sources.buildroot.net//binutils-.tar.bz2
Resolving sources.buildroot.net... 88.198.64.109
Connecting to sources.buildroot.net|88.198.64.109|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2010-07-20 16:07:12 ERROR 404: Not Found.

Fix
--- toolchain/external-toolchain/Config.in.old 2010-07-20 16:30:51.345366895 +0800
+++ toolchain/external-toolchain/Config.in 2010-07-20 16:30:14.953219224 +0800
@@ -19,4 +19,6 @@
prompt "Strip shared libraries"
help
Strip shared libraries copied from the external toolchain.
+
+source "toolchain/binutils/Config.in"
endif



build oprofile with buildroot, but using external toolchain (CodeSourcery arm2009q1)
checking libiberty.h usability... yes
checking libiberty.h presence... yes
checking for libiberty.h... yes
checking for cplus_demangle in -liberty... no
configure: error: liberty library not found
make: *** [/home/prj/vega_trunk/other/buildroot-2010.05/buildroot-2010.05/output/build/oprofile-0.9.4/.stamp_configured] Error 1

ld -liberty library
http://ubuntuforums.org/showthread.php?t=390903
It looks like you need the "iberty" library: http://gcc.gnu.org/onlinedocs/libiberty/

Install binutils-dev. It provides /usr/lib/libiberty.a

Fix
--- package/oprofile/oprofile.mk.old 2010-07-20 16:48:25.753219513 +0800
+++ package/oprofile/oprofile.mk 2010-07-20 16:54:17.765301012 +0800
@@ -6,8 +6,8 @@
OPROFILE_VERSION := 0.9.4
OPROFILE_CONF_OPT := --localstatedir=/var \
--with-extra-includes="$(BUILD_DIR)/binutils-$(BR2_BINUTILS_VERSION)-target/bfd \
- -I$(TOOLCHAIN_DIR)/binutils-$(BR2_BINUTILS_VERSION)/include" \
- --with-extra-libs=$(BUILD_DIR)/binutils-$(BR2_BINUTILS_VERSION)-target/bfd \
+ -I$(TOOLCHAIN_DIR)/binutils-$(BR2_BINUTILS_VERSION)/include -I$(BUILD_DIR)/binutils-$(BR2_BINUTILS_VERSION)-target/libiberty" \
+ --with-extra-libs="$(BUILD_DIR)/binutils-$(BR2_BINUTILS_VERSION)-target/bfd -L$(BUILD_DIR)/binutils-$(BR2_BINUTILS_VERSION)-target/libiberty" \
--with-kernel-support LIBS=-lz

OPROFILE_BINARIES := utils/ophelp

沒有留言: