tedyyan 发表于 2017-3-29 14:45:45

内核编译出错:unrecognized command line option '-mgeneral-regs-only'

:~/proj/firefly-rk3399/kernel$ echo $CROSS_COMPILE
/home/teddy/proj/firefly-rk3288-lollipop/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-
:~/proj/firefly-rk3399/kernel$ echo $ARCH
arm
-----------------------------------------------------------------------------------------------
:~/proj/firefly-rk3399/kernel$ make -j8 ARCH=arm64 rk3399-firefly.img
CHK   include/config/kernel.release
CHK   include/generated/uapi/linux/version.h
CC      scripts/mod/empty.o
CC      scripts/mod/devicetable-offsets.s
CHK   include/generated/utsrelease.h
cc1: error: unrecognized command line option '-mgeneral-regs-only'
make: *** Error 1
make: *** Waiting for unfinished jobs....
cc1: error: unrecognized command line option '-mgeneral-regs-only'
make: *** Error 1
make: *** Error 2
make: *** Error 2
make: *** Waiting for unfinished jobs....
CHK   include/generated/timeconst.h
CC      kernel/bounds.s
cc1: error: unrecognized command line option '-mgeneral-regs-only'
make: *** Error 1
make: *** Error 2

----------------------------------------------------------------------------------------------
make -j8 ARCH=arm64 rk3399-firefly.img
CHK   include/config/kernel.release
CHK   include/generated/uapi/linux/version.h
CC      scripts/mod/empty.o
CC      scripts/mod/devicetable-offsets.s
CHK   include/generated/utsrelease.h
arm-eabi-gcc: error: unrecognized command line option '-mgeneral-regs-only'
make: *** Error 1
make: *** Waiting for unfinished jobs....
arm-eabi-gcc: error: unrecognized command line option '-mgeneral-regs-only'
make: *** Error 1
make: *** Error 2
make: *** Error 2
make: *** Waiting for unfinished jobs....
CHK   include/generated/timeconst.h
CC      kernel/bounds.s
arm-eabi-gcc: error: unrecognized command line option '-mgeneral-regs-only'
make: *** Error

tedyyan 发表于 2017-3-29 15:05:47

自带的prebuild里的交叉编译不行,必须要自己装

export ARCH=arm64e

sudo apt-get install gcc-aarch64-linux-gnu
sudo apt-get install gcc-arm-linux-gnueabi

export CROSS_COMPILE=/usr/bin/aarch64-linux-gnu-

export CROSS32CC=arm-linux-gnueabi-gcc

https://devtalk.nvidia.com/default/topic/906942/failed-to-compile-kernel-module-gcc-cannot-recognize-aarch64-option-mgeneral-regs-only-/

饿客登门 发表于 2017-3-29 15:59:51

总之就是编译器的毛病,之前也遇到这个问题,换了 Linaro 4.9.x 就好了。

freeheartgy 发表于 2023-3-9 15:08:07

tedyyan 发表于 2017-3-29 15:05
自带的prebuild里的交叉编译不行,必须要自己装

export ARCH=arm64e


在3399PRO LINUX 1.4的内核里面编译NPU的固件,遇到这个问题,感谢楼主,完美解决。
页: [1]
查看完整版本: 内核编译出错:unrecognized command line option '-mgeneral-regs-only'