假設寫了一支 smalldd 的程式是一支以網路核心功能開發的程式

1.
把 smalldd.h 檔放到 include/net/

 

2.
把 smalldd.c 檔放到 net/core/
smalldd.c 檔內引用 smalldd.h 的寫法 #include <net/smalldd.h>

 

3.
編輯 net/Kconfig
>vim net/Kconfig

endif   # if NET 前加入

config SMALLDD
    bool "smalldd network function"
    default y
    help
        If you say Y, smallddd can help you.

說明
config <tag>
    bool "<title>"
    default <default>
    help
        <description>

<tag>: 一個專用的標籤,在 gcc 編譯時就會有一個定義 CONFIG_<tag>
<title>: 程式的標題
<default>: 預設設定要不要一起編譯
<description>: 程式的說明

 

4.
編輯 Makefile
>vim net/core/Makefile

加入
obj-$(CONFIG_SMALLDD) += smalldd.o

 

5.
設定 kernel 編譯設定檔
>make menuconfig

因為預設是要加入編譯
所以進入直接存檔就好

 

6.
編譯 kernel 吧!!!!

arrow
arrow
    全站熱搜

    smalldd 發表在 痞客邦 留言(0) 人氣()