zoukankan      html  css  js  c++  java
  • 加载模块

    1、下载源码
    2、安装附加包:sudo apt-get install libncurses-dev
    3、解压源码
    4、make menuconfig
    5、make bzImage(在boot下名称是vmlinuz)
    6、make modules
    7、sudo make install
    8、sudo make modules install   (在/lib/modules/)
    9、sudo mkmitamfs
    在/grub下的grub.cfg可以修改启动顺序


    添加模块:
    在源码所在目录中的drivers目录中新建文件(设为wangfangyong)并生成目录树(在目录下创建的有:cup目录(创建cup.c) test.c  test_net.c  usr.c),在wangfangyong目录中创建Makefile和Kconfig
    在drivers/Kcongfig中增加source "drivers/wangfangyong/Kconfig"
    在drivers/Makefile中增加obj-y      +=wangfangyong/
    在 wangfangyong/Kconfig中增加:
    menu "wangfangyong Driver"
    config test
        bool "test support"
    config usr
        tristate "test-space Interface"
           depends on test
    endmenu
    在wangfangyong/Makefile中增加:
      1 obj-$(CONFIG_TEST)+=test.o test_net.o
      2 obj-$(CONFIG_TEST_USR)+=usr.o
      3 obj-$(CONFIG_TEST_CPU)+=cpu/
    现在在cup目录中创建Kconfig和Makefile
    在Kconfig中增加:
    menu "cup "
      config TEST_CUP
      bool "test cup"
      depends on test
    endmenu
    在Makefile中增加:
    obj-$(CONFIG_TEST_CUP)+=cpu.o
    现在在/drivers下编译make menuconfig后不会出现cup菜单,现在在上级目录wangfangyongzhong
    中修改wangfangyong中的Kconfig和Makefile
    在Kconfig中增加:
    #cpu config
     source "drivers/wangfangyong/cup/Kconfig"
    #end cup
    在Makefile中增加:
    obj-y  +=cup/
    现在在/drivers下编译make menuconfig后就会出现cup菜单了。

  • 相关阅读:
    Prometheus-node-exporter
    Prometheus基础
    普通函数与回调函数的区别
    HTML转义字符大全
    使用 Chrome DevTools 模拟缓慢的 3G 网络速度
    Chrome 浏览器如何修改 User-Agent
    服务器上的 Git
    Mac配置go环境变量
    Linux和Mac环境变量设置
    Cloudflare DNS设置中子域委派不成功的问题
  • 原文地址:https://www.cnblogs.com/276815076/p/2052074.html
Copyright © 2011-2022 走看看