• Rockie's Android Porting Guide(4)——Add SD card to your system


    Rockie's Android Porting Guide(4)——Add SD card to your system


    from:
     http://hi.baidu.com/aokikyon/blog/item/a806363b3572e8e114cecb14.html



    Rockie's Android Porting Guide(4)——Add SD card to your system

    Rockie Cheng

    Andorid use vold to manage SD card and it is easy to use.
    But I meet many troubles and finally find that the real problem is in the Linux Kernel.
    Thanks to the Android Mail List.

    Part I (kernel)

    (1)make sure thus kernel configuration in MMC driver

    CONFIG_MMC=y
    # CONFIG_MMC_DEBUG is not set
    CONFIG_MMC_UNSAFE_RESUME=y
    # CONFIG_MMC_EMBEDDED_SDIO is not set
    CONFIG_MMC_PARANOID_SD_INIT=y

    #
    # MMC/SD Card Drivers
    #
    CONFIG_MMC_BLOCK=y
    CONFIG_MMC_BLOCK_BOUNCE=y
    # CONFIG_MMC_BLOCK_PARANOID_RESUME is not set
    # CONFIG_SDIO_UART is not set
    # CONFIG_MMC_TEST is not set

    #
    # MMC/SD Host Controller Drivers
    #
    CONFIG_MMC_SDHCI=y

    (2)Disable this option
    General Setup -> Create deprecated sysfs layout for older userspace tools

    Before I did this,vold showed a lot of trouble.
    And ,my media_path is not right
    media_path /devices/platform/s3c-sdhci.0/mmc_host:mmc0<--my path before turn off that option

    media_path /devices/platform/s3c-sdhci.0/mmc_host/mmc0 <--this is the right one

    Vold may be unhappy to accept my old path,and it didn't work.

    D/vold    (   42): Accepted connection from framework
    D/vold    (   42): dispatch_cmd(send_ums_status):
    D/vold    (   42): dispatch_cmd(mount_volume:/sdcard):
    E/vold    (   42): Cannot start volume '/sdcard' (volume is not bound)
    D/MountListener(   59): handleEvent volume_nomedia:/sdcard
    D/MountListener(   59): handleEvent ums_disabled
    D/MountListener(   59): handleEvent ums_disconnected

    (3) rebuild your linux kernel

    PART II(android system)

    (1) creat a vold.conf in build/target/board/idea6410

    ## vold configuration file for idea6410

    volume_sdcard {
        ## This is the direct uevent device path to the SD slot on the device
    media_path /devices/platform/s3c-sdhci.0/mmc_host/mmc0

        media_type     mmc
        mount_point    /sdcard
        ums_path       /devices/platform/usb_mass_storage/lun0
    }

    (2)add those below to AndroidBoard.mk

    include $(CLEAR_VARS)
    LOCAL_MODULE_CLASS := ETC
    LOCAL_MODULE := vold.conf
    LOCAL_SRC_FILES := $(LOCAL_MODULE)
    include $(BUILD_PREBUILT)

    (3)rebuild the system and check init.rc

    service vold /system/bin/vold
        socket vold stream 0660 root mount

    (4)enjoy

    D/vold    (   42): Accepted connection from framework
    D/vold    (   42): dispatch_cmd(send_ums_status):
    D/vold    (   42): dispatch_cmd(mount_volume:/sdcard):
    I/vold    (   42): Evaluating dev '/devices/platform/s3c-sdhci.0/mmc_host/mmc0/mmc0:e624/block/mmcblk0' for mountable filesystems for '/sdcard'
    D/MountListener(   61): handleEvent volume_unmounted:/sdcard
    D/MountListener(   61): handleEvent ums_disabled
    D/MountListener(   61): handleEvent ums_disconnected
    D/MountListener(   61): handleEvent volume_checking:/sdcard

    Rockie Cheng

    阿虚

     

    • I//system/bin/fsck_msdos( 1656): ** /dev/block//vold/179:1
      I//system/bin/fsck_msdos( 1656): ** Phase 1 - Read and Compare FATs
      I//system/bin/fsck_msdos( 1656): Attempting to allocate 30 KB for FAT
      I//system/bin/fsck_msdos( 1656): Attempting to allocate 30 KB for FAT
      I//system/bin/fsck_msdos( 1656): ** Phase 2 - Check Cluster Chains
      I//system/bin/fsck_msdos( 1656): ** Phase 3 - Checking Directories
      I//system/bin/fsck_msdos( 1656): ** Phase 4 - Checking for Lost Files
      I//system/bin/fsck_msdos( 1656): 1 files, 122856 free (15357 clusters)
      I/logwrapper( 1656): /system/bin/fsck_msdos terminated by exit(0)
      D/vold    ( 1656): Filesystem check completed OK
      E/vold    ( 1656): vfat filesystem mount of 179:1 failed (-1)
      D/MountListener( 1671): handleEvent volume_damaged:/sdcard

    • 搞定了!
      open option:
      kernel->file system->DOS/FAT/NT Filesystems ---> MSDOS & VFAT

  • 相关阅读:
    流程控制语句
    lminus
    TCL create list from file
    DFT 问答 III
    DFT 问答 II
    DFT 问答 I
    猜字符小游戏
    用户模式构造
    基元线程同步构造
    七大原则,24种设计模式
  • 原文地址:https://www.cnblogs.com/yuzaipiaofei/p/4124452.html
Copyright © 2020-2023  润新知