diff options
Diffstat (limited to 'filesystem/bootimg.go')
-rw-r--r-- | filesystem/bootimg.go | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/filesystem/bootimg.go b/filesystem/bootimg.go index 0a3a1773f..effbd6542 100644 --- a/filesystem/bootimg.go +++ b/filesystem/bootimg.go @@ -99,6 +99,9 @@ type BootimgProperties struct { // The index used to prevent rollback of the image on device. Avb_rollback_index *int64 + // Rollback index location of this image. Must be 0, 1, 2, etc. + Avb_rollback_index_location *int64 + // The security patch passed to as the com.android.build.<type>.security_patch avb property. // Replacement for the make variables BOOT_SECURITY_PATCH / INIT_BOOT_SECURITY_PATCH. Security_patch *string @@ -227,6 +230,8 @@ func (b *bootimg) GenerateAndroidBuildActions(ctx android.ModuleContext) { ramdiskModule := ctx.GetDirectDepWithTag(ramdisk, bootimgRamdiskDep) fsInfo, _ := android.OtherModuleProvider(ctx, ramdiskModule, FilesystemProvider) android.SetProvider(ctx, FilesystemProvider, fsInfo) + } else { + setCommonFilesystemInfo(ctx, b) } // Set BootimgInfo for building target_files.zip @@ -235,6 +240,28 @@ func (b *bootimg) GenerateAndroidBuildActions(ctx android.ModuleContext) { Kernel: b.getKernelPath(ctx), Dtb: b.getDtbPath(ctx), Bootconfig: b.getBootconfigPath(ctx), + Output: output, + }) + + extractedPublicKey := android.PathForModuleOut(ctx, b.partitionName()+".avbpubkey") + if b.properties.Avb_private_key != nil { + key := android.PathForModuleSrc(ctx, proptools.String(b.properties.Avb_private_key)) + ctx.Build(pctx, android.BuildParams{ + Rule: extractPublicKeyRule, + Input: key, + Output: extractedPublicKey, + }) + } + var ril int + if b.properties.Avb_rollback_index_location != nil { + ril = proptools.Int(b.properties.Avb_rollback_index_location) + } + + android.SetProvider(ctx, vbmetaPartitionProvider, vbmetaPartitionInfo{ + Name: b.bootImageType.String(), + RollbackIndexLocation: ril, + PublicKey: extractedPublicKey, + Output: output, }) } @@ -245,6 +272,7 @@ type BootimgInfo struct { Kernel android.Path Dtb android.Path Bootconfig android.Path + Output android.Path } func (b *bootimg) getKernelPath(ctx android.ModuleContext) android.Path { @@ -418,10 +446,6 @@ func (b *bootimg) addAvbFooter(ctx android.ModuleContext, unsignedImage android. cmd.FlagWithArg("--rollback_index ", strconv.FormatInt(*b.properties.Avb_rollback_index, 10)) } - if !ctx.Config().KatiEnabled() { - copyImageFileToProductOut(ctx, builder, b.bootImageType.String(), output) - } - builder.Build("add_avb_footer", fmt.Sprintf("Adding avb footer to %s", b.BaseModuleName())) return output } @@ -437,10 +461,6 @@ func (b *bootimg) signImage(ctx android.ModuleContext, unsignedImage android.Pat Implicits(toolDeps). Output(output) - if !ctx.Config().KatiEnabled() { - copyImageFileToProductOut(ctx, builder, b.bootImageType.String(), output) - } - builder.Build("sign_bootimg", fmt.Sprintf("Signing %s", b.BaseModuleName())) return output } |