日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

内核与驱动编译方法

發布時間:2024/4/14 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 内核与驱动编译方法 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

驅動編譯有兩種方法:

1. 編譯到內核中

2. 編譯為獨立模塊

?

建立方法:

  1)?在linux源碼樹的驅動目錄增加自己的驅動目錄,比如:現在新增一個網絡設備驅動

    mkdir?linux_tree/drivers/net/poker_driver -p

    cd?linux_tree/drivers/net/poker_driver

  2) 編寫驅動源碼

    vi??poker_drv_part1.c

    vi??poker_drv_part2.c

    vi??poker_drv_part3.c

  3) 編寫源碼目錄Kconfig

    vi Kconfig

      config?POKER_DRV
      tristate "poker_driver support"
      default n
      ---help---
      If you say Y here, the kernel will support poker_driver.
      If you say M here, the kernel not support poker_driver, must perform "insmod poker_driver.ko".
      If you say N here, the kernel not support?poker_driver.

  4) 編寫源碼目錄Makefile

    vi Makefile

      obj-$(CONFIG_POKER_DRV) += poker_drv.o
      poker_drv-objs += poker_drv_part1.o poker_drv_part2.o poker_drv_part3.o

  5) 修改上級Kconfig

    vi?linux_tree/drivers/net/Kconfig

      source "drivers/net/poker_driver/Kconfig"

  6) 修改上級Makefile

?    vi?linux_tree/drivers/net/Makefile

      obj-$(CONFIG_POKER_DRV) +=?poker_driver/

  7) 配置內核

    make menuconfig

      Device Drivers ?--->

        ?[*] Network device support ?--->?

          <>poker_driver?support

1. 編譯到內核中:

  <*>poker_driver?support

  linux_tree# make uImage

2. 編譯為獨立模塊

  <M>poker_driver?support?

  linux_tree# make modules

?

括號問題:

  [] ? 可選項 * 空

  <> 可選項?* M?空

Kconfig語法:

Makefile語法:

未完待續....

轉載于:https://www.cnblogs.com/pokerface/p/5780159.html

總結

以上是生活随笔為你收集整理的内核与驱动编译方法的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。