helloworld 驱动程序编译的问题?
一个简单的驱动程序例子,怎么编译都不行,请指教。源代码和makefile 如下:
我的机器: winxp +vmware
makefile:
出错信息如下:
make -C /lib/modules/2.6.21-1.3194.fc7/build M=/tonny/test/chapter12/hello modules
make[1]: Entering directory `/usr/src/kernels/2.6.21-1.3194.fc7-i686'
scripts/Makefile.build:17: /tonny/test/chapter12/hello/Makefile: No such file or directory
make[2]: *** No rule to make target `/tonny/test/chapter12/hello/Makefile'. Stop.
make[1]: *** [_module_/tonny/test/chapter12/hello] Error 2
make[1]: Leaving directory `/usr/src/kernels/2.6.21-1.3194.fc7-i686'
make: *** [modules] Error 2
我的机器: winxp +vmware
/*
* $Id: hello.c,v 1.5 2004/10/26 03:32:21 corbet Exp $
*/
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE( "Dual BSD/GPL ");
static int hello_init(void)
{
printk(KERN_ALERT "Hello, world\n ");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye, cruel world\n ");
}
module_init(hello_init);
module_exit(hello_exit);
makefile:
ifeq ($(KERNELRELEASE),)
KDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
modules:
$(MAKE) -C $(KDIR) M=$(PWD) modules
modules_install:
$(MAKE) -C $(KDIR) M=$(PWD) modules_install
clean:
rm -rf *.ko *.o *.mod.c
.PHONY:modules modules_install clean
else
obj-m := hello.o
endif出错信息如下:
make -C /lib/modules/2.6.21-1.3194.fc7/build M=/tonny/test/chapter12/hello modules
make[1]: Entering directory `/usr/src/kernels/2.6.21-1.3194.fc7-i686'
scripts/Makefile.build:17: /tonny/test/chapter12/hello/Makefile: No such file or directory
make[2]: *** No rule to make target `/tonny/test/chapter12/hello/Makefile'. Stop.
make[1]: *** [_module_/tonny/test/chapter12/hello] Error 2
make[1]: Leaving directory `/usr/src/kernels/2.6.21-1.3194.fc7-i686'
make: *** [modules] Error 2
...全文
相关推荐
linux环境下用makefile编译简单的helloworld程序
在这个“linux环境下用makefile编译简单的helloworld程序”的主题中,我们将深入理解如何创建并使用`Makefile`来编译一个基本的C或C++程序,例如“helloworld”。
OpenWrt之helloworld程序
在这个"OpenWrt之helloworld程序"中,我们将探讨如何在OpenWrt环境中编写、编译和运行一个简单的 HelloWorld 程序,这将帮助初学者了解OpenWrt的开发流程。
HelloWorld程序编写及内核驱动
这不仅有助于理解驱动程序的基本结构,还能够为学习更复杂的内核编程打下坚实的基础。#### 相关简介本节将详细介绍从创建驱动文件到最终编译、烧录和运行的全过程。1.
Android编译NativeC的helloworld模块
### Android编译Native C的helloworld模块#### 知识点概述本篇文章将详细介绍如何在Android环境中构建一个简单的C语言程序——helloworld模块。
使用Android Studio开发HelloWorld应用程序
使用 Android Studio 可以快速创建、编译、调试和优化 Android 应用程序。下面是使用 Android Studio 创建 HelloWorld 应用程序的详细步骤和知识点。1.


