持久化修改Android模拟器的system分区
来源:互联网 发布:淘宝运营视频 编辑:程序博客网 时间:2024/06/11 04:09
对Android的模拟器,如果要修改其system分区里的文件,除了remount之外,还需要对数据进行持久化——因为默认情况下emulator会以只读的形式加载system.img,即便remount之后对其进行的修改也不会实际被保存下来。
下面介绍一种简单的方法对数据进行持久化:
1. 创建一个AVD,在这个例子里,我们用Android 4.3.1,命名为Android4.3.1。
2. 将SDK(E:\Android\sdk\system-images\android-18\default\armeabi-v7a)下这个系统的system.img,kernel-qemu,ramdisk.img文件拷贝至emulator的目录下一份E:\Android\sdk\.android\avd\Android4.3.1.avd.目录结构如下:
3.修改hardware-qemu.ini文件的kernel.path,disk.ramdisk.path ,disk.systemPartition.initPath字段路径
hw.cpu.arch = armhw.cpu.model = cortex-a8hw.cpu.ncore = 2hw.ramSize = 500hw.screen = touchhw.mainKeys = truehw.trackBall = falsehw.keyboard = truehw.keyboard.lid = falsehw.keyboard.charmap = qwerty2hw.dPad = falsehw.gsmModem = truehw.gps = truehw.battery = truehw.accelerometer = truehw.audioInput = truehw.audioOutput = truehw.sdCard = truehw.sdCard.path = E:\Android\sdk\.android\avd\Android4.3.1.avd/sdcard.imgdisk.cachePartition = truedisk.cachePartition.path = E:\Android\sdk\.android\avd\Android4.3.1.avd/cache.imgdisk.cachePartition.size = 66mhw.lcd.width = 480hw.lcd.height = 800hw.lcd.depth = 16hw.lcd.density = 240hw.lcd.backlight = truehw.gpu.enabled = falsehw.gpu.mode = autohw.gpu.blacklisted = nohw.initialOrientation = portraithw.camera.back = nonehw.camera.front = nonevm.heapSize = 32hw.sensors.light = truehw.sensors.pressure = truehw.sensors.humidity = truehw.sensors.proximity = truehw.sensors.magnetic_field = truehw.sensors.orientation = truehw.sensors.temperature = truehw.useext4 = truekernel.path = E:\Android\sdk\.android\avd\Android4.3.1.avd\/kernel-qemukernel.parameters = androidboot.hardware=goldfish android.checkjni=1kernel.newDeviceNaming = nokernel.supportsYaffs2 = yesdisk.ramdisk.path = E:\Android\sdk\.android\avd\Android4.3.1.avd\/ramdisk.imgdisk.systemPartition.initPath = E:\Android\sdk\.android\avd\Android4.3.1.avd\/system.imgdisk.systemPartition.size = 218mdisk.dataPartition.path = E:\Android\sdk\.android\avd\Android4.3.1.avd/userdata-qemu.imgdisk.dataPartition.size = 500mavd.name = Android4.3.1
4. 手工指定挂载参数地启动它:
C:\Users\Administrator>emulator -avd Android4.3.1 -qemu -nand system,size=0x1f400000,file=E:\Android\sdk\.android\avd\Android4.3.1.avd\system.img
其中,0x1f400000是指给/system分区500MB的空间。
4. 系统启动后,adb remount一下,然后通过adb shell mount可以看到system分区已经变为rw了。
C:\Users\Administrator>adb shell mountrootfs / rootfs ro 0 0tmpfs /dev tmpfs rw,nosuid,mode=755 0 0devpts /dev/pts devpts rw,mode=600 0 0proc /proc proc rw 0 0sysfs /sys sysfs rw 0 0none /acct cgroup rw,cpuacct 0 0tmpfs /mnt/secure tmpfs rw,mode=700 0 0tmpfs /mnt/asec tmpfs rw,mode=755,gid=1000 0 0tmpfs /mnt/obb tmpfs rw,mode=755,gid=1000 0 0none /dev/cpuctl cgroup rw,cpu 0 0/dev/block/mtdblock0 /system yaffs2 rw 0 0/dev/block/mtdblock2 /data yaffs2 rw,nosuid,nodev 0 0/dev/block/mtdblock3 /cache yaffs2 rw,nosuid,nodev 0 0/dev/block/vold/179:0 /storage/sdcard vfat rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0/dev/block/vold/179:0 /mnt/secure/asec vfat rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0tmpfs /storage/sdcard/.android_secure tmpfs ro,size=0k,mode=000 0 0
5. 现在可以对/system分区做持久化修改。
6. 修改完成后,关掉模拟器。之后启动即可。
emulator说明如下:
C:\Users\Administrator>emulator -help-disk-images The emulator needs several key image files to run appropriately. Their exact location depends on whether you're using the emulator from the Android SDK, or not (more details below). The minimal required image files are the following: kernel-qemu the emulator-specific Linux kernel image ramdisk.img the ramdisk image used to boot the system system.img the *initial* system image userdata.img the *initial* data partition image It will also use the following writable image files: userdata-qemu.img the persistent data partition image system-qemu.img an *optional* persistent system image cache.img an *optional* cache partition image sdcard.img an *optional* SD Card partition image snapshots.img an *optional* state snapshots image If you use a virtual device, its content directory should store all writable images, and read-only ones will be found from the corresponding platform/add-on directories. See -help-sdk-images for more details. If you are building from the Android build system, you should have ANDROID_PRODUCT_OUT defined in your environment, and the emulator shall be able to pick-up the right image files automatically. See -help-build-images for more details. If you're neither using the SDK or the Android build system, you can still run the emulator by explicitely providing the paths to *all* required disk images through a combination of the following options: -sysdir, -datadir, -kernel, -ramdisk, -system, -data, -cache -sdcard and -snapstorage. The actual logic being that the emulator should be able to find all images from the options you give it. For more detail, see the corresponding -help-<option> entry. Other related options are: -init-data Specify an alternative *initial* user data image -wipe-data Copy the content of the *initial* user data image (userdata.img) into the writable one (userdata-qemu.img) -no-cache do not use a cache partition, even if one is available. -no-snapstorage do not use a state snapshot image, even if one is available.
0 1
- 持久化修改Android模拟器的system分区
- 修改Android模拟器的system分区,以及加入SuperSU
- 扩展Android模拟器的System分区空间
- 扩展Android模拟器的System分区空间
- 扩展Android模拟器的System分区空间
- 扩展Android模拟器的System分区空间
- Android: 模拟器system分区没有可用空间的问题
- 手动修改android模拟器system.img
- android模拟器中,不能将文件拷贝到的/system分区的原因,以及自动化解决方法
- 扩充Android模拟器分区大小的方法
- 修改Android模拟器中System目录的内容(framework.jar)
- 修改Android模拟器的尺寸
- 修改Android模拟器的存储空间
- 修改Android模拟器的存储空间
- 修改Android模拟器的IMSI
- android 模拟器 system 操作
- Android system 分区讲解
- 如何修改Android模拟器的hosts文件
- 结构体中动态内存的管理(malloc和free)
- SQL Server 连接字符串和身份验证
- 杭电oj 2002 计算球的体积
- Feast Coins(多重背包)
- per-CPU变量
- 持久化修改Android模拟器的system分区
- POJ - 3045/USACO - Nov05 Silver Cow Acrobats 牛的杂技 重庆一中高2018级竞赛班第四次测试 2016.7.25 Problem 3
- Postgresql ERROR: database is not accepting commands to avoid wraparound data loss in database
- 神经网络与深度学习1
- BYTE bits[1] 和 BYTE* bits的区别
- SVM如何避免过拟合
- hadoop:Streaming接口实现
- 侧滑菜单
- IBM助推OpenPOWER联手传智播客落地大数据人才培养计划