diff options
author | 2025-03-18 00:14:47 +0000 | |
---|---|---|
committer | 2025-03-18 00:49:55 +0000 | |
commit | 65bcd97dbce6aee8aac13193d5d30742903afbda (patch) | |
tree | 35df76bdb48114f3eff0f011b2d1ed8da9c275f8 | |
parent | a1afd8a8930acbd48ec24102737752ad13f49bed (diff) |
Add some OTA related entries to misc_info.txt
Corresponding make code: https://cs.android.com/android/_/android/platform/build/+/8445b1703a24d34a2c6fc789f47cf81ceda3aaea:core/Makefile;l=5957-5965;drc=519f75666431ee2926e0ec8991c682b28a4c9521;bpv=1;bpt=0
This adds a subset of the args passed to mkbootimg cmd of the bootimg
deps. For cuttlefish, `header_version` seems to be the only argument
added to BOARD_*_MKBOOTIMG_ARGS.
Bug: 398036609
Test: Built Soong target_files.zip locally
Change-Id: I1e8e61df00a538c63b7020a3c9fa027ce3e52e12
-rw-r--r-- | android/config.go | 4 | ||||
-rw-r--r-- | filesystem/android_device.go | 24 | ||||
-rw-r--r-- | filesystem/bootimg.go | 2 |
3 files changed, 30 insertions, 0 deletions
diff --git a/android/config.go b/android/config.go index 2a4b9272b..885960bd3 100644 --- a/android/config.go +++ b/android/config.go @@ -1212,6 +1212,10 @@ func (c *config) ExtraOtaKeys(ctx PathContext, recovery bool) []SourcePath { return otaPaths } +func (c *config) ExtraOtaRecoveryKeys() []string { + return c.productVariables.ExtraOtaRecoveryKeys +} + func (c *config) BuildKeys() string { defaultCert := String(c.productVariables.DefaultAppCertificate) if defaultCert == "" || defaultCert == filepath.Join(testKeyDir, "testkey") { diff --git a/filesystem/android_device.go b/filesystem/android_device.go index 9cb90da12..11c0834ec 100644 --- a/filesystem/android_device.go +++ b/filesystem/android_device.go @@ -760,6 +760,24 @@ func (a *androidDevice) addMiscInfo(ctx android.ModuleContext) android.Path { Textf("&& echo recovery_api_version=%s >> %s", ctx.Config().VendorConfig("recovery").String("recovery_api_version"), miscInfo). Textf("&& echo fstab_version=%s >> %s", ctx.Config().VendorConfig("recovery").String("recovery_fstab_version"), miscInfo). ImplicitOutput(miscInfo) + if len(ctx.Config().ExtraOtaRecoveryKeys()) > 0 { + builder.Command().Textf(`echo "extra_recovery_keys=%s" >> %s`, strings.Join(ctx.Config().ExtraOtaRecoveryKeys(), ""), miscInfo) + } else { + if a.partitionProps.Boot_partition_name != nil { + builder.Command(). + Textf("echo mkbootimg_args='--header_version %s' >> %s", a.getBootimgHeaderVersion(ctx, a.partitionProps.Boot_partition_name), miscInfo). + // TODO: Use boot's header version for recovery for now since cuttlefish does not set `BOARD_RECOVERY_MKBOOTIMG_ARGS` + Textf(" && echo recovery_mkbootimg_args='--header_version %s' >> %s", a.getBootimgHeaderVersion(ctx, a.partitionProps.Boot_partition_name), miscInfo) + } + if a.partitionProps.Init_boot_partition_name != nil { + builder.Command(). + Textf("echo mkbootimg_init_args='--header_version' %s >> %s", a.getBootimgHeaderVersion(ctx, a.partitionProps.Init_boot_partition_name), miscInfo) + } + builder.Command(). + Textf("echo mkbootimg_version_args='--os_version %s --os_patch_level %s' >> %s", ctx.Config().PlatformVersionLastStable(), ctx.Config().PlatformSecurityPatch(), miscInfo). + Textf(" && echo multistage_support=1 >> %s", miscInfo). + Textf(" && echo blockimgdiff_versions=3,4 >> %s", miscInfo) + } if a.partitionProps.Recovery_partition_name == nil { builder.Command().Textf("echo no_recovery=true >> %s", miscInfo) @@ -813,6 +831,12 @@ func (a *androidDevice) addMiscInfo(ctx android.ModuleContext) android.Path { return miscInfo } +func (a *androidDevice) getBootimgHeaderVersion(ctx android.ModuleContext, bootImgName *string) string { + bootImg := ctx.GetDirectDepProxyWithTag(proptools.String(bootImgName), filesystemDepTag) + bootImgInfo, _ := android.OtherModuleProvider(ctx, bootImg, BootimgInfoProvider) + return bootImgInfo.HeaderVersion +} + // addImgToTargetFiles invokes `add_img_to_target_files` and creates the following files in META/ // - apex_info.pb // - care_map.pb diff --git a/filesystem/bootimg.go b/filesystem/bootimg.go index a1c4bce58..5ab0c6899 100644 --- a/filesystem/bootimg.go +++ b/filesystem/bootimg.go @@ -244,6 +244,7 @@ func (b *bootimg) GenerateAndroidBuildActions(ctx android.ModuleContext) { Bootconfig: b.getBootconfigPath(ctx), Output: output, PropFileForMiscInfo: b.buildPropFileForMiscInfo(ctx), + HeaderVersion: proptools.String(b.properties.Header_version), }) extractedPublicKey := android.PathForModuleOut(ctx, b.partitionName()+".avbpubkey") @@ -292,6 +293,7 @@ type BootimgInfo struct { Bootconfig android.Path Output android.Path PropFileForMiscInfo android.Path + HeaderVersion string } func (b *bootimg) getKernelPath(ctx android.ModuleContext) android.Path { |