精华 | |
金钱 | BA |
威望 | 点 |
贡献值 | 点 |
爱心 | 点 |
经验 | 点 |
注册时间 | 2010-6-5 |
最后登录 | 1970-1-1 |
在线时间 | 小时 |
| |
| |
| |
|
立即注册,加入爱黑武论坛的大家庭!爱黑武,爱上搞机生活!
您需要 登录 才可以下载或查看,没有账号?注册
x
linux中使用root用户运行mksystem.sh,即可生成system.img........
默认生成的yaffs2镜像,如果需要ext2或squashfs镜像,百度.谷歌方法。
boot.img这个想做的,百度吧
mksystem.sh 脚本命令:- #!/bin/sh
- ####################
- # 获取当前路径
- ####################
- SCRIPT_PATH=`dirname $(readlink -f $0)`
- EXTRACT_PATH=$SCRIPT_PATH/extract
- ####################
- # 获取升级包名称
- # 解压缩升级包
- ####################
- BUILD=`ls $SCRIPT_PATH/*.zip | tail -1`
- BUILD_VER=`echo $BUILD | cut -d'-' -f2 | sed 's/.zip//'`
- unzip $SCRIPT_PATH/$BUILD -d $EXTRACT_PATH/
- ####################
- # 删除不需要的文件
- ####################
- # app
- rm $EXTRACT_PATH/system/app/CMWallpapers.apk
- rm $EXTRACT_PATH/system/app/Provision.apk
- rm $EXTRACT_PATH/system/app/RomManager.apk
- # etc
- rm $EXTRACT_PATH/system/etc/init.d/05mountsd
- rm $EXTRACT_PATH/system/etc/firmware/default*.acdb
- # lib
- rm $EXTRACT_PATH/system/lib/hw/gps.goldfish.so
- rm $EXTRACT_PATH/system/lib/hw/gps.mahimahi.so
- rm $EXTRACT_PATH/system/lib/hw/sensors.goldfish.so
- rm $EXTRACT_PATH/system/lib/hw/lights.mahimahi.so
- # tts
- rm $EXTRACT_PATH/system/tts/lang_pico/de-DE_gl0_sg.bin
- rm $EXTRACT_PATH/system/tts/lang_pico/de-DE_ta.bin
- rm $EXTRACT_PATH/system/tts/lang_pico/en-GB_kh0_sg.bin
- rm $EXTRACT_PATH/system/tts/lang_pico/en-GB_ta.bin
- rm $EXTRACT_PATH/system/tts/lang_pico/es-ES_ta.bin
- rm $EXTRACT_PATH/system/tts/lang_pico/es-ES_zl0_sg.bin
- rm $EXTRACT_PATH/system/tts/lang_pico/fr-FR_nk0_sg.bin
- rm $EXTRACT_PATH/system/tts/lang_pico/fr-FR_ta.bin
- rm $EXTRACT_PATH/system/tts/lang_pico/it-IT_cm0_sg.bin
- rm $EXTRACT_PATH/system/tts/lang_pico/it-IT_ta.bin
- # usr
- rm $EXTRACT_PATH/system/usr/keylayout/mahimahi-keypad.kl
- rm $EXTRACT_PATH/system/usr/keychars/mahimahi-keypad.kcm.bin
- ####################
- # 替换相关文件
- # 修改build.prop,使其适用于本机型
- ####################
- cp -a $SCRIPT_PATH/update/* $EXTRACT_PATH/system
- mv $EXTRACT_PATH/system/lib/hw/sensors.mahimahi.so $EXTRACT_PATH/system/lib/hw/sensors.htcleo.so
- # build.prop
- sed -i \
- -e 's/ro.product.model=Nexus One/ro.product.model=HTC HD2/' \
- -e 's/ro.product.brand=google/ro.product.brand=htc_wwe/' \
- -e 's/ro.product.board=mahimahi/ro.product.board=htcleo/' \
- -e 's/-N1/-HD2ONE/' \
- $EXTRACT_PATH/system/build.prop
- ####################
- # 读取updater-script
- # 创建符号链接
- # 设置目录和文件权限
- ####################
- # updater script
- UPDATE_SCRIPT=$EXTRACT_PATH/META-INF/com/google/android/updater-script
- # create symbolic links
- SYMLINKS=`grep "symlink" $UPDATE_SCRIPT | cut -d'"' -f2`
- for SYMLINK in $SYMLINKS; do
- echo "Creating symolic links for $SYMLINK..."
- if [ "$SYMLINK" = "busybox" -o "$SYMLINK" = "iwmulticall" ]; then
- LINK_DIR='/system/xbin/'
- elif [ "$SYMLINK" = "toolbox" ]; then
- LINK_DIR='/system/bin/'
- fi
- MATCHES=`awk '/symlink\("'"$SYMLINK"'/,/\);/ {print}' $UPDATE_SCRIPT | \
- sed "s/symlink("$SYMLINK",//g" | \
- sed 's/);//g' | \
- sed 's/"//g' | \
- sed 'N;s/\n//g' | \
- sed 's/ //g' | \
- sed 's/,/ /g' | \
- sed "s@$LINK_DIR@@g"`
- cd $EXTRACT_PATH$LINK_DIR
- for LINK in $MATCHES; do
- echo -n "Linking $SYMLINK to $LINK... "
- ln -sf $SYMLINK $LINK && echo "done"
- done
- done
- # set permissions
- grep "set_perm_recursive" $UPDATE_SCRIPT | grep -v "tmp" | grep -v "recovery" | \
- while read LINE; do
- PERM=`echo $LINE | sed 's/set_perm_recursive(//g' | sed 's/);//g' | sed 's/"//g' | sed 's/ //g'`
- USER=`echo $PERM | cut -d',' -f1`;
- GROUP=`echo $PERM | cut -d',' -f2`;
- DIR_PERM=`echo $PERM | cut -d',' -f3`;
- FILE_PERM=`echo $PERM | cut -d',' -f4`;
- TARGET=`echo $PERM | cut -d',' -f5`;
- echo -n "Setting permissions for $TARGET... "
- chown -R $USER:$GROUP $EXTRACT_PATH$TARGET
- chmod -R $DIR_PERM $EXTRACT_PATH$TARGET
- find $EXTRACT_PATH$TARGET -type f -exec chmod $FILE_PERM {} \; && echo "done"
- done
- grep "set_perm" $UPDATE_SCRIPT | grep -v "recursive" | grep -v "tmp" | grep -v "recovery" | \
- while read LINE; do
- PERM=`echo $LINE | sed 's/set_perm(//g' | sed 's/);//g' | sed 's/"//g' | sed 's/ //g'`
- USER=`echo $PERM | cut -d',' -f1`;
- GROUP=`echo $PERM | cut -d',' -f2`;
- FILE_PERM=`echo $PERM | cut -d',' -f3`;
- TARGET=`echo $PERM | cut -d',' -f4`;
- echo -n "Setting permissions for $TARGET... "
- chown $USER:$GROUP $EXTRACT_PATH$TARGET
- chmod $FILE_PERM $EXTRACT_PATH$TARGET && echo "done"
- done
- ####################
- # 这部分可以删除
- ####################
- chown 0:2000 $EXTRACT_PATH/system/xbin/cssync
- chmod 06755 $EXTRACT_PATH/system/xbin/cssync
- ####################
- # 创建yaffs2镜像文件
- ####################
- rm -f $SCRIPT_PATH/system-$BUILD_VER.img
- cd $EXTRACT_PATH && mkyaffs2image system $SCRIPT_PATH/system-$BUILD_VER.img
- chmod 644 $SCRIPT_PATH/system-$BUILD_VER.img
复制代码 |
|