diff options
author | Kevin <kevin.nilsson.2@volvocars.com> | 2024-05-02 12:37:59 +0200 |
---|---|---|
committer | Mattias Brodda <mattias.brodda@volvocars.com> | 2024-05-16 11:00:32 +0200 |
commit | 93f7cd85285aa653ee55a5bbe8fe0600a3a3fc6c (patch) | |
tree | 517fdea9432e82ea06d0d024003eac3f8f3566dd | |
parent | 0bcdc1f4175a9dbd4b938d2394d448d825a318e6 (diff) | |
download | soong-93f7cd85285aa653ee55a5bbe8fe0600a3a3fc6c.tar.gz |
Add support for prebuilt_overlay module type in soong
In Android 11 or higher, you can use OverlayConfig
to configure the mutability, default state, and priority
of overlays.
To configure an overlay, you need to create a config.xml
in partition/overlay/config/. Since there is no module type
in soong to install prebuilt artifacts on that location
(like prebuilt_etc for example) we need to manually create
and move that file using Make duing the build process.
This commit adds support to instead create that file
using soong. Then we can instead do something along the
lines of:
prebuilt_overlay {
name: "test-overlay",
src: ":generate-test-overlay",
sub_dir: "config",
filename: "config.xml",
product_specific: true,
}
which would create a config.xml file at the overlay/
directory of the partion in which the overlay is configured,
product/ in this example.
Test: cd build/soong/etc ; go test -run \
TestPrebuiltOverlayInstallDirPath
Bug: 340833016
Change-Id: Iaecae7784683fb9c4306a6834b3ee705c9c20806
-rw-r--r-- | etc/prebuilt_etc.go | 10 | ||||
-rw-r--r-- | etc/prebuilt_etc_test.go | 13 |
2 files changed, 23 insertions, 0 deletions
diff --git a/etc/prebuilt_etc.go b/etc/prebuilt_etc.go index 6ab3b8890..e168edc63 100644 --- a/etc/prebuilt_etc.go +++ b/etc/prebuilt_etc.go @@ -59,6 +59,7 @@ func RegisterPrebuiltEtcBuildComponents(ctx android.RegistrationContext) { ctx.RegisterModuleType("prebuilt_usr_keychars", PrebuiltUserKeyCharsFactory) ctx.RegisterModuleType("prebuilt_usr_idc", PrebuiltUserIdcFactory) ctx.RegisterModuleType("prebuilt_font", PrebuiltFontFactory) + ctx.RegisterModuleType("prebuilt_overlay", PrebuiltOverlayFactory) ctx.RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory) ctx.RegisterModuleType("prebuilt_dsp", PrebuiltDSPFactory) ctx.RegisterModuleType("prebuilt_rfsa", PrebuiltRFSAFactory) @@ -650,6 +651,15 @@ func PrebuiltFontFactory() android.Module { return module } +// prebuilt_overlay is for a prebuilt artifact in <partition>/overlay directory. +func PrebuiltOverlayFactory() android.Module { + module := &PrebuiltEtc{} + InitPrebuiltEtcModule(module, "overlay") + // This module is device-only + android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) + return module +} + // prebuilt_firmware installs a firmware file to <partition>/etc/firmware directory for system // image. // If soc_specific property is set to true, the firmware file is installed to the diff --git a/etc/prebuilt_etc_test.go b/etc/prebuilt_etc_test.go index 3ee234069..c44574aab 100644 --- a/etc/prebuilt_etc_test.go +++ b/etc/prebuilt_etc_test.go @@ -342,6 +342,19 @@ func TestPrebuiltFontInstallDirPath(t *testing.T) { android.AssertPathRelativeToTopEquals(t, "install dir", expected, p.installDirPath) } +func TestPrebuiltOverlayInstallDirPath(t *testing.T) { + result := prepareForPrebuiltEtcTest.RunTestWithBp(t, ` + prebuilt_overlay { + name: "foo.conf", + src: "foo.conf", + } + `) + + p := result.Module("foo.conf", "android_arm64_armv8-a").(*PrebuiltEtc) + expected := "out/soong/target/product/test_device/system/overlay" + android.AssertPathRelativeToTopEquals(t, "install dir", expected, p.installDirPath) +} + func TestPrebuiltFirmwareDirPath(t *testing.T) { targetPath := "out/soong/target/product/test_device" tests := []struct { |