Crosscompiling GDB 7.5 for ARM

If you want to crosscompile GDB for your Linux ARM system, then you need first to cross-compile termcap:

$ export ARCH=arm
$ export CROSSCOMPILE=arm-linux-
$ export PATH=/usr/local/arm/3.4.6/bin:$PATH
$ wget ftp://ftp.gnu.org/pub/pub/gnu/termcap/termcap-1.3.1.tar.gz
$ tar xvf termcap-1.3.1.tar.gz
$ cd termcap-1.3.1/
$ CC=${CROSSCOMPILE}gcc ./configure --host=arm-linux --prefix=/usr
$ make
$ sudo make install

Copy termcap lib and header files to your toolchain (this is my toolchain example)

$ cd /usr/local/arm/3.4.6/arm-linux/lib/
$ sudo mv /usr/lib/libtermcap.a .
$ cd /usr/local/arm/3.4.6/arm-linux/include/
$ sudo mv /usr/include/termcap.h .

Download GDB:

$ wget http://ftp.gnu.org/gnu/gdb/gdb-7.5.tar.bz2
$ tar xvf gdb-7.5.tar.bz2
$ cd gdb-7.5

Add this define PTRACE_GETSIGINFO otherwise you will receive an error message:

$ vi gdb/gdbserver/linux-arm-low.c
#define PTRACE_GETSIGINFO    0x4202

Cross-compile GDB:

$ CC=arm-linux-gcc ./configure --target=arm-linux --build=x86-linux --host=arm-linux --enable-static=yes

Source: http://autosysprogs.blogspot.com.br/2012/04/compile-gdb-for-embedded-devices.html

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s