blob: ea2231f4d3d7b6a02567fcdc2f98e916d7693b69 [file] [log] [blame]
Jackie Huangb5105bb2019-10-16 14:53:59 +08001#!/bin/bash
Jackie Huang90b87ff2019-09-30 13:36:48 +08002
3help_info () {
4cat << ENDHELP
5Usage:
Jackie Huangbe9f4e22019-10-16 10:02:00 +08006$(basename $0) <-w WORKSPACE_DIR> [-n] [-h]
Jackie Huang90b87ff2019-09-30 13:36:48 +08007where:
Jackie Huangbe9f4e22019-10-16 10:02:00 +08008 -w WORKSPACE_DIR is the path for the project
9 -n dry-run only for bitbake
10 -h this help info
Jackie Huang90b87ff2019-09-30 13:36:48 +080011ENDHELP
12}
13
14echo_info () {
15 echo "INFO: $1"
16}
17
18echo_error () {
19 echo "ERROR: $1"
20}
21
22echo_cmd () {
23 echo
24 echo "$1"
25 echo "CMD: ${RUN_CMD}"
26}
27
28if [ $# -eq 0 ]; then
Jackie Huangbe9f4e22019-10-16 10:02:00 +080029 echo "Missing options!"
Jackie Huang90b87ff2019-09-30 13:36:48 +080030 help_info
31 exit
32fi
33
Jackie Huangbe9f4e22019-10-16 10:02:00 +080034DRYRUN=""
35
Jackie Huang90b87ff2019-09-30 13:36:48 +080036SCRIPTS_DIR=`dirname $0`
37SCRIPTS_DIR=`readlink -f $SCRIPTS_DIR`
38
Jackie Huangbe9f4e22019-10-16 10:02:00 +080039while getopts "w:nh" OPTION; do
40 case ${OPTION} in
41 w)
42 WORKSPACE=`readlink -f ${OPTARG}`
43 ;;
44 n)
45 DRYRUN="-n"
46 ;;
47 h)
48 help_info
49 exit
50 ;;
51 esac
52done
53
54if [ -z ${WORKSPACE} ]; then
55 echo_info "No workspace specified, a directory 'workspace' will be created in current directory as the workspace"
56 WORKSPACE=`readlink -f workspace`
57fi
Jackie Huang90b87ff2019-09-30 13:36:48 +080058
59SRC_WRL_DIR=${WORKSPACE}/src_wrl1018
60SRC_ORAN_DIR=${WORKSPACE}/src_oran
61PRJ_BUILD_DIR=${WORKSPACE}/prj_oran-inf
62
63mkdir -p ${SRC_WRL_DIR} ${PRJ_BUILD_DIR} ${SRC_ORAN_DIR}
64
65echo_info "The following directories are created in your workspace(${WORKSPACE}):"
66echo_info "For wrlinux1018 source: ${SRC_WRL_DIR}"
67echo_info "For oran layer source: ${SRC_ORAN_DIR}"
68echo_info "For build project: ${PRJ_BUILD_DIR}"
69
70# Clone the source of WRLinux BASE 10.18 from github and setup
71RUN_CMD="git clone --branch WRLINUX_10_18_BASE git://github.com/WindRiver-Labs/wrlinux-x.git"
72echo_cmd "Cloning wrlinux 1018 source from github:"
73cd ${SRC_WRL_DIR}
74${RUN_CMD}
75
Jackie Huangda071f82019-09-30 14:33:27 +080076RUN_CMD="./wrlinux-x/setup.sh --machines intel-x86-64 --layers meta-cloud-services"
Jackie Huang90b87ff2019-09-30 13:36:48 +080077echo_cmd "Setup wrlinux build project:"
78${RUN_CMD}
79
80# Clone extra layers
81echo_info "Cloning oran layer:"
82
83cd ${SRC_ORAN_DIR}
Jackie Huang477f99a2019-10-09 20:52:26 +080084RUN_CMD="git clone https://gerrit.o-ran-sc.org/r/pti/rtp"
Jackie Huang90b87ff2019-09-30 13:36:48 +080085echo_cmd "Cloing with:"
86${RUN_CMD}
87
88# Source the build env
89cd ${SRC_WRL_DIR}
90. ./environment-setup-x86_64-wrlinuxsdk-linux
91set ${PRJ_BUILD_DIR}
92. ./oe-init-build-env ${PRJ_BUILD_DIR}
93
94# Add the meta-oran layer and required layers
95cd ${PRJ_BUILD_DIR}
Jackie Huang477f99a2019-10-09 20:52:26 +080096bitbake-layers add-layer ${SRC_ORAN_DIR}/rtp/meta-oran
Jackie Huang90b87ff2019-09-30 13:36:48 +080097
98# Add extra configs into local.conf
99cat << EOF >> conf/local.conf
100########################
101# Configs for oran-inf #
102########################
103DISTRO = "oran-inf"
104BB_NO_NETWORK = '0'
105EOF
106
107# Build the oran-inf-host image
108mkdir -p logs
109TIMESTAMP=`date +"%Y%m%d_%H%M%S"`
Jackie Huangb5105bb2019-10-16 14:53:59 +0800110set -o pipefail
Jackie Huangbe9f4e22019-10-16 10:02:00 +0800111bitbake ${DRYRUN} oran-image-inf-host 2>&1|tee logs/bitbake_oran-image-inf-host_${TIMESTAMP}.log