[IMX6Q][Android5.1]移植笔记 --- 无法挂载system文件系统

platform: imx6q

os: Android5.1

branch: l5.1.1_2.1.0-ga


编译好system image之后开机提示如下log,注意红色部分:

Freeing unused kernel memory: 432K (c0be3000 - c0c4f000)
usb 1-1: USB disconnect, device number 2
Console: switching to colour dummy device 80x30
EXT4-fs (mmcblk2p5): VFS: Can't find ext4 filesystem
fs_mgr: __mount(source=/dev/block/mmcblk2p5,target=/system,type=ext4)=-1
fs_mgr: Failed to mount an un-encryptable or wiped partition on/dev/block/mmcblk2p5 at /system options: barrier=1 error: Invalid argument
fs_mgr: __mount(source=/dev/block/mmcblk2p4,target=/data,type=ext4)=-1
fs_mgr: fs_mgr_mount_all(): possibly an encryptable blkdev /dev/block/mmcblk2p4 for mount /data type ext4 )
fs_mgr: __mount(source=/dev/block/mmcblk2p6,target=/cache,type=ext4)=-1
fs_mgr: Failed to mount an un-encryptable or wiped partition on/dev/block/mmcblk2p6 at /cache options: nomblk_io_submit error: Read-only file system
EXT4-fs (mmcblk2p7): INFO: recovery required on readonly filesystem
EXT4-fs (mmcblk2p7): write access unavailable, cannot proceed
fs_mgr: __mount(source=/dev/block/mmcblk2p7,target=/device,type=ext4)=-1
fs_mgr: Failed to mount an un-encryptable or wiped partition on/dev/block/mmcblk2p7 at /device options: (null) error: Invalid argument
init: fs_mgr_mount_all returned an error
init: fs_mgr_mount_all returned unexpected error 255
Unable to find swap-space signature
fs_mgr: swapon failed for /dev/block/zram0
......
android_usb gadget: high-speed config #1: android
android_work: sent uevent USB_STATE=CONFIGURED
binder: 153:153 transaction failed 29189, size 0-0
binder: 153:153 transaction failed 29189, size 0-0

尝试在本地上挂载system.img也失败,而之前的imx6dl平台是可以的,所以对比两者system.img格式:



发现imx6q的是data格式,这种格式也叫sparse image,是Android为了解决system image越来越大而引进的,有如下说明:


因此我将sparse image转换成了raw image.

[kris@ecovacs:~/myandroid/out/target/product/sabresd_6dq]$ ./../../../../out/host/linux-x86/bin/simg2img  system.img  system_raw.img

download system_raw.img后确实可以正常开机了,所以应该是freescale对sparse image还没有完全支持。


来看看系统流程是如何编译为sparse image的:

build/core/Makefile:







build/tools/releasetools/build_image.py:



关注其中extfs_sparse_flag来源:



build/core/Makefile:


因此最终由TARGET_USERIMAGES_SPARSE_EXT_DISABLED来控制来决定make_ext4fs是否需要带-s参数,

它的意义是用来控制生成的是否是sparse image,然而系统定义TARGET_USERIMAGES_SPARSE_EXT_DISABLED为false,

也就是使用了-s,可以从build log中看到:



解决方法:

定义TARGET_USERIMAGES_SPARSE_EXT_DISABLED为true, 让系统默认编译为system raw image.


参考:

http://forum.xda-developers.com/android/software-hacking/how-to-conver-lollipop-dat-files-to-t2978952

https://community.freescale.com/docs/DOC-105215

http://blog.csdn.net/wh_19910525/article/details/20720307


你可能感兴趣的:(image,System,sparse)