麻烦hello world linux内核模块makefile

时间:2016-07-18 18:28:33

标签: linux makefile

我有hello world模块的代码:

#include <linux/module.h>
#include <linux/kernel.h>

int init_module(void)
{
    printk(KERN_INFO "Hello module\n");
    return 0;
}

void cleanup_module(void)
{
    printk(KERN_INFO "Bye module\n");
}

Makefile:

obj-m := hello.o
K := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)

all:
    make -C $(K) M=$(PWD) modules

clean:
    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

我从makefile获取此编译消息:

make -C /lib/modules/3.16.0-4-amd64/build M=/home/neo/ker modules
make[1]: Entering directory '/usr/src/linux-headers-3.16.0-4-amd64'
Makefile:10: *** mixed implicit and normal rules: deprecated syntax
make[1]: Entering directory `/usr/src/linux-headers-3.16.0-4-amd64'
  CC [M]  /home/neo/ker/hello.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/neo/ker/hello.mod.o
  LD [M]  /home/neo/ker/hello.ko
make[1]: Leaving directory '/usr/src/linux-headers-3.16.0-4-amd64'

这是我不明白的警告:

Makefile:10: *** mixed implicit and normal rules: deprecated syntax

提前致谢

0 个答案:

没有答案