1//
2// Copyright (C) 2021 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16package {
17    default_team: "trendy_team_virtualization",
18    default_applicable_licenses: ["Android-Apache-2.0"],
19}
20
21soong_config_module_type {
22    name: "avf_flag_aware_rust_defaults",
23    module_type: "rust_defaults",
24    config_namespace: "ANDROID",
25    bool_variables: [
26        "release_avf_enable_device_assignment",
27        "release_avf_enable_dice_changes",
28        "release_avf_enable_llpvm_changes",
29        "release_avf_enable_multi_tenant_microdroid_vm",
30        "release_avf_enable_network",
31        "release_avf_enable_remote_attestation",
32        "release_avf_enable_vendor_modules",
33        "release_avf_enable_virt_cpufreq",
34        "release_avf_support_custom_vm_with_paravirtualized_devices",
35    ],
36    properties: [
37        "cfgs",
38    ],
39}
40
41avf_flag_aware_rust_defaults {
42    name: "avf_build_flags_rust",
43    soong_config_variables: {
44        release_avf_enable_device_assignment: {
45            cfgs: ["device_assignment"],
46        },
47        release_avf_enable_dice_changes: {
48            cfgs: ["dice_changes"],
49        },
50        release_avf_enable_llpvm_changes: {
51            cfgs: ["llpvm_changes"],
52        },
53        release_avf_enable_multi_tenant_microdroid_vm: {
54            cfgs: ["multi_tenant"],
55        },
56        release_avf_enable_network: {
57            cfgs: ["network"],
58        },
59        release_avf_enable_remote_attestation: {
60            cfgs: ["remote_attestation"],
61        },
62        release_avf_enable_vendor_modules: {
63            cfgs: ["vendor_modules"],
64        },
65        release_avf_enable_virt_cpufreq: {
66            cfgs: ["virt_cpufreq"],
67        },
68        release_avf_support_custom_vm_with_paravirtualized_devices: {
69            cfgs: ["paravirtualized_devices"],
70        },
71    },
72}
73
74soong_config_module_type {
75    name: "avf_flag_aware_cc_defaults",
76    module_type: "cc_defaults",
77    config_namespace: "ANDROID",
78    bool_variables: [
79        "release_avf_enable_dice_changes",
80        "release_avf_enable_vendor_modules",
81        "release_avf_enable_virt_cpufreq",
82    ],
83    properties: [
84        "cflags",
85    ],
86}
87
88avf_flag_aware_cc_defaults {
89    name: "avf_build_flags_cc",
90    soong_config_variables: {
91        release_avf_enable_dice_changes: {
92            cflags: ["-DAVF_OPEN_DICE_CHANGES=1"],
93        },
94        release_avf_enable_vendor_modules: {
95            cflags: ["-DAVF_ENABLE_VENDOR_MODULES=1"],
96        },
97        release_avf_enable_virt_cpufreq: {
98            cflags: ["-DAVF_ENABLE_VIRT_CPUFREQ=1"],
99        },
100    },
101}
102
103genrule_defaults {
104    name: "dts_to_dtb",
105    tools: ["dtc"],
106    cmd: "FILES=($(in)) && $(location dtc) -@ -I dts -O dtb $${FILES[-1]} -o $(out)",
107}
108
109// This is a temporary workaround until b/309090563 is implemented.
110aconfig_declarations {
111    name: "avf_aconfig_flags",
112    package: "com.android.system.virtualmachine.flags",
113    container: "com.android.virt",
114    srcs: [
115        "avf_flags.aconfig",
116    ],
117}
118
119java_aconfig_library {
120    name: "avf_aconfig_flags_java",
121    aconfig_declarations: "avf_aconfig_flags",
122    sdk_version: "module_current",
123    apex_available: ["com.android.virt"],
124}
125