From 1d4f813a5df52cbd2344a960247ef82cfe96f491 Mon Sep 17 00:00:00 2001 From: Jordan Hand Date: Wed, 8 Jan 2025 17:43:27 -0800 Subject: [PATCH] Support populating SVNs in image builder FMC and RT SVNs are controlled by the vendor. Add an option to the image builder to specify these SVNs from the command-line. --- builder/bin/image_gen.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/builder/bin/image_gen.rs b/builder/bin/image_gen.rs index 69f347b330..9249589219 100644 --- a/builder/bin/image_gen.rs +++ b/builder/bin/image_gen.rs @@ -19,6 +19,14 @@ fn main() { .value_parser(value_parser!(PathBuf)), ) .arg(arg!(--"fw" [FILE] "FW bundle image").value_parser(value_parser!(PathBuf))) + .arg( + arg!(--"fmc-svn" [FILE] "Security Version Number of FMC firmware image") + .value_parser(value_parser!(u32)), + ) + .arg( + arg!(--"rt-svn" [FILE] "Security Version Number of RT firmware image") + .value_parser(value_parser!(u32)), + ) .arg( arg!(--"all_elfs" [DIR] "Build all firmware elf files") .value_parser(value_parser!(PathBuf)), @@ -41,6 +49,18 @@ fn main() { std::fs::write(path, rom).unwrap(); } + let fmc_svn = if let Some(fmc) = args.get_one::("fmc-svn") { + *fmc + } else { + 0 + }; + + let app_svn = if let Some(rt) = args.get_one::("rt-svn") { + *rt + } else { + 0 + }; + if let Some(path) = args.get_one::("fw") { // Generate Image Bundle let image = caliptra_builder::build_and_sign_image( @@ -49,6 +69,8 @@ fn main() { ImageOptions { fmc_version: version::get_fmc_version(), app_version: version::get_runtime_version(), + fmc_svn, + app_svn, ..Default::default() }, ) @@ -64,6 +86,8 @@ fn main() { ImageOptions { fmc_version: version::get_fmc_version(), app_version: version::get_runtime_version(), + fmc_svn, + app_svn, ..Default::default() }, )