Chinaunix首页 | 论坛 | 博客
  • 博客访问: 384452
  • 博文数量: 39
  • 博客积分: 1771
  • 博客等级: 上尉
  • 技术积分: 1231
  • 用 户 组: 普通用户
  • 注册时间: 2005-05-01 14:21
文章分类

全部博文(39)

文章存档

2013年(1)

2012年(4)

2011年(16)

2010年(6)

2009年(12)

分类: LINUX

2013-03-08 08:35:04

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!

阅读(2130) | 评论(0) | 转发(0) |
0

上一篇:gdb tips

下一篇:没有了

给主人留下些什么吧!~~