gendumpheader: Originator details info added

There are two parameters available for each dump,
Originator ID and Originator Type. This change
aims to include these fields into the BMC dump
header.

If for any reason either the originator ID or
originator type or both are unavailable then
they are been replaced by their allocated null
bytes.

Test Results:
Tested on generated BMC dumps and verified.

Signed-off-by: Swarnendu Roy Chowdhury <swarnendu.roy.chowdhury@ibm.com>
Signed-off-by: Gopichand Paturi <gopichandpaturi@gmail.com>
Change-Id: I611cce4f19aaef13c3ee68c16cf7b4fb2f841591
diff --git a/dump/tools/common/include/gendumpheader b/dump/tools/common/include/gendumpheader
index 201c08a..d83ce20 100644
--- a/dump/tools/common/include/gendumpheader
+++ b/dump/tools/common/include/gendumpheader
@@ -50,6 +50,31 @@
     printf '%*s' $a | tr ' ' "\0" >> $FILE
 }
 
+# Function to add Originator details to dump header
+function add_originator_details() {
+    if [ -z "$ORIGINATOR_TYPE" ]; then
+        add_null 4
+    else
+        len=${#ORIGINATOR_TYPE}
+        nulltoadd=$(( SIZE_4 - len ))
+        printf '%s' "$ORIGINATOR_TYPE" >> "$FILE"
+        if [ "$nulltoadd" -gt 0 ]; then
+            add_null "$nulltoadd"
+        fi
+    fi
+
+    if [ -z "$ORIGINATOR_ID" ]; then
+        add_null 32
+    else
+        len=${#ORIGINATOR_ID}
+        nulltoadd=$(( SIZE_32 - len ))
+        printf '%s' "$ORIGINATOR_ID" >> "$FILE"
+        if [ "$nulltoadd" -gt 0 ]; then
+            add_null "$nulltoadd"
+        fi
+    fi
+}
+
 #Function to is to convert the EPOCHTIME collected
 #from dreport into hex values and write the same in
 #header.
@@ -376,7 +401,9 @@
     add_null 2 # SRC size
     add_null 320 # SRC dump
     getbmc_serial
-    add_null 68 # Dump requester details
+    # Dump requester/Originator details
+    add_originator_details
+    add_null 32 # Dump Req user ID
 }
 
 #Function to add Dump entry, consists of below entries
@@ -546,4 +573,4 @@
 get_bmc_model_serial_number
 
 #Run gen_header_package
-gen_header_package
\ No newline at end of file
+gen_header_package