Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame] | 1 | # |
| 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 |
| 20 | set -e |
| 21 | ASFVOLT_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 | |
| 33 | echo ONL_TOPDIR=${ONL_TOPDIR} |
| 34 | echo MAKE_JOBS=${MAKE_JOBS} |
| 35 | echo BALSRC_RELEASE=${BALSRC_RELEASE} |
| 36 | echo VOLTHA_TOPDIR=${VOLTHA_TOPDIR} |
| 37 | echo BALSRC_TOPDIR=${BALSRC_TOPDIR} |
| 38 | echo ASFSRC_TOPDIR=${ASFSRC_TOPDIR} |
| 39 | echo 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 | # |
| 46 | cd ${EDGECORE_DOWNLOAD_DIR}/grpc-c |
| 47 | cp ${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 |
| 52 | cd ${EDGECORE_DOWNLOAD_DIR}/grpc-c/build/examples |
| 53 | cp ${ASFSRC_TOPDIR}/voltha_bal_driver.c ${EDGECORE_DOWNLOAD_DIR}/grpc-c/examples/ |
| 54 | make 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 |
| 61 | cd ${EDGECORE_DOWNLOAD_DIR}/grpc-c/build/examples |
| 62 | sed -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 | |
| 67 | pushd ${ASFSRC_TOPDIR} |
| 68 | sed -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 |
| 71 | popd |
| 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 |
| 78 | make clean_all |
| 79 | make |
| 80 | # |
| 81 | #The ultimate executable voltha_bal_driver can be found under ~/grpc-c/build/examples/.libs/ |
| 82 | |
| 83 | echo "${ASFVOLT_REPO_NAME} build complete" |