2010年4月9日 星期五

Cross Compile gdb for x86 and gdbserver for ARM

1. Download GDB source code
2. Download toolchain. ex, you can download the toolchain binary from codesourcery.
3. you will have GDB for x86 host machine after the following:
#./configure --target=arm-none-linux-gnueabi LDFLAGS=-static --with-build-libsubdir=/usr/local/arm-2008q3/arm-none-linux-gnueabi/libc/usr/lib --disable-werror
#make
4. enter gdb/gdbserver, you will have gdbserver for ARM after the following:
#./configure --host=arm-none-linux-gnueabi --target=arm-none-linux-gnueabi LDFLAGS=-static --with-build-libsubdir=/usr/local/arm-2008q3/arm-none-linux-gnueabi/libc/usr/lib --disable-werror
#make

ps.
If make complains about no termcap library, do the following
1. Download ncurses (search the web)
2. Do the following
#./configure --host=arm-none-linux-gnueabi --target=arm-none-linux-gnueabi --prefix="$HOME/install"
#make && make install
#sudo cp ~/install/lib/libncurses.a /usr/local/arm-2008q3/arm-none-linux-gnueabi/libc/usr/lib
#sudo cp ~/install/include/ncurses/ /usr/local/arm-2008q3/arm-none-linux-gnueabi/libc/usr/include -rf

Beaware that this is because that the toolchain is not aware of the libncurses.a library though you've probably install it in the regular path. We need it for the toolchain and which is for ARM machine.
You can do
#file libncurses.a
to check if it's for your machine or for the target. The format should match to cease the complaining.

沒有留言: