SD card simulated by disk in Android simulator & SD card loaded in Android system

Source: Internet
Author: User

Debugging related to SD card is often encountered in andorid development, such as MP3 files and image files. When developing a simulator, you can simulate an SD card through a hard disk. The specific method is:

(1) Create an SD card image file: Open CMD and go to the tools directory of the SDK directory. Enter the following command: mksdcard
64 m sdcard. IMG. This command will generate an sdcard. imgfile in the current directory, which is the SD card image file of the android simulator.

(2) Start the android simulator with sdcard. Enter emulator in cmd
-AVD sdk_rj5_version-sdcard. IMG. This command starts a simulator with an SD card and uses a specific AVD as the platform. In this way, a folder named sdcard. IMG. Lock is generated dynamically under the tools directory, and disappears when the simulator is disabled. Note: Do not close this DOS window. Otherwise, the simulator will be closed and the subsequent step cannot be executed.

(3) Add a file to the SD card. In cmd, the command is as follows: ADB
Push testbench sdcard/testbench to copy the files in the current directory to the SD card. The process displays the time consumption, file size, and speed.

(4) There are multiple methods to view the copy object in the SD card. The first is to directly click the menu music in the simulator to play the video and you can see the tested song, or devtools-> Meida
Detection detects SD card recognition. Another method is to click the ddms view of eclipse windows, which contains file explorer. Click SD card to view the content, and you can also move and remove files on this interface. In this case, the access permission of the sdcard is occasionally insufficient, but it can still be accessed through the CMD command.


 

(6) The above is to start the simulator with SD in DOS mode. If you want to start the simulator with SD from eclipse, you need to add a command line in the running configuration of each project. For example, run
Configuations-> Target-> aditional emulator command line options add the startup parameter:-sdcard
E:/toolbackup/Java/android-sdk-windows-1.5_r3/tools/sdcard. IMG. Then the simulator with SD will be run again.


========================================================== ========================================================== ====================================

For Android system sdcard development, the main work is as follows:

(1) After kernel driver development, the sdcard system will display relevant information each time it is inserted and pulled out, and the sdcard can be manually mounted.

(2) Android sdcard mounting is mainly completed by vold. The source code of vold is in the Alps \ System \ vold \ directory, compiled into Alps \ out \ target \ product \ $ projectname \ System \ bin \ vold. The init. RC file contains the vold System Service, which ensures the normal operation of the vold after the Android system is started.

(3) Add the vold configuration file. First, check the process_config function in the Alps \ System \ vold \ main. cpp file. The configuration file path is as follows:
/Etc/vold. fstab is a generated file. The original file is in Alps \ mediatek \ config \ $ projectname \ vold. fstab.

(4) Modify vold. fstab. The statement is as follows. For more information about the definitions, see the description at the top of the file:
Dev_mount <label> <mount_point> <part> <sysfs_path1...>
Dev_mount command label mount point sub-partition device path under sysfs File System (multiple)
Add the following content to vold. fstab according to the above requirements and the actual situation of my platform:

Dev_mount sdcard/mnt/sdcard Auto/devices/platform/goldfish_mmc.0/devices/platform/mtk-sd.1/mmc_host/mmc0

(5) The sdcard is available in the Android system. To sum up, the sdcard part is very simple, mainly to find the sysfs file system path corresponding to the sdcard device.

 

Http://blog.csdn.net/jiajie961/article/details/6035369 ()

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.