面大(lamian)的m8 android kernel共享给大家了,目前的m8 A13内核已经趋于稳定(不过待机电流仍然偏大,否则的话真的可以甩掉魅族的WinCE了)。
地址:https://github.com/lamian/m8_android_kernel
代码的目录结构:
./initramfs RAM根(root)文件系统,将在系统引导过程中被加载
./kernel 2.6.29 内核
初始化脚本分析:
简单看了下init初始化脚本(./initramfs/init),基本上还都能看懂。
基本上就是挂载设备和镜像,通过md5来校验版本是否匹配。
#!/bin/sh
# This is the first script called by init process
validmd5=”c4681275d035fc778bb55b98425a0ef5″
/bin/mount -a/bin/mount -t tmpfs mdev /dev
/bin/echo /sbin/mdev > /proc/sys/kernel/hotplug
/sbin/mdev -sifconfig usb0 192.168.1.100 255.255.255.0 up
#Display Logo
/fbv –delay 10 /images/logo.pngtest -d /dev/pts || mkdir /dev/pts
/bin/mount -t devpts devpts /dev/pts/debugmsg.sh
devmem 0x7e00f810 32 0xBFFF6D00
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governormkdir -p /mnt/disk
mkdir -p /mnt/looproot
mkdir -p /mnt/patchrootif [ -e /dev/mmcblk0p5 ]; then
mmcblk=/dev/mmcblk0p5
else
mmcblk=/dev/mmcblk0
fimount -t vfat -o fmask=0000,dmask=0000,utf8,errors=continue,sync,dirsync $mmcblk /mnt/disk
if [ -e /mnt/disk/lbe_android/msys.img ]; then
curmd5=`md5sum /mnt/disk/lbe_android/msys.img | cut -d ‘ ‘ -f1`
validmd5=`cat /mnt/disk/lbe_android/version.txt | grep -i “CHECKSUM” | cut -d’=’ -f2`
fiif [ -e /mnt/disk/lbe_android/mroot.img ] && [ -e /mnt/disk/lbe_android/msys.img ] && [ -e /mnt/disk/lbe_android/mdata.img ] && [ "$validmd5" = "$curmd5" ]; then
foundmdroid=1
mount -o sync,dirsync /mnt/disk/lbe_android/mroot.img /mnt/looproot
if [ $? -ne 0 ]; then
umount /mnt/looproot
foundmdroid=0
fi
mount -r -o loop -t squashfs /mnt/disk/lbe_android/msys.img /mnt/looproot/system
if [ $? -ne 0 ]; then
umount /mnt/looproot/system
umount /mnt/looproot
foundmdroid=0
fi
mount -o sync,dirsync /mnt/disk/lbe_android/mdata.img /mnt/looproot/data
if [ $? -ne 0 ] || [ ! -f /mnt/looproot/data/A11 ]; then
umount /mnt/looproot/data
umount /mnt/looproot/system
umount /mnt/looproot
foundmdroid=0
fi
else
foundmdroid=0
fiif [ $foundmdroid -ne 1 ]; then
/fbv –delay 50 /images/corrupt.png
umount /mnt/disk
sync
fiif [ -e /mnt/disk/lbe_android/mpatch_a13.img ]; then
foundmpatch=1
mount /mnt/disk/lbe_android/mpatch_a13.img /mnt/patchroot
else
foundmpatch=0
fiif [ $foundmpatch -eq 1 ]; then
if [ -e /mnt/patchroot/patch_apply.sh ]; then
/mnt/patchroot/patch_apply.sh /mnt/patchroot /mnt/looproot
fi
umount /mnt/patchroot
fiif [ $foundmdroid -eq 1 ]; then
ver=`grep ro.lbe.version /mnt/looproot/init.rc | tr -s ‘ ‘ | cut -d’ ‘ -f4`
if [ "$ver" != "A13" ]; then
/fbv –delay 50 /images/wrongver.png
umount /mnt/looproot/data
umount /mnt/


逃离北上广
NaRiver Blog
最近留言