3 # Ensure we fail the job if any steps fail.
9 $(basename $0) <-w WORKSPACE_DIR> [-n] [-h]
11 -w WORKSPACE_DIR is the path for the project
12 -n dry-run only for bitbake
14 -e EXTRA_CONF is the pat for extra config file
29 echo "CMD: ${RUN_CMD}"
33 echo "Missing options!"
41 SCRIPTS_DIR=`dirname $0`
42 SCRIPTS_DIR=`readlink -f $SCRIPTS_DIR`
44 while getopts "w:e:nh" OPTION; do
47 WORKSPACE=`readlink -f ${OPTARG}`
50 EXTRA_CONF=`readlink -f ${OPTARG}`
62 if [ -z ${WORKSPACE} ]; then
63 echo_info "No workspace specified, a directory 'workspace' will be created in current directory as the workspace"
64 WORKSPACE=`readlink -f workspace`
67 SRC_WRL_DIR=${WORKSPACE}/src_wrl1018
68 SRC_ORAN_DIR=${WORKSPACE}/src_oran
69 PRJ_BUILD_DIR=${WORKSPACE}/prj_oran-inf
71 mkdir -p ${SRC_WRL_DIR} ${PRJ_BUILD_DIR} ${SRC_ORAN_DIR}
73 echo_info "The following directories are created in your workspace(${WORKSPACE}):"
74 echo_info "For wrlinux1018 source: ${SRC_WRL_DIR}"
75 echo_info "For oran layer source: ${SRC_ORAN_DIR}"
76 echo_info "For build project: ${PRJ_BUILD_DIR}"
78 # Clone the source of WRLinux BASE 10.18 from github and setup
79 RUN_CMD="git clone --branch WRLINUX_10_18_BASE git://github.com/WindRiver-Labs/wrlinux-x.git"
80 echo_cmd "Cloning wrlinux 1018 source from github:"
84 RUN_CMD="./wrlinux-x/setup.sh --machines intel-x86-64 --layers meta-cloud-services"
85 echo_cmd "Setup wrlinux build project:"
88 # Clone the oran layer if it's not already cloned
89 # Check if the script is inside the repo
90 if cd ${SCRIPTS_DIR} && git rev-parse --is-inside-work-tree > /dev/null 2>&1; then
91 CLONED_ORAN_REPO=`dirname ${SCRIPTS_DIR}`
92 echo_info "Use the cloned oran repo: ${CLONED_ORAN_REPO}"
94 ln -sf ${CLONED_ORAN_REPO} rtp
96 echo_info "Cloning oran layer:"
98 RUN_CMD="git clone https://gerrit.o-ran-sc.org/r/pti/rtp"
99 echo_cmd "Cloing with:"
103 # Source the build env
105 . ./environment-setup-x86_64-wrlinuxsdk-linux
107 . ./oe-init-build-env ${PRJ_BUILD_DIR}
109 # Add the meta-oran layer
111 RUN_CMD="bitbake-layers add-layer ${SRC_ORAN_DIR}/rtp/meta-oran"
112 echo_cmd "Add the meta-oran layer into the build project"
115 # Add extra configs into local.conf
116 cat << EOF >> conf/local.conf
117 ########################
118 # Configs for oran-inf #
119 ########################
122 WRTEMPLATE += "feature/oran-host-rt-tune"
125 if [ "${EXTRA_CONF}" != "" ] && [ -f "${EXTRA_CONF}" ]; then
126 cat ${EXTRA_CONF} >> conf/local.conf
129 # Build the oran-inf-host image
131 TIMESTAMP=`date +"%Y%m%d_%H%M%S"`
132 RUN_CMD="bitbake ${DRYRUN} oran-image-inf-host"
133 echo_cmd "Build the oran-image-inf-host image"
134 bitbake ${DRYRUN} oran-image-inf-host 2>&1|tee logs/bitbake_oran-image-inf-host_${TIMESTAMP}.log
136 echo_info "Build succeeded, you can get the image in ${PRJ_BUILD_DIR}/tmp-glibc/deploy/images/intel-x86-64/oran-image-inf-host-intel-x86-64.iso"