编译脚本

编译脚本


#!/bin/bash
echo "******************************************************"
echo "Note  :    一键编译固件脚本                "
echo "Author:    chwenj@gmail.com                "
echo "Agreement: GPL                             "
echo "******************************************************"

echo "******************************************************"
echo "Entry: "
#获取脚本当前的路径:
SdkPath=$(cd "$(dirname "$0")"; pwd) 
echo ""
echo ""
echo "The Sdk Path= $SdkPath"
echo ""
echo ""
source $SdkPath/proccessing.sh 
source $SdkPath/proccess_ime.sh 
read -p "Press ENTER to continue" var

echo "******************************************************"
echo "process_preprare function: "
process_preprare $1 $2;
read -p "Press ENTER to continue" var

echo "******************************************************"
echo "make kernel"
pwd
make kernel
read -p "Press ENTER to continue" var

echo "******************************************************"
echo "source build/envsetup.sh"
cd ./android4.0
pwd
source build/envsetup.sh
read -p "Press ENTER to continue" var

echo "******************************************************"
echo "lunch = $1-eng"
pwd
if [ $1 = "mc-v80c" ] ; then 
    lunch crane_mc_v80c-eng 

    elif [ $1 = "mc-v80" ] ; then
        lunch crane_mc_v80-eng 

    elif [ $1 = "mc-v81c" ] ; then   
        lunch crane_mc_v81c-eng 

    elif [ $1 = "mc-v40c" ] ; then
        lunch crane_mc_v40c-eng 

    elif [ $1 = "mc-v21" ] ; then
        lunch crane_mc_v21-eng

    elif [ $1 = "com-v80c" ] ; then
        lunch crane_com_v80c-eng 

    elif [ $1 = "com-v80" ] ; then
        lunch crane_com_v80-eng 

    elif [ $1 = "com-v81c" ] ; then
        lunch crane_com_v81c-eng

    elif [ $1 = "com-v81" ] ; then
        lunch crane_com_v81-eng

    elif [ $1 = "com-v40c" ] ; then
        lunch crane_com_v40c-eng

    else
    echo "build error cmd!"
    exit 0
fi

read -p "Press ENTER to continue" var

echo "******************************************************"
echo "extract-bsp"
pwd
extract-bsp
read -p "Press ENTER to continue" var

echo "******************************************************"
echo "make -j8" 
pwd
make -j8
read -p "Press ENTER to continue" var

echo "******************************************************"
echo "processing IME"
process_ime $1 $3
 
read -p "Press ENTER to continue" var


cd ./android4.0
pwd

echo "******************************************************"
echo "pack"
pwd
pack
read -p "Press ENTER to continue" var

echo "******************************************************"
echo "recovery"
process_recovery;
read -p "Press ENTER to continue" var

echo "******************************************************"
echo "Compiling img success!!!"
echo "******************************************************"

#!/bin/bash

pSdkPath=/home/carlton/jacktestplace/a10_Project/android40_A10

###
DrvPath=lichee/linux-3.0/drivers

###
GpioPath=$DrvPath/char

GpioName20=idc_v80_gpio-20.c
GpioName14=idc_v80_gpio_14.c
GpioDstName=idc_v80_gpio.c

function process_gpio()
{

    echo "proccess function_gpio: $0 $1"
    rm -vf $pSdkPath/$GpioPath/*.o 

    if [ $1 = "IO-20" ] ; then 
        echo "IO-20: "
        cp -vf $pSdkPath/$GpioPath/$GpioName20 $pSdkPath/$GpioPath/$GpioDstName
        
        elif [ $1 = "IO-14" ] ; then
        echo "IO-14: "
        cp -vf $pSdkPath/$GpioPath/$GpioName14 $pSdkPath/$GpioPath/$GpioDstName
        
        else
        echo "select gpio error!"
        exit 0
    fi

}

###
KbPath=$DrvPath/input/keyboard

KbNameS=sun4i-keyboard-S.c
KbNameM=sun4i-keyboard-M.c
KbName4P3=sun4i-keyboard-4point3.c
KbObjName=sun4i-keyboard.o
KbDstName=sun4i-keyboard.c

function process_keyboard()
{
    echo "proccess_keyboard: $0 $1"

    rm -vf $pSdkPath/$KbPath/$KbObjName

    if [ $1 = "KB-S" ] ; then 
        echo "KB-S: "
        cp -rf $pSdkPath/$KbPath/$KbNameS $pSdkPath/$KbPath/$KbDstName 
        
        elif [ $1 = "KB-M" ] ; then
        echo "KB-M: "
        cp -rf $pSdkPath/$KbPath/$KbNameM $pSdkPath/$KbPath/$KbDstName
        
        elif [ $1 = "KB-4P3" ] ; then
        echo "KB-4P3: "
        cp -rf $pSdkPath/$KbPath/$KbName4P3 $pSdkPath/$KbPath/$KbDstName
        
        else
        echo "select KEYBOARD error!"
        exit 0
    fi

}

###
CamDevPath=$DrvPath/media/video/sun4i_csi/device
CamCsiPath=$DrvPath/media/video/sun4i_csi/csi0
CamIncPath=$DrvPath/media/video/sun4i_csi/include

CamDevNameComm=ov2643.c_Common
CamCsiNameComm=sun4i_drv_csi.c_Common
CamIncNameComm=sun4i_dev_csi.h_Common

CamDevNameLed=ov2643.c_LEDTAG
CamCsiNameLed=sun4i_drv_csi.c_LEDTAG
CamIncNameLed=sun4i_dev_csi.h_LEDTAG

CamDevDst=ov2643.c
CamCsiDst=sun4i_drv_csi.c
CamIncDst=sun4i_dev_csi.h

function process_camera()
{
    echo "proccess_camera: $0 $1"

    rm -vf $pSdkPath/$CamDevPath/*.o  $pSdkPath/$CamDevPath/*.ko $pSdkPath/$CamCsiPath/*.o

    if [ $1 = "CAM-COM" ] ; then 
        echo "CAM-COM: "
        cp -vf $pSdkPath/$CamDevPath/$CamDevNameComm $pSdkPath/$CamDevPath/$CamDevDst
        cp -vf $pSdkPath/$CamCsiPath/$CamCsiNameComm $pSdkPath/$CamCsiPath/$CamCsiDst
        cp -vf $pSdkPath/$CamIncPath/$CamIncNameComm $pSdkPath/$CamIncPath/$CamIncDst
        
        elif [ $1 = "CAM-LED" ] ; then
        echo "CAM-LED: "
        cp -vf $pSdkPath/$CamDevPath/$CamDevNameLed $pSdkPath/$CamDevPath/$CamDevDst
        cp -vf $pSdkPath/$CamCsiPath/$CamCsiNameLed $pSdkPath/$CamCsiPath/$CamCsiDst
        cp -vf $pSdkPath/$CamIncPath/$CamIncNameLed $pSdkPath/$CamIncPath/$CamIncDst

        else
        echo "select CAMERA error!"
        exit 0
    fi
}

###
DispPath=$DrvPath/video/sun4i/lcd

DispSrcNameRgb=lcd0_panel_cfg_20141117_rgb.c
DispSrcNameLvds=lcd0_panel_cfg_20141117_lvds.c

DispDstName=lcd0_panel_cfg.c

function process_display()
{
    echo "proccess_display: $0 $1"
    rm $pSdkPath/$DrvPath/video/sun4i/lcd/*.o

    if [ $1 = "LCD-RGB" ] ; then 
        echo "LCD-RGB: "
        cp -vf $pSdkPath/$DispPath/$DispSrcNameRgb $pSdkPath/$DispPath/$DispDstName
        
        elif [ $1 = "LCD-LVDS" ] ; then
        echo "LCD-LVDS: "
        cp -vf $pSdkPath/$DispPath/$DispSrcNameLvds $pSdkPath/$DispPath/$DispDstName
        
        else
        echo "select DISPLAY I/F error!"
        exit 0
    fi
    
}

###
SuiPath=android4.0/frameworks/base/packages/SystemUI/src/com/android/systemui

SuiSrcNameUp=SystemUIService.java_UP
SuiSrcNameDown=SystemUIService.java_DOWN

SuiDstName=SystemUIService.java

function process_SystemUI()
{
    echo "proccess_SystemUI: $0 $1"

    if [ $1 = "UI-UP" ] ; then 
        echo "UI-UP: "
        cp -vf $pSdkPath/$SuiPath/$SuiSrcNameUp $pSdkPath/$SuiPath/$SuiDstName
        
        elif [ $1 = "UI-DOWN" ] ; then
        echo "UI-DOWN: "
        cp -vf $pSdkPath/$SuiPath/$SuiSrcNameDown $pSdkPath/$SuiPath/$SuiDstName
        
        else
        echo "select SystemUI error!"
        exit 0

    fi

}

###
SbPath=android4.0/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar

SbSrcNameAdd=StatusBar.java_ADD
SbSrcNameRemove=StatusBar.java_REMOVE

SbDstName=StatusBar.java

function process_StatusBar()
{
    echo "proccess function_StatusBar: "

    if [ $1 = "BAR-ADD" ] ; then 
        echo "BAR-ADD: "
        cp -vf $pSdkPath/$SbPath/$SbSrcNameAdd $pSdkPath/$SbPath/$SbDstName
        
        elif [ $1 = "BAR-REMOVE" ] ; then
        echo "PY-REMOVE: "
        cp -vf $pSdkPath/$SbPath/$SbSrcNameRemove $pSdkPath/$SbPath/$SbDstName
        
        else
        echo "select StatusBar error!"
        exit 0
    fi
}

###
AppInputPath=/home/carlton/jacktestplace/Routine/update_app_a10
OutDirPath=android4.0/out/target/product
DevPath=android4.0/device/softwinner

function process_app()
{

    local LunchName=crane-$1
    echo "LunchName = $LunchName"

    rm -rvf $pSdkPath/$OutDirPath/$LunchName/*.img $pSdkPath/$OutDirPath/$LunchName/system
    rm -vf $pSdkPath/$DevPath/$LunchName/apkinstall/* 
    rm -vf $pSdkPath/$DevPath/$LunchName/apklib/* 
    cp -vf $AppInputPath/$1/apkinstall/* $pSdkPath/$DevPath/$LunchName/apkinstall
    cp -vf $AppInputPath/$1/apklib/* $pSdkPath/$DevPath/$LunchName/apklib

}

function process_preprare()
{
    echo "@@@@@@@@@@@@@@@@@@@@@@@@@"
    echo "proccess function: $0 $1 $2"

###小门口机
    if [ $1 = "mc-v21" ] ; then
        echo "#BRANCH: mc-v21 zone8_outdoor"
        process_camera "CAM-LED"
        process_display "LCD-LVDS"
        process_app $1

###4.3寸
    elif [ $1 = "mc-v40c" ] ; then
        echo "#BRANCH: mc-v40c zone8_outdoor"
        process_keyboard "KB-4P3"
        process_StatusBar "BAR-REMOVE"
        process_SystemUI "UI-DOWN"
        process_app $1

    elif [ $1 = "com-v40c" ] ; then
        echo "#BRANCH: com-v40c zone8_outdoor"
        process_keyboard "KB-4P3"
        process_StatusBar "BAR-REMOVE"
        process_SystemUI "UI-DOWN"
        process_app $1

###小门口机和4.3寸之外
    else
        if [ $2 = "zone8_indoor" ] ; then    
            echo "#BRANCH: $1 八防区 室内机"
            process_app $1

        elif [ $2 = "zone4_indoor" ] ; then
            echo "#FIXME: $1 四防区 室内机:出现错误:不支持该机器!!!"
            exit 0

        elif [ $2 = "zone8_outdoor" ] ; then
            echo "#BRANCH: $1 八防区 门口机"
            process_keyboard "KB-M"
            process_app $1

        elif [ $2 = "zone4_outdoor" ] ; then
            echo "#FIXME: $1 四防区 室内机:出现错误:不支持该机器!!!"
            exit 0

        else
            echo "#ERROR: 严重错误,请检查process处理函数的传入参数!!!"
            exit 0
        fi

    fi

}

function process_recovery()
{
    process_gpio "IO-20"
    process_keyboard "KB-S"
    process_camera "CAM-COM"
    process_display "LCD-RGB"
    process_StatusBar "BAR-ADD"
    process_SystemUI "UI-UP"
}



#!/bin/bash

mSdkPath=/home/carlton/jacktestplace/a10_Project/android40_A10
PdtPath=android4.0/out/target/product
ApkPath=""
LibPath=""
OutPath=""

function process_ApkPath()
{
echo "processing lunch ApkPath:"

    ApkPath=$mSdkPath/$PdtPath/crane-$1/system/app
    LibPath=$mSdkPath/$PdtPath/crane-$1/system/lib
    OutPath=$mSdkPath/$PdtPath/crane-$1

}

function process_Pinyin_remove()
{
    ls -al $ApkPath/PinyinIME.apk
    ls -al $LibPath/libjni_pinyinime.so
    rm -vf $ApkPath/PinyinIME.apk
    rm -vf $LibPath/libjni_pinyinime.so
}

function process_ime()
{
    echo "@#@#@#@#@#@#@#@#@#@#@#@#@#@#@"
    pwd
    process_ApkPath $1
    echo $ApkPath
    echo $LibPath
    echo $OutPath

    
    if [ $2 = "py-add" ] ; then
        echo "PinyinIME.apk add"

    elif [ $2 = "py-remove" ] ; then
        echo "PinyinIME.apk remove"
        process_Pinyin_remove;
        read -p "Press ENTER to continue" var
        pwd
        make snod
    
    elif [ $2 = "3rdIME-add" ] ; then
        echo "add the 3rd party IME"

    else
        echo "error!!!"
        exit 0
    fi

}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值