miui patchrom项目 生成原厂包问题 /卡死现象For MTK CPU

【 学习交流】

 

首先 rec下必须 挂载所有分区

 

 

转载

 

 

 

 

适配过MTK和展迅CPU的patchrom的人就知道,无论是MIUI还是乐蛙还是百度云,在运行完指令

tools/releasetools/ota_target_from_phone -r 之后,往往会又卡死的现象。久久没看到动。即使后面弄完了,发现boot.img有好几G大,导致无法适配


其实这是MTK CPU的一个特性。MTK CPU的内核,recovery和基带等数据都是混在一起的,在硬盘最前面大概50M左右的空间,没有单独的分区。
这个就导致这个卡死现象的原因,这个在tools/releasetools/ota_target_from_phone脚本稍微做一下修改就行了。这可能是MIUI当时开发的时候一个遗漏之处。


大家看tools/releasetools/ota_target_from_phone脚本的107-124行之间有这么一个函数。
function dump_bootimage {
echo "Dump bootimage from device"
if [ -f dumpimage.sh ];then
./dumpimage.sh $TARGET_FILES_DIR/BOOTABLE_IMAGES
else
echo "2"
local info=`adb shell cat /etc/recovery.fstab | grep boot | sed -e "s/\s\+/:/g"`
local fstype=`echo $info | cut -d":" -f2`
echo $fstype
if [ "$fstype" == "mtd" ]; then
mtdn=`adb shell cat /proc/mtd | grep boot | cut -f1 -d":"`
device=/dev/$fstype/$mtdn
else
device=`echo $info | cut -d":" -f3`
adb pull $device $TARGET_FILES_DIR/BOOTABLE_IMAGES/boot.img
fi
fi
}


看红色的部分,这是提取内核的脚本,是直接push出来的,而MTK和展迅的CPU这样做是会导致整个磁盘都被提取下来(因为MTK和展迅前面不是单独分区,adb判断不了大小,导致整个磁盘全被弄下来)。
我对他稍微做了下修。
function dump_bootimage {
echo "Dump bootimage from device"
if [ -f dumpimage.sh ];then
./dumpimage.sh $TARGET_FILES_DIR/BOOTABLE_IMAGES
else
local info=`adb shell cat /etc/recovery.fstab | grep boot | sed -e "s/\s\+/:/g"`
local fstype=`echo $info | cut -d":" -f2`
if [ "$fstype" == "mtd" ]; then
mtdn=`adb shell cat /proc/mtd | grep boot | cut -f1 -d":"`
device=/dev/$fstype/$mtdn
else
device=`echo $info | cut -d":" -f3`
fi
if [ "$device" == "/dev/bootimg" ]; then
adb shell "dd if=/dev/bootimg of=/cache/boot.img bs=512 count=20000"
adb shell "chmod 777 cache/boot.img"
adb pull /cache/boot.img $TARGET_FILES_DIR/BOOTABLE_IMAGES/boot.img
else
adb pull $device $TARGET_FILES_DIR/BOOTABLE_IMAGES/boot.img
fi
fi
}
如上红色的代码,就可以解决这个问题拉。当然有些内核会大于10M ,那样可以改动count=20000这个参数,大致就是10000等于5M。

posted @ 2014-05-23 20:11  vcql  阅读(535)  评论(0编辑  收藏  举报