VOL-793: Makefile debian target for openolt driver
Change-Id: I9d71af17a4adc1d988dd85c76f1af1738c084b86
diff --git a/mkdebian/build_asfvolt16_deb.sh b/mkdebian/build_asfvolt16_deb.sh
new file mode 100755
index 0000000..1aed343
--- /dev/null
+++ b/mkdebian/build_asfvolt16_deb.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+export ONL_ARCH="amd64"
+dpkg-buildpackage -b -us -uc -a"$ONL_ARCH"
+
diff --git a/mkdebian/debian/asfvolt16.install b/mkdebian/debian/asfvolt16.install
new file mode 100644
index 0000000..ceeb05b
--- /dev/null
+++ b/mkdebian/debian/asfvolt16.install
@@ -0,0 +1 @@
+/tmp
diff --git a/mkdebian/debian/asfvolt16.postinst b/mkdebian/debian/asfvolt16.postinst
new file mode 100644
index 0000000..8c4e661
--- /dev/null
+++ b/mkdebian/debian/asfvolt16.postinst
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+rm -rf /opt/bcm68620
+rm -rf /broadcom
+rm -rf /run/bcm68620
+tar zxf /tmp/release_asfvolt16.tar.gz -C / 2>&1 > /dev/null
+source /root/.bashrc
+/sbin/ldconfig
+/opt/bcm68620/svk_init.sh
diff --git a/mkdebian/debian/asfvolt16.preinst b/mkdebian/debian/asfvolt16.preinst
new file mode 100644
index 0000000..d2b2335
--- /dev/null
+++ b/mkdebian/debian/asfvolt16.preinst
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+# kill CLI applications
+echo "kill running time application"
+[ -n "`pidof bcm_user_appl`" ] && killall bcm_user_appl
+[ -n "`pidof bcm.user`" ] && killall bcm.user
+[ -n "`pidof bcm_sdn_agent`" ] && killall bcm_sdn_agent
+[ -n "`pidof bal_core_dist`" ] && killall bal_core_dist
+[ -n "`pidof voltha_bal_driver`" ] && killall voltha_bal_driver
+
+# unload drivers
+echo "unload kernel drivers"
+[ -n "`lsmod | grep bcm_coop_dba_linux`" ] && rmmod bcm_coop_dba_linux && sleep 1
+[ -n "`lsmod | grep bcm_dev_ctrl_linux`" ] && rmmod bcm_dev_ctrl_linux && sleep 1
+[ -n "`lsmod | grep i2c_devs`" ] && rmmod i2c_devs && sleep 1
+[ -n "`lsmod | grep os_linux`" ] && rmmod os_linux && sleep 1
+[ -n "`lsmod | grep ll_pcie`" ] && rmmod ll_pcie && sleep 1
+[ -n "`lsmod | grep linux_user_bde`" ] && rmmod linux-user-bde && sleep 1
+[ -n "`lsmod | grep linux_kernel_bde`" ] && rmmod linux-kernel-bde && sleep 1
+rm -rf /dev/maple_i2c
+rm -rf /dev/bcm_log
+rm -rf /dev/maple_dev_ctrl
+rm -rf /dev/linux-user-bde
+rm -rf /dev/linux-kernel-bde
+rm -rf /dev/coop_dba
+
diff --git a/mkdebian/debian/asfvolt16.substvars b/mkdebian/debian/asfvolt16.substvars
new file mode 100644
index 0000000..abd3ebe
--- /dev/null
+++ b/mkdebian/debian/asfvolt16.substvars
@@ -0,0 +1 @@
+misc:Depends=
diff --git a/mkdebian/debian/changelog b/mkdebian/debian/changelog
new file mode 100644
index 0000000..286153c
--- /dev/null
+++ b/mkdebian/debian/changelog
@@ -0,0 +1,8 @@
+asfvolt16 (2.4.3.6+accton1.1-0) stable; urgency=high
+
+ * Added Pre-emphasis adjustment on the Qumran
+ * Added Qumran LED function
+ * Patch file name: ACCTON_BAL_2.4.6.10-V201711151812.patch
+
+ -- Jason Huang <jasonsc_huang@edge-core.com> Thu, 15 Nov 2017 18:12:32 +0800
+
diff --git a/mkdebian/debian/compat b/mkdebian/debian/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/mkdebian/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/mkdebian/debian/control b/mkdebian/debian/control
new file mode 100644
index 0000000..dd12b49
--- /dev/null
+++ b/mkdebian/debian/control
@@ -0,0 +1,13 @@
+Source: asfvolt16
+Section: misc
+Priority: optional
+Maintainer: Jason Huang <jasonsc_huang@edge-core.com>
+Build-Depends: debhelper (>= 4.0.0)
+Standards-Version: 3.6.2
+
+Package: asfvolt16
+Architecture: amd64
+Depends: ${shlibs:Depends}
+Description: Broadcom OLT drivers and CLI
+ ported from Broadcom SDK-2.4.3.6 package
+
diff --git a/mkdebian/debian/copyright b/mkdebian/debian/copyright
new file mode 100644
index 0000000..0e527f0
--- /dev/null
+++ b/mkdebian/debian/copyright
@@ -0,0 +1 @@
+(C) Copyright Broadcom Corporation 2003-2016
diff --git a/mkdebian/debian/files b/mkdebian/debian/files
new file mode 100644
index 0000000..33ff7dc
--- /dev/null
+++ b/mkdebian/debian/files
@@ -0,0 +1 @@
+asfvolt16_2.4.3.6+accton1.1-0_amd64.deb misc optional
diff --git a/mkdebian/debian/rules b/mkdebian/debian/rules
new file mode 100755
index 0000000..dbb836f
--- /dev/null
+++ b/mkdebian/debian/rules
@@ -0,0 +1,67 @@
+#!/usr/bin/make -f
+# See debhelper(7) (uncomment to enable)
+# output every command that modifies files on the build system.
+#DH_VERBOSE = 1
+
+# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
+DPKG_EXPORT_BUILDFLAGS = 1
+include /usr/share/dpkg/default.mk
+
+# see FEATURE AREAS in dpkg-buildflags(1)
+#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
+
+# see ENVIRONMENT in dpkg-buildflags(1)
+# package maintainers to append CFLAGS
+#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
+# package maintainers to append LDFLAGS
+#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
+
+# main packaging script based on dh7 syntax
+%:
+ dh $@
+
+DOCS=LEGAL_TERMS README LICENSE_APACHE20
+
+DEB_DH_INSTALL_SOURCEDIR = $(CURDIR)/debian/tmp
+
+override_dh_auto_install:
+ mkdir -p $(DEB_DH_INSTALL_SOURCEDIR)/tmp
+ cp -a $(CURDIR)/debian/release_asfvolt16.tar.gz $(DEB_DH_INSTALL_SOURCEDIR)/tmp
+
+#override_dh_shlibdeps:
+# dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info -l$(ONLP_LIB_PATH):$(OFDPA_LIB_PATH)
+
+# avoid auto strip for debug ofagentapp.dbg
+#
+#override_dh_strip:
+# echo "No auto strip!"
+
+#override_dh_installdeb:
+# dh_installdeb
+# for pkg in $$(dh_listpackages); do \
+# sed -i -e 's!#DEB_SOURCE#!$(DEB_SOURCE)!' debian/$$pkg/DEBIAN/*; \
+# sed -i -e 's!#OPDPA_VER_SUFFIX#!-$(OPDPA_VER)!g' debian/$$pkg/DEBIAN/*; \
+# done
+
+test:
+ @echo DEB_SOURCE=$(DEB_SOURCE)
+ @echo DEB_VERSION=$(DEB_VERSION)
+ @echo DEB_VERSION_EPOCH_UPSTREAM=$(DEB_VERSION_EPOCH_UPSTREAM)
+ @echo DEB_VERSION_UPSTREAM_REVISION=$(DEB_VERSION_UPSTREAM_REVISION)
+ @echo DEB_VERSION_UPSTREAM=$(DEB_VERSION_UPSTREAM)
+ @echo DEB_DISTRIBUTION=$(DEB_DISTRIBUTION)
+ @echo DEB_HOST_ARCH=$(DEB_HOST_ARCH)
+ @echo DEB_HOST_ARCH_CPU=$(DEB_HOST_ARCH_CPU)
+ @echo DEB_HOST_ARCH_OS=$(DEB_HOST_ARCH_OS)
+ @echo DEB_HOST_GNU_TYPE=$(DEB_HOST_GNU_TYPE)
+ @echo DEB_HOST_GNU_CPU=$(DEB_HOST_GNU_CPU)
+ @echo DEB_HOST_GNU_SYSTEM=$(DEB_HOST_GNU_SYSTEM)
+ @echo DEB_BUILD_ARCH=$(DEB_BUILD_ARCH)
+ @echo DEB_BUILD_ARCH_CPU=$(DEB_BUILD_ARCH_CPU)
+ @echo DEB_BUILD_ARCH_OS=$(DEB_BUILD_ARCH_OS)
+ @echo DEB_BUILD_GNU_TYPE=$(DEB_BUILD_GNU_TYPE)
+ @echo DEB_BUILD_GNU_CPU=$(DEB_BUILD_GNU_CPU)
+ @echo DEB_BUILD_GNU_SYSTEM=$(DEB_BUILD_GNU_SYSTEM)
+ @echo ONLP_LIB_PATH=$(ONLP_LIB_PATH)
+# @echo OFDPA_LIB_PATH=$(OFDPA_LIB_PATH)
+# @echo OFDPA_BIN_PATH=$(OFDPA_BIN_PATH)