Installation of mips cross compilation environment

In the Ubuntu environment, there are always some problems with the programs compiled with qemu, so use Buildroot to build an environment for compiling mips programs.

Download Buildroot

wget http://buildroot.uclibc.org/downloads/snapshots/buildroot-snapshot.tar.bz2

Unzip

tar -jxvf buildroot-snapshot.tar.bz2

Configure Buildroot

cd buildroot
sudo apt-get install libncurses5-dev patch
make clean
make menuconfig

An interface will appear

Insert picture description here

Choose Target options

Insert picture description here

Change Target Architecture to mips big endian

Then go back to the main interface, select Toolchain, and enter

Insert picture description here

Choose the kernel version of your current system

View version command

uname -a

After configuration, select save to save

Finally, compile

sudo make

After a long wait, after Buildroot is compiled, we will see the newly generated output directory

Insert picture description here

After entering the buildroot/output/host/bindirectory, you will see the file as shown below, indicating that the compilation has been successful

Insert picture description here

Test compilation environment

Ready to compile, to be compiled ~/Desktop/codeundervuln_system.c

In order to make the generated files do not rely on dynamic libraries, use here -staticfor static compilation

Insert picture description here

After the compilation is complete, view the generated file

Insert picture description here
At this point, the environment installation is complete

Guess you like

Origin blog.csdn.net/weixin_44001905/article/details/99730019