libavb: Support vbmeta blobs in beginning of partition.
If we don't find a AvbFooter when resolving a chain descriptor, also
check if there's a vbmeta struct in the beginning. If there is, use
it.
This is to support the use-case where a single vbmeta_<orgname>
partition can hold metadata for several other partitions which may not
be easily readable by the bootloader (e.g. they are "logical"
partitions using a proprietary partitioning format). For example, this
supports the following setup
vbmeta # chain desc for vbmeta_google
vbmeta_google # hash desc for boot, dtbo and hashtree desc for system, vendor
boot
dtbo
super # container for system and vendor logical partitions
system # logical partition (not readable by bootloader)
vendor # logical partition (not readable by bootloader)
where vbmeta_google has the vbmeta struct in the beginning just as if
it were the main vbmeta partition.
Additional change: Previously it was optional to support the
get_size_of_partition() operation. Starting with this commit, this
operation is mandatory and must be implemented such that
AVB_IO_RESULT_ERROR_NO_SUCH_PARTITION is returned for partitions that
don't exist.
Also introduce a new 'extract_vbmeta_image' sub-command to avbtool
that can be used to extract the vbmeta blob from a footer.
Change-Id: I157537f36f77c768283c0745794cf9be93089c35
diff --git a/platform/msm_shared/avb/libavb/avb_ops.h b/platform/msm_shared/avb/libavb/avb_ops.h
index 4899b95..a74e1c0 100644
--- a/platform/msm_shared/avb/libavb/avb_ops.h
+++ b/platform/msm_shared/avb/libavb/avb_ops.h
@@ -221,6 +221,9 @@
* (NUL-terminated UTF-8 string). Returns the value in
* |out_size_num_bytes|.
*
+ * If the partition doesn't exist the AVB_IO_RESULT_ERROR_NO_SUCH_PARTITION
+ * error code should be returned.
+ *
* Returns AVB_IO_RESULT_OK on success, otherwise an error code.
*/
AvbIOResult (*get_size_of_partition)(AvbOps* ops,