You are not logged in.

#1 2017-08-09 13:47:25

tanjmaxalb
Member
Registered: 2017-08-09
Posts: 6

[SOLVED] Compile kernel MIPS on x86

Hi, ArchCommunity!
I'm try build linux kernel with cross-mips-elf- toolchain from AUR, but without success, because there are no headers for MIPS architecture.
Can someone tell me rigth toolchain needed to build MIPS linux kernel on x86?

Last edited by tanjmaxalb (2017-08-10 14:47:14)

Offline

#2 2017-08-09 20:37:38

pypi
Wiki Maintainer
Registered: 2014-04-22
Posts: 250

Re: [SOLVED] Compile kernel MIPS on x86

You shouldn't need any headers when building the kernel.

If you can't get your build to work and you are convinced that it is the toolchain, you could build a toolchain CLFS style - you should only need http://clfs.org/view/CLFS-SYSTEMD-TRUNK … utils.html, http://clfs.org/view/CLFS-SYSTEMD-TRUNK … tatic.html (properly packaged using a PKGBUILD, of course). I also have my own PKGBUILDs that work for MIPS - https://github.com/takahe-linux/pkgs/bl … s/PKGBUILD, https://github.com/takahe-linux/pkgs/bl … c/PKGBUILD - but you'll need to set some environmental variables before using them.

Offline

#3 2017-08-10 07:09:05

tanjmaxalb
Member
Registered: 2017-08-09
Posts: 6

Re: [SOLVED] Compile kernel MIPS on x86

Thank for the answer. I'm used your PKGBUILD's files and build binutils, gcc-static.
Unfortunately, it did't solve my problem. When build a kernel, I get this error message:

./arch/mips/include/uapi/asm/sgidefs.h:18:2: error: #error Use a Linux compiler or give up.
 #error Use a Linux compiler or give up.

P.S. When compiling any program, example helloworld, I get error what gcc can't find headers.
Therefore, I concluded that the problem in toolchain (maybe uncorrect install). I don't know if I'm right...
Maybe you know other source of the problem?

Last edited by tanjmaxalb (2017-08-10 07:33:20)

Offline

#4 2017-08-10 07:57:45

pypi
Wiki Maintainer
Registered: 2014-04-22
Posts: 250

Re: [SOLVED] Compile kernel MIPS on x86

From the error message it looks like you've set _target_triplet to be mips-elf and you need to use a proper triplet, eg mips-linux-gnu or mips-linux-musl. You can't compile any normal program because you haven't set up a libc and built a "real" GCC - only a "static" GCC, which is limited to fairly bare-metal targets (eg the libc and kernel). The difference between the normal and static GCC is described in the CLFS gcc-static page.

I'm not entirely sure what the difference between mips-elf and mips-linux-gnu actually is for building the kernel - from here perhaps the elf toolchain uses a different calling convention from what the kernel wants? Either way, try changing the target triplet and rebuilding.

Offline

#5 2017-08-10 10:14:00

tanjmaxalb
Member
Registered: 2017-08-09
Posts: 6

Re: [SOLVED] Compile kernel MIPS on x86

Thank for solve! I'm built the mips-linux-gnu
As I understand difference mips-elf and mips-linux-gnu is in calling convention.

Offline

Board footer

Powered by FluxBB