diff options
Diffstat (limited to 'filesystem/bootimg.go')
-rw-r--r-- | filesystem/bootimg.go | 62 |
1 files changed, 50 insertions, 12 deletions
diff --git a/filesystem/bootimg.go b/filesystem/bootimg.go index effbd6542..7959365e8 100644 --- a/filesystem/bootimg.go +++ b/filesystem/bootimg.go @@ -201,7 +201,8 @@ func (b *bootimg) GenerateAndroidBuildActions(ctx android.ModuleContext) { return } - unsignedOutput := b.buildBootImage(ctx, b.getKernelPath(ctx)) + kernelPath := b.getKernelPath(ctx) + unsignedOutput := b.buildBootImage(ctx, kernelPath) output := unsignedOutput if proptools.Bool(b.properties.Use_avb) { @@ -212,7 +213,7 @@ func (b *bootimg) GenerateAndroidBuildActions(ctx android.ModuleContext) { case "default": output = b.signImage(ctx, unsignedOutput) case "make_legacy": - output = b.addAvbFooter(ctx, unsignedOutput, b.getKernelPath(ctx)) + output = b.addAvbFooter(ctx, unsignedOutput, kernelPath) default: ctx.PropertyErrorf("avb_mode", `Unknown value for avb_mode, expected "default" or "make_legacy", got: %q`, *b.properties.Avb_mode) } @@ -235,12 +236,14 @@ func (b *bootimg) GenerateAndroidBuildActions(ctx android.ModuleContext) { } // Set BootimgInfo for building target_files.zip + dtbPath := b.getDtbPath(ctx) android.SetProvider(ctx, BootimgInfoProvider, BootimgInfo{ - Cmdline: b.properties.Cmdline, - Kernel: b.getKernelPath(ctx), - Dtb: b.getDtbPath(ctx), - Bootconfig: b.getBootconfigPath(ctx), - Output: output, + Cmdline: b.properties.Cmdline, + Kernel: kernelPath, + Dtb: dtbPath, + Bootconfig: b.getBootconfigPath(ctx), + Output: output, + PropFileForMiscInfo: b.buildPropFileForMiscInfo(ctx), }) extractedPublicKey := android.PathForModuleOut(ctx, b.partitionName()+".avbpubkey") @@ -263,16 +266,32 @@ func (b *bootimg) GenerateAndroidBuildActions(ctx android.ModuleContext) { PublicKey: extractedPublicKey, Output: output, }) + + // Dump compliance metadata + complianceMetadataInfo := ctx.ComplianceMetadataInfo() + prebuiltFilesCopied := make([]string, 0) + if kernelPath != nil { + prebuiltFilesCopied = append(prebuiltFilesCopied, kernelPath.String()+":kernel") + } + if dtbPath != nil { + prebuiltFilesCopied = append(prebuiltFilesCopied, dtbPath.String()+":dtb.img") + } + complianceMetadataInfo.SetPrebuiltFilesCopied(prebuiltFilesCopied) + + if ramdisk := proptools.String(b.properties.Ramdisk_module); ramdisk != "" { + buildComplianceMetadata(ctx, bootimgRamdiskDep) + } } var BootimgInfoProvider = blueprint.NewProvider[BootimgInfo]() type BootimgInfo struct { - Cmdline []string - Kernel android.Path - Dtb android.Path - Bootconfig android.Path - Output android.Path + Cmdline []string + Kernel android.Path + Dtb android.Path + Bootconfig android.Path + Output android.Path + PropFileForMiscInfo android.Path } func (b *bootimg) getKernelPath(ctx android.ModuleContext) android.Path { @@ -491,6 +510,25 @@ func (b *bootimg) buildPropFile(ctx android.ModuleContext) (android.Path, androi return propFile, deps } +func (b *bootimg) buildPropFileForMiscInfo(ctx android.ModuleContext) android.Path { + var sb strings.Builder + addStr := func(name string, value string) { + fmt.Fprintf(&sb, "%s=%s\n", name, value) + } + + bootImgType := proptools.String(b.properties.Boot_image_type) + addStr("avb_"+bootImgType+"_add_hash_footer_args", "TODO(b/398036609)") + if b.properties.Avb_private_key != nil { + addStr("avb_"+bootImgType+"_algorithm", proptools.StringDefault(b.properties.Avb_algorithm, "SHA256_RSA4096")) + addStr("avb_"+bootImgType+"_key_path", android.PathForModuleSrc(ctx, proptools.String(b.properties.Avb_private_key)).String()) + addStr("avb_"+bootImgType+"_rollback_index_location", strconv.Itoa(proptools.Int(b.properties.Avb_rollback_index_location))) + } + + propFile := android.PathForModuleOut(ctx, "prop_for_misc_info") + android.WriteFileRuleVerbatim(ctx, propFile, sb.String()) + return propFile +} + var _ android.AndroidMkEntriesProvider = (*bootimg)(nil) // Implements android.AndroidMkEntriesProvider |