最近我尝试为我的小米mi4c交叉编译android内核。为此,我下载并配置了如下工具链:
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9 -b marshmallow-release toolchain64
export ARCH=arm64
export SUBARCH=arm64
export CROSS_COMPILE=`pwd`/toolchain64/bin/aarch64-linux-android-
然后我从这里克隆了内核源:https ://github.com/AndropaX/android_kernel_xiaomi_msm8992
并这样做:
make clean && make mrproper
make ARCH=arm64 resurrection_libra_defconfig
make ARCH=arm64 CROSS_COMPILE=$CROSS_COMPILE -j3
然后我有一个错误:
In file included from include/linux/kernel.h:14:0,
from include/linux/sched.h:15,
from /home/owner/android_kernel_xiaomi_msm8992/arch/arm64/include/asm/compat.h:25,
from /home/owner/android_kernel_xiaomi_msm8992/arch/arm64/include/asm/stat.h:23,
from include/linux/stat.h:5,
from include/linux/module.h:10,
from drivers/tspdrv/tspdrv.c:26:
drivers/tspdrv/ImmVibeSPI_ISA1000.c: In function 'ImmVibeSPI_ForceOut_SetSamples':
include/linux/dynamic_debug.h:64:16: error: implicit declaration of function 'KBUILD_STR' [-Werror=implicit-function-declaration]
static struct _ddebug __aligned(8) \
^
include/linux/dynamic_debug.h:76:2: note: in expansion of macro 'DEFINE_DYNAMIC_DEBUG_METADATA'
DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
^
include/linux/printk.h:240:2: note: in expansion of macro 'dynamic_pr_debug'
dynamic_pr_debug(fmt, ##__VA_ARGS__)
^
drivers/tspdrv/ImmVibeSPI_ISA1000.c:573:2: note: in expansion of macro 'pr_debug'
pr_debug("%s: level = %d\n", __func__, level);
^
<command-line>:0:27: error: 'tspdrv' undeclared (first use in this function)
include/linux/dynamic_debug.h:66:14: note: in expansion of macro 'KBUILD_MODNAME'
.modname = KBUILD_MODNAME, \
^
include/linux/dynamic_debug.h:76:2: note: in expansion of macro 'DEFINE_DYNAMIC_DEBUG_METADATA'
DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
^
include/linux/printk.h:240:2: note: in expansion of macro 'dynamic_pr_debug'
dynamic_pr_debug(fmt, ##__VA_ARGS__)
^
drivers/tspdrv/ImmVibeSPI_ISA1000.c:573:2: note: in expansion of macro 'pr_debug'
pr_debug("%s: level = %d\n", __func__, level);
^
<command-line>:0:27: note: each undeclared identifier is reported only once for each function it appears in
include/linux/dynamic_debug.h:66:14: note: in expansion of macro 'KBUILD_MODNAME'
.modname = KBUILD_MODNAME, \
^
include/linux/dynamic_debug.h:76:2: note: in expansion of macro 'DEFINE_DYNAMIC_DEBUG_METADATA'
DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
^
include/linux/printk.h:240:2: note: in expansion of macro 'dynamic_pr_debug'
dynamic_pr_debug(fmt, ##__VA_ARGS__)
^
drivers/tspdrv/ImmVibeSPI_ISA1000.c:573:2: note: in expansion of macro 'pr_debug'
pr_debug("%s: level = %d\n", __func__, level);
^
drivers/tspdrv/tspdrv.c: At top level:
drivers/tspdrv/tspdrv.c:94:37: fatal error: tspdrvOutputDataHandler.c: No such file or directory
#include <tspdrvOutputDataHandler.c>
^
cc1: some warnings being treated as errors
compilation terminated.
所以,问题是,我做错了什么?也许我需要另一个工具链来进行交叉编译?有人可以推荐一个吗?我不认为内核代码有错误。那么会出什么问题呢?