#!/bin/bash # create: armeasy # date: 2011-12-16 # mail: [email protected] echo "Modify the android.img.cpio" echo "1.unzip the image" echo "2.Create the image" echo "3.exit" SOURCE_DIR=$(cd `dirname $0` ; pwd) TOOLS_DIR=${SOURCE_DIR}/tools/ TARGET_DIR=${SOURCE_DIR}/out/release/ read -p "Choose:" CHOOSE if [ "1" = ${CHOOSE} ];then echo "unzip android.img.cpio" cd ${TARGET_DIR} [ -e "tmp" ] ||{ echo "mkdir tmp"; mkdir tmp;} [ -e "android.img.cpio" ] || { echo "error!can't find andaroid.img.cpio!"; exit; } cd tmp cpio -idmv --no-absolute-filenames < ../android.img.cpio echo "^_^ unzip android.img.cpio finished!" exit elif [ "2" = ${CHOOSE} ];then echo "create android.img.cpio test" [ -e "${TARGET_DIR}/tmp" ] || { echo "can't find [tmp],please unzip android.img.cpio first!"; exit; } rm -f ${TARGET_DIR}/cpio_list rm -f ${TARGET_DIR}/android.img.cpio $TOOLS_DIR/gen_initramfs_list.sh ${TARGET_DIR}/tmp > ${TARGET_DIR}/cpio_list || { exit; } $TOOLS_DIR/gen_init_cpio ${TARGET_DIR}/cpio_list > ${TARGET_DIR}/android.img.cpio || { exit; } rm -rf ${TARGET_DIR}/tmp echo "^_^ Create android.img.cpio finished!" exit elif [ "3" = ${CHOOSE} ];then exit fi
再将android.img.cpio拷贝到内核根目录下,执行./mk -k -x更新xboot.bin,即完成了init.rc的修改。
附:脚本下载地址:
http://xboot.org/thread-347-1-1.html