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
21rust_defaults {
22    name: "avf_build_flags_rust",
23    cfgs: select(release_flag("RELEASE_AVF_ENABLE_DEVICE_ASSIGNMENT"), {
24        true: ["device_assignment"],
25        default: [],
26    }) + select(release_flag("RELEASE_AVF_ENABLE_DICE_CHANGES"), {
27        true: ["dice_changes"],
28        default: [],
29    }) + select(release_flag("RELEASE_AVF_ENABLE_LLPVM_CHANGES"), {
30        true: ["llpvm_changes"],
31        default: [],
32    }) + select(release_flag("RELEASE_AVF_ENABLE_MULTI_TENANT_MICRODROID_VM"), {
33        true: ["multi_tenant"],
34        default: [],
35    }) + select(release_flag("RELEASE_AVF_ENABLE_NETWORK"), {
36        true: ["network"],
37        default: [],
38    }) + select(release_flag("RELEASE_AVF_ENABLE_REMOTE_ATTESTATION"), {
39        true: ["remote_attestation"],
40        default: [],
41    }) + select(release_flag("RELEASE_AVF_ENABLE_VENDOR_MODULES"), {
42        true: ["vendor_modules"],
43        default: [],
44    }) + select(release_flag("RELEASE_AVF_ENABLE_VM_TO_TEE_SERVICES_ALLOWLIST"), {
45        true: ["tee_services_allowlist"],
46        default: [],
47    }) + select(release_flag("RELEASE_AVF_ENABLE_VIRT_CPUFREQ"), {
48        true: ["virt_cpufreq"],
49        default: [],
50    }) + select(release_flag("RELEASE_AVF_IMPROVE_DEBUGGABLE_VMS"), {
51        true: ["debuggable_vms_improvements"],
52        default: [],
53    }) + select(release_flag("RELEASE_AVF_SUPPORT_CUSTOM_VM_WITH_PARAVIRTUALIZED_DEVICES"), {
54        true: ["paravirtualized_devices"],
55        default: [],
56    }),
57}
58
59cc_defaults {
60    name: "avf_build_flags_cc",
61    cflags: select(release_flag("RELEASE_AVF_ENABLE_DICE_CHANGES"), {
62        true: ["-DAVF_OPEN_DICE_CHANGES=1"],
63        default: [],
64    }) + select(release_flag("RELEASE_AVF_ENABLE_VENDOR_MODULES"), {
65        true: ["-DAVF_ENABLE_VENDOR_MODULES=1"],
66        default: [],
67    }) + select(release_flag("RELEASE_AVF_ENABLE_VIRT_CPUFREQ"), {
68        true: ["-DAVF_ENABLE_VIRT_CPUFREQ=1"],
69        default: [],
70    }),
71}
72
73genrule_defaults {
74    name: "dts_to_dtb",
75    tools: ["dtc"],
76    cmd: "FILES=($(in)) && $(location dtc) -@ -I dts -O dtb $${FILES[-1]} -o $(out)",
77}
78