pw_software_update: Add user_manifest bundle arg
This change adds a user-defined "user_manifest" option to the GN
template for creating update bundles. The user manifest is treated like
any other target payload for the purpose of bundle creation, but has a
unique API on the GN side because it will be treated differently in the
update client on the firmware side.
Tested: Built downtream with and without user_manifest
Change-Id: Id15d8138e17e4a85808ae04b3c014be5f6e3ea18
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/65360
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Pigweed-Auto-Submit: Joe Ethier <jethier@google.com>
Reviewed-by: Armando Montanez <amontanez@google.com>
diff --git a/pw_build/update_bundle.gni b/pw_build/update_bundle.gni
index fd06298..7200d65 100644
--- a/pw_build/update_bundle.gni
+++ b/pw_build/update_bundle.gni
@@ -23,6 +23,10 @@
# targets: List of targets mapping filenames to target names.
# persist: Optional boolean; if true, the raw tuf repo will be persisted to
# disk in the target out dir in addition to being serialized as a bundle.
+# user_manifest: Optional path to an extra user-defined manifest file; if
+# provided, this file will be included as a target payload, but handled
+# specially. See the following file for details:
+# pw_software_update/public/pw_software_update/bundled_update_backend.h
#
# Each target in targets should be a string formatted as follows:
# "/path/to/file > target_name"
@@ -60,15 +64,22 @@
tuf_target_list = string_split(tuf_target, _delimiter)
tuf_target_path = rebase_path(tuf_target_list[0], root_build_dir)
tuf_target_name = tuf_target_list[1]
+ assert(tuf_target_name != "user_manifest",
+ "The target name 'user_manifest' is reserved for special use.")
args += [ "${tuf_target_path} > ${tuf_target_name}" ]
if (_persist_path != "") {
outputs += [ "${_persist_path}/${tuf_target_name}" ]
}
}
+ if (defined(invoker.user_manifest)) {
+ args += [ rebase_path(invoker.user_manifest, root_build_dir) +
+ " > user_manifest" ]
+ }
+
if (_persist_path != "") {
args += [
- "--persist-repo",
+ "--persist",
rebase_path(_persist_path),
]
}