Skip to content

MIPS binutils

Pavel Kryukov edited this page Mar 10, 2017 · 26 revisions

Introduction

This cheat-sheet is based on this following instruction: http://www.linux-mips.org/wiki/Toolchains#Roll-your-own. See it if you have any problem or need more information.

Note: this instruction will works only for Linux machines. It was verified on Ubuntu 12.04.1 LTS (GNU/Linux 2.6.32-042stab084.26 x86_64).

Getting binutils sources

  • The following command will download the required sources (binutils-2.28.tar.bz2) from the FTP server into /tmp/ directory:
cd /tmp
wget http://ftp.gnu.org/gnu/binutils/binutils-2.28.tar.bz2
  • Then, unpacked the sources:
tar xjf binutils-2.28.tar.bz2

Building binutils sources

  • Create a folder where the binutils will be installed (can be any):
mkdir /opt/cross
  • Create a folder for a build process (can be any):
cd /tmp
mkdir build-binutils && cd build-binutils
  • Configure build (can dump a lot of info):
../binutils-2.28/configure --target=mipsel-unknown-linux-gnu --prefix=/opt/cross
  • Make sources (can dump a lot of info):
make
  • Install (can dump a lot of info):
make install

After that you should now have the cross-binutils installed under /opt/cross/bin/ with names prefixed by mipsel-unknown-linux-gnu-.


Set short names

It is convenient to give a short name to MIPS Binutils binaries. We suggest to put a short symlink into /usr/bin/, which also make the tools visible without modification of the $PATH.

For example:

cd /usr/bin
ln -s /opt/cross/bin/mipsel-unknown-linux-gnu-as mips-as
ln -s /opt/cross/bin/mipsel-unknown-linux-gnu-ld mips-ld
ln -s /opt/cross/bin/mipsel-unknown-linux-gnu-objdump mips-objdump
Clone this wiki locally