久久婷婷香蕉热狠狠综合,精品无码国产自产拍在线观看蜜,寡妇房东在做爰3,中文字幕日本人妻久久久免费,国产成人精品三上悠亚久久

Hi,歡迎來到嵌入式培訓高端品牌 - 華清遠見教育科技集團<北京總部官網>,專注嵌入式工程師培養15年!
當前位置: > 華清遠見教育科技集團 > 嵌入式學習 > 講師博文 > 為Android內核添加新驅動
為Android內核添加新驅動
時間:2017-01-06作者:華清(qing)遠見

為Android內(nei)核添(tian)加新(xin)驅動,并(bing)提供menuconfig選項(xiang)

Android的Linux內核2.6.35添(tian)加驅動。

1. 在(zai)drives目(mu)錄下添加(jia)hello目(mu)錄,內含hello.c Kconfig Makefile

hello.c內容:
        #include <linux/init.h>
        #include <linux/module.h>

  &nbsp;     MODULE_LICENSE("Dual BSD/GPL");

static int hello_init(void)
        {
                printk(KERN_ALERT"Hello, world\n");
                return 0;
        }
        static void hello_exit(void)
    &nbsp;   {

        printk(KERN_ALERT"Goodbye, world\n");
  &nbsp;   &nbsp; }

module_init(hello_init);
        module_exit(hello_exit);

Kconfig內容:
        config HELLO
        tristate "Hello Driver added by Farsight" 
        default n
        help
                test for adding driver to menuconfig. 
        MakeFile內容:
&nbsp;  &nbsp;    obj-$(CONFIG_HELLO) += hello.o

2. 上面的(de)Kconfig文件再加(jia)上下面的(de)兩個配置,可使hello項出現在配置菜(cai)單中(zhong)。

在arch/arm/Kconfig menu "Device Drivers" endmenu之間添加:
     &nbsp;   source "drivers/hello/Kconfig"

在drivers/Kconfig menu "Device Drivers" endmenu之間添加:
        source "drivers/hello/Kconfig"

3.修改Drivers目錄下的Makefile文件,添加如下行:
        obj-$(CONFIG_HELLO) += hello/
        當CONFIG_HELLO為y或m時,使系(xi)統能(neng)找到(dao)hello驅動的makefile。

linux-2.6.35目錄下make menuconfig,在Device Drivers菜(cai)單下選中Hello Driver added by Farsight項比(bi)如M,作為module。然后保存配置,執(zhi)行make命令,就可以看(kan)到 CC [M] drivers/hello/hello.o 的log了,hello目錄里生成了hello.o hello.ko的等(deng)文(wen)件。

發表評論
評論列表(網友評論僅供網友表達個人看法,并不表明本站同意其觀點或證實其描述)