android - Android: 在外部编译kexec错误包括'expected'=',',',',','asm'or'__attribute__'before'*'token'

  显示原文与译文双语对照的内容
0 0

我正在使用 kexec NDK构建作为外部内核模块。 我知道我的环境变量 设置都正确了。

模块基于来自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

无论如何,有问题的代码片段,还有下列链接到pastebined完整的kexec.c 和 kexec.h.

谢谢!

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
};
时间:原作者:3个回答

0 0

尝试定义 CONFIG_KEXEC 没有这个定义所有相关defintions都不包含在 kexec.h 中,然后至少导致了一些错误消息。

为此,你可以向 CFLAGS 或者任何approriate环境变量添加 -DCONFIG_KEXEC,或者只编辑 Makefile

原作者:
...