无法编译LKM为Android [英] Unable to compile LKM for Android
问题描述
我的Ubuntu 12.04作为编译环境现状。
I have Ubuntu 12.04 as compilation evironment.
我也有在氰MOD内核的源$ C $ C(获得从GitHub:的 https://github.com/CyanogenMod/cm-kernel )
I also have the Cyanogen mod kernel's source code (get from Github: https://github.com/CyanogenMod/cm-kernel)
我使用工具链在Android NDK R5C(Linux)的
我有以下的code:
#include <linux/kernel.h>
#include <linux/module.h>
#include <asm/unistd.h>
asmlinkage ssize_t (*orig_open)(const char *pathname, int flags);
asmlinkage ssize_t hooked_open(const char *pathname, int flags) {
printk(KERN_INFO "SYS_OPEN: %s\n", pathname);
return orig_open(pathname, flags);
}
void **sys_call_table;
static int __init root_start(void) {
sys_call_table= (void *) 0x0030084;
orig_open = sys_call_table[__NR_open];
sys_call_table[__NR_open] = hooked_open;
return 0;
}
static void __exit root_stop(void) {
sys_call_table[__NR_open] = &orig_open;
}
module_init(root_start);
module_exit(root_stop);
这是我的的Makefile
obj-m += root.o
all:
make -C CyanogenMod-cm-kernel-2a32a61/ M=$(PWD) ARCH=arm CROSS_COMPILE=arm-eabi- modules
我的步骤来编译的终端
export PATH=$PATH:/home/hongnhat/lkm/android-ndk-r5c/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin
cd CyanogenMod-cm-kernel-2a32a61
make oldconfig && make prepare
cd ..
make
的结果是:
make -C CyanogenMod-cm-kernel-2a32a61/ M=/home/hongnhat/lkm ARCH=arm CROSS_COMPILE=arm-eabi- modules
make[1]: Entering directory `/home/hongnhat/lkm/CyanogenMod-cm-kernel-2a32a61'
WARNING: Symbol version dump /home/hongnhat/lkm/CyanogenMod-cm-kernel-2a32a61/Module.symvers
is missing; modules will have no dependencies and modversions.
CC [M] /home/hongnhat/lkm/root.o
as: unrecognized option '-EL'
make[2]: *** [/home/hongnhat/lkm/root.o] Error 1
make[1]: *** [_module_/home/hongnhat/lkm] Error 2
make[1]: Leaving directory `/home/hongnhat/lkm/CyanogenMod-cm-kernel-2a32a61'
make: *** [all] Error 2
我不知道为什么它抛出的无法识别选项'-EL'错误。
请帮我解决这个问题,我一直在拉我的头发试图,我试图用不同的 GCC 版本(4.4.0,4.4.3,4.6),但没有用。
I don't know why it throws the unrecognized option '-EL' error. Please help me address the problem, I have been pulling my hair out trying, I tried to use different gcc version (4.4.0, 4.4.3, 4.6) but no use.
推荐答案
尝试与导师的Sourcery GCC编译它。我曾尝试之前,编译Linux内核为Android。也许这帮助。
Try compiling it with GCC from Sourcery Mentor. I have tried it before to compile Linux kernel for Android. Maybe it help.
这篇关于无法编译LKM为Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!