Truncate vbmeta to 64KB

This is a porting of https://r.android.com/1675465 to make in order to
make the output filesize of the vbmeta partitions identical between make
and Soong.

Test: diff soong vs make vbmeta_system partitions
Bug: 390204058
Change-Id: Ieaf7583d4bb3cfe9da80f8abccf0af3e2372e638
diff --git a/core/Makefile b/core/Makefile
index c56c782..618e2d6 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -5034,6 +5034,10 @@
 	    $(foreach image,$(BOARD_AVB_$(call to-upper,$(1))), \
 	        --include_descriptors_from_image $(call images-for-partitions,$(image))) \
 	    --output $@
+      # libavb expects to be able to read the maximum vbmeta size, so we must provide a partition
+      # which matches this or the read will fail.
+      # See external/avb/libavb/avb_slot_verify.c#VBMETA_MAX_SIZE
+      truncate -s 65536 $@
 endef
 
 ifdef BUILDING_SYSTEM_IMAGE
@@ -5092,6 +5096,10 @@
     $(PRIVATE_AVB_VBMETA_SIGNING_ARGS) \
     $(BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS) \
     --output $@
+    # libavb expects to be able to read the maximum vbmeta size, so we must provide a partition
+    # which matches this or the read will fail.
+    # See external/avb/libavb/avb_slot_verify.c#VBMETA_MAX_SIZE
+    truncate -s 65536 $@
   $(hide) rm -rf $(AVB_CHAIN_KEY_DIR)
 endef