diff --git a/generate_release_metadata.py b/generate_release_metadata.py
new file mode 100755
index 0000000000000000000000000000000000000000..f1f6418bd616d94b04cb9bf51a7cfda0837a0be1
--- /dev/null
+++ b/generate_release_metadata.py
@@ -0,0 +1,82 @@
+#!/usr/bin/env python3
+import json
+import os
+from datetime import datetime
+
+
+def generate_metadata(
+    machine,
+    version,
+    artifacts_image,
+    sdk,
+    output_dir,
+    outlocal_dir,
+):
+    """Generates a metainfo.json for the release"""
+
+    install_script = None
+    licenses = None
+    image_general = None
+    image_wic = None
+
+    # Join filepath for metadata
+
+    if output_dir is not None:
+        filepath = os.path.join(output_dir, machine, "metainfo.json")
+    elif outlocal_dir is not None:
+        filepath = os.path.join(outlocal_dir, machine, "metainfo.json")
+    else:
+        print("Error: Filepath is empty")
+        return -1
+
+    # Collect metadata and write to metainfo.json
+
+    for artifact in artifacts_image:
+        if artifact == "fng-install.sh":
+            install_script = artifact
+        elif artifact == "license.manifest":
+            licenses = artifact
+        elif artifact.endswith(machine + ".tar.gz"):
+            image_general = artifact
+        elif artifact.endswith(machine + ".wic"):
+            image_wic = artifact
+
+    metadata = dict()
+
+    metadata["files"] = []
+    metadata["version"] = version
+    metadata["machine"] = machine
+    metadata["date"] = datetime.today().strftime("%Y-%m-%d")
+
+    if install_script is not None:
+        new_file = dict()
+        new_file["name"] = "Install Script"
+        new_file["path"] = install_script
+        metadata["files"].append(new_file)
+
+    if image_general is not None:
+        new_file = dict()
+        new_file["name"] = "Image"
+        new_file["path"] = image_general
+        metadata["files"].append(new_file)
+
+    if image_wic is not None:
+        new_file = dict()
+        new_file["name"] = "SD-Card Image (WIC)"
+        new_file["path"] = image_wic
+        metadata["files"].append(new_file)
+
+    if sdk is not None:
+        new_file = dict()
+        new_file["name"] = "SDK"
+        new_file["path"] = "sdk/" + sdk + ".sh"
+        metadata["files"].append(new_file)
+
+    if licenses is not None:
+        new_file = dict()
+        new_file["name"] = "Licenses"
+        new_file["path"] = licenses
+        metadata["files"].append(new_file)
+
+    with open(filepath, "w", encoding="utf-8") as file:
+        file.write(json.dumps(metadata))
diff --git a/package_release.py b/package_release.py
index ad6d54790e972d7b4dc35610c75904bd03800729..8d75985d3be1f47cf12b959ec44e72975bf25404 100755
--- a/package_release.py
+++ b/package_release.py
@@ -7,9 +7,8 @@ import sys
 import shutil
 import hashlib
 import tempfile
-from datetime import datetime
-
 from convert_md2html import convertmd2html
+from generate_release_metadata import generate_metadata
 
 
 def md5(fname):
@@ -76,84 +75,6 @@ def copy_files(files, input_dir, subdir, output_dir, outlocal_dir):
     return md5sums
 
 
-def generate_metadata(
-    machine,
-    version,
-    artifacts_image,
-    sdk,
-    output_dir,
-    outlocal_dir,
-):
-    """Generates a metainfo.json for the release"""
-
-    install_script = None
-    licenses = None
-    image_general = None
-    image_wic = None
-
-    # Join filepath for metadata
-
-    if output_dir is not None:
-        filepath = os.path.join(output_dir, machine, "metainfo.json")
-    elif outlocal_dir is not None:
-        filepath = os.path.join(outlocal_dir, machine, "metainfo.json")
-    else:
-        print("Error: Filepath is empty")
-        return -1
-
-    # Collect metadata and write to metainfo.json
-
-    for artifact in artifacts_image:
-        if artifact == "fng-install.sh":
-            install_script = artifact
-        elif artifact == "license.manifest":
-            licenses = artifact
-        elif artifact.endswith(machine + ".tar.gz"):
-            image_general = artifact
-        elif artifact.endswith(machine + ".wic"):
-            image_wic = artifact
-
-    metadata = dict()
-
-    metadata["files"] = []
-    metadata["version"] = version
-    metadata["machine"] = machine
-    metadata["date"] = datetime.today().strftime("%Y-%m-%d")
-
-    if install_script is not None:
-        new_file = dict()
-        new_file["name"] = "Install Script"
-        new_file["path"] = install_script
-        metadata["files"].append(new_file)
-
-    if image_general is not None:
-        new_file = dict()
-        new_file["name"] = "Image"
-        new_file["path"] = image_general
-        metadata["files"].append(new_file)
-
-    if image_wic is not None:
-        new_file = dict()
-        new_file["name"] = "SD-Card Image (WIC)"
-        new_file["path"] = image_wic
-        metadata["files"].append(new_file)
-
-    if sdk is not None:
-        new_file = dict()
-        new_file["name"] = "SDK"
-        new_file["path"] = "sdk/" + sdk + ".sh"
-        metadata["files"].append(new_file)
-
-    if licenses is not None:
-        new_file = dict()
-        new_file["name"] = "Licenses"
-        new_file["path"] = licenses
-        metadata["files"].append(new_file)
-
-    with open(filepath, "w", encoding="utf-8") as file:
-        file.write(json.dumps(metadata))
-
-
 def main():
     parser = argparse.ArgumentParser()
     parser.add_argument(
@@ -243,6 +164,7 @@ def main():
     else:
         outlocal_dir = None
 
+    # Convert markdown files into html and package them
     if args.doc_dir is not None:
         doc_files = glob.glob(os.path.join(args.doc_dir, "*.md"))
         html_files = []
@@ -251,7 +173,8 @@ def main():
             convertmd2html(f, fout)
             html_files.append(fout)
 
-        copy_files(doc_files + html_files, "", "", output_dir, outlocal_dir)
+        doc_md5sums = copy_files(doc_files + html_files, "", "", output_dir, outlocal_dir)
+        write_md5sums_file(doc_md5sums, "", output_dir, outlocal_dir)
 
     if args.images_dir is not None:
         # Add some additional files to the artifacts
@@ -284,12 +207,10 @@ def main():
                 )
                 artifacts_all.append("license.manifest")
 
-        # Everything copied? Create md5sums file
-        write_md5sums_file(
-            md5sums, machine, output_dir, outlocal_dir
-        )
+        # Create md5sums file for build artifacts
+        write_md5sums_file(md5sums, machine, output_dir, outlocal_dir)
 
-    # Generate metadata
+    # Generate metadata in case of an image build
     if args.sdk_dir is None:
         generate_metadata(
             machine,
@@ -303,7 +224,8 @@ def main():
     # Handle SDK if available
     if args.sdk_dir is not None:
         sdkfiles = glob.glob(os.path.join(args.sdk_dir, sdkname + "*"))
-        copy_files(sdkfiles, "", os.path.join(machine, "sdk"), None, outlocal_dir)
+        sdk_md5sums = copy_files(sdkfiles, "", os.path.join(machine, "sdk"), None, outlocal_dir)
+        write_md5sums_file(sdk_md5sums, os.path.join(machine, "sdk"), None, outlocal_dir)
 
     # Store pathes and other stuff in environment variable file
     with open("package.env", "w", encoding="utf-8") as env_file: