【问题标题】:Error Compiling Kernel Modules: no such file or directory编译内核模块时出错:没有这样的文件或目录
【发布时间】:2015-10-26 01:11:25
【问题描述】:

我构建了一个示例 hello world 内核模块并尝试使用 ubuntu 上的 makefile 编译它 obj-m = m.o

全部:

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

干净:

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

我收到错误消息:

没有这样的文件或目录

【问题讨论】:

  • 你可以找到答案hear希望有用

标签: linux ubuntu kernel-module


【解决方案1】:

为 hello-1.c 构建标准内核模块 Makefile

obj-m    := hello-1.o

KDIR    := /lib/modules/$(shell uname -r)/build
PWD    := $(shell pwd)

default:
    $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

clean:
    rm -rf *.o *.ko *.mod.* *.symvers *.order

......... 将创建 hello-1.ko、hello-1.mod.c、hello-1.mod.o、hello-1.o


【讨论】:

  • 我尝试了上面的 makefile 我得到了这个错误消息 makefile:10: *** missing separator。停止。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-12-04
  • 2012-11-09
  • 1970-01-01
  • 2015-10-14
  • 1970-01-01
  • 1970-01-01
  • 2021-03-30
相关资源
最近更新 更多