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
43 echo "CMD: ${RUN_CMD}"
47 echo "Missing options!"
55 SCRIPTS_DIR=`dirname $0`
56 SCRIPTS_DIR=`readlink -f $SCRIPTS_DIR`
58 while getopts "w:e:nh" OPTION; do
61 WORKSPACE=`readlink -f ${OPTARG}`
64 EXTRA_CONF=`readlink -f ${OPTARG}`
76 if [ -z ${WORKSPACE} ]; then
77 echo_info "No workspace specified, a directory 'workspace' will be created in current directory as the workspace"
78 WORKSPACE=`readlink -f workspace`
81 SRC_WRL_DIR=${WORKSPACE}/src_wrl1018
82 SRC_ORAN_DIR=${WORKSPACE}/src_oran
83 PRJ_BUILD_DIR=${WORKSPACE}/prj_oran-inf
85 mkdir -p ${SRC_WRL_DIR} ${PRJ_BUILD_DIR} ${SRC_ORAN_DIR}
87 echo_info "The following directories are created in your workspace(${WORKSPACE}):"
88 echo_info "For wrlinux1018 source: ${SRC_WRL_DIR}"
89 echo_info "For oran layer source: ${SRC_ORAN_DIR}"
90 echo_info "For build project: ${PRJ_BUILD_DIR}"
92 # Clone the source of WRLinux BASE 10.18 from github and setup
93 RUN_CMD="git clone --branch WRLINUX_10_18_BASE git://github.com/WindRiver-Labs/wrlinux-x.git"
94 echo_cmd "Cloning wrlinux 1018 source from github:"
98 RUN_CMD="./wrlinux-x/setup.sh --machines intel-x86-64 --layers meta-cloud-services"
99 echo_cmd "Setup wrlinux build project:"
102 # Clone the oran layer if it's not already cloned
103 # Check if the script is inside the repo
104 if cd ${SCRIPTS_DIR} && git rev-parse --is-inside-work-tree > /dev/null 2>&1; then
105 CLONED_ORAN_REPO=`dirname ${SCRIPTS_DIR}`
106 echo_info "Use the cloned oran repo: ${CLONED_ORAN_REPO}"
108 ln -sf ${CLONED_ORAN_REPO} rtp
110 echo_info "Cloning oran layer:"
112 RUN_CMD="git clone https://gerrit.o-ran-sc.org/r/pti/rtp"
113 echo_cmd "Cloing with:"
117 # Source the build env
119 . ./environment-setup-x86_64-wrlinuxsdk-linux
121 . ./oe-init-build-env ${PRJ_BUILD_DIR}
123 # Add the meta-oran layer
125 RUN_CMD="bitbake-layers add-layer ${SRC_ORAN_DIR}/rtp/meta-oran"
126 echo_cmd "Add the meta-oran layer into the build project"
129 # Add extra configs into local.conf
130 cat << EOF >> conf/local.conf
131 ########################
132 # Configs for oran-inf #
133 ########################
136 WRTEMPLATE += "feature/oran-host-rt-tune"
139 if [ "${EXTRA_CONF}" != "" ] && [ -f "${EXTRA_CONF}" ]; then
140 cat ${EXTRA_CONF} >> conf/local.conf
143 # Build the oran-inf-host image
145 TIMESTAMP=`date +"%Y%m%d_%H%M%S"`
146 RUN_CMD="bitbake ${DRYRUN} oran-image-inf-host"
147 echo_cmd "Build the oran-image-inf-host image"
148 bitbake ${DRYRUN} oran-image-inf-host 2>&1|tee logs/bitbake_oran-image-inf-host_${TIMESTAMP}.log
150 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"