3 # Copyright (C) 2019 Wind River Systems, Inc.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # Ensure we fail the job if any steps fail.
23 $(basename $0) <-w WORKSPACE_DIR> [-n] [-h]
25 -w WORKSPACE_DIR is the path for the project
26 -n dry-run only for bitbake
28 -e EXTRA_CONF is the pat for extra config file
29 -r whether to inherit rm_work (default is Yes)
44 echo "CMD: ${RUN_CMD}"
48 echo "Missing options!"
63 echo "Invalid arg for -r option."
74 SCRIPTS_DIR=`dirname $0`
75 SCRIPTS_DIR=`readlink -f $SCRIPTS_DIR`
77 while getopts "w:e:r:nh" OPTION; do
80 WORKSPACE=`readlink -f ${OPTARG}`
83 EXTRA_CONF=`readlink -f ${OPTARG}`
89 check_yn_rm_work ${OPTARG}
98 if [ -z ${WORKSPACE} ]; then
99 echo_info "No workspace specified, a directory 'workspace' will be created in current directory as the workspace"
100 WORKSPACE=`readlink -f workspace`
103 SRC_WRL_DIR=${WORKSPACE}/src_wrl1018
104 SRC_ORAN_DIR=${WORKSPACE}/src_oran
105 PRJ_BUILD_DIR=${WORKSPACE}/prj_oran-inf
107 mkdir -p ${SRC_WRL_DIR} ${PRJ_BUILD_DIR} ${SRC_ORAN_DIR}
109 echo_info "The following directories are created in your workspace(${WORKSPACE}):"
110 echo_info "For wrlinux1018 source: ${SRC_WRL_DIR}"
111 echo_info "For oran layer source: ${SRC_ORAN_DIR}"
112 echo_info "For build project: ${PRJ_BUILD_DIR}"
114 # Clone the source of WRLinux BASE 10.18 from github and setup
115 RUN_CMD="git clone --branch WRLINUX_10_18_BASE git://github.com/WindRiver-Labs/wrlinux-x.git"
116 echo_cmd "Cloning wrlinux 1018 source from github:"
120 RUN_CMD="./wrlinux-x/setup.sh --machines intel-x86-64 --layers meta-cloud-services"
121 echo_cmd "Setup wrlinux build project:"
124 # Clone the oran layer if it's not already cloned
125 # Check if the script is inside the repo
126 if cd ${SCRIPTS_DIR} && git rev-parse --is-inside-work-tree > /dev/null 2>&1; then
127 CLONED_ORAN_REPO=`dirname ${SCRIPTS_DIR}`
128 echo_info "Use the cloned oran repo: ${CLONED_ORAN_REPO}"
129 mkdir ${SRC_ORAN_DIR}/rtp
130 cd ${SRC_ORAN_DIR}/rtp
131 ln -sf ${CLONED_ORAN_REPO}/meta-oran meta-oran
132 ln -sf ${CLONED_ORAN_REPO}/scripts scripts
134 echo_info "Cloning oran layer:"
136 RUN_CMD="git clone https://gerrit.o-ran-sc.org/r/pti/rtp"
137 echo_cmd "Cloing with:"
141 # Source the build env
143 . ./environment-setup-x86_64-wrlinuxsdk-linux
145 . ./oe-init-build-env ${PRJ_BUILD_DIR}
147 # Add the meta-oran layer
149 RUN_CMD="bitbake-layers add-layer ${SRC_ORAN_DIR}/rtp/meta-oran"
150 echo_cmd "Add the meta-oran layer into the build project"
153 # Add extra configs into local.conf
154 cat << EOF >> conf/local.conf
155 ########################
156 # Configs for oran-inf #
157 ########################
160 WRTEMPLATE += "feature/oran-host-rt-tune"
162 # Work around for CI build
163 IMAGE_INSTALL_remove = "ceph"
166 if [ "${RM_WORK}" == "Yes" ]; then
167 echo "INHERIT += 'rm_work'" >> conf/local.conf
170 if [ "${EXTRA_CONF}" != "" ] && [ -f "${EXTRA_CONF}" ]; then
171 cat ${EXTRA_CONF} >> conf/local.conf
174 # Build the oran-inf-host image
176 TIMESTAMP=`date +"%Y%m%d_%H%M%S"`
177 RUN_CMD="bitbake ${DRYRUN} oran-image-inf-host"
178 echo_cmd "Build the oran-image-inf-host image"
179 bitbake ${DRYRUN} oran-image-inf-host 2>&1|tee logs/bitbake_oran-image-inf-host_${TIMESTAMP}.log
181 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"