0
最近我嘗試爲我的xiaomi mi4c交叉編譯android內核。 要做到這一點,我已經下載並這樣配置的工具鏈:從這裏編譯android 3.10內核源碼時出錯
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.
所以,問題是,我在做什麼錯誤?也許我需要另一個用於交叉編譯的工具鏈? Sombody可以提供一個嗎?我不認爲在內核代碼中有錯誤。那麼會出現什麼問題呢?
它可能不會有所作爲,但你的shell輸入是標新立異。 (1)由於您導出了ARCH和CROSS_COMPILE env變量,因此您不必在** make **命令中再次指定它們。 (2)CROSS_COMPILE僅僅是命令前綴,而不是整個路徑。修改env變量PATH以包含您的工具鏈。 (3)'make mrproper'使前面的'make clean'成爲多餘的。 (4)嘗試沒有'-j3'選項的構建。 IIRC偶爾出現並行工作問題。 – sawdust
這看起來像是同樣的問題:https://github.com/MiCode/Xiaomi_Kernel_OpenSource/issues/14 – sawdust