Move dump scripts from phosphor-debug-collector

This commit is intended to move the dump collection
scripts from openbmc/phosphor-debug-collector repository.
Following are the scripts that are pulled from the
specified paths of openbmc/phosphor-debug-collector.

1. tools/dreport.d/ibm.d/package
2. tools/dreport.d/ibm.d/plugins.d/pels
3. tools/dreport.d/ibm.d/plugins.d/badpel
4. tools/dreport.d/ibm.d/plugins.d/vpd_data
5. tools/dreport.d/openpower.d/plugins.d/cfam
6. tools/dreport.d/openpower.d/plugins.d/dumpfilelist
7. tools/dreport.d/openpower.d/plugins.d/guardlist
8. tools/dreport.d/openpower.d/plugins.d/obmcconsole1
9. tools/dreport.d/openpower.d/plugins.d/occ
10.tools/dreport.d/openpower.d/plugins.d/phal_devtree

Also the following 3 patches have been applied.
1.https://gerrit.openbmc.org/c/openbmc/phosphor-debug-collector/+/56428
2.https://gerrit.openbmc.org/c/openbmc/phosphor-debug-collector/+/52436
3.https://gerrit.openbmc.org/c/openbmc/phosphor-debug-collector/+/47917

Also, added meson changes to install the scripts.

Test:
Verified that the scripts are getting installed correctly on BMC.

Change-Id: Iaddf909efaa138db06c877e5ca6a80608feb5baf
Signed-off-by: Gopichand Paturi <gopichandpaturi@gmail.com>
diff --git a/dump/tools/common/include/meson.build b/dump/tools/common/include/meson.build
index baac424..8feab83 100644
--- a/dump/tools/common/include/meson.build
+++ b/dump/tools/common/include/meson.build
@@ -1,2 +1,3 @@
 include_scripts += meson.current_source_dir() / 'gendumpheader'
 include_scripts += meson.current_source_dir() / 'gendumpinfo'
+include_scripts += meson.current_source_dir() / 'opfunctions'
diff --git a/dump/tools/common/include/opfunctions b/dump/tools/common/include/opfunctions
new file mode 100644
index 0000000..0808597
--- /dev/null
+++ b/dump/tools/common/include/opfunctions
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+
+# @brief fetch serial number
+# @param serial number
+function fetch_serial_number() {
+    serialNo=$(busctl get-property xyz.openbmc_project.Inventory.Manager \
+            /xyz/openbmc_project/inventory/system xyz.openbmc_project.Inventory.Decorator.Asset \
+        SerialNumber | cut -d " " -f 2 | sed "s/^\(\"\)\(.*\)\1\$/\2/g")
+
+    if [ -z "$serialNo" ]; then
+        serialNo="0000000"
+    fi
+}
+
+# @brief Add BMC dump File Name
+# @param BMC Dump File Name
+function get_bmc_dump_filename() {
+    fetch_serial_number
+    dump_id=$(printf %07d $dump_id)
+    if [ $dump_type = "$TYPE_FAULTDATA" ]; then
+        header_dump_name="FLTDUMP"
+        name="NAGDUMP.${serialNo}.${dump_id}.${dDay}"
+    else
+        header_dump_name="BMCDUMP"
+        name="BMCDUMP.${serialNo}.${dump_id}.${dDay}"
+    fi
+}
diff --git a/dump/tools/common/meson.build b/dump/tools/common/meson.build
index 1e82fd3..5d13ec5 100644
--- a/dump/tools/common/meson.build
+++ b/dump/tools/common/meson.build
@@ -1 +1 @@
-subdir('include')
\ No newline at end of file
+subdir('include')