【问题标题】:Load kernel module prior of device tree's probing在设备树探测之前加载内核模块
【发布时间】:2014-03-24 17:36:10
【问题描述】:

我为我的 custom_hardware 开发了一个工作驱动程序,它依赖于设备树。因为我的驱动程序可能会发展,所以我不希望我的驱动程序成为内核的一部分(当我说“成为内核的一部分”时,我的意思是在内核创建期间与内核一起编译)

这是我的 dts 的一瞥:

custom_hardware: custom_hardware@0x41006000 {
    compatible = "mfg,custom";
    reg = <0x41006000 0x1000>;
    #interrupt-cells = <0x1>;
    interrupt-controller;
};

existing_hardware: existing_hardward@41004000 {
    compatible = "mfg,existing";
    reg = <0x41004000 0x1000>;
    interrupt-parent = <&custom_hardware>;
    interrupts = <0>;
};

existing_hardware 的驱动程序已经用内核编译(existing_hardware 的驱动程序在内核创建期间已经用内核编译)。

我想做的是将我的 custom_hardware 的驱动程序附加到 ramfs 并让内核在 之前加载 custom_hardware 的驱动程序existing_hardware 的驱动程序。

这很重要,因为 existing_hardware 的驱动程序从 custom_hardwareirq_domain 请求 virq'的司机。为了获得 irq_domain,必须先加载 custom_hardware 的驱动程序。

请注意,existing_hardware 的驱动程序在探测设备树期间被加载,这似乎发生在内核启动序列的早期阶段。

【问题讨论】:

  • 您似乎夸大了要求。 “我不希望我的驱动程序成为内核的一部分。” “在设备树探测之前(之前)加载内核模块。” 似乎唯一突出的要求是custom_hardware驱动需要在existing_hardware驱动之前安装,这可以在现有框架内完成。看到这个Q&A

标签: linux-kernel embedded device-tree


【解决方案1】:

这不是办法。模块/驱动程序加载的顺序无关紧要。您需要做的是在现有硬件中获取 IRQ 失败时返回 -EPROBE_DEFER。然后它会在稍后再次被探测,希望在 custom_hardware 被探测之后。

此外,您可以应用该补丁,以确保 request_irq() 因域尚不存在而失败,并在这种情况下返回 -EPROBE_DEFER https://lkml.org/lkml/2014/2/13/114

【讨论】:

    【解决方案2】:

    我遇到了类似的问题(探测顺序错误),我发现的唯一简单解决方案是将模块按所需的探测顺序放入 Makefile。 我在这里找到了解决方案:What is the Linux built-in driver load order?

    【讨论】:

      猜你喜欢
      • 2015-07-04
      • 1970-01-01
      • 2019-01-15
      • 2021-10-07
      • 2012-03-14
      • 2021-03-23
      • 1970-01-01
      • 2020-05-31
      • 1970-01-01
      相关资源
      最近更新 更多