0
编译模块,我创建make文件与外部工具链
obj-m += hello.o
all:
make -C /home/developer/Desktop/xukr-20120201-omap3/linux-2.6.37-tn M=/home/developer/Desktop/module_test modules
clean:
make -C /home/developer/Desktop/xukr-20120201-omap3/linux-2.6.37-tn M=/home/developer/Desktop/module_test clean
然后,我发现了一个简单的hello程序
#define __KERNEL__ /* We're part of the kernel */
#define MODULE /* Not a permanent part, though. */
/* Standard headers for LKMs */
#include <linux/modversions.h>
#include <linux/module.h>
#include <linux/tty.h> /* console_print() interface */
/* Initialize the LKM */
int init_module()
{
console_print("Hello, world - this is the kernel speaking\n");
/* More normal is printk(), but there's less that can go wrong with
console_print(), so let's start simple.
*/
/* If we return a non zero value, it means that
* init_module failed and the LKM can't be loaded
*/
return 0;
}
/* Cleanup - undo whatever init_module did */
void cleanup_module()
{
console_print("Short is the life of an LKM\n");
}
,我试图在命令行编译此
make ARCH=arm CROSS_COMPILE=angstrom-linux-gnueabi-
,我得到这个错误
/bin/sh: angstrom-linux-gnueabi-gcc: not found
有什么不对呢?我真的很新。
由于提前,
使用'$(MAKE)''不是一个'Makefile' – 2012-03-02 08:41:23
不幸的是同样的错误里面make'。 – thehilmisu 2012-03-02 08:57:03
在开始使用内核代码之前,您应该真正获得用户级Linux命令行实用程序和应用程序级Linux系统调用的流畅性。 – 2012-03-02 09:15:20