【发布时间】:2016-10-14 14:57:00
【问题描述】:
我尝试在 Ubuntu 16.04 LTS 上编译 Linux 内核 3.10.31。 我曾经在 Ubuntu 12.04 LTS 上编译过完全相同的内核,一切运行良好。
在 Ubuntu 16.04 上,gcc 版本为gcc-5;
在 Ubuntu 12.04 上,gcc 版本为gcc-4.6。
3.18之前的Linux内核内核好像不能用gcc-5编译。内核3.10.31在make编译时报如下错误
fatal error: linux/compiler-gcc5.h: No such file or directory
我尝试在 Ubuntu 16.04 上安装 gcc-4.7 并将 /usr/bin/gcc 更改为指向 gcc-4.7。这可以解决上述错误。但是,在我运行make后会导致新问题
$linux/arch/x86/Makefile:98: stack protector enabled but no compiler support
make[1]: Nothing to be done for 'all'.
make[1]: Nothing to be done for 'relocs'.
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
CC kernel/bounds.s
gcc-4.7.real: error: unrecognized command line option ‘-no-pie’
linux/./Kbuild:35: recipe for target 'kernel/bounds.s' failed
make[1]: *** [kernel/bounds.s] Error 1
Makefile:835: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2
我的问题是:
在 Ubuntu 16.04 上使用旧的编译链编译旧的内核 3.10.31 有没有一种巧妙的方法?
非常感谢您的帮助!任何建议都非常感谢。
【问题讨论】:
标签: linux ubuntu gcc linux-kernel