Joey Armstrong | 0ebb782 | 2023-08-17 14:21:41 -0400 | [diff] [blame] | 1 | # -*- makefile -*- |
| 2 | #Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 3 | # |
Girish Gowdra | a707e7c | 2019-11-07 11:36:13 +0530 | [diff] [blame] | 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 |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 7 | # |
Girish Gowdra | a707e7c | 2019-11-07 11:36:13 +0530 | [diff] [blame] | 8 | #http://www.apache.org/licenses/LICENSE-2.0 |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 9 | # |
Girish Gowdra | a707e7c | 2019-11-07 11:36:13 +0530 | [diff] [blame] | 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. |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 15 | |
| 16 | ######################################################################## |
| 17 | ## |
| 18 | ## |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 19 | ## Config |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 20 | ## |
| 21 | ## |
Girish Gowdra | 5287fde | 2021-07-31 00:41:45 +0000 | [diff] [blame] | 22 | TOP_DIR=$(shell pwd) |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame] | 23 | OPENOLTDEVICE ?= generic |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 24 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 25 | # |
| 26 | # Three vendor proprietary source files are required to build BAL. |
| 27 | # SW-BCM68620_<VER>.zip - Broadcom BAL source and Maple SDK. |
| 28 | # sdk-all-<SDK_VER>.tar.gz - Broadcom Qumran SDK. |
Craig Lutgen | f040dba | 2018-09-27 11:21:43 -0500 | [diff] [blame] | 29 | # ACCTON_BAL_<BAL_VER>-<DEV_VER>.patch - Accton/Edgecore's patch. |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 30 | BAL_MAJOR_VER = 3 |
Girish Gowdra | 5287fde | 2021-07-31 00:41:45 +0000 | [diff] [blame] | 31 | BAL_MINOR_VER = 10 |
| 32 | BAL_REV_HOST_VER = 2 |
| 33 | BAL_REV_EMBEDDED_VER = 2 |
| 34 | BAL_API_SO_VER = $(BAL_MAJOR_VER).$(BAL_MINOR_VER).$(BAL_REV_HOST_VER) |
| 35 | BAL_VER = $(BAL_API_SO_VER).$(BAL_REV_EMBEDDED_VER) |
Thiyagarajan Subramani | 4e62e17 | 2021-06-25 17:31:30 +0530 | [diff] [blame] | 36 | ifeq ("$(strip $(OPENOLTDEVICE))",$(findstring "$(strip $(OPENOLTDEVICE))", "rlt-3200g-w" "rlt-1600g-w" "rlt-1600x-w")) |
Thiyagarajan Subramani | af1a5fb | 2022-02-24 18:32:05 +0530 | [diff] [blame] | 37 | DEV_VER = 20211129 |
Thiyagarajan Subramani | 4e62e17 | 2021-06-25 17:31:30 +0530 | [diff] [blame] | 38 | # Version of Open Network Linux (ONL). |
| 39 | ONL_KERN_VER_MAJOR = 4.19 |
Arthur Syu | 094df16 | 2022-04-21 17:50:06 +0800 | [diff] [blame] | 40 | else ifeq ("$(strip $(OPENOLTDEVICE))","sda3016ss") |
| 41 | BAL_VER = 3.10.0.0 |
| 42 | DEV_VER = 20220425 |
Thiyagarajan Subramani | 4e62e17 | 2021-06-25 17:31:30 +0530 | [diff] [blame] | 43 | else |
Girish Gowdra | 5287fde | 2021-07-31 00:41:45 +0000 | [diff] [blame] | 44 | DEV_VER = 202111040101 |
| 45 | API_VER = 202111090101 |
| 46 | # Version of Open Network Linux (ONL). |
Thiyagarajan Subramani | 4e62e17 | 2021-06-25 17:31:30 +0530 | [diff] [blame] | 47 | ONL_KERN_VER_MAJOR = 4.14 |
| 48 | endif |
Girish Gowdra | 5287fde | 2021-07-31 00:41:45 +0000 | [diff] [blame] | 49 | SDK_VER = 6.5.21 |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 50 | |
| 51 | # OpenOLT Proto version. |
| 52 | # This specifies the GIT tag in https://github.com/opencord/voltha-protos |
| 53 | # repo that we need to refer to, to pick the right version of |
| 54 | # openolt.proto and tech_profile.proto |
Fridolin Siegmund | 94ab2ff | 2023-09-04 12:02:47 +0200 | [diff] [blame] | 55 | OPENOLT_PROTO_VER ?= v5.4.10 |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 56 | |
Thiyagarajan Subramani | e84935d | 2020-04-23 17:45:44 +0530 | [diff] [blame] | 57 | # Variables used for Inband build |
| 58 | INBAND = "n" |
| 59 | VLAN_ID = 4093 |
| 60 | |
Jason Huang | dc83ba7 | 2020-11-16 22:08:43 +0800 | [diff] [blame] | 61 | # NNI ports speed setting |
| 62 | PORT_100G_SPEED ?= 100000 |
| 63 | PORT_25G_SPEED ?= 25000 |
Thiyagarajan Subramani | 4e62e17 | 2021-06-25 17:31:30 +0530 | [diff] [blame] | 64 | ifeq ("$(strip $(OPENOLTDEVICE))",$(findstring "$(strip $(OPENOLTDEVICE))", "rlt-3200g-w" "rlt-1600g-w")) |
| 65 | PORT_QSFP_SPEED ?= 40g |
| 66 | PORT_SFP_SPEED ?= 10g |
| 67 | else ifeq ("$(strip $(OPENOLTDEVICE))","rlt-1600x-w") |
| 68 | PORT_QSFP_SPEED ?= 100g |
| 69 | PORT_SFP_SPEED ?= 25g |
| 70 | endif |
Jason Huang | dc83ba7 | 2020-11-16 22:08:43 +0800 | [diff] [blame] | 71 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 72 | # Build directory |
| 73 | BUILD_DIR = build |
Girish Gowdra | ddf9a16 | 2020-01-27 12:56:27 +0530 | [diff] [blame] | 74 | |
Orhan Kupusoglu | ec57af0 | 2021-05-12 12:38:17 +0000 | [diff] [blame] | 75 | # Rx optical power test app |
| 76 | RXTX_POWER_EXE = read_rxtx_power |
| 77 | |
Girish Gowdra | 252f497 | 2020-09-07 21:24:01 -0700 | [diff] [blame] | 78 | # initialiaze path of protoc binary |
Girish Gowdra | 489425a | 2020-02-22 13:07:42 +0530 | [diff] [blame] | 79 | protoc-bin = $(shell which protoc) |
Girish Gowdra | ddf9a16 | 2020-01-27 12:56:27 +0530 | [diff] [blame] | 80 | |
Girish Gowdra | 252f497 | 2020-09-07 21:24:01 -0700 | [diff] [blame] | 81 | # initialiaze path of grpc_cpp_plugin binary |
Girish Gowdra | 489425a | 2020-02-22 13:07:42 +0530 | [diff] [blame] | 82 | grpc-cpp-plugin-bin = $(shell which grpc_cpp_plugin) |
Shad Ansari | 2cddc55 | 2018-06-26 20:34:27 +0000 | [diff] [blame] | 83 | |
| 84 | USER := $(shell echo $(USER)) |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 85 | # |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 86 | ######################################################################## |
| 87 | ## |
| 88 | ## |
Girish Gowdra | 252f497 | 2020-09-07 21:24:01 -0700 | [diff] [blame] | 89 | ## Initialize various build flags |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 90 | ## |
| 91 | ## |
| 92 | HOST_SYSTEM = $(shell uname | cut -f 1 -d_) |
| 93 | SYSTEM ?= $(HOST_SYSTEM) |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 94 | |
Humera Kouser | 5ac5661 | 2019-07-25 20:23:01 -0400 | [diff] [blame] | 95 | VERSION ?= $(shell cat ../VERSION) |
| 96 | |
| 97 | #set ref and commit date only if committed |
| 98 | LABEL_VCS_URL ?= $(shell git remote get-url $(shell git remote)) |
| 99 | LABEL_VCS_REF = $(shell git rev-parse HEAD) |
| 100 | LABEL_BUILD_DATE ?= $(shell date -u "+%Y-%m-%dT%H:%M:%SZ") |
| 101 | LABEL_COMMIT_DATE = $(shell git show -s --format=%cd --date=iso-strict HEAD) |
| 102 | |
Craig Lutgen | f040dba | 2018-09-27 11:21:43 -0500 | [diff] [blame] | 103 | LIBGRPC_PATH=$(shell pkg-config --libs-only-L grpc | sed s/-L// | sed s/\ //g) |
Girish Gowdra | 252f497 | 2020-09-07 21:24:01 -0700 | [diff] [blame] | 104 | LIBZ_PATH=$(shell pkg-config --libs-only-L zlib | sed s/-L// | sed s/\ //g) |
Craig Lutgen | f040dba | 2018-09-27 11:21:43 -0500 | [diff] [blame] | 105 | LIBPROTOBUF_PATH=$(shell PKG_CONFIG_ALLOW_SYSTEM_LIBS=true pkg-config --libs-only-L protobuf | sed s/-L// | sed s/\ //g) |
| 106 | |
Girish Gowdra | 1935e6a | 2020-10-31 21:48:22 -0700 | [diff] [blame] | 107 | PCAPPLUSPLUS_INCLUDE_PATH=-I/usr/local/include/pcapplusplus/ |
| 108 | PCAPPLUSPLUS_LIB_PATH=-lPcap++ -lPacket++ -lCommon++ |
| 109 | |
Thiyagarajan Subramani | 4e62e17 | 2021-06-25 17:31:30 +0530 | [diff] [blame] | 110 | ifeq ("$(strip $(OPENOLTDEVICE))",$(findstring "$(strip $(OPENOLTDEVICE))", "rlt-3200g-w" "rlt-1600g-w" "rlt-1600x-w")) |
| 111 | CXX = @CXX@-6 |
| 112 | else |
| 113 | CXX = @CXX@-4.9 |
| 114 | endif |
Craig Lutgen | f040dba | 2018-09-27 11:21:43 -0500 | [diff] [blame] | 115 | CXXFLAGS += @CXXFLAGS@ |
| 116 | CXXFLAGS += $(shell pkg-config --cflags-only-I grpc++) |
Girish Gowdra | 1935e6a | 2020-10-31 21:48:22 -0700 | [diff] [blame] | 117 | CXXFLAGS += $(PCAPPLUSPLUS_INCLUDE_PATH) |
Humera Kouser | 5ac5661 | 2019-07-25 20:23:01 -0400 | [diff] [blame] | 118 | CPPFLAGS += @CPPFLAGS@ |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 119 | CPPFLAGS += `pkg-config --cflags protobuf grpc` |
Girish Gowdra | 252f497 | 2020-09-07 21:24:01 -0700 | [diff] [blame] | 120 | |
| 121 | # Enabling SCALE_AND_PERF for higher performance and scaling to 512 subscribers. Enabling the flag will |
| 122 | # disable the handling in FLOW_CHECKER and also disable flow statistics |
Humera Kouser | 5ac5661 | 2019-07-25 20:23:01 -0400 | [diff] [blame] | 123 | CPPFLAGS += -DVERSION=\"$(VERSION)\" -DBAL_VER=\"$(BAL_VER)\" -DLABEL_VCS_URL=\"$(LABEL_VCS_URL)\" \ |
| 124 | -DLABEL_VCS_REF=\"$(LABEL_VCS_REF)\" -DLABEL_BUILD_DATE=\"$(LABEL_BUILD_DATE)\" \ |
Girish Gowdra | 5287fde | 2021-07-31 00:41:45 +0000 | [diff] [blame] | 125 | -DLABEL_COMMIT_DATE=\"$(LABEL_COMMIT_DATE)\" -DFLOW_CHECKER -USCALE_AND_PERF |
Humera Kouser | 6143c9e | 2020-06-17 22:37:31 +0530 | [diff] [blame] | 126 | CPPFLAGS += -I./ |
Craig Lutgen | 7ebee13 | 2018-11-16 15:31:11 -0600 | [diff] [blame] | 127 | CXXFLAGS += -std=c++11 -fpermissive -Wno-literal-suffix |
Craig Lutgen | f040dba | 2018-09-27 11:21:43 -0500 | [diff] [blame] | 128 | LDFLAGS += @LDFLAGS@ |
| 129 | LDFLAGS += `pkg-config --libs protobuf grpc++ grpc` -ldl -lgpr |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame] | 130 | CXXFLAGSDEVICE = -I./device -I./device/$(OPENOLTDEVICE) -I./device/generic |
Craig Lutgen | f040dba | 2018-09-27 11:21:43 -0500 | [diff] [blame] | 131 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 132 | export CXX CXXFLAGS OPENOLT_PROTO_VER |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 133 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 134 | ######################################################################## |
| 135 | ## |
| 136 | ## |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 137 | ## ONL |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 138 | ## |
| 139 | ## |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 140 | ONL_REPO = onl |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 141 | ONL_DIR = $(BUILD_DIR)/$(ONL_REPO) |
Arthur Syu | 094df16 | 2022-04-21 17:50:06 +0800 | [diff] [blame] | 142 | ONL_COMMIT_ID = 11ed2140 |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 143 | onl: |
| 144 | if [ ! -d "$(ONL_DIR)/OpenNetworkLinux" ]; then \ |
| 145 | mkdir -p $(ONL_DIR); \ |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 146 | git clone https://github.com/opencomputeproject/OpenNetworkLinux.git $(ONL_DIR)/OpenNetworkLinux; \ |
Arthur Syu | 094df16 | 2022-04-21 17:50:06 +0800 | [diff] [blame] | 147 | if [ "$(OPENOLTDEVICE)" = "sda3016ss" ]; then \ |
| 148 | tar zxvf download/onl_zyxel_sda3016ss.tar.gz -C $(ONL_DIR)/OpenNetworkLinux; \ |
| 149 | cp download/onl_workaround.patch $(ONL_DIR)/OpenNetworkLinux; \ |
| 150 | cd $(ONL_DIR)/OpenNetworkLinux; \ |
| 151 | git checkout $(ONL_COMMIT_ID); \ |
| 152 | git apply --whitespace=nowarn onl_zyxel_sda3016ss.patch; \ |
| 153 | git apply --whitespace=nowarn onl_workaround.patch; \ |
| 154 | export VERSION=8; \ |
| 155 | make docker; \ |
| 156 | cd packages/base/amd64/kernels/kernel-4.19-lts-x86-64-all/builds/jessie; tar zcf linux-4.19.81.tgz linux-4.19.81; \ |
| 157 | mv $(BUILD_DIR)/$(ONL_REPO)/OpenNetworkLinux/packages/base/amd64/kernels/kernel-4.19-lts-x86-64-all/builds/jessie/linux-4.19.81.tgz download/; \ |
| 158 | else \ |
| 159 | cp download/Makefile.onl $(ONL_DIR)/Makefile; \ |
| 160 | install -m 755 download/build-onl.sh $(ONL_DIR)/OpenNetworkLinux; \ |
| 161 | cp download/disable-certificate-validation*.patch $(ONL_DIR)/OpenNetworkLinux; \ |
| 162 | if [ "$(OPENOLTDEVICE)" = "rlt-3200g-w" ] || [ "$(OPENOLTDEVICE)" = "rlt-1600g-w" ] || [ "$(OPENOLTDEVICE)" = "rlt-1600x-w" ]; \ |
| 163 | then \ |
| 164 | cp $(TOP_DIR)/device/$(OPENOLTDEVICE)/update_kernel_options.sh $(ONL_DIR)/OpenNetworkLinux/.; \ |
| 165 | chmod 0755 $(ONL_DIR)/OpenNetworkLinux/update_kernel_options.sh; \ |
| 166 | fi; \ |
| 167 | make -C $(ONL_DIR) onl-$(ONL_KERN_VER_MAJOR) INBAND=n BOARD=$(OPENOLTDEVICE); \ |
Thiyagarajan Subramani | 3e8bfd9 | 2021-04-26 15:07:14 +0530 | [diff] [blame] | 168 | fi; \ |
Thiyagarajan Subramani | e84935d | 2020-04-23 17:45:44 +0530 | [diff] [blame] | 169 | else \ |
| 170 | if [ "$(INBAND)" = n -a "$$(grep "inband" $(ONL_DIR)/onl_build.mode | cut -d= -f 2)" = y ]; then \ |
| 171 | make -C $(ONL_DIR) onl-$(ONL_KERN_VER_MAJOR) INBAND=n; \ |
| 172 | fi; \ |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 173 | fi; |
| 174 | onl-force: |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame] | 175 | make -C $(ONL_DIR) $(OPENOLTDEVICE)-$(ONL_KERN_VER_MAJOR) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 176 | distclean-onl: |
| 177 | sudo rm -rf $(ONL_DIR) |
| 178 | |
Girish Gowdra | 5287fde | 2021-07-31 00:41:45 +0000 | [diff] [blame] | 179 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 180 | ######################################################################## |
| 181 | ## |
| 182 | ## |
Girish Gowdra | 5287fde | 2021-07-31 00:41:45 +0000 | [diff] [blame] | 183 | ## Broadcom LIBRARY OSS API |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 184 | ## |
| 185 | ## |
Girish Gowdra | 5287fde | 2021-07-31 00:41:45 +0000 | [diff] [blame] | 186 | BAL_API_DIR = $(TOP_DIR)/$(BUILD_DIR)/bal-oss-api-$(BAL_VER) |
| 187 | BAL_API_PATCH = ACCTON_BAL_API_$(BAL_VER)-V$(API_VER).patch |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 188 | |
Girish Gowdra | 5287fde | 2021-07-31 00:41:45 +0000 | [diff] [blame] | 189 | $(BUILD_DIR)/libbal_host_api-oss.so: |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 190 | if [ ! -d "$(BAL_API_DIR)" ]; then \ |
| 191 | mkdir -p $(BAL_API_DIR); \ |
Girish Gowdra | 5287fde | 2021-07-31 00:41:45 +0000 | [diff] [blame] | 192 | cd $(BAL_API_DIR); \ |
| 193 | git clone https://github.com/balapi/bal-sdk.git -b $(BAL_VER); \ |
| 194 | mv bal-sdk bal-sdk-$(BAL_VER); \ |
Thiyagarajan Subramani | af1a5fb | 2022-02-24 18:32:05 +0530 | [diff] [blame] | 195 | if [ "$(OPENOLTDEVICE)" = "rlt-3200g-w" ] || [ "$(OPENOLTDEVICE)" = "rlt-1600g-w" ] || [ "$(OPENOLTDEVICE)" = "rlt-1600x-w" ]; \ |
| 196 | then \ |
| 197 | cd $(BAL_API_DIR)/bal-sdk-$(BAL_VER); \ |
| 198 | make; \ |
| 199 | cp build/fs/libbal_host_api-oss.$(BAL_API_SO_VER).so ../../../$(BUILD_DIR)/libbal_host_api-oss.so; \ |
| 200 | cd .. && ln -s bal-sdk-$(BAL_VER)/build/fs/include include; \ |
| 201 | cd; \ |
| 202 | else \ |
| 203 | cat $(TOP_DIR)/download/$(BAL_API_PATCH) | patch -p1 -d $(BAL_API_DIR)/bal-sdk-$(BAL_VER); \ |
| 204 | cd $(BAL_API_DIR)/bal-sdk-$(BAL_VER); \ |
| 205 | make BOARD=$(OPENOLTDEVICE); \ |
| 206 | cp build/fs/libbal_host_api-oss.$(BAL_API_SO_VER).so ../../../$(BUILD_DIR)/libbal_host_api-oss.so; \ |
| 207 | cp config/$(OPENOLTDEVICE)/bcm_config.h build/fs/include; \ |
| 208 | cd .. && ln -s bal-sdk-$(BAL_VER)/build/fs/include include; \ |
| 209 | cd; \ |
| 210 | fi; \ |
Girish Gowdra | fc6c0bf | 2022-01-28 18:31:30 -0800 | [diff] [blame] | 211 | else \ |
| 212 | cd $(BAL_API_DIR)/bal-sdk-$(BAL_VER); \ |
| 213 | cp build/fs/libbal_host_api-oss.$(BAL_API_SO_VER).so ../../../$(BUILD_DIR)/libbal_host_api-oss.so; \ |
Thiyagarajan Subramani | af1a5fb | 2022-02-24 18:32:05 +0530 | [diff] [blame] | 214 | if [ "$(OPENOLTDEVICE)" != "rlt-3200g-w" ] && [ "$(OPENOLTDEVICE)" != "rlt-1600g-w" ] && [ "$(OPENOLTDEVICE)" != "rlt-1600x-w" ]; \ |
| 215 | then \ |
| 216 | cp config/$(OPENOLTDEVICE)/bcm_config.h build/fs/include; \ |
| 217 | fi; \ |
Girish Gowdra | fc6c0bf | 2022-01-28 18:31:30 -0800 | [diff] [blame] | 218 | cd .. && ln -s bal-sdk-$(BAL_VER)/build/fs/include include; \ |
| 219 | cd; \ |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 220 | fi; |
Girish Gowdra | 5287fde | 2021-07-31 00:41:45 +0000 | [diff] [blame] | 221 | |
| 222 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 223 | bal-api-clean: |
Girish Gowdra | 5287fde | 2021-07-31 00:41:45 +0000 | [diff] [blame] | 224 | if [ -d "$(BAL_API_DIR)" ]; then \ |
| 225 | rm -rf $(BAL_API_DIR); \ |
| 226 | fi; |
| 227 | rm -rf $(BUILD_DIR)/libbal_host_api-oss.so |
| 228 | |
| 229 | ######################################################################## |
| 230 | # |
| 231 | # Choose api type: open api (api-oss) or proprietary api (api-nda-req) |
| 232 | BAL_API_TYPE = api-oss |
Arthur Syu | 094df16 | 2022-04-21 17:50:06 +0800 | [diff] [blame] | 233 | #BAL_API_TYPE = api-nda_req |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 234 | |
| 235 | ######################################################################## |
| 236 | ## |
| 237 | ## |
Girish Gowdra | 5287fde | 2021-07-31 00:41:45 +0000 | [diff] [blame] | 238 | ## BAL OSS API |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 239 | ## |
| 240 | ## |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame] | 241 | BAL_DIR = $(BUILD_DIR)/$(OPENOLTDEVICE)-bal |
Girish Gowdra | 5287fde | 2021-07-31 00:41:45 +0000 | [diff] [blame] | 242 | BALLIBDIR = $(BUILD_DIR) |
| 243 | BALLIBNAME = bal_host_$(BAL_API_TYPE) |
| 244 | BAL_INC = -I$(BAL_API_DIR)/include |
Arthur Syu | 094df16 | 2022-04-21 17:50:06 +0800 | [diff] [blame] | 245 | ifeq ("$(strip $(OPENOLTDEVICE))","sda3016ss") |
| 246 | BALLIBDIR = $(BAL_DIR)/build/host_reference/host_api |
| 247 | BAL_INC += -I$(BAL_DIR)/host_driver/bal/bal_include \ |
| 248 | -I$(BAL_DIR)/host_driver/topology \ |
| 249 | -I$(BAL_DIR)/host_driver/utils \ |
| 250 | -I$(BAL_DIR)/host_driver/api \ |
| 251 | -I$(BAL_DIR)/host_driver/metadata \ |
| 252 | -I$(BAL_DIR)/host_customized/os_abstraction \ |
| 253 | -I$(BAL_DIR)/host_customized/os_abstraction/posix \ |
| 254 | -I$(BAL_DIR)/host_customized/config \ |
| 255 | -I$(BAL_DIR)/host_driver/api_conn_mgr \ |
| 256 | -I$(BAL_DIR)/host_driver/conn_mgr \ |
| 257 | -I$(BAL_DIR)/host_driver/api/host/topology \ |
| 258 | -I$(BAL_DIR)/host_driver/system_types \ |
| 259 | -I$(BAL_DIR)/host_driver/transport \ |
| 260 | -I$(BAL_DIR)/host_reference/cli \ |
| 261 | -I$(BAL_DIR)/host_reference/api_cli \ |
| 262 | -I$(BAL_DIR)/host_reference/dev_log \ |
| 263 | -I$(BAL_DIR)/host_reference/host_api \ |
| 264 | -I$(BAL_DIR)/lib/cmdline |
| 265 | endif |
Girish Gowdra | 5287fde | 2021-07-31 00:41:45 +0000 | [diff] [blame] | 266 | CXXFLAGS += $(BAL_INC) |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 267 | CXXFLAGS += -DBCMOS_MSG_QUEUE_DOMAIN_SOCKET -DBCMOS_MSG_QUEUE_UDP_SOCKET -DBCMOS_MEM_CHECK -DBCMOS_SYS_UNITTEST -DENABLE_LOG -DENABLE_CLI |
Jason Huang | dc83ba7 | 2020-11-16 22:08:43 +0800 | [diff] [blame] | 268 | PORT_SPEED_FILE = $(BAL_DIR)/switch_sdk/$(SDK_VER)/rc/$(OPENOLTDEVICE)/board_files/broadcom/port_speed.soc |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 269 | |
Girish Gowdra | 5287fde | 2021-07-31 00:41:45 +0000 | [diff] [blame] | 270 | ######################################################################## |
| 271 | ## |
| 272 | ## BAL proprietary elements - NDA is required with Broadcom |
| 273 | ## |
| 274 | ## For Accton patch - contact Accton corporation |
| 275 | ## |
| 276 | ## Not required when building the OpenOLT agent from github source |
| 277 | ## |
| 278 | ## !!!NOTE: libbal_host_api-nda_req.so is proprietary and must not be |
| 279 | ## published in any open debian package or otherwise made |
| 280 | ## available to third parties that do not have an SLA and |
| 281 | ## NDA with Broadcom |
| 282 | ## |
| 283 | BAL_SDK_ZIP = SW-BCM686OLT_$(subst .,_,$(BAL_VER)).tgz |
| 284 | CSG_SDK_ZIP = sdk-all-$(SDK_VER).tar.gz |
| 285 | ACCTON_PATCH = ACCTON_BAL_$(BAL_VER)-V$(DEV_VER).patch |
Thiyagarajan Subramani | af1a5fb | 2022-02-24 18:32:05 +0530 | [diff] [blame] | 286 | RADISYS_PATCH = RADISYS_BAL_$(BAL_VER)_V$(DEV_VER).patch |
Girish Gowdra | 5287fde | 2021-07-31 00:41:45 +0000 | [diff] [blame] | 287 | BROADCOM_IP_PATCH = ACCTON_BAL_$(BAL_VER)-V$(DEV_VER)-BROADCOM-IP.patch |
| 288 | BCM_SWITCH_SDK = $(BAL_DIR)/switch_sdk/$(SDK_VER) |
Arthur Syu | 094df16 | 2022-04-21 17:50:06 +0800 | [diff] [blame] | 289 | ZYXEL_PATCH = ZYXEL_BAL_$(BAL_VER)_V$(DEV_VER).patch |
Girish Gowdra | 5287fde | 2021-07-31 00:41:45 +0000 | [diff] [blame] | 290 | |
| 291 | sdk: onl |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 292 | ifeq ("$(wildcard $(BAL_DIR))","") |
| 293 | mkdir $(BAL_DIR) |
Girish Gowdra | 5287fde | 2021-07-31 00:41:45 +0000 | [diff] [blame] | 294 | tar zxvf download/$(BAL_SDK_ZIP) --strip 1 -C $(BAL_DIR) |
| 295 | cp download/$(CSG_SDK_ZIP) $(BCM_SWITCH_SDK) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 296 | chmod -R 744 $(BAL_DIR) |
Thiyagarajan Subramani | af1a5fb | 2022-02-24 18:32:05 +0530 | [diff] [blame] | 297 | ifeq ("$(strip $(OPENOLTDEVICE))",$(findstring "$(strip $(OPENOLTDEVICE))", "rlt-3200g-w" "rlt-1600g-w" "rlt-1600x-w")) |
| 298 | cat download/$(RADISYS_PATCH) | patch -p1 -d $(BAL_DIR) |
Arthur Syu | 094df16 | 2022-04-21 17:50:06 +0800 | [diff] [blame] | 299 | else ifeq ("$(strip $(OPENOLTDEVICE))","sda3016ss") |
| 300 | tar zxf download/sda3016ss_rootfs.tar.gz -C $(BAL_DIR) |
| 301 | cat download/$(ZYXEL_PATCH) | patch -p1 -d $(BAL_DIR) |
Thiyagarajan Subramani | af1a5fb | 2022-02-24 18:32:05 +0530 | [diff] [blame] | 302 | else |
Girish Gowdra | 5287fde | 2021-07-31 00:41:45 +0000 | [diff] [blame] | 303 | cat download/$(ACCTON_PATCH) | patch -p1 -d $(BAL_DIR) |
| 304 | cat download/$(BROADCOM_IP_PATCH) | patch -p1 -d $(BAL_DIR) |
Thiyagarajan Subramani | af1a5fb | 2022-02-24 18:32:05 +0530 | [diff] [blame] | 305 | endif |
Girish Gowdra | 5287fde | 2021-07-31 00:41:45 +0000 | [diff] [blame] | 306 | |
Jason Huang | dc83ba7 | 2020-11-16 22:08:43 +0800 | [diff] [blame] | 307 | ifeq ("$(strip $(OPENOLTDEVICE))","asfvolt16") |
| 308 | echo "setenv port_speed_for_100 $(PORT_100G_SPEED)" > $(PORT_SPEED_FILE) |
| 309 | else ifeq ("$(strip $(OPENOLTDEVICE))","asgvolt64") |
| 310 | echo "setenv port_speed_for_100 $(PORT_100G_SPEED)" > $(PORT_SPEED_FILE) |
| 311 | echo "setenv port_speed_for_25 $(PORT_25G_SPEED)" >> $(PORT_SPEED_FILE) |
| 312 | endif |
Girish Gowdra | 5287fde | 2021-07-31 00:41:45 +0000 | [diff] [blame] | 313 | |
Thiyagarajan Subramani | 4e62e17 | 2021-06-25 17:31:30 +0530 | [diff] [blame] | 314 | ifeq ("$(strip $(OPENOLTDEVICE))",$(findstring "$(strip $(OPENOLTDEVICE))", "rlt-3200g-w" "rlt-1600g-w" "rlt-1600x-w")) |
Thiyagarajan Subramani | 3e8bfd9 | 2021-04-26 15:07:14 +0530 | [diff] [blame] | 315 | chmod 0755 $(BAL_DIR)/onu_mgmt/libomcistack/me_codegen/omci_stack_codegen |
Thiyagarajan Subramani | af1a5fb | 2022-02-24 18:32:05 +0530 | [diff] [blame] | 316 | chmod 0755 $(BCM_SWITCH_SDK)/sdk_patches_apply.sh |
| 317 | make -C $(BAL_DIR) BOARD=radisys ONL=$(TOP_DIR)/$(ONL_DIR)/OpenNetworkLinux ONL_DEBIAN_SUITE=$(shell lsb_release -c -s) |
| 318 | make -C $(BAL_DIR) BOARD=radisys release_board |
Arthur Syu | 094df16 | 2022-04-21 17:50:06 +0800 | [diff] [blame] | 319 | else ifeq ("$(strip $(OPENOLTDEVICE))","sda3016ss") |
| 320 | cp download/Dockerfile $(BAL_DIR) |
| 321 | tar zxf download/linux-4.19.81.tgz -C $(BAL_DIR) |
| 322 | docker build $(BAL_DIR) -t tt_ub18 |
| 323 | docker run -v $(TOP_DIR)/$(BAL_DIR):/mnt -w /mnt tt_ub18 bash -c 'make' |
| 324 | cp download/sda3016_nni_init.conf $(BAL_DIR)/sda3016ss_rootfs/opt/bcm68620/ |
| 325 | docker run -v $(TOP_DIR)/$(BAL_DIR):/mnt -w /mnt tt_ub18 bash -c 'make release_board' |
Thiyagarajan Subramani | 3e8bfd9 | 2021-04-26 15:07:14 +0530 | [diff] [blame] | 326 | else |
Girish Gowdra | 5287fde | 2021-07-31 00:41:45 +0000 | [diff] [blame] | 327 | make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) ONL_DIR=$(TOP_DIR)/$(ONL_DIR)/OpenNetworkLinux |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 328 | make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) release_board |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 329 | endif |
Thiyagarajan Subramani | 4e62e17 | 2021-06-25 17:31:30 +0530 | [diff] [blame] | 330 | endif |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 331 | |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 332 | bal-clean: |
Arthur Syu | 094df16 | 2022-04-21 17:50:06 +0800 | [diff] [blame] | 333 | ifeq ("$(strip $(OPENOLTDEVICE))","sda3016ss") |
| 334 | docker run -v $(TOP_DIR)/$(BAL_DIR):/mnt -w /mnt tt_ub18 bash -c 'make clean_all' |
| 335 | else |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 336 | make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) clean_all |
Arthur Syu | 094df16 | 2022-04-21 17:50:06 +0800 | [diff] [blame] | 337 | endif |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 338 | ######################################################################## |
| 339 | ## |
| 340 | ## |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 341 | ## OpenOLT API |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 342 | ## |
| 343 | ## |
Shad Ansari | 56c8ea4 | 2018-10-30 19:34:35 +0000 | [diff] [blame] | 344 | OPENOLT_PROTOS_DIR = ../protos |
Shad Ansari | 1924958 | 2018-04-30 04:31:00 +0000 | [diff] [blame] | 345 | OPENOLT_API_LIB = $(OPENOLT_PROTOS_DIR)/libopenoltapi.a |
Girish Gowdra | 252f497 | 2020-09-07 21:24:01 -0700 | [diff] [blame] | 346 | CXXFLAGS += -I$(OPENOLT_PROTOS_DIR) -I./device -I./device/$(OPENOLTDEVICE) -I$(OPENOLT_PROTOS_DIR)/googleapis/gens |
Shad Ansari | 1924958 | 2018-04-30 04:31:00 +0000 | [diff] [blame] | 347 | protos: |
Girish Gowdra | fc6c0bf | 2022-01-28 18:31:30 -0800 | [diff] [blame] | 348 | if [ ! -f "$(OPENOLT_API_LIB)" ]; then \ |
| 349 | make -C $(OPENOLT_PROTOS_DIR) all; \ |
| 350 | fi; |
Shad Ansari | cc01de1 | 2018-05-21 22:54:45 +0000 | [diff] [blame] | 351 | protos-clean: |
Shad Ansari | 1924958 | 2018-04-30 04:31:00 +0000 | [diff] [blame] | 352 | -make -C $(OPENOLT_PROTOS_DIR) clean |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 353 | |
| 354 | ######################################################################## |
| 355 | ## |
| 356 | ## |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 357 | ## common |
Shad Ansari | 7193ae2 | 2018-08-08 22:23:18 +0000 | [diff] [blame] | 358 | ## |
| 359 | ## |
Girish Gowdra | fe64970 | 2019-10-30 12:49:58 +0530 | [diff] [blame] | 360 | |
| 361 | # A hack to force a re-build of common/main.cc everytime. |
| 362 | # This is needed to bake in the git VCS information in the openolt binary |
| 363 | # at the time of building the openolt package. |
| 364 | common/main.o: .FORCE |
| 365 | .FORCE: |
| 366 | $(CXX) $(CXXFLAGS) $(CPPFLAGS) -I./common -c common/main.cc -o common/main.o |
| 367 | |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 368 | common/%.o: common/%.cc |
Humera Kouser | 5ac5661 | 2019-07-25 20:23:01 -0400 | [diff] [blame] | 369 | $(CXX) $(CXXFLAGS) $(CPPFLAGS) -I./common -c $< -o $@ |
Shad Ansari | 7193ae2 | 2018-08-08 22:23:18 +0000 | [diff] [blame] | 370 | |
| 371 | ######################################################################## |
| 372 | ## |
| 373 | ## |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 374 | ## device |
| 375 | ## |
| 376 | ## |
Girish Gowdra | b0337eb | 2022-03-25 16:44:21 -0700 | [diff] [blame] | 377 | device/%.o: device/%.cc |
| 378 | $(CXX) $(CXXFLAGS) $(CXXFLAGSDEVICE) -I./common -I./src -c $< -o $@ |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 379 | |
Girish Gowdra | b0337eb | 2022-03-25 16:44:21 -0700 | [diff] [blame] | 380 | device/$(OPENOLTDEVICE)/%.o: device/$(OPENOLTDEVICE)/%.cc |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 381 | $(CXX) $(CXXFLAGS) $(CXXFLAGSDEVICE) -c $< -o $@ |
| 382 | |
| 383 | ######################################################################## |
| 384 | ## |
| 385 | ## |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 386 | ## openolt |
| 387 | ## |
| 388 | ## |
Humera Kouser | 9c2bd9f | 2020-09-25 02:41:29 -0400 | [diff] [blame] | 389 | OLT_SW_UPGRADE_DIR = ../olt-sw-upgrade |
Girish Gowdra | b0337eb | 2022-03-25 16:44:21 -0700 | [diff] [blame] | 390 | SRCS = $(wildcard src/*.cc) $(wildcard common/*.cc) $(wildcard device/*.cc) $(wildcard device/$(OPENOLTDEVICE)/*.cc) |
Humera Kouser | 9c2bd9f | 2020-09-25 02:41:29 -0400 | [diff] [blame] | 391 | ANSIBLE_DIR = /etc/ansible |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 392 | OBJS = $(SRCS:.cc=.o) |
| 393 | DEPS = $(SRCS:.cc=.d) |
Arthur Syu | 094df16 | 2022-04-21 17:50:06 +0800 | [diff] [blame] | 394 | ZYXEL_DOCKER_PATCH = ZYXEL_Docker_V$(DEV_VER).patch |
| 395 | |
| 396 | ifeq ("$(strip $(OPENOLTDEVICE))","sda3016ss") |
| 397 | PREREQ = sdk |
| 398 | else |
| 399 | PREREQ = $(BUILD_DIR)/lib$(BALLIBNAME).so sdk protos $(OBJS) |
| 400 | endif |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 401 | .DEFAULT_GOAL := all |
Shad Ansari | 2ae2767 | 2019-05-09 00:26:34 +0000 | [diff] [blame] | 402 | all: $(BUILD_DIR)/openolt |
Arthur Syu | 094df16 | 2022-04-21 17:50:06 +0800 | [diff] [blame] | 403 | $(BUILD_DIR)/openolt: $(PREREQ) |
| 404 | ifeq ("$(strip $(OPENOLTDEVICE))","sda3016ss") |
| 405 | if [ ! -f "Dockerfile" ]; then \ |
| 406 | git apply --whitespace=nowarn download/$(ZYXEL_DOCKER_PATCH); \ |
| 407 | fi; |
| 408 | if !(docker images | grep -q onl-builder-8-openolt); then \ |
| 409 | docker build . -t onl-builder-8-openolt; \ |
| 410 | fi; |
| 411 | docker/tools/onlbuilder -8 --isolate -c make -C agent OPENOLTDEVICE=sda3016ss openolt-in-docker |
| 412 | else |
Girish Gowdra | 1935e6a | 2020-10-31 21:48:22 -0700 | [diff] [blame] | 413 | $(CXX) $(LDFLAGS) -L$(BALLIBDIR) $(OBJS) $(OPENOLT_API_LIB) $(LIBPROTOBUF_PATH)/libprotobuf.a -o $@ -l$(BALLIBNAME) $(shell pkg-config --libs protobuf grpc++ grpc) $(PCAPPLUSPLUS_LIB_PATH) |
Thiyagarajan Subramani | af1a5fb | 2022-02-24 18:32:05 +0530 | [diff] [blame] | 414 | ifeq ("$(strip $(OPENOLTDEVICE))",$(findstring "$(strip $(OPENOLTDEVICE))", "rlt-3200g-w" "rlt-1600g-w" "rlt-1600x-w")) |
| 415 | ln -sf $(TOP_DIR)/$(BAL_DIR)/build/fs/radisys/release/release_radisys_v$(BAL_VER).tar.gz $(BUILD_DIR)/release_$(OPENOLTDEVICE)_V$(BAL_VER).$(DEV_VER).tar.gz |
| 416 | else |
Jason Huang | 09b73ea | 2020-01-08 17:52:05 +0800 | [diff] [blame] | 417 | ln -sf $(TOP_DIR)/$(BAL_DIR)/build/fs/$(OPENOLTDEVICE)/release/release_$(OPENOLTDEVICE)_V$(BAL_VER).$(DEV_VER).tar.gz $(BUILD_DIR)/. |
Thiyagarajan Subramani | af1a5fb | 2022-02-24 18:32:05 +0530 | [diff] [blame] | 418 | endif |
Girish Gowdra | 252f497 | 2020-09-07 21:24:01 -0700 | [diff] [blame] | 419 | ln -sf $(LIBGRPC_PATH)/libz.so.1 $(BUILD_DIR)/libz.so.1 |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 420 | ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 $(BUILD_DIR)/libstdc++.so.6 |
| 421 | strip $(BUILD_DIR)/openolt |
Thiyagarajan Subramani | e84935d | 2020-04-23 17:45:44 +0530 | [diff] [blame] | 422 | echo "inband=n" > $(ONL_DIR)/onl_build.mode |
| 423 | if [ $(INBAND) = y ]; then \ |
| 424 | echo "Building ONL+BAL+OpenoltAgent allinone image"; \ |
| 425 | make deb; \ |
| 426 | make inband-onl; \ |
| 427 | fi; |
Arthur Syu | 094df16 | 2022-04-21 17:50:06 +0800 | [diff] [blame] | 428 | endif |
| 429 | |
| 430 | openolt-in-docker: protos $(OBJS) |
| 431 | $(CXX) $(LDFLAGS) -L$(BALLIBDIR) $(OBJS) $(OPENOLT_API_LIB) $(LIBPROTOBUF_PATH)/libprotobuf.a -o $(BUILD_DIR)/openolt -l$(BALLIBNAME) $(shell pkg-config --libs protobuf grpc++ grpc) $(PCAPPLUSPLUS_LIB_PATH) |
| 432 | ln -sf $(TOP_DIR)/$(BAL_DIR)/release_$(OPENOLTDEVICE)_V$(BAL_VER)-$(DEV_VER).tar.gz $(BUILD_DIR)/. |
| 433 | ln -sf $(TOP_DIR)/$(BAL_DIR)/build/host_reference/host_api/strip/libbal_host_$(BAL_API_TYPE).so $(BUILD_DIR)/. |
| 434 | ln -sf $(TOP_DIR)/$(BAL_DIR)/build/host_driver/dev_mgmt_daemon/dev_mgmt_daemon $(BUILD_DIR)/. |
| 435 | ln -sf $(LIBGRPC_PATH)/libz.so.1 $(BUILD_DIR)/libz.so.1 |
| 436 | ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 $(BUILD_DIR)/libstdc++.so.6 |
| 437 | strip $(BUILD_DIR)/openolt |
| 438 | echo "inband=n" > $(ONL_DIR)/onl_build.mode |
| 439 | mkdir -p tmp/opt/openolt |
| 440 | cp build/libbal_host_$(BAL_API_TYPE).so build/openolt tmp/opt/openolt |
| 441 | tar zcf build/release_$(OPENOLTDEVICE)_openolt_V$(BAL_VER)-$(DEV_VER).tar.gz tmp/ |
| 442 | rm -rf tmp |
Thiyagarajan Subramani | e84935d | 2020-04-23 17:45:44 +0530 | [diff] [blame] | 443 | |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 444 | src/%.o: src/%.cc |
Humera Kouser | 5ac5661 | 2019-07-25 20:23:01 -0400 | [diff] [blame] | 445 | $(CXX) $(CXXFLAGS) $(CXXFLAGSDEVICE) $(CPPFLAGS) -I./common -c $< -o $@ |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 446 | |
Orhan Kupusoglu | ec57af0 | 2021-05-12 12:38:17 +0000 | [diff] [blame] | 447 | deb: rxtx-power |
Arthur Syu | 094df16 | 2022-04-21 17:50:06 +0800 | [diff] [blame] | 448 | ifeq ("$(strip $(OPENOLTDEVICE))","sda3016ss") |
| 449 | mkdir -p device/$(OPENOLTDEVICE)/mkdebian/tmp |
| 450 | cp download/release_$(OPENOLTDEVICE)_custom_V2.0.0.1-$(DEV_VER).tar.gz device/$(OPENOLTDEVICE)/mkdebian/tmp |
| 451 | cp $(BUILD_DIR)/release_$(OPENOLTDEVICE)_V$(BAL_VER)-$(DEV_VER) device/$(OPENOLTDEVICE)/mkdebian/tmp |
| 452 | cp $(BUILD_DIR)/release_$(OPENOLTDEVICE)_openolt_V$(BAL_VER)-$(DEV_VER).tar.gz device/$(OPENOLTDEVICE)/mkdebian/tmp |
| 453 | else |
Jason Huang | 09b73ea | 2020-01-08 17:52:05 +0800 | [diff] [blame] | 454 | cp $(BUILD_DIR)/release_$(OPENOLTDEVICE)_V$(BAL_VER).$(DEV_VER).tar.gz device/$(OPENOLTDEVICE)/mkdebian/debian |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 455 | cp $(BUILD_DIR)/openolt device/$(OPENOLTDEVICE)/mkdebian/debian |
Girish Gowdra | 252f497 | 2020-09-07 21:24:01 -0700 | [diff] [blame] | 456 | cp $(BUILD_DIR)/libz.so.1 device/$(OPENOLTDEVICE)/mkdebian/debian |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 457 | cp $(BUILD_DIR)/libstdc++.so.6 device/$(OPENOLTDEVICE)/mkdebian/debian |
Girish Gowdra | 5287fde | 2021-07-31 00:41:45 +0000 | [diff] [blame] | 458 | cp $(BUILD_DIR)/libbal_host_api-oss.so device/$(OPENOLTDEVICE)/mkdebian/debian |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 459 | cp -a scripts/init.d device/$(OPENOLTDEVICE)/mkdebian/debian |
Orhan Kupusoglu | ec57af0 | 2021-05-12 12:38:17 +0000 | [diff] [blame] | 460 | cp -a $(RXTX_POWER_EXE) device/$(OPENOLTDEVICE)/mkdebian/debian |
Arthur Syu | 094df16 | 2022-04-21 17:50:06 +0800 | [diff] [blame] | 461 | cp -a scripts/watchdog device/$(OPENOLTDEVICE)/mkdebian/debian |
| 462 | endif |
Thiyagarajan Subramani | 4e62e17 | 2021-06-25 17:31:30 +0530 | [diff] [blame] | 463 | ifeq ("$(strip $(OPENOLTDEVICE))",$(findstring "$(strip $(OPENOLTDEVICE))", "rlt-3200g-w" "rlt-1600g-w" "rlt-1600x-w")) |
| 464 | sed -i '/\/opt\/bcm68650\/svk_init.sh/c\ \/opt\/bcm68650\/svk_init.sh -qsfp_speed=$(PORT_QSFP_SPEED) -sfp_speed=$(PORT_SFP_SPEED)' device/$(OPENOLTDEVICE)/mkdebian/debian/init.d/dev_mgmt_daemon |
Thiyagarajan Subramani | 3e8bfd9 | 2021-04-26 15:07:14 +0530 | [diff] [blame] | 465 | endif |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 466 | cd device/$(OPENOLTDEVICE)/mkdebian && ./build_$(OPENOLTDEVICE)_deb.sh |
Thiyagarajan Subramani | 3e8bfd9 | 2021-04-26 15:07:14 +0530 | [diff] [blame] | 467 | mv device/$(OPENOLTDEVICE)/$(OPENOLTDEVICE)_*.deb $(BUILD_DIR)/openolt_$(OPENOLTDEVICE)-$(VERSION)-$(LABEL_VCS_REF).deb |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 468 | make deb-cleanup |
Shad Ansari | 6cd46a6 | 2018-05-13 23:20:51 +0000 | [diff] [blame] | 469 | |
Thiyagarajan Subramani | e84935d | 2020-04-23 17:45:44 +0530 | [diff] [blame] | 470 | inband-onl: |
| 471 | # Clean previous ONL build and build freshly |
| 472 | sudo rm -rf $(ONL_DIR) |
| 473 | mkdir -p $(ONL_DIR) |
| 474 | git clone https://github.com/opencomputeproject/OpenNetworkLinux.git $(ONL_DIR)/OpenNetworkLinux |
| 475 | cp download/Makefile.onl $(ONL_DIR)/Makefile |
| 476 | install -m 755 download/build-onl.sh $(ONL_DIR)/OpenNetworkLinux |
| 477 | |
| 478 | # Check ONL commit equals to Inband patch commit |
| 479 | ONL_COMMIT_ID=$(awk \'/COMMIT_ID = /{print $0}\' $(ONL_DIR)/Makefile | awk -F \"=\" \'{print $2}\') |
| 480 | INBAND_PATCH_COMMIT_ID=$(echo cp $(TOP_DIR)/inband/patch/*.patch | cut -d- -f 2 | cut -d. -f 1) |
| 481 | if [ "$(ONL_COMMIT_ID)" = "$(INBAND_PATCH_COMMIT_ID)" ]; then \ |
| 482 | echo "ONL commit and inband patch commit matched."; \ |
| 483 | cp $(TOP_DIR)/inband/patch/*.patch $(ONL_DIR)/OpenNetworkLinux; \ |
Girish Gowdra | a164080 | 2021-11-24 20:24:38 -0800 | [diff] [blame] | 484 | cp $(TOP_DIR)/download/disable-certificate-validation-v*.patch $(ONL_DIR)/OpenNetworkLinux; \ |
Thiyagarajan Subramani | e84935d | 2020-04-23 17:45:44 +0530 | [diff] [blame] | 485 | else \ |
| 486 | echo "ONL commit and inband patch commit does not match. Exiting."; \ |
| 487 | exit 1; \ |
| 488 | fi; |
| 489 | |
Girish Gowdra | 6e74552 | 2020-07-15 15:52:13 -0700 | [diff] [blame] | 490 | # Update inband.config file with VLAN ID argument passed |
| 491 | sed -i 's/asfvolt16_vlan_id_eth2=.*/asfvolt16_vlan_id_eth2=$(VLAN_ID)/' $(TOP_DIR)/inband/config/inband.config |
| 492 | sed -i 's/asgvolt64_vlan_id_eth1=.*/asgvolt64_vlan_id_eth1=$(VLAN_ID)/' $(TOP_DIR)/inband/config/inband.config |
Thiyagarajan Subramani | e84935d | 2020-04-23 17:45:44 +0530 | [diff] [blame] | 493 | |
| 494 | # Copy Inband config files and olt startup scripts to ONL source code and build |
| 495 | cd $(TOP_DIR) && mkdir -p $(ONL_DIR)/OpenNetworkLinux/bal_packages |
| 496 | cp $(TOP_DIR)/inband/scripts/* $(ONL_DIR)/OpenNetworkLinux/bal_packages |
Girish Gowdra | 6e74552 | 2020-07-15 15:52:13 -0700 | [diff] [blame] | 497 | cp $(TOP_DIR)/inband/config/inband.config $(ONL_DIR)/OpenNetworkLinux/bal_packages |
Thiyagarajan Subramani | e84935d | 2020-04-23 17:45:44 +0530 | [diff] [blame] | 498 | cp $(BUILD_DIR)/openolt_$(OPENOLTDEVICE)-$(VERSION)-$(LABEL_VCS_REF).deb $(ONL_DIR)/OpenNetworkLinux/bal_packages/openolt_$(OPENOLTDEVICE).deb |
Humera Kouser | 9c2bd9f | 2020-09-25 02:41:29 -0400 | [diff] [blame] | 499 | cp $(OLT_SW_UPGRADE_DIR)/change_labels.sh $(ONL_DIR)/OpenNetworkLinux/bal_packages |
Thiyagarajan Subramani | e84935d | 2020-04-23 17:45:44 +0530 | [diff] [blame] | 500 | |
| 501 | # Rebuild ONL packed with already built BAL+Openolt debian package |
| 502 | make -C $(ONL_DIR) onl-$(ONL_KERN_VER_MAJOR) INBAND=y |
| 503 | echo "inband=y" > $(ONL_DIR)/onl_build.mode |
| 504 | make inband-onl-cleanup |
Humera Kouser | 9c2bd9f | 2020-09-25 02:41:29 -0400 | [diff] [blame] | 505 | # requires 'sudo' privileges |
| 506 | |
| 507 | ansible: |
| 508 | (ONL_INSTALLED_INSTALLER="$(shell find "$$(cd ./build/onl/OpenNetworkLinux/RELEASE/jessie/amd64; pwd)" -name "ONL-onl-*_AMD64_INSTALLED_INSTALLER")"; \ |
| 509 | rm -rf $(ANSIBLE_DIR)/roles/upgrade/files; \ |
| 510 | mkdir -p $(ANSIBLE_DIR)/roles/upgrade/files; \ |
| 511 | cp ../olt-sw-upgrade/install_onl.sh $(ANSIBLE_DIR)/roles/upgrade/files; \ |
| 512 | chmod +x $(ANSIBLE_DIR)/roles/upgrade/files/*.sh; \ |
| 513 | ln -s $$ONL_INSTALLED_INSTALLER $(ANSIBLE_DIR)/roles/upgrade/files/ONL_INSTALLED_INSTALLER) |
Thiyagarajan Subramani | e84935d | 2020-04-23 17:45:44 +0530 | [diff] [blame] | 514 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 515 | src/%.o: %.cpp |
| 516 | $(CXX) -MMD -c $< -o $@ |
| 517 | |
Orhan Kupusoglu | ec57af0 | 2021-05-12 12:38:17 +0000 | [diff] [blame] | 518 | rxtx-power: clean-rxtx-power |
| 519 | $(CXX) -std=c++11 -DRXTX_POWER_EXE_MODE src/trx_eeprom_reader.cc -o $(RXTX_POWER_EXE) && ls -l $(RXTX_POWER_EXE) |
| 520 | |
| 521 | deb-cleanup: clean-rxtx-power |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 522 | @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/$(OPENOLTDEVICE).debhelper.log |
| 523 | @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/$(OPENOLTDEVICE).postinst.debhelper |
| 524 | @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/$(OPENOLTDEVICE).postrm.debhelper |
| 525 | @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/$(OPENOLTDEVICE).substvars |
| 526 | @rm -rf device/$(OPENOLTDEVICE)/mkdebian/debian/$(OPENOLTDEVICE)/ |
| 527 | @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/debhelper-build-stamp |
Girish Gowdra | 252f497 | 2020-09-07 21:24:01 -0700 | [diff] [blame] | 528 | @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/libz.so.1 |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 529 | @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/libstdc++.so.6 |
Girish Gowdra | 5287fde | 2021-07-31 00:41:45 +0000 | [diff] [blame] | 530 | @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/libbal_host_api-oss.so |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 531 | @rm -rf device/$(OPENOLTDEVICE)/mkdebian/debian/init.d/ |
| 532 | @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/openolt |
Jason Huang | 09b73ea | 2020-01-08 17:52:05 +0800 | [diff] [blame] | 533 | @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/release_$(OPENOLTDEVICE)_V$(BAL_VER).$(DEV_VER).tar.gz |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 534 | @rm -rf device/$(OPENOLTDEVICE)/mkdebian/debian/tmp/ |
| 535 | @rm -f device/$(OPENOLTDEVICE)/$(OPENOLTDEVICE)_$(BAL_VER)+edgecore-V$(DEV_VER)_amd64.changes |
Orhan Kupusoglu | ec57af0 | 2021-05-12 12:38:17 +0000 | [diff] [blame] | 536 | @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/$(RXTX_POWER_EXE) |
Girish Gowdra | b8c09fa | 2021-08-02 10:22:59 -0700 | [diff] [blame] | 537 | @rm -rf device/$(OPENOLTDEVICE)/mkdebian/debian/watchdog/ |
Arthur Syu | 094df16 | 2022-04-21 17:50:06 +0800 | [diff] [blame] | 538 | @rm -rf device/$(OPENOLTDEVICE)/mkdebian/tmp/ |
Shad Ansari | cc01de1 | 2018-05-21 22:54:45 +0000 | [diff] [blame] | 539 | |
Thiyagarajan Subramani | e84935d | 2020-04-23 17:45:44 +0530 | [diff] [blame] | 540 | inband-onl-cleanup: |
| 541 | @rm -f $(ONL_DIR)/OpenNetworkLinux/*.patch |
| 542 | @rm -rf $(ONL_DIR)/OpenNetworkLinux/bal_packages |
| 543 | |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 544 | clean: protos-clean deb-cleanup |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 545 | @rm -f $(OBJS) $(DEPS) |
| 546 | @rm -rf $(OPENOLT_PROTOS_DIR)/googleapis |
Girish Gowdra | 252f497 | 2020-09-07 21:24:01 -0700 | [diff] [blame] | 547 | @rm -f $(BUILD_DIR)/libz.so.1 |
Girish Gowdra | 5287fde | 2021-07-31 00:41:45 +0000 | [diff] [blame] | 548 | @rm -f $(BUILD_DIR)/libbal_host_api-oss.so |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 549 | @rm -f $(BUILD_DIR)/openolt |
Girish Gowdra | ab7ea55 | 2020-01-07 13:25:15 +0530 | [diff] [blame] | 550 | @rm -f $(BUILD_DIR)/dev_mgmt_daemon |
Jason Huang | 09b73ea | 2020-01-08 17:52:05 +0800 | [diff] [blame] | 551 | @rm -f $(BUILD_DIR)/release_$(OPENOLTDEVICE)_V$(BAL_VER).$(DEV_VER).tar.gz |
Girish Gowdra | bc6e085 | 2020-03-26 11:36:12 -0700 | [diff] [blame] | 552 | @rm -f $(BUILD_DIR)/openolt_$(OPENOLTDEVICE)-$(VERSION)-$(LABEL_VCS_REF).deb |
Shad Ansari | 1924958 | 2018-04-30 04:31:00 +0000 | [diff] [blame] | 553 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 554 | clean-src: protos-clean |
| 555 | @rm -f $(OBJS) $(DEPS) |
| 556 | |
Orhan Kupusoglu | ec57af0 | 2021-05-12 12:38:17 +0000 | [diff] [blame] | 557 | clean-rxtx-power: |
| 558 | @rm -f src/$(RXTX_POWER_EXE) |
| 559 | @rm -f $(RXTX_POWER_EXE) |
| 560 | |
Thiyagarajan Subramani | 89fffc0 | 2019-05-13 21:33:20 +0000 | [diff] [blame] | 561 | distclean: clean-src clean |
| 562 | @rm -rf $(BUILD_DIR) |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 563 | |
Humera Kouser | 9c2bd9f | 2020-09-25 02:41:29 -0400 | [diff] [blame] | 564 | .PHONY: onl sdk bal protos inband-onl ansible .FORCE |