[英]Building android kernel
两周以来,我尝试为我的 htc 设备构建 kernel。 获得正确的来源不是问题,但由于 gcc 已从工具链中删除,这真是一场噩梦。 遵循使用 clang 的建议总是以大量错误消息结束。
到目前为止我做了什么?
$ cd <kernel-source-root>
($ make mrproper) // just after failed attempt to build
$ export ARCH=arm64
$ export SUBARCH=arm64
$ export CROSS_COMPILE=<path-to-toolchain-llvm-bin-folder>
// replace all occurences of 'gcc' with 'clang'
-gcc
+clang
$ make msm-perf_defconfig
$ make V=1
// ...
../kernel/bounds.c:18:2: error: unexpected token at start of statement
DEFINE(NR_PAGEFLAGS, __NR_PAGEFLAGS);
^
../include/linux/kbuild.h:5:25: note: expanded from macro 'DEFINE'
asm volatile("\n->" #sym " %0 " #val : : "i" (val))
^
<inline asm>:2:1: note: instantiated into assembly here
->NR_PAGEFLAGS 21 __NR_PAGEFLAGS
^
../kernel/bounds.c:19:2: error: unexpected token at start of statement
DEFINE(MAX_NR_ZONES, __MAX_NR_ZONES);
^
../include/linux/kbuild.h:5:25: note: expanded from macro 'DEFINE'
asm volatile("\n->" #sym " %0 " #val : : "i" (val))
^
<inline asm>:2:1: note: instantiated into assembly here
->MAX_NR_ZONES 3 __MAX_NR_ZONES
^
../kernel/bounds.c:21:2: error: unexpected token at start of statement
DEFINE(NR_CPUS_BITS, ilog2(CONFIG_NR_CPUS));
^
../include/linux/kbuild.h:5:25: note: expanded from macro 'DEFINE'
asm volatile("\n->" #sym " %0 " #val : : "i" (val))
^
<inline asm>:2:1: note: instantiated into assembly here
->NR_CPUS_BITS 3 ilog2(CONFIG_NR_CPUS)
^
../kernel/bounds.c:23:2: error: unexpected token at start of statement
DEFINE(SPINLOCK_SIZE, sizeof(spinlock_t));
^
../include/linux/kbuild.h:5:25: note: expanded from macro 'DEFINE'
asm volatile("\n->" #sym " %0 " #val : : "i" (val))
^
<inline asm>:2:1: note: instantiated into assembly here
->SPINLOCK_SIZE 4 sizeof(spinlock_t)
^
4 errors generated.
make[2]: *** [kernel/bounds.s] Error 1
make[1]: *** [prepare0] Error 2
make: *** [sub-make] Error 2
有人看到出了什么问题吗?
将-no-integrated-as
添加到 build 命令修复了它。
据 clang 开发人员介绍:
添加 -no-integrated-as。 这是编译器对 output 的已知滥用,而不是汇编。
make ARCH=arm64 -j64 -no-integrated-as
在为 Redmi 5(Rosy) 修补 kernel 时,我收到了确切的错误。 你得到错误解决了吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.