ȫ־ƽ̨Android4.0ԤװýÌå×ÊÔ´Îļþ
×î½ü¿ª·¢À´ÁËÒ»¸öСÐèÇó£ºÔÚ·¢²¼µÄÈí¼þ°üÀïÃæԤװһЩ¶àýÌå×ÊÔ´Îļþ¡£ÏëÆðÀ´£¬Í¦ÈÝÒ׵ģ¬²»¾ÍÊǰѶàýÌåÎļþ¿½±´µ½ÏµÍ³ÀïÃæÈ¥Âð£¿Êǵģ¬È·ÊµÊÇÕâÑù£¬¿ÉÊǵÃÔÚ²»Í¬¿ª·¢Æ½Ì¨×ö·¨²»´óÒ»Ñù£¬Ä¿Ç°È«Ö¾Èí¼þ´ò°üÉý¼¶¹¤¾ß»¹Ã»ÓкÜÍêÉÆ£¬Ö»ÊÇÔÚ¿¨Æô¶¯µÄ×ö¿¨³ÌÐòÀï¿ÉÒÔÔÚÉÕ¿¨µÄʱºòԤװһЩýÌå×ÊÔ´Îļþ¡£
ÔÚÎļþ¹ÜÀíÆ÷·ÃÎʵÄ·¾¶ÊÇ/mnt/sdcardÕâ¸ö¹ÒÔصãÊǹÜÀíÁËnandÓû§Êý¾ÝÇøÓòµÄ£¬¿ÉÒÔͨ¹ýUSBÁ¬µ½µçÄÔ¿½±´¡¢É¾³ýÎļþ¡£µ«ÊÇÕâÊÇÒ»¸ö¹ÒÔص㣬²¢ÇÒÊÇÔÚϵͳִÐÐpreinstall·þÎñʱ²ÅÖ´ÐйÒÔØ¡£ÄÇÎÒÃÇÔõô°ÑýÌåÎļþ¿½±´µ½Õâ¸öÊý¾ÝÇøÄØ£¿
±ÊÕßÏëµ½µÄÒ»¸ö±È½Ï±£Êصķ½·¨£¬¾ÍÊÇ°ÑýÌå×ÊÔ´ÎļþÏÈѹËõ´ò°üºÃ£¬±àÒëµÄʱºò¿½±´µ½/system/mediaÏÂÃæÈ¥£¬ÕâÑùÔÚ±àÒëµÄʱºò¾Í»á´ò°üµ½system.imgÀïÃæÈ¥£¬ÔÚÉÕдÍæ³ÌÐòºóÖØпª»úºóÖ´ÐÐpreinstallµÄʱºòÔÙ°ÑýÌå×ÊԴѹËõ°ü¿½±´µ½Êý¾ÝÇø½âѹ£¬ÕâÑù¾ÍÍê³ÉÁË×ÊÔ´ÎļþԤװ¡£µ«ÊÇÕâÀïÃæÓм¸¸öСÎÊÌâÐèҪעÒâ,/mnt/sdcard¹ÒÔصãÒªÔÙÖ´ÐÐÍ꣺/system/bin/sh /system/bin/pm preinstall /sdcard/preinstall²ÅÄÜʹÓá£È«Ö¾·¢²¼µÄ״̬:
#!/system/bin/busybox shBUSYBOX="/system/bin/busybox"if [ ! -e /data/system.notfirstrun ]; then echo "do preinstall job" /system/bin/sh /system/bin/pm preinstall /system/preinstall /system/bin/sh /system/bin/pm preinstall /sdcard/preinstall # copy android modify tool files mkdir /mnt/nanda mount -t vfat /dev/block/nanda /mnt/nanda $BUSYBOX cp /mnt/nanda/vendor/system/build.prop /system/ $BUSYBOX cp /mnt/nanda/vendor/system/media/bootanimation.zip /system/media/ $BUSYBOX cp /mnt/nanda/vendor/system/usr/keylayout/*.kl /system/usr/keylayout/ sync umount /mnt/nanda rmdir /mnt/nanda $BUSYBOX touch /data/system.notfirstrun mkdir /databk mount -t ext4 /dev/block/nandi /databk rm /databk/data_backup.tar umount /databk rmdir /databk echo "preinstall ok"elif [ -e /system/data.need.backup ];then echo "data backup:tar /databk/data_backup.tar /data" mkdir /databk mount -t ext4 /dev/block/nandi /databk rm /databk/data_backup.tar $BUSYBOX tar -cf /databk/data_backup.tar /data rm /system/data.need.backup umount /databk rmdir /databkelse echo "do nothing"fi
Èç¹û°Ñ¿½±´Ã½Ìå×ÊÔ´Îļþ·Åµ½ÕâÁ½¾äÖ®ºó£¬¿Ï¶¨Äܹ»¿½±´³É¹¦£¬µ«ÊÇ/system/preinstallÖ´ÐеÄʱ¼äÈ¡¾öÓÚԤװµÄapk¶àÉÙ£¬¶à×°¼¸¸öÓÎÏ·¡¢Ó¦ÓÃapk£¬Ò»°ãºÄʱ±È½Ï¶à£¬¶àÊýÔÚ50ÃëÒÔÉÏ¡£Ò²¾ÍÊÇ˵ÔÚ½øÈë×ÀÃæºó50ÃëÖ®ÄÚ¿ÉÄÜ´ÓÎļþ¹ÜÀíÆ÷ÉÏ¿´»¹Ã»·¨¿´µ½Ô¤×°µÄýÌå×ÊÔ´Îļþ£¬ÕâÑùÕâÖÖÌåÑé¾Í²»ÊǺܺá£Ò»µ©½øÈë×ÀÃ棬Óû§¾Í¿ÉÒÔ´ò¿ª×ÊÔ´¹ÜÀíÆ÷½øÈëԤװµÄ×ÊÔ´¹ÜÀíĿ¼£¬²¥·ÅԤװµÄýÌåÎļþ¡£Òò´Ë¾ÍÐèÒª×öһЩСµ÷Õû£¬ÈçÏ£º
if [ ! -e /data/system.notfirstrun ]; then echo "do preinstall job" /system/bin/sh /system/bin/pm preinstall /sdcard/preinstall if [ -f /system/media/mediaresource.tar ]; then $BUSYBOX echo "######## Copy media resouce to sdcard ##########" $BUSYBOX cp /system/media/mediaresource.tar /mnt/sdcard cd /mnt/sdcard $BUSYBOX tar -xvf /mnt/sdcard/mediaresource.tar ; sync cd /if [ -d /sdcard/mediaresource ]; then rm /system/media/mediaresource.tar; rm /mnt/sdcard/mediaresource.tar; $BUSYBOX touch /data/system.mediapreinstallok fifi /system/bin/sh /system/bin/pm preinstall /system/preinstall # copy android modify tool files mkdir /mnt/nanda mount -t vfat /dev/block/nanda /mnt/nanda $BUSYBOX cp /mnt/nanda/vendor/system/build.prop /system/ $BUSYBOX cp /mnt/nanda/vendor/system/media/bootanimation.zip /system/media/ $BUSYBOX cp /mnt/nanda/vendor/system/usr/keylayout/*.kl /system/usr/keylayout/ sync umount /mnt/nanda rmdir /mnt/nanda $BUSYBOX touch /data/system.notfirstrun mkdir /databk mount -t ext4 /dev/block/nandi /databk rm /databk/data_backup.tar umount /databk rmdir /databk echo "preinstall ok"elif [ -e /system/data.need.backup ];then echo "data backup:tar /databk/data_backup.tar /data" mkdir /databk mount -t ext4 /dev/block/nandi /databk rm /databk/data_backup.tar $BUSYBOX tar -cf /databk/data_backup.tar /data rm /system/data.need.backup umount /databk rmdir /databkelse echo "do nothing"fi
ÏÈÅжÏýÌå×ÊÔ´Îļþ°üµÄ´æÔÚÐÔ£¬Èç¹û´æÔھͿ½±´ÔÙ½âѹ£¬Èç¹û½âѹ³É¹¦¾Íɾ³ýsystemÀïÃæµÄ×ÊÔ´Îļþ°ü£¬ÊÍ·Å¿Õ¼ä³öÀ´£¬ÕâÑù¾ÍÍê³ÉÁËÕû¸öԤװ¡£
Õâ¸öÎÊÌâ±¾ÉíûʲôÄѶȣ¬±¾ÎÄʵÏÖ·½·¨¾¹ýÑéÖ¤¿ÉÐУ¬ÎÂÜ°Ìáʾ×ÊÔ´Îļþ°ü²»ÒªÌ«´ó£¬¿ØÖÆÔÚ30MÖ®ÄڱȽϺá£