Search code examples
cgccmipscross-compilingnetbsd

cross-compiling from linux x32/x64 to netbsd mips/el


I have some embedded systems which run on netbsd with mips processors.

I want to play around a little bit with them and as I understand it I need a cross-compiler. I have never done such a thing and all information I find is rather assuming in knowledge I don`t have.

so What would it take for me to set-up a compiler which compiles to a program which is executable on a mips netbsd system?

language is straight up c


Solution

  • The easiest way is probably to have the NetBSD source tree checked out and using the build.sh script to just build the cross-compiler.

    http://www.netbsd.org/docs/guide/en/chap-build.html#chap-build-tools

    Run uname -m on the target system to see the target machine type that you would use with build.sh.

    For the different options to download the NetBSD source, have another look at the NetBSD Guide.

    http://www.netbsd.org/docs/guide/en/chap-fetch.html

    Note that you don't have to place the source code in /usr/src -- it is just a tradition on NetBSD, but you can freely pick any directory you want.