Infrastructure for running tests under Linux in primary VM.

Includes an initial test of simply inserting and removing the Hafnium
kernel module.

Change-Id: I832a30d902f58ca71f89374300ab39b2ba3ab877
diff --git a/build/image/generate_initrd.py b/build/image/generate_initrd.py
index a49865a..6fb76de 100644
--- a/build/image/generate_initrd.py
+++ b/build/image/generate_initrd.py
@@ -39,15 +39,14 @@
     parser.add_argument("--staging", required=True)
     parser.add_argument("--output", required=True)
     args = parser.parse_args()
+    staged_files = ["vmlinuz", "initrd.img"]
     # Prepare the primary VM image.
-    staged_files = ["vmlinuz"]
     shutil.copyfile(args.primary_vm, os.path.join(args.staging, "vmlinuz"))
-    # Prepare the primary VM's initrd. Currently, it just makes an empty one.
+    # Prepare the primary VM's initrd.
     if args.primary_vm_initrd:
-        raise NotImplementedError(
-            "This doesn't copy the primary VM's initrd yet")
-    with open(os.path.join(args.staging, "initrd.img"), "w") as vms_txt:
-        staged_files.append("initrd.img")
+        shutil.copyfile(args.primary_vm_initrd, os.path.join(args.staging, "initrd.img"))
+    else:
+        open(os.path.join(args.staging, "initrd.img"), "w").close()
     # Prepare the secondary VMs.
     with open(os.path.join(args.staging, "vms.txt"), "w") as vms_txt:
         staged_files.append("vms.txt")