【问题标题】:How to change kernel module loading order in yocto如何在 yocto 中更改内核模块加载顺序
【发布时间】:2017-07-11 00:09:48
【问题描述】:

目前我正在构建一个自定义的 yocto morty 内核。我发现在内核中,内核模块(实际上是相机驱动)加载顺序不正确会导致模块失败。

我不想修改驱动,因为依赖太多,而且它们是由不同公司的不同人实现的。

如题,如何在内核启动阶段改变驱动加载的顺序呢?

非常感谢任何帮助!

【问题讨论】:

    标签: module linux-kernel driver yocto


    【解决方案1】:

    您也可以使用KERNEL_MODULE_AUTOLOAD 变量。它对我有用。

    添加 KERNEL_MODULE_AUTOLOAD += "<module-name>" 在你的 local.conf 中

    【讨论】:

      【解决方案2】:

      如果您正在谈论加载驱动程序,这意味着它不是内置驱动程序,因为它们是在启动时激活的,您无法将一个优先于另一个。 对于内核模块,您应该使用您的启动系统功能,systemd 或 sysv。
      工作驱动程序(谈到优先级)的示例:

      [Unit]
      Description=Initializer for good driver
      Before=bad_driver.service
      
      [Service]
      Type=oneshot
      ExecStart=/bin/sh /usr/bin/script_modprobing_good_driver.sh
      
      [Install]
      WantedBy=multi-user.target
      

      systemd 的不工作驱动程序(谈到优先级)示例:

      [Unit]
      Description=Initializer for bad driver
      After=good_driver.service
      
      [Service]
      Type=oneshot
      ExecStart=/bin/sh /usr/bin/script_modprobing_bad_driver.sh
      
      [Install]
      WantedBy=multi-user.target
      

      还有一个小 .bb 文件来安装这些家伙。

      SUMMARY = "Systemd test for changing precedence of 2 kernel modules"
      LICENSE = "CLOSED"
      
      SRC_URI = "file://script_modprobing_good_driver.sh \
                 file://script_modprobing_bad_driver.sh \
                 file://bad_driver.service \
                 file://good_driver.service \
                "
      
      DEPENDS = "systemd"
      
      S = "${WORKDIR}"
      
      inherit systemd
      
      SYSTEMD_SERVICE_${PN} = " bad_driver.service good_driver.service "
      
      do_install () {
          install -d ${D}/usr/bin
          install -d ${D}/etc/systemd/system
      
          install -m 700 ${S}/script_modprobing_bad_driver.sh  ${D}/usr/bin/
          install -m 700 ${S}/script_modprobing_good_driver.sh ${D}/usr/bin/
          install -m 644 ${S}/bad_driver.service               ${D}/etc/systemd/system/
          install -m 644 ${S}/good_driver.service              ${D}/etc/systemd/system/
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-09-12
        • 2021-10-07
        • 2023-04-03
        • 2019-09-18
        • 2018-06-20
        • 1970-01-01
        • 1970-01-01
        • 2012-03-14
        相关资源
        最近更新 更多