diff options
| author | mosimchah <mosimchah@gmail.com> | 2025-12-02 09:27:38 -0500 |
|---|---|---|
| committer | mosimchah <mosimchah@gmail.com> | 2025-12-02 09:27:38 -0500 |
| commit | c7bade461dc55726f62997d13a48582f7c4b4655 (patch) | |
| tree | ea0588da76060a2038f54f67efd046ca77634b10 /filesystem/vbmeta.go | |
| parent | 0f5414d19317805e8bbbe7c4db5f0fd78769bad5 (diff) | |
| parent | 89d78cff8b00d3b20a90074635c3fe5a2ee49474 (diff) | |
Merge branch 'lineage-23.1' of https://github.com/LineageOS/android_build_soong into HEADw16.1
* 'lineage-23.1' of https://github.com/LineageOS/android_build_soong: (528 commits)
Revert "install_symlink: Make symlink target configurable"
Reapply "Clear as much of cc.Module as possible after GenerateBuildActions"
Revert "rust: config: Fix missing CPU variant LD flags in Rust"
Rename build-flag in outdir
Revert^4 "cipd: Default CIPD proxy server to on, add opt-out"
Convert check-vintf-all to phony with actions
Create a partial implementation of check-vintf-all for soong-only
Configure RBE rust pool based on build variant
Revert^3 "Add sdk version check to arr"
Add jdk.internal.invoke to the allowlist
Make droid always depend on symbols zip
Import Device and Odm skus
Don't install gob_gen in Soong
Remove bazel reference from run_integration_tests.sh
Fix bootstrap_test.sh
Don't panic in aconfig libraries when AllowMissingDependencies is set
Avoid returning nil paths from PathForModuleSrc
Revert "Flag controled clang version"
Rework module target dependencies on required deps
Revert^2 "Add sdk version check to arr"
...
Change-Id: I6e9a63fa14fda917a42e426e5dcebbad7f67e1de
Diffstat (limited to 'filesystem/vbmeta.go')
| -rw-r--r-- | filesystem/vbmeta.go | 77 |
1 files changed, 67 insertions, 10 deletions
diff --git a/filesystem/vbmeta.go b/filesystem/vbmeta.go index e7a39bef7..c71fbb791 100644 --- a/filesystem/vbmeta.go +++ b/filesystem/vbmeta.go @@ -16,6 +16,7 @@ package filesystem import ( "fmt" + "slices" "sort" "strconv" "strings" @@ -177,6 +178,30 @@ func (v *vbmeta) partitionName() string { // See external/avb/libavb/avb_slot_verify.c#VBMETA_MAX_SIZE const vbmetaMaxSize = 64 * 1024 +// This is the order that make listed the partitions in. The order is important because +// it ends up being encoded in the output file. Maintain the order so that the resultant +// files are easier to compare. +// https://cs.android.com/android/platform/superproject/main/+/main:build/make/core/Makefile;l=4833;drc=a951ebf0198006f7fd38073a05c442d0eb92f97b +var includeDescriptorsFromImgOrder = []string{ + "boot", + "init_boot", + "vendor_boot", + "vendor_kernel_boot", + "system", + "vendor", + "product", + "system_ext", + "odm", + "vendor_dlkm", + "odm_dlkm", + "system_dlkm", + "dtbo", + "pvmfw", + "recovery", + "vbmeta_system", + "vbmeta_vendor", +} + func (v *vbmeta) GenerateAndroidBuildActions(ctx android.ModuleContext) { builder := android.NewRuleBuilder(pctx, ctx) cmd := builder.Command().BuiltTool("avbtool").Text("make_vbmeta_image") @@ -210,24 +235,56 @@ func (v *vbmeta) GenerateAndroidBuildActions(ctx android.ModuleContext) { cmd.FlagWithArg("--prop ", key+":"+value) } - for _, p := range ctx.GetDirectDepsWithTag(vbmetaPartitionDep) { - f, ok := p.(Filesystem) - if !ok { - ctx.PropertyErrorf("partitions", "%q(type: %s) is not supported", - p.Name(), ctx.OtherModuleType(p)) + type partitionWithName struct { + Name string + Output android.Path + } + var includeDescriptorsFromImages []partitionWithName + for _, p := range ctx.GetDirectDepsProxyWithTag(vbmetaPartitionDep) { + bootImgInfo, ok := android.OtherModuleProvider(ctx, p, BootimgInfoProvider) + if ok { + includeDescriptorsFromImages = append(includeDescriptorsFromImages, partitionWithName{ + Name: bootImgInfo.Type.String(), + Output: bootImgInfo.SignedOutput, + }) continue } - signedImage := f.SignedOutputPath() - if signedImage == nil { - ctx.PropertyErrorf("partitions", "%q(type: %s) is not signed. Use `use_avb: true`", + + fsInfo, ok := android.OtherModuleProvider(ctx, p, FilesystemProvider) + if !ok { + ctx.PropertyErrorf("partitions", "%q(type: %s) is not supported, must be a filesystem", p.Name(), ctx.OtherModuleType(p)) continue } - cmd.FlagWithInput("--include_descriptors_from_image ", signedImage) + includeDescriptorsFromImages = append(includeDescriptorsFromImages, partitionWithName{ + Name: fsInfo.PartitionName, + Output: fsInfo.SignedOutputPath, + }) + } + + sort.SliceStable(includeDescriptorsFromImages, func(i, j int) bool { + iName := includeDescriptorsFromImages[i].Name + jName := includeDescriptorsFromImages[j].Name + iIndex := slices.Index(includeDescriptorsFromImgOrder, iName) + jIndex := slices.Index(includeDescriptorsFromImgOrder, jName) + if iIndex < 0 && jIndex < 0 { + return iName < jName + } + if iIndex < 0 { + return false + } + if jIndex < 0 { + return true + } + return iIndex < jIndex + }) + + for _, partition := range includeDescriptorsFromImages { + cmd.FlagWithInput("--include_descriptors_from_image ", partition.Output) } seenRils := make(map[int]bool) - for _, cp := range ctx.GetDirectDepsWithTag(vbmetaChainedPartitionDep) { + for _, cp := range ctx.GetDirectDepsProxyWithTag(vbmetaChainedPartitionDep) { info, ok := android.OtherModuleProvider(ctx, cp, vbmetaPartitionProvider) if !ok { ctx.PropertyErrorf("chained_partitions", "Expected all modules in chained_partitions to provide vbmetaPartitionProvider, but %s did not", cp.Name()) |
