【问题标题】:Linux kernel and my kernel moduleLinux内核和我的内核模块
【发布时间】:2014-02-25 04:29:04
【问题描述】:

我试图将我的驱动程序作为 Linux 内核的一部分。以下是Makefile。模块 rs_pci 依赖于 rs_9x。但是,内核会在构建 rs_9x 之前尝试构建 rs_pci,这会导致 rs_pci 的编译失败。我希望内核先编译 rs_9x,然后再编译 rs_pci。我该怎么做?

以下是我的 Makefile

rs_9x-y                       += rs_a.o
rs_9x-y                       += rs_b.o
rs_9x-y                       += rs_c.o

rs_pci-y                      += rs_pci.o rs_pci_ops.o
obj-$(CONFIG_RS)               := rs_9x.o
obj-$(CONFIG_RS_PCI)           := rs_pci.o

In the .config file, I have both options enabled as modules.
CONFIG_RS=m
CONFIG_RS_PCI=m

请帮帮我。

【问题讨论】:

  • 如果您发布构建输出可能会更容易帮助您
  • 为什么编译顺序很重要?这表明rs_pci 模块中存在错误。

标签: linux makefile linux-kernel linux-device-driver embedded-linux


【解决方案1】:

首先检查:确保 CONFIG_RS 已启用

第二次检查:将 rs_9x.o 放在 rs_pci.o 的上方,如下所示:

obj-$(CONFIG_RS)    += rs_9x.o
rs_pci-y    += rs_pci.o rs_pci_ops.o
obj-$(CONFIG_RS_PCI)    += rs_pci.o

也可以尝试将“:”更改为“+”,就像我上面所做的那样,它会为你解决的。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-04-11
    • 2013-12-17
    • 2011-05-03
    • 2016-03-25
    • 2015-09-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多