发新话题
打印

【求助】内核模块编译:make: Nothing to be done for `default'.

【求助】内核模块编译:make: Nothing to be done for `default'.

我按照LDD3写的那种方法,把代码放在一起,
  demo.c
  #include <linux/init.h><linux>
  #include <linux/module.h><linux>
  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
  
  # If KERNELRELEASE is defined, we've been invoked from the
  # kernel build system and can use its language.
  ifneq ($(KERNELRELEASE),)
       obj-m := demo.o
  # Otherwise we were called directly from the command
  # line; invoke the kernel build system.
  else
       KERNELDIR ?= /lib/modules/$(shell uname -r)/build
       PWD := $(shell pwd)
  default:
       $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
  endif
  
  
  运行make时提示:
  make: Nothing to be done for `default'
  我有自己的源代码树,而且两套内核。
  即便没有指定上面的脚本也能确定啊,
  为什么不行,高手帮忙啊!</linux></linux>      

TOP

应该没什么问题,你查看一下相关的几个环境变量有没有正确设置。      

TOP

我不是很明白,那个#include后面怎么会没东西?

这段代码是用来干什么的?      
Linux新新手:D

TOP

同样的问题
不过这样可以
复制内容到剪贴板
代码:
make -C linux-source-2.6.15 M=`pwd` modules
linux-source-2.6.15是目录      
linux相关 http://www.herofit.com

TOP

发新话题