From 2f0d193a9d12afd44060e16dd6af324df123fdff Mon Sep 17 00:00:00 2001 From: Jihoon Kang Date: Fri, 17 Jan 2025 19:22:44 +0000 Subject: Modify autogen vbmeta chain and include partitions logic This change modifies the logic in selecting the chain and include partitions for the top level vbmeta partition generation to follow that in make. Implementation details: - Introduce separate functions for selecting the include and chain partitions - Set vbmetaPartitionProvider in boot images and filesystem modules given that boot images can be selected as chained partitions. Test: compare soong and make generated vbmeta partitions command Bug: 390204058 Change-Id: I7940629212c4624e88d25b162755205503cfa469 --- fsgen/filesystem_creator.go | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'fsgen/filesystem_creator.go') diff --git a/fsgen/filesystem_creator.go b/fsgen/filesystem_creator.go index d2f00cd26..ebcc68b2b 100644 --- a/fsgen/filesystem_creator.go +++ b/fsgen/filesystem_creator.go @@ -178,7 +178,7 @@ func (f *filesystemCreator) createInternalModules(ctx android.LoadHookContext) { ) } - for _, x := range createVbmetaPartitions(ctx, finalSoongGeneratedPartitions) { + for _, x := range f.createVbmetaPartitions(ctx, finalSoongGeneratedPartitions) { f.properties.Vbmeta_module_names = append(f.properties.Vbmeta_module_names, x.moduleName) f.properties.Vbmeta_partition_names = append(f.properties.Vbmeta_partition_names, x.partitionName) } @@ -865,6 +865,8 @@ func generateFsProps(ctx android.EarlyModuleContext, partitionType string) (*fil fsProps.Avb_algorithm = avbInfo.avbAlgorithm // BOARD_AVB_SYSTEM_ROLLBACK_INDEX fsProps.Rollback_index = avbInfo.avbRollbackIndex + // BOARD_AVB_SYSTEM_ROLLBACK_INDEX_LOCATION + fsProps.Rollback_index_location = avbInfo.avbRollbackIndexLocation fsProps.Avb_hash_algorithm = avbInfo.avbHashAlgorithm fsProps.Partition_name = proptools.StringPtr(partitionType) @@ -893,13 +895,14 @@ func generateFsProps(ctx android.EarlyModuleContext, partitionType string) (*fil } type avbInfo struct { - avbEnable *bool - avbKeyPath *string - avbkeyFilegroup *string - avbAlgorithm *string - avbRollbackIndex *int64 - avbMode *string - avbHashAlgorithm *string + avbEnable *bool + avbKeyPath *string + avbkeyFilegroup *string + avbAlgorithm *string + avbRollbackIndex *int64 + avbRollbackIndexLocation *int64 + avbMode *string + avbHashAlgorithm *string } func getAvbInfo(config android.Config, partitionType string) avbInfo { @@ -946,6 +949,13 @@ func getAvbInfo(config android.Config, partitionType string) avbInfo { } result.avbRollbackIndex = &parsed } + if specificPartitionVars.BoardAvbRollbackIndexLocation != "" { + parsed, err := strconv.ParseInt(specificPartitionVars.BoardAvbRollbackIndexLocation, 10, 64) + if err != nil { + panic(fmt.Sprintf("Rollback index location must be an int, got %s", specificPartitionVars.BoardAvbRollbackIndexLocation)) + } + result.avbRollbackIndexLocation = &parsed + } // Make allows you to pass arbitrary arguments to avbtool via this variable, but in practice // it's only used for --hash_algorithm. The soong module has a dedicated property for the -- cgit v1.2.3-59-g8ed1b