编译脚本

#!/bin/bash

TOP_DIR=$(dirname `readlink -f $0`)

TARGET_BOARD=""

ANDROID_CODEBASE=LA.UM.6.6/LINUX/android/

print_usage()

{

echo "

$0 <build_type>

<build_type> can be defined as follows:

bootonly compile boot_images

tzonly compile trustzone_images

rpmonly compile rpm_proc

modemonly compile modem_proc

commoncompile common

androidonly compile LINUX

adsp only compile adsp

allcomiple all

downloadgather all needed images "

exit 1

}

print_usage2()

{

echo "

$0 <build_type> <board_type>

<board_type> can be defined as follows:

msm8917

msm8920

msm8937

msm8940

msm8953

"

exit 1

}

boot()

{

if [ $2 = "msm8917" -o $2 = "msm8920" ];then

source ${TOP_DIR}/BOOT.BF.3.3/boot_images/build/ms/setenv.sh

${TOP_DIR}/BOOT.BF.3.3/boot_images/build/ms/build.sh TARGET_FAMILY=8917 --prod

else

source ${TOP_DIR}/BOOT.BF.3.3/boot_images/build/ms/setenv.sh

${TOP_DIR}/BOOT.BF.3.3/boot_images/build/ms/build.sh TARGET_FAMILY=8953 --prod

fi

}

tz()

{

source ${TOP_DIR}/TZ.BF.4.0.5/trustzone_images/build/ms/setenv.sh

${TOP_DIR}/TZ.BF.4.0.5/trustzone_images/build/ms/build.sh CHIPSET=msm8953 devcfg sampleapp

}

build_rpm()

{

cd ${TOP_DIR}/RPM.BF.2.4/

source ./rpm_proc/build/setenvar.sh

./rpm_proc/build/build_8953.sh

cd ${TOP_DIR}

}

adsp()

{

cd ${TOP_DIR}/ADSP.VT.3.0/adsp_proc

source ./build/setenv.sh

python build/build.py -c msm8953 -o all

cd ${TOP_DIR}

}

modem()

{

if [ $2 = "msm8917" -o $2 = "msm8937" ];then

source ${TOP_DIR}/MPSS.JO.3.1/modem_proc/build/ms/setenv.sh

${TOP_DIR}/MPSS.JO.3.1/modem_proc/build/ms/build.sh 8937.genns.prod -k

elif [ $2 = "msm8920" -o $2 = "msm8940" ];then

source ${TOP_DIR}/MPSS.TA.3.0/modem_proc/build/ms/setenv.sh

${TOP_DIR}/MPSS.TA.3.0/modem_proc/build/ms/build.sh 8940.gen.prod -k

elif [ $2 = "msm8953" ];then

source ${TOP_DIR}/MPSS.TA.3.0/modem_proc/build/ms/setenv.sh

${TOP_DIR}/MPSS.TA.3.0/modem_proc/build/ms/build.sh 8953.gen.prod -k

else

print_usage2

fi

}

common()

{

case $2 in

msm8917)

cd ${TOP_DIR}/MSM8917.LA.3.1.1/common/build

;;

msm8920)

cd ${TOP_DIR}/MSM8920.LA.3.1.1/common/build

;;

msm8937)

cd ${TOP_DIR}/MSM8937.LA.3.1.1/common/build

;;

msm8940)

cd ${TOP_DIR}/MSM8940.LA.3.1.1/common/build

;;

msm8953)

cd ${TOP_DIR}/SDM450.LA.3.1.1/common/build

;;

*)

print_usage2

exit

;;

esac

python build.py

cd ${TOP_DIR}

}

android()

{

cd ${TOP_DIR}/LA.UM.6.6/LINUX/android

source build/envsetup.sh

lunch msm8953_64-userdebug

make update-api

mkdir -p ${OUT}/download_images

mkdir -p ${OUT}/collect_elfs

m -j8 2>&1 | tee build_android.log

cd ${TOP_DIR}

}

gather_images()

{

IMAGES_DIR=${TOP_DIR}/LA.UM.6.6/LINUX/android/out/target/product/msm8953_64/download_images

ELFS_DIR=${TOP_DIR}/LA.UM.6.6/LINUX/android/out/target/product/msm8953_64/collect_elfs

cd ${TOP_DIR}

case $2 in

msm8917)

;;

msm8920)

;;

msm8953)

cp -f ./LA.UM.6.6/LINUX/android/out/target/product/msm8953_64/emmc_appsboot.mbn $IMAGES_DIR

cp -f ./LA.UM.6.6/LINUX/android/out/target/product/msm8953_64/boot.img $IMAGES_DIR

#cp -f ./LA.UM.6.6/LINUX/android/out/target/product/msm8953_64/recovery.img $IMAGES_DIR

cp -f ./LA.UM.6.6/LINUX/android/out/target/product/msm8953_64/mdtp.img $IMAGES_DIR

cp -f ./LA.UM.6.6/LINUX/android/out/target/product/msm8953_64/persist.img $IMAGES_DIR

cp -f ./LA.UM.6.6/LINUX/android/device/qcom/msm8953_64/fs_image.tar.gz.mbn.img $IMAGES_DIR

cp -f ./RPM.BF.2.4/rpm_proc/build/ms/bin/8953/rpm.mbn $IMAGES_DIR

cp -f ./ADSP.VT.3.0/adsp_proc/build/dynamic_signed/8953/adspso.bin $IMAGES_DIR

cp -f ./LA.UM.6.6/LINUX/android/out/target/product/msm8953_64/obj/KERNEL_OBJ/vmlinux  $ELFS_DIR

cp -f ./LA.UM.6.6/LINUX/android/out/target/product/msm8953_64/obj/KERNEL_OBJ/vmlinux  $IMAGES_DIR

cp -f ./MPSS.TA.3.0/modem_proc/build/ms/orig_MODEM_PROC_IMG_8953.gen.prodQ.elf  $IMAGES_DIR

cp -f ./CNSS.PR.4.0.3/wcnss_proc/build/ms/8953_LPL_PRONTO_MR.elf   $IMAGES_DIR

cp -f ./SDM450.LA.3.1.1/common/build/gpt_main0.bin $IMAGES_DIR

cp -f ./SDM450.LA.3.1.1/common/build/gpt_backup0.bin $IMAGES_DIR

cp -f ./SDM450.LA.3.1.1/common/build/bin/asic/sparse_images/* $IMAGES_DIR

cp -f ./SDM450.LA.3.1.1/common/build/bin/asic/NON-HLOS.bin $IMAGES_DIR

cp -f ./SDM450.LA.3.1.1/common/build/patch0.xml $IMAGES_DIR

cp -f ./SDM450.LA.3.1.1/common/build/splash.img $IMAGES_DIR

cp -f ./SDM450.LA.3.1.1/common/sectools/resources/build/sec.dat $IMAGES_DIR

#cp -f ./MPSS.JO.3.1/modem_proc/Golden-EFS/${TARGET_BOARD}/fs_image.tar.gz.mbn.img $IMAGES_DIR

cp -f ./TZ.BF.4.0.5/trustzone_images/build/ms/bin/SANAANAA/cmnlib.mbn $IMAGES_DIR

cp -f ./TZ.BF.4.0.5/trustzone_images/build/ms/bin/SANAANAA/cmnlib_30.mbn $IMAGES_DIR

cp -f ./TZ.BF.4.0.5/trustzone_images/build/ms/bin/SANAANAA/cmnlib64_30.mbn $IMAGES_DIR

cp -f ./TZ.BF.4.0.5/trustzone_images/build/ms/bin/SANAANAA/tz.mbn $IMAGES_DIR

cp -f ./TZ.BF.4.0.5/trustzone_images/build/ms/bin/SANAANAA/keymaster64.mbn $IMAGES_DIR

cp -f ./TZ.BF.4.0.5/trustzone_images/build/ms/bin/SANAANAA/devcfg.mbn $IMAGES_DIR

cp -f ./TZ.BF.4.0.5/trustzone_images/build/ms/bin/SANAANAA/smplap32.mbn $IMAGES_DIR

cp -f ./TZ.BF.4.0.5/trustzone_images/build/ms/bin/SANAANAA/smplap64.mbn $IMAGES_DIR

cp -f ./TZ.BF.4.0.5/trustzone_images/build/ms/bin/SANAANAA/lksecapp.mbn $IMAGES_DIR

cp -f ./BOOT.BF.3.3/boot_images/build/ms/bin/JAASANAZ/sbl1.mbn $IMAGES_DIR

cp -f ./BOOT.BF.3.3/boot_images/build/ms/bin/JAADANAZ/prog_emmc_firehose_8953_ddr.mbn $IMAGES_DIR

;;

msm8940)

cp -f ./MSM8940.LA.3.1.1/common/build/gpt_main0.bin $IMAGES_DIR

cp -f ./MSM8940.LA.3.1.1/common/build/gpt_backup0.bin $IMAGES_DIR

cp -f ./MSM8940.LA.3.1.1/common/build/bin/asic/sparse_images/* $IMAGES_DIR

cp -f ./MSM8940.LA.3.1.1/common/build/bin/asic/NON-HLOS.bin $IMAGES_DIR

cp -f ./MSM8940.LA.3.1.1/common/build/patch0.xml $IMAGES_DIR

cp -f ./MSM8940.LA.3.1.1/common/build/splash.img $IMAGES_DIR

cp -f ./MSM8940.LA.3.1.1/common/sectools/resources/build/sec.dat $IMAGES_DIR

cp -f ./BOOT.BF.3.3/boot_images/build/ms/bin/FAADANAZ/prog_emmc_firehose_8937_ddr.mbn $IMAGES_DIR

cp -f ./MPSS.JO.3.1/modem_proc/build/ms/M89408940.gen.prodQ0000.elf  $ELFS_DIR

cp -f ./MPSS.JO.3.1/modem_proc/Golden-EFS/${TARGET_BOARD}/fs_image.tar.gz.mbn.img $IMAGES_DIR

;;

*)

;;

esac

}

zip_image()

{

IMAGES_DIR="./${ANDROID_CODEBASE}/out/target/product/msm8953_64/download_images"

PROP_FILE=./${ANDROID_CODEBASE}/out/target/product/msm8953_64/system/build.prop

SW_VER="`grep "ro.build.display.id" ${PROP_FILE} | cut -d = -f2 |sed 's/^[ \t]*//g'| sed 's/[[:space:]]\+/_/g'`"

PACNAME=$SW_VER"_USERDEBUG"

echo "PACNAME $PACNAME"

zip -ryj ${PACNAME}.zip $IMAGES_DIR

}

[ $# -eq 0 ] && print_usage

[ $# -eq 1 ] && print_usage2

#case $2 in

#benz)

#TARGET_BOARD=BENZ

#;;

#eagle)

#TARGET_BOARD=EAGLE

#;;

#*)

#print_usage2

#;;

#esac

if [ $2 = "msm8917" -o $2 = "msm8920" -o $2 = "msm8937" -o $2 = "msm8940" -o $2 = "msm8953" ];then

echo "TARGET is $2"

else

print_usage2

exit

fi

case $1 in

boot)

boot $*

;;

common)

echo "Build android first!!!"

echo "Continue to build???"

echo -n "Please answer with Yes or No [y|n]:"

while true; do

read -p "" yn

case $yn in

[Yy]*)

common $*

break

;;

[Nn]*)

break

;;

*)

echo -n "Please answer with Yes or No [y|n]:"

;;

esac

done

;;

rpm)

build_rpm

;;

tz)

tz

;;

modem)

modem $*

;;

adsp)

adsp $*

;;

android)

android $*

common $*

gather_images $*

zip_image $*

;;

download)

gather_images $*

;;

all)

boot $*

build_rpm

tz

modem $*

android

adsp $*

common $*

gather_images $*

zip_image $*

;;

zip)

zip_image $*

;;

*)

print_usage

;;

esac

(0)

相关推荐