Linux 内核编译配置

日期: 2013年12月30日 标签: 硬件
  • 内核配置

    make menuconfig 或者make ARCH=arm menuconfig

  • 编译

    make kernel.img

  • 清除编译的东西

    make clean

linux 内核支持adk

  • 有人在要配置adk时,发现在android 设备中的/proc/找不到config.gz,那是在编译内核的时候,没有勾选Enable access to .config through /proc/config.gz

    进入android kernel目录,make menuconfig 或者make ARCH=arm menuconfig

           General setup  --->
                 Kernel .config support
                      [*] Enable access to .config through /proc/config.gz
    

    在该栏目中按y 即可。

  • adk支持(本身是不显示的)

     add: ADB Garget /drives/usb/gadget/
     CONFIG_USB_ANDROID    (android.c)
     CONFIG_USB_ANDROID_ACM   (f_acm.c u_serial.c)
     CONFIG_USB_ANDROID_ADB   (f_adb.c)
     CONFIG_USB_ANDROID_MASS_STORAGE (f_mass_storage.c)
     CONFIG_USB_ANDROID_MTP   (f_mtp.c)
     CONFIG_USB_ANDROID_RNDIS     (f_rndis.c u_ether.c)
     CONFIG_USB_ANDROID_ACCESSORY (f_accessory.c)
    
     Device Drivers  --->
             [*] USB support  --->
                 <*> USB Gadget Support  --->
                     <*> USB Gadget Drivers (Android Gadget)  --->
                         [X]       Android gadget
    

将以上的.c文件下载后放入,drives/usb/gadget中

          vi ./Kconfig

将入以下配置加入Kconfig中

config USB_ANDROID_ACM
     boolean "Android gadget ACM serial function"
     depends on USB_ANDROID
     help
       Provides ACM serial function for android gadget driver.
config USB_ANDROID_ADB
    boolean "Android gadget adb function"
    depends on USB_ANDROID
    help
       Provides adb function for android gadget driver.
config USB_ANDROID_MASS_STORAGE
    boolean "Android gadget mass storage function"
    depends on USB_ANDROID && SWITCH
    help
      Provides USB mass storage function for android gadget driver.
config USB_ANDROID_MTP
    boolean "Android MTP function"
    depends on USB_ANDROID
    help
      Provides Media Transfer Protocol (MTP) support for android gadget driver.
config USB_ANDROID_RNDIS
    boolean "Android gadget RNDIS ethernet function"
    depends on USB_ANDROID
    help
       Provides RNDIS ethernet function for android gadget driver.
config USB_ANDROID_RNDIS_WCEIS
    boolean "Use Windows Internet Sharing Class/SubClass/Protocol"
    depends on USB_ANDROID_RNDIS
    help
      Causes the driver to look like a Windows-compatible Internet
      Sharing device, so Windows auto-detects it.
      If you enable this option, the device is no longer CDC ethernet
      compatible.
config USB_ANDROID_RNDIS_DWORD_ALIGNED
    boolean "Use double word aligned"
    depends on USB_ANDROID_RNDIS
    help
       Provides dword aligned for DMA controller.
config USB_ANDROID_ACCESSORY
    boolean "Android USB accessory function"
    depends on USB_ANDROID
    help
        Provides Android USB Accessory support for android gadget driver.

看到以上你们可能就明白了,这些配置都是依赖于usb_android的当usb_android选中他们的config就=y了! 然后在Makefile中加入

    obj-$(CONFIG_USB_ANDROID) += android.o
    obj-$(CONFIG_USB_ANDROID_ACM) += f_acm.o u_serial.o
    obj-$(CONFIG_USB_ANDROID_ADB) += f_adb.o
    obj-$(CONFIG_USB_ANDROID_MASS_STORAGE) += f_mass_storage.o
    obj-$(CONFIG_USB_ANDROID_MTP) += f_mtp.o
    obj-$(CONFIG_USB_ANDROID_RNDIS) += f_rndis.o u_ether.o
    obj-$(CONFIG_USB_ANDROID_ACCESSORY) += f_accessory.o

判断设备是否支持adk

*

adb pull /proc/config.gz

然后打开,应该会有以下字段

ezgb_ebi0_defconfig:CONFIG_USB_ANDROID_ACCESSORY=y
ezgb_2708_defconfig:CONFIG_USB_ANDROID_ACCESSORY=y
ezgb_ebi1_defconfig:CONFIG_USB_ANDROID_ACCESSORY=y
  • 另外需要在system/framework/下 com.android.future.usb.accessory.jar,

  • /etc/permissions/下 android.hardware.usb.accessory.xml

内核支持动态加载模块

参考网页

demokit原理 [环境搭建][http://blog.csdn.net/slugzoe/article/details/6897534] 原理 andoird jb源码 支持adk的机子 内核源代码


<-->