按照 https://rocketboards.org/foswiki/Documentation/EmbeddedLinuxBeginnerSGuide 编译linux内核,遇到报错:
gcc: error: unrecognized argument in option ‘-mabi=aapcs-linux’
gcc: note: valid arguments to ‘-mabi=’ are: ms sysv
gcc: error: unrecognized command line option ‘-mlittle-endian’
gcc: error: unrecognized command line option ‘-mapcs’
gcc: error: unrecognized command line option ‘-mno-sched-prolog’
gcc: error: unrecognized command line option ‘-mfpu=vfp’
Kbuild:21: recipe for target 'kernel/bounds.s' failed
make[1]: *** [kernel/bounds.s] Error 1
Makefile:1083: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2
参考rocketboard https://rocketboards.org/foswiki/Documentation/EmbeddedLinuxBeginnerSGuide
的提示:
于是我设置交叉编译环境变量 export CROSS_COMPILE=arm-linux-gnueabihf-。 但是这样设置以后提示:未找到编译链命令
原来是没有安装编译链,于是下发命令:wget http://releases.linaro.org/components/toolchain
/binaries/4.9-2016.02/arm-linux-gnueabihf/gcc-linaro-4.9-2016.02-x86_64_arm-linux-gnueabihf.tar.xz
解压编译链。
然后设置环境变量:
这样就可以正常编译了!
环境变量 也可以这样设置:export CROSS_COMPILE=/home/terasic/桌面/DE10_NANO_SoC_GHRD/software/gcc-linaro-4.9-2016.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-