summaryrefslogtreecommitdiff
path: root/filesystem/system_other.go
diff options
context:
space:
mode:
author Cole Faust <colefaust@google.com> 2025-02-19 15:20:20 -0800
committer Cole Faust <colefaust@google.com> 2025-02-19 15:32:11 -0800
commit3c02ffa832304de0e52eb66611058775ac69f45a (patch)
treebca1a11596ebc55a5bc82db4a8b909a323df0a5f /filesystem/system_other.go
parent4b1a0b83301ff2dfeaa1de93f741a8886ed4ffeb (diff)
Fix diffs in system_other image
Make seems to use functionality of build_image that relies on the output filename. So it sees that the output is system_other.img and makes changes based on that. We don't use that codepath, so make those changes ourselves. Bug: 376539388 Test: diff out/target/product/vsoc_x86_64/system_other.img out/soong/.intermediates/build/soong/fsgen/aosp_cf_x86_64_phone_generated_system_other_image/android_common/system_other.img Change-Id: I425b54efc5412e780369b2a851606bd1f1c99ae3
Diffstat (limited to 'filesystem/system_other.go')
-rw-r--r--filesystem/system_other.go21
1 files changed, 19 insertions, 2 deletions
diff --git a/filesystem/system_other.go b/filesystem/system_other.go
index 1c00dd35e..5309e9012 100644
--- a/filesystem/system_other.go
+++ b/filesystem/system_other.go
@@ -23,6 +23,12 @@ import (
"github.com/google/blueprint/proptools"
)
+var (
+ systemOtherPropFileTweaks = pctx.AndroidStaticRule("system_other_prop_file_tweaks", blueprint.RuleParams{
+ Command: `rm -rf $out && sed -e 's@^mount_point=/$$@mount_point=system_other@g' -e 's@^partition_name=system$$@partition_name=system_other@g' $in > $out`,
+ })
+)
+
type SystemOtherImageProperties struct {
// The system_other image always requires a reference to the system image. The system_other
// partition gets built into the system partition's "b" slot in a/b partition builds. Thus, it
@@ -123,12 +129,23 @@ func (m *systemOtherImage) GenerateAndroidBuildActions(ctx android.ModuleContext
fec := ctx.Config().HostToolPath(ctx, "fec")
pathToolDirs := []string{filepath.Dir(fec.String())}
+ // In make, the exact same prop file is used for both system and system_other. However, I
+ // believe make goes through a different build_image code path that is based on the name of
+ // the output file. So it sees the output file is named system_other.img and makes some changes.
+ // We don't use that codepath, so make the changes manually to the prop file.
+ propFile := android.PathForModuleOut(ctx, "prop")
+ ctx.Build(pctx, android.BuildParams{
+ Rule: systemOtherPropFileTweaks,
+ Input: systemInfo.BuildImagePropFile,
+ Output: propFile,
+ })
+
builder = android.NewRuleBuilder(pctx, ctx)
builder.Command().
Textf("PATH=%s:$PATH", strings.Join(pathToolDirs, ":")).
BuiltTool("build_image").
Text(stagingDir.String()). // input directory
- Input(systemInfo.BuildImagePropFile).
+ Input(propFile).
Implicits(systemInfo.BuildImagePropFileDeps).
Implicit(fec).
Implicit(stagingDirTimestamp).
@@ -140,7 +157,7 @@ func (m *systemOtherImage) GenerateAndroidBuildActions(ctx android.ModuleContext
// Create a hermetic system_other.img with pinned timestamps
builder = android.NewRuleBuilder(pctx, ctx)
outputHermetic := android.PathForModuleOut(ctx, "for_target_files", "system_other.img")
- outputHermeticPropFile := m.propFileForHermeticImg(ctx, builder, systemInfo.BuildImagePropFile)
+ outputHermeticPropFile := m.propFileForHermeticImg(ctx, builder, propFile)
builder.Command().
Textf("PATH=%s:$PATH", strings.Join(pathToolDirs, ":")).
BuiltTool("build_image").