交叉编译GDB和GDBserver(mipsel版)

来源:互联网 发布:生意参谋数据解读 编辑:程序博客网 时间:2024/05/16 18:39
系统平台: Ubuntu Kylin 14.04
目标平台: MT7620A(主芯片
交叉工具链: mipsel-openwrt-linux

1)下载GDB
2)解压GDB
3)配置/编译/安装GDB
4)配置/编译GDBserver
5)推送GDBserver

1)在终端下进入超级用户模式,使用apt-get获取GDB源包
        sudo -s
        apt-get source gdb
2)解压
        tar xjf gdb_7.7.1.orig.tar.bz2
3)进入到GDB顶层目录,配置GDB,配置完成后,执行make;make install
        cd gdb_7.7.1
        ./configure --target=mipsel-openwrt-linux --prefix=/usr/toolchain/mipsel-gdb-7.7.1
        make;make install
4)到这GDB就编译安装完了,接下来是GDBserver
        cd gdb/gdbserver
        ./configure --target=mipsel-openwrt-linux --host=mipsel-openwrt-linux
        make
5)此时你会在当前目录找到gdbserver这样一个文件,把它下载到目标版后放在/bin目录下就可以

Ps1:若出现
remote 'g' packet reply is too long: xxxxx
则修改gdb/remote.c,注释掉一下两行
//  if (buf_len > 2 * rsa->sizeof_g_packet)
//    error (_("Remote 'g' packet reply is too long: %s"), rs->buf);

Ps2:若出现
configure: WARNING: no enhanced curses library found; disabling TUI
checking for library containing tgetent... no
configure: error: no termcap library found
make[1]: *** [configure-gdb] Error 1
则需要交叉编译libncurses5-dev,并且把生成的.a放到工具链的lib下。

0 0