0

Android NDKを使用して、外部カーネルモジュールとしてkexecを構築しています。すべての環境変数が正しく設定されていることはわかっています。

このモジュールは、Linuxが通常カーネルに組み込むkexec.cに基づくAndroidフォーラムのコードに基づいています。最終的な目標は、最初のカーネルの後に2番目のカーネルをロードすることにより、ロックされたブートローダーをバイパスすることです。

複数のエラーが発生しています。おそらくすべてが.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
};
4

1 に答える 1

1

を定義してみてくださいCONFIG_KEXEC。この定義kexec.hがないと、関連するすべての定義が含まれず、エラーメッセージの少なくとも一部が表示されます。

これを行うには、または適切な環境変数を追加-DCONFIG_KEXECするか、を編集します。CFLAGSMakefile

于 2012-04-19T12:37:31.803 に答える