My end goal is to compile wireless tools for my old Actiontec modem/router so I can configure it as a wireless to ethernet bridge. Currently it's wireless features are (seemingly) controlled by the same binary that manages most of the web interface, but it appears that they used the library wireless tools uses internally for at least some of the functionality.
I've never cross compiled for a different CPU architecture before and not sure how to fully identity what I need to do. I'm trying to use uClibc since it appears to be used in the rest of the system, but I'm not sure how to configure buildroot for the modems environment. I made a best guess at what the configuration should be based on the information from proc below, but somethings wrong since a simple C application that only returns 0 compiled with it fails to run properly.
# cat /proc/version
Linux version 2.4.17_mvl21-malta-mips_fp_le ([email protected]) (gcc version 2.95.3 20010315 (release/MontaVista)) #1 Thu Apr 21 18:04:37 PDT 2005
# cat /proc/cpuinfo
processor : 0
cpu model : MIPS 4KEc V4.8
BogoMIPS : 149.91
wait instruction : no
microsecond timers : yes
extra interrupt vector : yes
hardware watchpoint : yes
VCED exceptions : not available
VCEI exceptions : not available
A cross-compiler is a compiler that runs on one architecture but compiles to another architecture, e.g. a compiler that runs on x86 Solaris machines such as torus.cs but builds MIPS programs. You will be making extensive use of MIPS cross-compilers this semester, unless you actually run Nachos on a MIPS machine.
Cross compiling the GNU toolchain for MIPS on x86_64. To build the toolchain, first edit any configuration options in config.sh (e.g. to change the installation directory) and then run: The build script will start from scratch, purging any existing toolchain. Be sure this is what you want before you start the build process.
A cross-compiler is a compiler that runs on one architecture but compiles to another architecture, e.g. a compiler that runs on x86 Solaris machines such as torus.cs but builds MIPS programs.
When you run gmake in the test directory, gmake will look for a cross-compiler in the directory pointed at by the ARCHDIR environment variable. If you are using an instructional machine of one of the architectures we support (HP machines, DEC Alpha machines, or x86 Solaris machines), then this is automatic.
You are right, you need a proper mips toolchain to cross-compile your application and Buildroot can do that. But you may need to tweak buildroot's menuconfig options.
Depending on the output of file
, your options may change. On my system, binary apps inform the following:
ELF 32-bit MSB executable, MIPS, MIPS32 rel2 version 1 (SYSV)
These are the options I have enabled for my Buildroot's menuconfig:
Target Architecture (mips) --->
Target Architecture Variant (mips 32r2) --->
Target ABI (o32) --->
Target options --->
Build options --->
(/opt/cross-mips-buildroot) Toolchain and header file location?
Toolchain --->
Toolchain type (Buildroot toolchain) --->
Kernel Headers (Linux 2.6.34.x kernel headers) --->
uClibc C library Version (uClibc 0.9.31.x) --->
[*] Build/install a shared libgcc?
[*] Enable compiler tls support
[*] Build gdb debugger for the Target
[*] Build gdb server for the Target
[*] Build gdb for the Host
GDB debugger Version (gdb 6.8) --->
[*] Enable large file (files > 2 GB) support?
[*] Enable WCHAR support
[*] Use software floating point by default
[*] Enable stack protection support
[*] Build/install c++ compiler and libstdc++?
[*] Include target utils in cross toolchain
Package Selection for the target --->
[*] BusyBox
[*] Run BusyBox's own full installation
Libraries --->
Networking --->
[*] libcurl
Text and terminal handling --->
[*] icu
-*- ncurses
Target filesystem options --->
Bootloaders --->
Kernel --->
The toolchain itself is installed at /opt/cross-mips-buildroot. You can find the compiler and other tools on /opt/cross-mips-buildroot/usr/bin/
Try to compile a simple hello world application and see if you can run it inside the mips system.
Note: this configuration will not build a C++ compiler. If you need it, you can grep LIBSTDCPP .config
and check if it's enable or not and change it to your likes. Then make menuconfig
to make it happen.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With