tools: Fix bug in pldm_fwup_pkg_creator.py

The fix is to generate the package header checksum after updating
the package header size, which includes the checksum.

Signed-off-by: Tom Joseph <rushtotom@gmail.com>
Change-Id: I3364ddcb1fa1d20c5abc3ae1be7562c9d9c2ed78
diff --git a/tools/fw-update/pldm_fwup_pkg_creator.py b/tools/fw-update/pldm_fwup_pkg_creator.py
index 3eb3ecc..1273296 100755
--- a/tools/fw-update/pldm_fwup_pkg_creator.py
+++ b/tools/fw-update/pldm_fwup_pkg_creator.py
@@ -428,7 +428,8 @@
         Parameters:
             pldm_fw_up_pkg: PLDM FW update package
     '''
-    file_size = pldm_fw_up_pkg.tell()
+    pkg_header_checksum_size = 4
+    file_size = pldm_fw_up_pkg.tell() + pkg_header_checksum_size
     pkg_header_size_offset = 17
     # Seek past PackageHeaderIdentifier and PackageHeaderFormatRevision
     pldm_fw_up_pkg.seek(pkg_header_size_offset)
@@ -483,8 +484,8 @@
                                                 component_bitmap_bit_length)
             write_component_image_info_area(pldm_fw_up_pkg, metadata,
                                             image_files)
-            write_pkg_header_checksum(pldm_fw_up_pkg)
             update_pkg_header_size(pldm_fw_up_pkg)
+            write_pkg_header_checksum(pldm_fw_up_pkg)
             append_component_images(pldm_fw_up_pkg, image_files)
             pldm_fw_up_pkg.close()
     except BaseException: