blob: 19ce328029974976d74f3dc5f13505d5dd720a68 [file] [log] [blame]
Girish Gowdru9ebd8b22018-09-26 03:21:03 -07001#
2# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16#
17# Run from OpenNetworkLinux top directory
18#
19#cd /aux/OpenNetworkLinux
20set -e
21ASFVOLT_REPO_NAME=asfvolt16-driver
22: ${MAKE_JOBS:=4}
23
24# override shell variables to match custom local build environment
25: ${ONL_TOPDIR:=`pwd`}
26: ${BALSRC_RELEASE=${BROADCOM_DOWNLOAD_DIR}/bal_src_release}
27: ${VOLTHA_TOPDIR:=${HOME}/voltha}
28: ${BALSRC_TOPDIR:=${BALSRC_RELEASE}/bal_release}
29: ${ASFSRC_TOPDIR:=${EDGECORE_DOWNLOAD_DIR}/${ASFVOLT_REPO_NAME}/src}
30: ${PATCHF_TOPDIR:=${EDGECORE_DOWNLOAD_DIR}/${ASFVOLT_REPO_NAME}/patches}
31: ${GRPC_C_PATH:=${EDGECORE_DOWNLOAD_DIR}/grpc-c}
32
33echo ONL_TOPDIR=${ONL_TOPDIR}
34echo MAKE_JOBS=${MAKE_JOBS}
35echo BALSRC_RELEASE=${BALSRC_RELEASE}
36echo VOLTHA_TOPDIR=${VOLTHA_TOPDIR}
37echo BALSRC_TOPDIR=${BALSRC_TOPDIR}
38echo ASFSRC_TOPDIR=${ASFSRC_TOPDIR}
39echo PATCHF_TOPDIR=${PATCHF_TOPDIR}
40
41#To obtain proto files - Have a repo sync of opencord voltha code base:
42# - git clone https://github.com/opencord/voltha.git ${HOME}/voltha
43# - cd ${HOME}/OpenNetworkLinux/grpc-c/
44# - cp ${HOME}/voltha/voltha/adapters/asfvolt16_olt/protos/* examples/
45#
46cd ${EDGECORE_DOWNLOAD_DIR}/grpc-c
47cp ${VOLTHA_TOPDIR}/voltha/adapters/asfvolt16_olt/protos/* examples/
48
49#To autogenerate code from proto files:
50# - cd ${HOME}/OpenNetworkLinux/grpc-c/build/examples
51# - make autogen
52cd ${EDGECORE_DOWNLOAD_DIR}/grpc-c/build/examples
53cp ${ASFSRC_TOPDIR}/voltha_bal_driver.c ${EDGECORE_DOWNLOAD_DIR}/grpc-c/examples/
54make autogen
55
56#
57#Build voltha_bal_driver:
58# - cd ${HOME}/OpenNetworkLinux/grpc-c/build/examples
59# - Note: Remove "-O2" from Makefile
60# - Note: Set EDGECORE and BRCM_PATH in Makefile
61cd ${EDGECORE_DOWNLOAD_DIR}/grpc-c/build/examples
62sed -i -e 's/-O2/-O0/g' \
63 -e "s:^EDGECORE = /home/asfvolt/shared.*:#&\nEDGECORE = ${ASFSRC_TOPDIR}:" \
64 -e "s:^BRCM_PATH = /home/asfvolt/shared.*:#&\nBRCM_PATH = ${BALSRC_TOPDIR}:" \
65 Makefile
66
67pushd ${ASFSRC_TOPDIR}
68sed -i -e "s:^BRDCM_SRC=/home/asfvolt/shared.*:#&\nBRDCM_SRC = ${BALSRC_TOPDIR}:" \
69 -e "s:^GRPC_C_PATH=/home/asfvolt/shared.*:#&\nGRPC_C_PATH = ${GRPC_C_PATH}:" \
70 Makefile
71popd
72
73#```
74# EDGECORE = ${EDGECORE_DOWNLOAD_DIR}/asfvolt16-driver/src/
75# BRCM_PATH = ${BROADCOM_DOWNLOAD_DIR}/bal_src_release/bal_release
76#```
77# - make clean_all;make
78make clean_all
79make
80#
81#The ultimate executable voltha_bal_driver can be found under ~/grpc-c/build/examples/.libs/
82
83echo "${ASFVOLT_REPO_NAME} build complete"