For ONL and BAL v3.0 build environment, you could only build for ONL and BAL source codes now.

Change-Id: I23d41b7364f5066355959d63eed94e3394aad024
(cherry picked from commit 355ef92e177a2017e8c3d1fd10fe6095c33cd798)
diff --git a/agent/Makefile.in b/agent/Makefile.in
index 29bdaf3..67ad514 100644
--- a/agent/Makefile.in
+++ b/agent/Makefile.in
@@ -19,6 +19,7 @@
 ##        Config
 ##
 ##
+TOP_DIR=`pwd`
 OPENOLTDEVICE ?= generic
 
 #
@@ -26,14 +27,14 @@
 # SW-BCM68620_<VER>.zip - Broadcom BAL source and Maple SDK.
 # sdk-all-<SDK_VER>.tar.gz - Broadcom Qumran SDK.
 # ACCTON_BAL_<BAL_VER>-<DEV_VER>.patch - Accton/Edgecore's patch.
-BAL_MAJOR_VER = 02.06
-BAL_VER = 2.6.0.1
-SDK_VER = 6.5.7
-DEV_VER ?= 201804301043
+BAL_MAJOR_VER = 03.00
+BAL_VER = 3.0.3.3
+SDK_VER = 6.5.13
+DEV_VER ?= 201904171432
 #
 # Version of Open Network Linux (ONL).
-ONL_KERN_VER_MAJOR = 3.7
-ONL_KERN_VER_MINOR = 10
+ONL_KERN_VER_MAJOR = 4.14
+ONL_KERN_VER_MINOR = 49
 #
 # Build directory
 BUILD_DIR = build
@@ -103,7 +104,9 @@
 onl:
 	if [ ! -d "$(ONL_DIR)/OpenNetworkLinux" ]; then \
 		mkdir -p $(ONL_DIR); \
-		git clone https://gerrit.opencord.org/$(ONL_REPO) $(ONL_DIR); \
+		git clone https://github.com/opencomputeproject/OpenNetworkLinux.git $(ONL_DIR)/OpenNetworkLinux; \
+		cp download/Makefile.onl $(ONL_DIR)/Makefile; \
+		install -m 755 download/build-asfvolt16.sh $(ONL_DIR)/OpenNetworkLinux; \
 		make -C $(ONL_DIR) $(OPENOLTDEVICE)-$(ONL_KERN_VER_MAJOR); \
 	fi;
 onl-force:
@@ -117,16 +120,14 @@
 ##        BAL
 ##
 ##
-BAL_ZIP = SW-BCM68620_$(subst .,_,$(BAL_VER)).zip
+BAL_ZIP = SW-BCM68620_$(subst .,_,$(BAL_VER)).tgz
 SDK_ZIP = sdk-all-$(SDK_VER).tar.gz
 ACCTON_PATCH = ACCTON_BAL_$(BAL_VER)-V$(DEV_VER).patch
 OPENOLT_BAL_PATCH = OPENOLT_BAL_$(BAL_VER).patch
 BAL_DIR = $(BUILD_DIR)/$(OPENOLTDEVICE)-bal
-ONL_KERNDIR = $(PWD)/$(ONL_DIR)/OpenNetworkLinux/packages/base/amd64/kernels/kernel-$(ONL_KERN_VER_MAJOR)-x86-64-all/builds
-MAPLE_KERNDIR = $(BAL_DIR)/bcm68620_release/$(OPENOLTDEVICE)/kernels
-BCM_SDK = $(BAL_DIR)/bal_release/3rdparty/bcm-sdk
-BALLIBDIR = $(BAL_DIR)/bal_release/build/core/src/apps/bal_api_dist_shared_lib
-BALLIBNAME = bal_api_dist
+BCM_SDK = $(BAL_DIR)/switch_sdk/6.5.13
+BALLIBDIR = $(BAL_DIR)/build/asfvolt16-bal/build/lib/libbal_core.so
+BALLIBNAME = bal_core.so
 BAL_INC = -I$(BAL_DIR)/bal_release/src/common/os_abstraction \
 	-I$(BAL_DIR)/bal_release/src/common/os_abstraction/posix \
 	-I$(BAL_DIR)/bal_release/src/common/config \
@@ -150,32 +151,21 @@
 sdk: onl
 ifeq ("$(wildcard $(BAL_DIR))","")
 	mkdir $(BAL_DIR)
-	unzip download/$(BAL_ZIP) -d $(BAL_DIR)
+	tar zxvf download/$(BAL_ZIP) --strip 1 -C $(BAL_DIR)
 	cp download/$(SDK_ZIP) $(BCM_SDK)
 	chmod -R 744 $(BAL_DIR)
 	cat download/$(ACCTON_PATCH) | patch -p1 -d $(BAL_DIR)
-	mkdir -p $(MAPLE_KERNDIR)
-	ln -s $(ONL_KERNDIR)/linux-$(ONL_KERN_VER) $(MAPLE_KERNDIR)/linux-$(ONL_KERN_VER)
-	ln -s $(ONL_DIR)/OpenNetworkLinux/packages/base/any/kernels/archives/linux-$(ONL_KERN_VER).tar.xz $(MAPLE_KERNDIR)/linux-$(ONL_KERN_VER).tar.xz
-	ln -s $(ONL_DIR)/OpenNetworkLinux/packages/base/any/kernels/$(ONL_KERN_VER_MAJOR)/configs/x86_64-all/x86_64-all.config $(MAPLE_KERNDIR)/x86_64-all.config
-	make -C $(BAL_DIR)/bal_release BOARD=$(OPENOLTDEVICE) maple_sdk_dir
-	cat download/$(OPENOLT_BAL_PATCH) | patch -p1 -d $(BAL_DIR)
-	make -C $(BAL_DIR)/bal_release BOARD=$(OPENOLTDEVICE) maple_sdk
-	make -C $(BAL_DIR)/bal_release BOARD=$(OPENOLTDEVICE) switch_sdk_dir
-	make -C $(BAL_DIR)/bal_release BOARD=$(OPENOLTDEVICE) switch_sdk
-	KERNDIR=$(ONL_KERNDIR)/linux-$(ONL_KERN_VER) BOARD=$(OPENOLTDEVICE) ARCH=x86_64 SDKBUILD=build_bcm_user make -C $(BCM_SDK)/build-$(OPENOLTDEVICE)/sdk-all-$(SDK_VER)/systems/linux/user/x86-generic_64-2_6
-	make -C $(BAL_DIR)/bal_release BOARD=$(OPENOLTDEVICE) bal
-	echo 'auto_create_interface_tm=y' >> $(BAL_DIR)/bal_release/3rdparty/maple/cur/$(OPENOLTDEVICE)/board_files/broadcom/bal_config.ini
-	make -C $(BAL_DIR)/bal_release BOARD=$(OPENOLTDEVICE) release_board
+	make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) ONL_DIR=$(TOP_DIR)/$(ONL_DIR)/OpenNetworkLinux SW_UTIL_SHELL=y
+	echo 'auto_create_interface_tm=y' >> $(BAL_DIR)/build/fs/$(OPENOLTDEVICE)/board_files/broadcom/bal_config.ini
+	make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) release_board
 endif
 
-bal: sdk
-	make -C $(BAL_DIR)/bal_release BOARD=$(OPENOLTDEVICE) bal
-	echo 'auto_create_interface_tm=y' >> $(BAL_DIR)/bal_release/3rdparty/maple/cur/asfvolt16/board_files/broadcom/bal_config.ini
-	make -C $(BAL_DIR)/bal_release BOARD=$(OPENOLTDEVICE) release_board
+bal-release: sdk
+	echo 'auto_create_interface_tm=y' >> $(BAL_DIR)/build/fs/$(OPENOLTDEVICE)/board_files/broadcom/bal_config.ini
+	make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) release_board
 
 bal-clean:
-	make -C $(BAL_DIR)/bal_release BOARD=$(OPENOLTDEVICE) clean_bal
+	make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) clean
 
 ########################################################################
 ##
@@ -239,7 +229,10 @@
 OBJS = $(SRCS:.cc=.o)
 DEPS = $(SRCS:.cc=.d)
 .DEFAULT_GOAL := all
-all: $(BUILD_DIR)/openolt
+#all: $(BUILD_DIR)/openolt
+all: notes onl sdk
+notes:
+	echo "\033[1;31m!!! The OpenOLT source codes is not yet support the BAL V3.0, so ignoring to build !!!\033[0m"
 $(BUILD_DIR)/openolt: sdk protos $(OBJS)
 	$(CXX) $(LDFLAGS) -L$(BALLIBDIR) $(OBJS) $(OPENOLT_API_LIB) $(LIBPROTOBUF_PATH)/libprotobuf.a -o $@ -l$(BALLIBNAME) $(shell pkg-config --libs protobuf grpc++ grpc)
 	ln -sf $(PWD)/$(BAL_DIR)/bcm68620_release/$(OPENOLTDEVICE)/release/release_$(OPENOLTDEVICE)_V$(BAL_MAJOR_VER).$(DEV_VER).tar.gz $(BUILD_DIR)/.
diff --git a/agent/download/Makefile.onl b/agent/download/Makefile.onl
new file mode 100644
index 0000000..a025194
--- /dev/null
+++ b/agent/download/Makefile.onl
@@ -0,0 +1,16 @@
+# Copyright (C) 2018 Makefile
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+asfvolt16-4.14:
+	cd OpenNetworkLinux && docker/tools/onlbuilder --non-interactive -8 -c ./build-asfvolt16.sh
diff --git a/agent/download/build-asfvolt16.sh b/agent/download/build-asfvolt16.sh
new file mode 100644
index 0000000..ae86073
--- /dev/null
+++ b/agent/download/build-asfvolt16.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+# Copyright (C) 2018 Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+apt-cacher-ng && source setup.env && make amd64
+exit