I need to run strace & gdb on the target arm device to toubleshoot. But there's no binary in the rootfs already. I decided to build it myself.
The toolchain I utilized is code source lit edition, here is the commands to issue:
1. strace
# apt-get source strace
# cd strace-4.5.20/
# CC=arm-none-linux-gnueabi-gcc ./configure --host=arm-none-linux-gnueabi // ignore the warning message that suggest you set --build flag
# CC=arm-none-linux-gnueabi-gcc make
If you want to build strace statically, add -static to AM_CFLAGS in Makefile before make, e.g.
AM_CFLAGS = $(WARNFLAGS) -static
Ok. Till now there will be a binary in you current dir.
you can strace it before you copy it to the target filesystem.
# arm-none-linux-gnueabi-strip strace
2. gdb
a) Modify gdb/gdb_curses.h to #include specifically.
b) Modify gdb/Makefile add "-I/workspace/DM365Core/products/common/dvsdk_3_10_00_19/linuxlibs-2009.11-armv5te/include/" to COMPILE
c) Add "extern int tgetnum (const char *);" to ./gdb/utils.c
commands:
# CC=arm-none-linux-gnueabi-gcc ./configure --host=arm-none-linux-gnueabi
# CC=arm-none-linux-gnueabi-gcc make
3. procps
a) Modify Makefile to add '-I/workspace/DM36x_IPCAM/products/common/dvsdk_3_10_00_19/linuxlibs-2009.11-armv5te/include' to CFLAGS
b) make CC=arm-none-linux-gnueabi-gcc
or alternatively: make SHARED=0 CC=arm-none-linux-gnueabi-gcc
to staticly link libproc to reduce binary size and save flash space.
4. binutils
# apt-get source binutils
# cd binutils-2.20.51.20100908/
# CC=arm-none-linux-gnueabi-gcc ./configure --host=arm-none-linux-gnueabi
# CC=arm-none-linux-gnueabi-gcc make
Enjoy yourself!
阅读(2232) | 评论(0) | 转发(0) |