[VOL-1685][BAL3.0 Brigade] generate OpenOLT debian package file

Change-Id: Ic5453616c0dbdbc1fb1eb241feba1cbfca5e8e85
diff --git a/agent/Makefile.in b/agent/Makefile.in
index fe683d0..985fc36 100644
--- a/agent/Makefile.in
+++ b/agent/Makefile.in
@@ -61,7 +61,7 @@
 LIBGRPC_PATH=$(shell pkg-config --libs-only-L grpc | sed s/-L// | sed s/\ //g)
 LIBPROTOBUF_PATH=$(shell PKG_CONFIG_ALLOW_SYSTEM_LIBS=true pkg-config --libs-only-L protobuf | sed s/-L// | sed s/\ //g)
 
-CXX = @CXX@
+CXX = @CXX@-4.9
 CXXFLAGS += @CXXFLAGS@
 CXXFLAGS += $(shell pkg-config --cflags-only-I grpc++)
 CPPFLAGS += `pkg-config --cflags protobuf grpc`
@@ -74,7 +74,7 @@
 
 prereq:
 	sudo apt-get -q -y install git pkg-config build-essential autoconf libtool libgflags-dev libgtest-dev clang libc++-dev unzip docker.io
-	sudo apt-get install -y build-essential autoconf libssl-dev gawk debhelper dh-systemd init-system-helpers
+	sudo apt-get install -y build-essential autoconf libssl-dev gawk debhelper dh-systemd init-system-helpers curl cmake ccache g++-4.9
 
 	# Install GRPC, libprotobuf and protoc
 	rm -rf $(GRPC_DST)
diff --git a/agent/mkdebian/debian/asfvolt16.preinst b/agent/mkdebian/debian/asfvolt16.preinst
index cf43cc1..9e42489 100644
--- a/agent/mkdebian/debian/asfvolt16.preinst
+++ b/agent/mkdebian/debian/asfvolt16.preinst
@@ -15,7 +15,6 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-DEVMEM_MAJOR=`cat /sys/module/devmem/parameters/bcmolt_devmem_chrdev_major`
 # kill CLI applications
 echo "kill running time application"
 [ -n "`pidof dev_mgmt_daemon`" ] && killall dev_mgmt_daemon
@@ -45,7 +44,6 @@
 rm -rf /dev/coop_dba_example
 rm -rf /dev/coop_dba
 for i in {0..7}; do
-    MAJOR=$(($DEVMEM_MAJOR + $i))
     [ ! -f /dev/bcmolt_devmem_sram$i ] && rm -f /dev/bcmolt_devmem_sram$i
     [ ! -f /dev/bcmolt_devmem_ddr$i ] && rm -f /dev/bcmolt_devmem_ddr$i
     [ ! -f /dev/bcmolt_devmem_regs$i ] && rm -f /dev/bcmolt_devmem_regs$i
diff --git a/agent/scripts/init.d/dev_mgmt_daemon b/agent/scripts/init.d/dev_mgmt_daemon
index 0fd80d8..14ef7a5 100755
--- a/agent/scripts/init.d/dev_mgmt_daemon
+++ b/agent/scripts/init.d/dev_mgmt_daemon
@@ -14,7 +14,7 @@
 PATH="/broadcom:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
 APPDIR="/broadcom"
 APPBIN="dev_mgmt_daemon"
-APPARGS="-d -pcie"
+APPARGS="-pcie -syslog"
 PID_FILE="root_dev_mgmt_pid"
 USER="root"
 GROUP="root"
@@ -24,9 +24,9 @@
 . /lib/lsb/init-functions
 
 start() {
-  touch /var/log/$NAME.log
   printf "Starting '$NAME'... "
-  start-stop-daemon --verbose --start --chuid "$USER:$GROUP" --background --no-close --make-pidfile --pidfile /var/run/$NAME.pid --chdir "$APPDIR" --exec "$APPBIN" -- $APPARGS < /dev/tty1 >> /var/log/$NAME.log 2>&1 || true
+  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$APPDIR
+  start-stop-daemon --verbose --start --chuid "$USER:$GROUP" --background --no-close --chdir "$APPDIR" --exec "$APPBIN" -- $APPARGS 2>&1 || true
   printf "done\n"
 }
 
@@ -42,17 +42,17 @@
 
 stop() {
   printf "Stopping '$NAME'... "
-  [ -z `cat /var/run/$NAME.pid 2>/dev/null` ] || \
-  while test -d /proc/$(cat /var/run/$NAME.pid); do
-    killtree $(cat /var/run/$NAME.pid) 15
+  [ -z `cat /tmp/$PID_FILE 2>/dev/null` ] || \
+  while test -d /proc/$(cat /tmp/$PID_FILE); do
+    killtree $(cat /tmp/$PID_FILE) 15
     sleep 0.5
   done 
-  [ -z `cat /var/run/$NAME.pid 2>/dev/null` ] || rm /var/run/$NAME.pid
+  [ -z `cat /tmp/$PID_FILE 2>/dev/null` ] || rm /tmp/$PID_FILE
   printf "done\n"
 }
 
 status() {
-  status_of_proc -p /var/run/$NAME.pid $APPDIR/$APPBIN $NAME && exit 0 || exit $?
+  status_of_proc -p /tmp/$PID_FILE $APPDIR/$APPBIN $NAME && exit 0 || exit $?
 }
 
 case "$1" in