【发布时间】:2016-09-09 10:27:11
【问题描述】:
我试图为我的设备(Moto G 2014 aka titan)构建一个 Android 内核,在我添加了一个自定义调控器“Yankactive”之后,我不断收到这个错误,我不知道如何修复这个错误。
这是错误:
drivers/cpufreq/cpufreq_yankactive.c: In function 'cpufreq_yankactive_timer_resched':
drivers/cpufreq/cpufreq_yankactive.c:166:3: error: implicit declaration of function 'get_cpu_idle_time' [-Werror=implicit-function-declaration]
get_cpu_idle_time(smp_processor_id(),
^
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:308: drivers/cpufreq/cpufreq_yankactive.o] Error 1
make[1]: *** [scripts/Makefile.build:443: drivers/cpufreq] Error 2
make: *** [Makefile:965: drivers] Error 2
这里是我使用的调速器的源代码文件:http://hastebin.com/vefequzema.pl
【问题讨论】:
-
您的代码在实际声明之前使用了函数
get_cpu_idle_time。在调用代码之前的某个点定义函数或提出前向声明。参见例如this question,如果您搜索错误,还有许多其他好的答案。 -
@sagar846 您正在尝试构建哪个内核?如果可能,请提供版本和链接。
-
@SamProtsenko 我正在尝试为我的设备构建 CM 13 版本 3.4.X:titan(摩托罗拉 Moto G2)。这是回购的链接:github.com/CyanogenMod/android_kernel_motorola_msm8226
-
@sagar846
get_cpu_idle_time()函数在内核 3.8 中被外部化:link。所以你需要使用 k3.8 或更高版本,还要在驱动程序顶部添加#include "cpufreq_governor.h"行。如果您想将驱动程序与 k3.4(您现在正在使用)一起使用,则需要在尝试构建驱动程序之前手动将get_cpu_idle_time()函数设为外部。
标签: android c linux-kernel