Truncate vbmeta to 64KB
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. Bug: 181923506 Test: m MicrodroidHostTestCases libavb tries Change-Id: Icc5b86ccd98e3ed9c4269e584f35dbfbdf1b0730
This commit is contained in:
@@ -110,6 +110,9 @@ func (v *vbmeta) partitionName() string {
|
||||
return proptools.StringDefault(v.properties.Partition_name, v.BaseModuleName())
|
||||
}
|
||||
|
||||
// See external/avb/libavb/avb_slot_verify.c#VBMETA_MAX_SIZE
|
||||
const vbmetaMaxSize = 64 * 1024
|
||||
|
||||
func (v *vbmeta) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
extractedPublicKeys := v.extractPublicKeys(ctx)
|
||||
|
||||
@@ -172,6 +175,13 @@ func (v *vbmeta) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
}
|
||||
|
||||
cmd.FlagWithOutput("--output ", v.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.
|
||||
builder.Command().Text("truncate").
|
||||
FlagWithArg("-s ", strconv.Itoa(vbmetaMaxSize)).
|
||||
Output(v.output)
|
||||
|
||||
builder.Build("vbmeta", fmt.Sprintf("vbmeta %s", ctx.ModuleName()))
|
||||
|
||||
v.installDir = android.PathForModuleInstall(ctx, "etc")
|
||||
|
Reference in New Issue
Block a user