2012-04-19 24 views
0

我正在將kexec構建爲外部內核模塊,使用Android NDK。我知道我已經正確設置了所有的環境變量。Android:構建kexec外部用於ARMv7 - 錯誤包括'expected'=',',';',','asm'或'__attribute__'之前'*'標記'

該模塊基於android論壇的代碼,該代碼基於linux通常會構建到內核中的kexec.c。最終目標是通過在第一個內核之後加載第二個內核來繞過鎖定的引導加載程序。

我遇到了多個錯誤,最有可能都與.h文件中的東西有關。我的C技能真的很生疏,但這裏是前幾個錯誤:

make -C /media/disk/android/kernel/omap3 M=/media/disk/android/kexec modules 
make[1]: Entering directory `/media/disk/android/kernel/omap3' 
    CC [M] /media/disk/android/kexec/kexec.o 
/media/disk/android/kexec/kexec.c:52: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token 
/media/disk/android/kexec/kexec.c:55: error: 'VMCOREINFO_BYTES' undeclared here (not in a function) 
/media/disk/android/kexec/kexec.c:56: error: 'VMCOREINFO_NOTE_SIZE' undeclared here (not in a function) 
/media/disk/android/kexec/kexec.c:115: warning: 'struct kimage' declared inside parameter list 
/media/disk/android/kexec/kexec.c:115: warning: its scope is only this definition or declaration, 
    which is probably not what you want 
/media/disk/android/kexec/kexec.c:118: warning: 'struct kimage' declared inside parameter list 
/media/disk/android/kexec/kexec.c:122: warning: 'struct kimage' declared inside parameter list 
/media/disk/android/kexec/kexec.c: In function 'do_kimage_alloc': 
/media/disk/android/kexec/kexec.c:131: error: dereferencing pointer to incomplete type 

無論如何,違規片斷如下,並且也存在以下鏈接kexec.c和kexec.h的pastebined完整的源。

謝謝!

MODULE_LICENSE("GPL"); 

/* Syscall table */ 
void **sys_call_table; 

/* original and new reboot syscall */ 
asmlinkage long (*original_reboot)(int magic1, int magic2, unsigned int cmd, void __user *arg); 
extern asmlinkage long reboot(int magic1, int magic2, unsigned int cmd, void __user *arg); 

/* Per cpu memory for storing cpu states in case of system crash. */ 
note_buf_t *crash_notes; 

/* vmcoreinfo stuff */ 
unsigned char vmcoreinfo_data[VMCOREINFO_BYTES]; 
u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4]; 
size_t vmcoreinfo_size; 
size_t vmcoreinfo_max_size = sizeof(vmcoreinfo_data); 

/* Location of the reserved area for the crash kernel */ 
struct resource crashk_res = { 
    .name = "Crash kernel", 
    .start = 0, 
    .end = 0, 
    .flags = IORESOURCE_BUSY | IORESOURCE_MEM 
}; 
+0

另外,這是針對android薑餅內核源碼構建的,該源碼基於股票linux v2.6.32.9內核樹。 – ilikenwf 2012-04-19 06:50:33

+0

此外,如果有人需要它作爲參考或測試,我可以將完整的源文件或鏈接壓縮... – ilikenwf 2012-04-19 06:58:56

回答

1

嘗試定義CONFIG_KEXEC。如果沒有這個定義,則不包括kexec.h中的所有相關定義,然後導致至少一些您得到的錯誤消息。

爲此,您可以將-DCONFIG_KEXEC添加到CFLAGS或任何相關的環境變量,或者編輯Makefile

+0

Hrmmm ...我不相信我沒有看到(實際上,我可以,實際上)。下班回家後,我一定會嘗試一下,並讓你知道結果! – ilikenwf 2012-04-19 16:21:23

+0

Woot!它的工作(好,直到下一個錯誤:) – ilikenwf 2012-04-20 00:58:56

相關問題