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