yb_arm/build.sh

107 lines
3.2 KiB
Bash
Raw Normal View History

2023-07-12 14:14:31 +08:00
set -e
usage() {
2025-05-20 01:51:25 +08:00
echo "usage: $0 [variants] [--evmy] [--cache] [--cpri/--ecpri/--jesd] [--pcie] [--test caseid] " 1>&2
2023-07-12 14:14:31 +08:00
msg=${1:-}
if [ ! -z "${msg}" ]; then
echo "error:$1"
fi
exit 1
}
2025-06-02 23:38:34 +08:00
variants=
fronthaul_option="cpri"
backhaul_option="tmac"
cache_option="no"
test_option="no"
case_id=0
board_option="EVB"
arm_version=`git log --decorate -1 | sed -n '1p' | awk '{print substr($2,0)}'`
arm_build_date=`date +"%Y-%m-%d-%H:%M:%S"`
2023-07-12 14:14:31 +08:00
2025-06-02 23:38:34 +08:00
#判断tag是否存在
if [ -z `git log --decorate -1 | grep -oP '(?<=tag: ).*' | awk '{print substr($1,0)}'` ]
then
2025-06-02 23:38:34 +08:00
arm_tag="NULL";
else
2025-06-02 23:38:34 +08:00
arm_tag=`git log --decorate -1 | grep -oP '(?<=tag: ).*' | awk '{print substr($1,0)}'`
arm_tag=${arm_tag%?}
fi
2023-07-12 14:14:31 +08:00
while [[ "$#" > 0 ]]; do
case $1 in
2025-06-02 23:38:34 +08:00
--cache) cache_option="yes"; shift;;
--evmy) board_option="EVMY"; shift;;
--evb) board_option="EVB"; shift;;
--evmyf) board_option="EVMYF"; shift;;
--evmyt) board_option="EVMYT"; shift;;
--cpri) fronthaul_option="cpri"; shift;;
--ecpri) fronthaul_option="ecpri"; shift;;
--jesd) fronthaul_option="jesd"; shift;;
--pcie) backhaul_option="pcie"; shift;;
--test) test_option="yes";
2023-07-12 14:14:31 +08:00
if [[ ! -z "$2" ]] && [[ -n "$(echo $2 | sed -n " /^[0-9]\+$/p")" ]]; then
2025-06-02 23:38:34 +08:00
case_id=$2; shift;
2023-07-12 14:14:31 +08:00
fi
shift;;
2025-06-02 23:38:34 +08:00
--*| -*) usage "unknown option $1"; exit 1;;
*) variants+=" $1"; shift;;
2023-07-12 14:14:31 +08:00
esac;
done
2025-06-02 23:38:34 +08:00
export arm_version=${arm_version}
export arm_tag=${arm_tag}
export arm_build_date=${arm_build_date}
2024-05-17 12:46:35 +08:00
printf "#arm_version[%s], arm_tag[%s], arm_build_date:[%s]\n" $arm_version $arm_tag $arm_build_date
2025-06-02 23:38:34 +08:00
export DIR_ROOT=$(cd `dirname "$0"`;pwd)
#echo "# script_dir:${DIR_ROOT}"
export BUILD_DIR=${DIR_ROOT}/build
2023-07-12 14:14:31 +08:00
if [ -d ${BUILD_DIR} ]; then
2023-09-26 11:29:28 +08:00
rm -rf ${BUILD_DIR}
2023-07-12 14:14:31 +08:00
fi
2025-06-02 23:38:34 +08:00
mkdir -p ${BUILD_DIR}
2023-07-12 14:14:31 +08:00
if [[ "${fronthaul_option}" == "jesd" ]]; then
2025-06-02 23:38:34 +08:00
export RFIC_DIR=${DIR_ROOT}/driver/rfic/rf/
export CJSON_DIR=${DIR_ROOT}/driver/rfic/ucp/cJSON/inc/
export RFIC_APP_DIR=${DIR_ROOT}/rfic
export BOARD_TYPE=${board_option}
2023-09-26 11:29:28 +08:00
echo -e "\n"
2025-06-02 23:38:34 +08:00
echo "###### start building libjesd.a and librfic.a and rfic.out ######"
2023-09-26 11:29:28 +08:00
cd ${DIR_ROOT}/driver/rfic
2025-06-02 23:38:34 +08:00
#chmod +x build.sh
source ./build.sh
2023-09-26 11:29:28 +08:00
cp ${RFIC_DIR}/out/jesd/*.a ${BUILD_DIR}
2023-07-21 09:57:43 +08:00
cp ${RFIC_DIR}/out/jesd/*.h ${DIR_ROOT}/interface
2025-06-02 23:38:34 +08:00
2023-09-26 11:29:28 +08:00
cp ${RFIC_DIR}/out/rfic/*.a ${DIR_ROOT}/lib
cp ${RFIC_DIR}/out/rfic/ucp_api_rfic.h ${RFIC_APP_DIR}/inc/
cp ${CJSON_DIR}/xzJSON.h ${RFIC_APP_DIR}/inc/
2025-06-02 23:38:34 +08:00
cp ${RFIC_DIR}/out/app/*.out ${BUILD_DIR}
#echo -e "\n"
#echo "###### start building rfic.out ######"
#cd ${RFIC_APP_DIR}/
#make
2023-07-12 14:14:31 +08:00
fi
2023-12-29 16:48:28 +08:00
cd ${DIR_ROOT}/driver/tfu
source ./build.sh
cp build/libstc.a ${DIR_ROOT}/lib
cp build/libstc.a ${BUILD_DIR}
cp stc/inc/stc_drv_api.h ${DIR_ROOT}/interface
2023-09-26 11:29:28 +08:00
echo -e "\n"
2025-06-02 23:38:34 +08:00
echo "###### start building msgTransfer.out and libmsgTransfer.a ######"
2023-07-12 14:14:31 +08:00
cd ${DIR_ROOT}/
2025-05-20 01:51:25 +08:00
make cache_option=${cache_option} fronthaul_option=${fronthaul_option} backhaul_option=${backhaul_option} test_option=${test_option} test_id=${case_id}
2025-06-02 23:38:34 +08:00
2023-07-21 10:04:33 +08:00
cd ${DIR_ROOT}/lib
rm -rf *.*