Support for prebuilt_avb in Soong

Generally, the `root` directories for `prebuilt_etc` and
`prebuilt_root` are <partitions>. And <partitions> default to false
for InstallInRoot(), they always create a "system" subdirectory.
(See android/paths.go:modulePartition())

However, avb keys like `q-developer-gsi.avbpubkey` are installed by
default in the `avb` subdirectory under the `root directory` of the
<partition>. Therefore, it is necessary to create `prebuilt_avb` in
Soong and force the installation directory to be the `avb` subdirectory
under the `root directory` of the <partition> to meet the requirements.

Bug: 347636127
Test: go test -run TestPrebuiltAvbInstallDirPath
Change-Id: I0ee08492da9a96a567700a7285c527b280dcd5db
This commit is contained in:
Nelson Li
2024-07-09 17:04:52 +08:00
parent 72be248e10
commit 1fb94b2245
2 changed files with 55 additions and 0 deletions

View File

@@ -244,6 +244,31 @@ func TestPrebuiltRootInstallDirPathValidate(t *testing.T) {
`)
}
func TestPrebuiltAvbInstallDirPath(t *testing.T) {
result := prepareForPrebuiltEtcTest.RunTestWithBp(t, `
prebuilt_avb {
name: "foo.conf",
src: "foo.conf",
filename: "foo.conf",
//recovery: true,
}
`)
p := result.Module("foo.conf", "android_arm64_armv8-a").(*PrebuiltEtc)
expected := "out/soong/target/product/test_device/root/avb"
android.AssertPathRelativeToTopEquals(t, "install dir", expected, p.installDirPath)
}
func TestPrebuiltAvdInstallDirPathValidate(t *testing.T) {
prepareForPrebuiltEtcTest.ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern("filename cannot contain separator")).RunTestWithBp(t, `
prebuilt_avb {
name: "foo.conf",
src: "foo.conf",
filename: "foo/bar.conf",
}
`)
}
func TestPrebuiltUserShareInstallDirPath(t *testing.T) {
result := prepareForPrebuiltEtcTest.RunTestWithBp(t, `
prebuilt_usr_share {