scripts/build_oran.sh: add wrapper script
[pti/rtp.git] / scripts / build_oran.sh
1 #!/bin/sh
2
3 help_info () {
4 cat << ENDHELP
5 Usage:
6 $(basename $0) WORKSPACE_DIR
7 where:
8     WORKSPACE_DIR is the path for the project
9 ENDHELP
10 }
11
12 echo_info () {
13     echo "INFO: $1"
14 }
15
16 echo_error () {
17     echo "ERROR: $1"
18 }
19
20 echo_cmd () {
21     echo
22     echo "$1"
23     echo "CMD: ${RUN_CMD}"
24 }
25
26 if [ $# -eq 0 ]; then
27     help_info
28     exit
29 fi
30
31 SCRIPTS_DIR=`dirname $0`
32 SCRIPTS_DIR=`readlink -f $SCRIPTS_DIR`
33
34 WORKSPACE=`readlink -f $1`
35
36 SRC_WRL_DIR=${WORKSPACE}/src_wrl1018
37 SRC_ORAN_DIR=${WORKSPACE}/src_oran
38 PRJ_BUILD_DIR=${WORKSPACE}/prj_oran-inf
39
40 mkdir -p ${SRC_WRL_DIR} ${PRJ_BUILD_DIR} ${SRC_ORAN_DIR}
41
42 echo_info "The following directories are created in your workspace(${WORKSPACE}):"
43 echo_info "For wrlinux1018 source: ${SRC_WRL_DIR}"
44 echo_info "For oran layer source: ${SRC_ORAN_DIR}"
45 echo_info "For build project: ${PRJ_BUILD_DIR}"
46
47 # Clone the source of WRLinux BASE 10.18 from github and setup
48 RUN_CMD="git clone --branch WRLINUX_10_18_BASE git://github.com/WindRiver-Labs/wrlinux-x.git"
49 echo_cmd "Cloning wrlinux 1018 source from github:"
50 cd ${SRC_WRL_DIR}
51 ${RUN_CMD}
52
53 RUN_CMD="./wrlinux-x/setup.sh --machines intel-x86-64 --layers wrlinux-ovp meta-cloud-services"
54 echo_cmd "Setup wrlinux build project:"
55 ${RUN_CMD}
56
57 # Clone extra layers
58 echo_info "Cloning oran layer:"
59
60 cd ${SRC_ORAN_DIR}
61 RUN_CMD="git clone http://stash.wrs.com/scm/~jhuang0/o-ran-pti-rtp.git"
62 echo_cmd "Cloing with:"
63 ${RUN_CMD}
64
65 # Source the build env
66 cd ${SRC_WRL_DIR}
67 . ./environment-setup-x86_64-wrlinuxsdk-linux
68 set ${PRJ_BUILD_DIR}
69 . ./oe-init-build-env ${PRJ_BUILD_DIR}
70
71 # Add the meta-oran layer and required layers
72 cd ${PRJ_BUILD_DIR}
73 bitbake-layers add-layer ${SRC_ORAN_DIR}/o-ran-pti-rtp/meta-oran
74
75 # Add extra configs into local.conf
76 cat << EOF >> conf/local.conf
77 ########################
78 # Configs for oran-inf #
79 ########################
80 DISTRO = "oran-inf"
81 BB_NO_NETWORK = '0'
82 EOF
83
84 # Build the oran-inf-host image
85 mkdir -p logs
86 TIMESTAMP=`date +"%Y%m%d_%H%M%S"`
87 bitbake wrlinux-image-oran-host 2>&1|tee logs/bitbake_wrlinux-image-oran-host_${TIMESTAMP}.log