2017-08-07 86 views
0

此內核使用ARM GCC工具鏈構建良好。出於某種原因,aarch64工具鏈會引發此錯誤。Android內核構建錯誤:core_ctl.c - 取消引用指向不完整類型的指針

kernel/sched/core_ctl.c: In function 'cpufreq_gov_cb': 
kernel/sched/core_ctl.c:1086:25: error: dereferencing pointer to incomplete type 
    core_ctl_set_busy(info->cpu, info->load); 
         ^
kernel/sched/core_ctl.c:1086:36: error: dereferencing pointer to incomplete type 
    core_ctl_set_busy(info->cpu, info->load); 
            ^
scripts/Makefile.build:257: recipe for target 'kernel/sched/core_ctl.o' failed 

下面是在其中「CPU」被定義(在C文件中找不到負載)的文件最開始的結構:

#include <linux/init.h> 
#include <linux/notifier.h> 
#include <linux/cpu.h> 
#include <linux/cpumask.h> 
#include <linux/cpufreq.h> 
#include <linux/timer.h> 
#include <linux/kthread.h> 
#include <linux/sched.h> 
#include <linux/sched/rt.h> 
#include <linux/mutex.h> 

#include <trace/events/sched.h> 

#define MAX_CPUS_PER_GROUP 4 

struct cpu_data { 
    /* Per CPU data. */ 
    bool inited; 
    bool online; 
    bool rejected; 
    bool is_busy; 
    bool not_preferred; 
    unsigned int busy; 
    unsigned int cpu; 
    struct list_head sib; 
    unsigned int first_cpu; 
    struct list_head pending_sib; 

    /* Per cluster data set only on first CPU */ 
    unsigned int min_cpus; 
    unsigned int max_cpus; 
    unsigned int offline_delay_ms; 
    unsigned int busy_up_thres[MAX_CPUS_PER_GROUP]; 
    unsigned int busy_down_thres[MAX_CPUS_PER_GROUP]; 
    unsigned int online_cpus; 
    unsigned int avail_cpus; 
    unsigned int num_cpus; 
    unsigned int need_cpus; 
    unsigned int task_thres; 
    s64 need_ts; 
    struct list_head lru; 
    bool pending; 
    spinlock_t pending_lock; 
    bool is_big_cluster; 
    int nrrun; 
    bool nrrun_changed; 
    struct timer_list timer; 
    struct task_struct *hotplug_thread; 
    struct kobject kobj; 
    struct list_head pending_lru; 
    bool disabled; 
}; 

什麼可以讓編譯器報告不完整的類型?我不太熟悉C中的指針和結構,但是......無法弄清楚。

+1

你需要找到** **定義的用於'info'變量的類型,而不是'cpu'類型。 – Tsyvarev

回答

0

在您的機器上編譯kernel/sched/core_ctl.c時,似乎struct cpufreq_govinfo的頭文件丟失。

struct cpufreq_govinfo { 
unsigned int cpu; 
unsigned int load; 
unsigned int sampling_rate_us; 
}; 

在我的機器(ARM:CortexA7),GCC編譯器不會拋出,因爲下面的頭文件是否正確包含編譯錯誤。

kernel/include/linux/cpufreq.h 

另外,下面的補丁將使您能夠在構建Linux Kernel之後擁有預處理文件。

diff --git a/Makefile b/Makefile 
index b03ca98..f52240c 100644 
--- a/Makefile 
+++ b/Makefile 
@@ -406,6 +406,7 @@ KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ 
        -fno-strict-aliasing -fno-common \ 
        -Werror-implicit-function-declaration \ 
        -Wno-format-security \ 
+     -save-temps=obj \ 
        -std=gnu89 

如果你看看在預處理文件.tmp_core_ctl.i,你將能夠看到所有的頭文件的編制core_ctl.c

相關問題