全部博文(478)
分类: Android平台
2016-03-21 19:41:46
1)修改bootable\recovery\etc\init.rc
在recovery mode下没有挂载/system,/data等目录,也没有开启adb。所以需要打开这些功能才能抓取coredump
· (1)添加PATH和设置core_pattern
修改:
init.rc
export PATH /sbin
为:
init.rc
export PATH /sbin:/system/bin
write /proc/self/coredump_filter 39
write /proc/sys/kernel/core_pattern "|/system/bin/aee_core_forwarder /data/core/ %p %s UID=%u GID=%g"
· (2)开启adbd
修改:
init.rc
service adbd /sbin/adbd recovery
disabled
为:
init.rc
service adbd /sbin/adbd recovery
start adbd
· (3)挂载/system和/data
添加:
init.rc
on fs_property:ro.mount.fs=YAFFS
# Mount /system rw first to give the filesystem a chance to save a checkpoint
write /proc/bootprof "INIT:NAND:Mount_START"
mount yaffs2 mtd@system /system
mount yaffs2 mtd@system /system ro remount
mount yaffs2 mtd@userdata /data nosuid nodev
write /proc/bootprof "INIT:NAND:Mount_END"
on fs_property:ro.mount.fs=UBIFS
write /proc/bootprof "INIT:NAND:Mount_START"
mount ubifs ubi@system /system
mount ubifs ubi@system /system ro remount
mount ubifs ubi@userdata /data nosuid nodev
write /proc/bootprof "INIT:NAND:Mount_END"
on fs_property:ro.mount.fs=EXT4
write /proc/bootprof "INIT:eMMC:Mount_START"
exec /sbin/e2fsck -p /emmc@android
# Mount /system rw first to give the filesystem a chance to save a checkpoint
#mount ext4 emmc@android /system wait commit=1,data=journal,noauto_da_alloc
mount ext4 /emmc@android /system wait commit=1,noauto_da_alloc
mount ext4 /emmc@android /system noatime ro remount wait
exec /sbin/e2fsck -pfD /emmc@usrdata
exec /sbin/tune2fs -O has_journal /emmc@usrdata
exec /system/bin/ext4_resize
mount ext4 /emmc@usrdata /data noatime nosuid nodev wait noauto_da_alloc,discard
write /proc/bootprof "INIT:eMMC:Mount_END"
2)编译recovery.img
./mk recoveryimage
编译完后下载
3)复现问题抓取coredump
复现问题后,如果发生NE,则会在/data/core目录下生成zcore-xxx.zip的coredump压缩包,此时可以通过usb连上手机,启动adb抓取文件:adb pull /data/core
4)分析coredump
将同一次编译生成的out/target/product/$proj/symbols/system/bin/recovery和coredump用gdb或trace32加载还原调用栈查看NE的原因,或者提交给MTK进行分析。