我们在定制自己的recovery.img时可能需要修改etc/recovery.fstab分区表文件,比如内置和外置SD卡挂载路径的配置
1、获取并解压recovery.img
这部分内容请参考我之前的博文 Android 制作recovery.img boot.img,重新打包recovery.img boot.img
2、修改etc/recovery.fstab (有的厂家可能是etc_recovery/recovery.fstab)
一般情况我们刷入自己定制的recovery.img之后手机无法进入recovery模式,很有可能就是这个文件的分区表挂载点配置有问题,这时候就需要修改了,
当然如果recovery.fstab 文件已经是正确的或者我们不需要修改那就不用干下面的活了。
查看该文件各个挂载点是否正确或者新增挂载点一般参考一下几处信息:
手机正常启动后
adb shell
su
1) cat /proc/partitions
root@msm8974:/ # cat /proc/partitions
cat /proc/partitions
major minor #blocks name
7 0 59283 loop0
179 0 15388672 mmcblk0
179 1 102400 mmcblk0p1
179 2 512 mmcblk0p2
179 3 32 mmcblk0p3
179 4 32 mmcblk0p4
179 5 512 mmcblk0p5
179 6 500 mmcblk0p6
179 7 16384 mmcblk0p7
179 8 500 mmcblk0p8
179 9 1024 mmcblk0p9
179 10 1536 mmcblk0p10
179 11 1536 mmcblk0p11
179 12 921600 mmcblk0p12
179 13 4194304 mmcblk0p13
179 14 32768 mmcblk0p14
179 15 307200 mmcblk0p15
179 16 16384 mmcblk0p16
179 17 1536 mmcblk0p17
179 18 1 mmcblk0p18
179 19 8 mmcblk0p19
179 20 10240 mmcblk0p20
179 21 1143 mmcblk0p21
179 22 131072 mmcblk0p22
179 23 9216879 mmcblk0p23
179 32 512 mmcblk0rpmb
179 64 7761920 mmcblk1
179 65 7757824 mmcblk1p1
254 0 59283 dm-0
2) cat /proc/mounts
root@msm8974:/ # cat /proc/mounts
cat /proc/mounts
rootfs / rootfs ro,relatime 0 0
tmpfs /dev tmpfs rw,seclabel,nosuid,relatime,size=936108k,nr_inodes=177238,mode=
755 0 0
devpts /dev/pts devpts rw,seclabel,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,seclabel,relatime 0 0
selinuxfs /sys/fs/selinux selinuxfs rw,relatime 0 0
debugfs /sys/kernel/debug debugfs rw,relatime 0 0
none /acct cgroup rw,relatime,cpuacct 0 0
tmpfs /mnt/secure tmpfs rw,seclabel,relatime,size=936108k,nr_inodes=177238,mode=
700 0 0
tmpfs /mnt/asec tmpfs rw,seclabel,relatime,size=936108k,nr_inodes=177238,mode=75
5,gid=1000 0 0
tmpfs /mnt/obb tmpfs rw,seclabel,relatime,size=936108k,nr_inodes=177238,mode=755
,gid=1000 0 0
none /dev/cpuctl cgroup rw,relatime,cpu 0 0
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 rw,seclabel,relatime,
discard,data=ordered 0 0
/dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 rw,seclabel,nosuid,no
dev,relatime,discard,noauto_da_alloc,data=ordered 0 0
/dev/block/platform/msm_sdcc.1/by-name/cache /cache ext4 rw,seclabel,nosuid,node
v,relatime,discard,noauto_da_alloc,data=ordered 0 0
/dev/block/platform/msm_sdcc.1/by-name/persist /persist ext4 rw,seclabel,nosuid,
nodev,relatime,data=ordered 0 0
/dev/block/platform/msm_sdcc.1/by-name/modem /firmware vfat ro,relatime,uid=1000
,gid=1000,fmask=0337,dmask=0227,codepage=cp437,iocharset=iso8859-1,shortname=low
er,errors=remount-ro 0 0
/dev/block/vold/179:23 /storage/sdcard vfat rw,dirsync,nosuid,nodev,noexec,relat
ime,uid=1000,gid=1015,fmask=0002,dmask=0002,allow_utime=0020,codepage=cp437,ioch
arset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
/dev/block/vold/179:23 /mnt/secure/asec vfat rw,dirsync,nosuid,nodev,noexec,rela
time,uid=1000,gid=1015,fmask=0002,dmask=0002,allow_utime=0020,codepage=cp437,ioc
harset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
tmpfs /storage/sdcard/.android_secure tmpfs ro,seclabel,relatime,size=0k,mode=00
0 0 0
/dev/block/vold/179:65 /storage/sdcard2 vfat rw,dirsync,nosuid,nodev,noexec,rela
time,uid=1000,gid=1015,fmask=0002,dmask=0002,allow_utime=0020,codepage=cp437,ioc
harset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
/dev/block/dm-0 /mnt/asec/com.tencent.pao-1 ext4 ro,dirsync,seclabel,nosuid,node
v,noatime 0 0
3)高通平台 cd /dev/block/platform/msm_sdcc.1/by-name
root@msm8974:/dev/block/platform/msm_sdcc.1/by-name # ll
ll
lrwxrwxrwx root root 1970-02-14 00:10 DDR -> /dev/block/mmcblk0p4
lrwxrwxrwx root root 1970-02-14 00:10 aboot -> /dev/block/mmcblk0p5
lrwxrwxrwx root root 1970-02-14 00:10 boot -> /dev/block/mmcblk0p7
lrwxrwxrwx root root 1970-02-14 00:10 cache -> /dev/block/mmcblk0p15
lrwxrwxrwx root root 1970-02-14 00:10 dbi -> /dev/block/mmcblk0p3
lrwxrwxrwx root root 1970-02-14 00:10 fat -> /dev/block/mmcblk0p23
lrwxrwxrwx root root 1970-02-14 00:10 fsc -> /dev/block/mmcblk0p18
lrwxrwxrwx root root 1970-02-14 00:10 fsg -> /dev/block/mmcblk0p17
lrwxrwxrwx root root 1970-02-14 00:10 logs -> /dev/block/mmcblk0p22
lrwxrwxrwx root root 1970-02-14 00:10 misc -> /dev/block/mmcblk0p21
lrwxrwxrwx root root 1970-02-14 00:10 modem -> /dev/block/mmcblk0p1
lrwxrwxrwx root root 1970-02-14 00:10 modemst1 -> /dev/block/mmcblk0p10
lrwxrwxrwx root root 1970-02-14 00:10 modemst2 -> /dev/block/mmcblk0p11
lrwxrwxrwx root root 1970-02-14 00:10 pad -> /dev/block/mmcblk0p9
lrwxrwxrwx root root 1970-02-14 00:10 persist -> /dev/block/mmcblk0p14
lrwxrwxrwx root root 1970-02-14 00:10 recovery -> /dev/block/mmcblk0p16
lrwxrwxrwx root root 1970-02-14 00:10 rpm -> /dev/block/mmcblk0p6
lrwxrwxrwx root root 1970-02-14 00:10 sbl1 -> /dev/block/mmcblk0p2
lrwxrwxrwx root root 1970-02-14 00:10 splash -> /dev/block/mmcblk0p20
lrwxrwxrwx root root 1970-02-14 00:10 ssd -> /dev/block/mmcblk0p19
lrwxrwxrwx root root 1970-02-14 00:10 system -> /dev/block/mmcblk0p12
lrwxrwxrwx root root 1970-02-14 00:10 tz -> /dev/block/mmcblk0p8
lrwxrwxrwx root root 1970-02-14 00:10 userdata -> /dev/block/mmcblk0p13
假如我们要关注内置和外置SD的挂载点,那么
/dev/block/vold/179:65 /storage/sdcard2 vfat ====》 179 65 7757824 mmcblk1p1 ======》 /dev/block/mmcblk1p1 (外置)
/dev/block/vold/179:23 /storage/sdcard vfat ====》 179 23 9216879 mmcblk0p23 ======》 /dev/block/platform/msm_sdcc.1/by-name/fat -> /dev/block/mmcblk0p23 (内置)
最后我们可以得出如下挂载配置:
fstype device
[device2] [length=]
/sdcard vfat /dev/block/mmcblk1p1
/sdcard2 vfat /dev/block/platform/msm_sdcc.1/by-name/fat
其他的分区表配置方法跟上面的一致,主要就是参考 3个信息: cat /proc/partitions 、cat /proc/mounts 、/dev/block/platform/msm_sdcc.1/by-name,都是有对应关系的,关键就是找这个对应关系。
原文地址:http://blog.csdn.net/whu_zhangmin/article/details/25334127