diff options
author | 2025-03-07 22:08:52 -0800 | |
---|---|---|
committer | 2025-03-07 22:08:52 -0800 | |
commit | 3639838f5e5700774f251ef8a2324015d3b1ad77 (patch) | |
tree | af256e3dfc7dacc8ede2403f372be05b81193cd7 /filesystem | |
parent | c4123f6638ff86dcaec2b8aaac325e6dabb0ba38 (diff) | |
parent | 583bc3639b7a41f4f29f07f0478ee62f7b69fecb (diff) |
Merge "Include kernel and dtb.img information in SBOM built in soong-only" into main
Diffstat (limited to 'filesystem')
-rw-r--r-- | filesystem/android_device.go | 12 | ||||
-rw-r--r-- | filesystem/bootimg.go | 20 |
2 files changed, 26 insertions, 6 deletions
diff --git a/filesystem/android_device.go b/filesystem/android_device.go index 6b8af741d..d74200970 100644 --- a/filesystem/android_device.go +++ b/filesystem/android_device.go @@ -294,18 +294,26 @@ func (a *androidDevice) GenerateAndroidBuildActions(ctx android.ModuleContext) { } func buildComplianceMetadata(ctx android.ModuleContext, tags ...blueprint.DependencyTag) { + // Collect metadata from deps filesContained := make([]string, 0) + prebuiltFilesCopied := make([]string, 0) for _, tag := range tags { ctx.VisitDirectDepsProxyWithTag(tag, func(m android.ModuleProxy) { if complianceMetadataInfo, ok := android.OtherModuleProvider(ctx, m, android.ComplianceMetadataProvider); ok { filesContained = append(filesContained, complianceMetadataInfo.GetFilesContained()...) + prebuiltFilesCopied = append(prebuiltFilesCopied, complianceMetadataInfo.GetPrebuiltFilesCopied()...) } }) } - sort.Strings(filesContained) - + // Merge to module's ComplianceMetadataInfo complianceMetadataInfo := ctx.ComplianceMetadataInfo() + filesContained = append(filesContained, complianceMetadataInfo.GetFilesContained()...) + sort.Strings(filesContained) complianceMetadataInfo.SetFilesContained(filesContained) + + prebuiltFilesCopied = append(prebuiltFilesCopied, complianceMetadataInfo.GetPrebuiltFilesCopied()...) + sort.Strings(prebuiltFilesCopied) + complianceMetadataInfo.SetPrebuiltFilesCopied(prebuiltFilesCopied) } // Returns a list of modules that are installed, which are collected from the dependency diff --git a/filesystem/bootimg.go b/filesystem/bootimg.go index 2bf0d5905..c06c20048 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,10 +236,11 @@ 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), + Kernel: kernelPath, + Dtb: dtbPath, Bootconfig: b.getBootconfigPath(ctx), Output: output, }) @@ -265,6 +267,16 @@ func (b *bootimg) GenerateAndroidBuildActions(ctx android.ModuleContext) { }) // 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) } |