Merge changes I3f9fed0e,I44420fab,Ib847ee61 into main

* changes:
  pvmfw: Update README.md to explain pvmfw-tool
  pvmfw-tool: Make VM DTBO optional for building pvmfw
  pvmfw-tool: Fix runtime crash
diff --git a/pvmfw/README.md b/pvmfw/README.md
index cccd8c1..124ef89 100644
--- a/pvmfw/README.md
+++ b/pvmfw/README.md
@@ -427,22 +427,23 @@
 and its configuration data.
 
 As a quick prototyping solution, a valid BCC (such as the [bcc.dat] test file)
-can be appended to the `pvmfw.bin` image, making use of the "legacy" mode that
-predates the configuration data format:
+can be appended to the `pvmfw.bin` image with `pvmfw-tool`.
 
 ```shell
-m pvmfw_bin
-cp out/target/product/generic_arm64/system/etc/pvmfw.bin ${PVMFW_BIN}
-truncate -s '%4KiB' ${PVMFW_BIN} && cat ${CONFIG_OR_BCC} >> ${PVMFW_BIN}
+m pvmfw-tool pvmfw_bin
+PVMFW_BIN=${ANDROID_PRODUCT_OUT}/system/etc/pvmfw.bin
+BCC_DAT=${ANDROID_BUILD_TOP}/packages/modules/Virtualization/tests/pvmfw/assets/bcc.dat
+
+pvmfw-tool custom_pvmfw ${PVMFW_BIN} ${BCC_DAT}
 ```
 
 The result can then be pushed to the device. Pointing the system property
 `hypervisor.pvmfw.path` to it will cause AVF to use that image as pvmfw:
 
 ```shell
-adb push ${PVMFW_BIN} /data/local/tmp/pvmfw.img
+adb push custom_pvmfw /data/local/tmp/pvmfw
 adb root
-adb shell setprop hypervisor.pvmfw.path /data/local/tmp/pvmfw.img
+adb shell setprop hypervisor.pvmfw.path /data/local/tmp/pvmfw
 ```
 
 Then run a protected VM, for example:
diff --git a/tests/pvmfw/tools/PvmfwTool.java b/tests/pvmfw/tools/PvmfwTool.java
index e4b6020..62c641b 100644
--- a/tests/pvmfw/tools/PvmfwTool.java
+++ b/tests/pvmfw/tools/PvmfwTool.java
@@ -25,13 +25,13 @@
 public class PvmfwTool {
     public static void printUsage() {
         System.out.println("pvmfw-tool: Appends pvmfw.bin and config payloads.");
-        System.out.println("Requires BCC and debug policy dtbo files");
+        System.out.println("Requires BCC and optional debug policy dtbo files");
         System.out.println("");
-        System.out.println("Usage: pvmfw-tool <pvmfw_with_config> <pvmfw_bin> <bcc.dat> <dp.dtbo>");
+        System.out.println("Usage: pvmfw-tool <out> <pvmfw.bin> <bcc.dat> [<dp.dtbo>]");
     }
 
     public static void main(String[] args) {
-        if (args.length != 4) {
+        if (args.length != 4 && args.length != 3) {
             printUsage();
             System.exit(1);
         }
@@ -39,11 +39,14 @@
         File out = new File(args[0]);
         File pvmfw_bin = new File(args[1]);
         File bcc_dat = new File(args[2]);
-        File dtbo = new File(args[3]);
 
         try {
-            Pvmfw pvmfw = new Pvmfw.Builder(pvmfw_bin, bcc_dat).setDebugPolicyOverlay(dtbo).build();
-            pvmfw.serialize(out);
+            Pvmfw.Builder builder = new Pvmfw.Builder(pvmfw_bin, bcc_dat);
+            if (args.length == 4) {
+                File dtbo = new File(args[3]);
+                builder.setDebugPolicyOverlay(dtbo);
+            }
+            builder.build().serialize(out);
         } catch (IOException e) {
             e.printStackTrace();
             printUsage();
diff --git a/tests/pvmfw/tools/pvmfw-tool-manifest.txt b/tests/pvmfw/tools/pvmfw-tool-manifest.txt
index dc71fd2..8b2535a 100644
--- a/tests/pvmfw/tools/pvmfw-tool-manifest.txt
+++ b/tests/pvmfw/tools/pvmfw-tool-manifest.txt
@@ -1,2 +1,2 @@
 Manifest-Version: 1.0
-Main-Class: com.android.microdroid.PvmfwTool
+Main-Class: com.android.pvmfw.PvmfwTool