pvmfw-tool: Make VM DTBO optional for building pvmfw
Bug: 289627688
Test: Boot microdroid with pvmfw.img generated by pvmfw-tool
Change-Id: I44420fab81318e1ec42364fa6a4283cad0ce8ce6
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();