pvmfw-tool: Make VM reference DT optional
Bug: 341187900
Test: Manually
Change-Id: Ie3bc2b8823ebda115cc3e4cad69f3213e0fbeb61
diff --git a/tests/pvmfw/tools/PvmfwTool.java b/tests/pvmfw/tools/PvmfwTool.java
index e150ec4..9f0cb42 100644
--- a/tests/pvmfw/tools/PvmfwTool.java
+++ b/tests/pvmfw/tools/PvmfwTool.java
@@ -25,10 +25,10 @@
public class PvmfwTool {
public static void printUsage() {
System.out.println("pvmfw-tool: Appends pvmfw.bin and config payloads.");
- System.out.println(" Requires BCC and VM reference DT.");
- System.out.println(" VM DTBO and Debug policy can optionally be specified");
+ System.out.println(" Requires BCC. VM Reference DT, VM DTBO, and Debug policy");
+ System.out.println(" can optionally be specified");
System.out.println(
- "Usage: pvmfw-tool <out> <pvmfw.bin> <bcc.dat> <VM reference DT> [VM DTBO] [debug"
+ "Usage: pvmfw-tool <out> <pvmfw.bin> <bcc.dat> [VM reference DT] [VM DTBO] [debug"
+ " policy]");
}
@@ -41,10 +41,13 @@
File out = new File(args[0]);
File pvmfwBin = new File(args[1]);
File bccData = new File(args[2]);
- File vmReferenceDt = new File(args[3]);
+ File vmReferenceDt = null;
File vmDtbo = null;
File dp = null;
+ if (args.length > 3) {
+ vmReferenceDt = new File(args[3]);
+ }
if (args.length > 4) {
vmDtbo = new File(args[4]);
}
@@ -53,12 +56,18 @@
}
try {
- Pvmfw pvmfw =
+ Pvmfw.Builder builder =
new Pvmfw.Builder(pvmfwBin, bccData)
.setVmReferenceDt(vmReferenceDt)
.setDebugPolicyOverlay(dp)
- .setVmDtbo(vmDtbo)
- .build();
+ .setVmDtbo(vmDtbo);
+ if (vmReferenceDt == null) {
+ builder.setVersion(1, 1);
+ } else {
+ builder.setVersion(1, 2);
+ }
+
+ Pvmfw pvmfw = builder.build();
pvmfw.serialize(out);
} catch (IOException e) {
e.printStackTrace();