1//
2// Copyright (C) 2020 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//
16
17package {
18    default_applicable_licenses: ["Android-Apache-2.0"],
19}
20
21python_defaults {
22    name: "gki_python_defaults",
23    libs: [
24        "releasetools_ota_from_target_files",
25    ],
26    version: {
27        py3: {
28            embedded_launcher: true,
29        },
30    },
31    target: {
32        darwin: {
33            // required module "brillo_update_payload" is disabled on darwin
34            enabled: false,
35        },
36    },
37}
38
39python_binary_host {
40    name: "ota_from_raw_image",
41    defaults: ["gki_python_defaults"],
42    srcs: ["ota_from_raw_image.py"],
43    required: [
44        "brillo_update_payload",
45    ],
46}
47
48python_binary_host {
49    name: "extract_img_from_apex",
50    defaults: ["gki_python_defaults"],
51    srcs: ["extract_img_from_apex.py"],
52    required: [
53        "debugfs",
54        "delta_generator",
55    ],
56}
57
58apex_key {
59    name: "com.android.gki.key",
60    public_key: "com.android.gki.avbpubkey",
61    private_key: "com.android.gki.pem",
62}
63
64// Use cc_prebuilt_binary because sh_binary does not support product_specific.
65// TODO(b/169954965): Change to sh_binary when product_specific is supported.
66cc_prebuilt_binary {
67    name: "com.android.gki.preinstall",
68    product_specific: true,
69    srcs: ["preinstall.sh"],
70    apex_available: ["com.android.gki.*"],
71    strip: {
72        none: true,
73    },
74}
75
76// Common defaults for all GKI APEXes.
77apex_defaults {
78    name: "com.android.gki_defaults",
79    product_specific: true,
80    binaries: [
81        "update_engine_stable_client",
82        "com.android.gki.preinstall",
83    ],
84    file_contexts: ":com.android.gki-file_contexts",
85    // Key to sign apex_payload.img
86    key: "com.android.gki.key",
87    // Key to sign APEX. Left empty to use defaults.
88    certificate: "",
89    updatable: false,
90}
91
92// Helper binary to build APEX manifest for GKI.
93cc_binary_host {
94    name: "build_gki_apex_manifest",
95    srcs: [
96        "build_gki_apex_manifest.cpp",
97    ],
98    static_libs: [
99        "libbase",
100        "libgflags",
101        "libjsoncpp",
102        "libkver",
103        "liblog",
104    ],
105    cflags: [
106        "-Wall",
107        "-Werror",
108    ],
109}
110
111// Build GKI APEX 5.4-android12-0 from $(PRODUCT_OUT)/boot.img.
112// Also generate test packages.
113gki_apex {
114    name: "com.android.gki.kmi_5_4_android12_0",
115    installable: true,
116    kmi_version: "5.4-android12-0",
117    product_out_path: "boot.img",
118    gen_test: true,
119}
120
121// Build GKI APEX 5.10-android12-0 from $(PRODUCT_OUT)/boot.img.
122// Also generate test packages.
123// TODO(b/186647770): Delete when no devices install it.
124gki_apex {
125    name: "com.android.gki.kmi_5_10_android12_0",
126    installable: true,
127    kmi_version: "5.10-android12-0",
128    product_out_path: "boot.img",
129    gen_test: true,
130}
131
132// Build GKI APEX 5.10-android12-1 from $(PRODUCT_OUT)/boot.img.
133// Also generate test packages.
134// TODO(b/186647770): Delete when no devices install it.
135gki_apex {
136    name: "com.android.gki.kmi_5_10_android12_1",
137    installable: true,
138    kmi_version: "5.10-android12-1",
139    product_out_path: "boot.img",
140    gen_test: true,
141}
142
143// Build GKI APEX 5.10-android12-unstable from $(PRODUCT_OUT)/boot.img.
144// Also generate test packages.
145gki_apex {
146    name: "com.android.gki.kmi_5_10_android12_unstable",
147    installable: true,
148    kmi_version: "5.10-android12-unstable",
149    product_out_path: "boot.img",
150    gen_test: true,
151}
152
153// Build GKI APEX 5.4-android12-0 from $(PRODUCT_OUT)/boot-5.4.img
154gki_apex {
155    name: "com.android.gki.kmi_5_4_android12_0_boot-5.4",
156    installable: false,
157    kmi_version: "5.4-android12-0",
158    product_out_path: "boot-5.4.img",
159}
160
161// Build GKI APEX 5.10-android12-0 from $(PRODUCT_OUT)/boot-5.10.img
162// TODO(b/186647770): Delete when no devices install it.
163gki_apex {
164    name: "com.android.gki.kmi_5_10_android12_0_boot-5.10",
165    installable: false,
166    kmi_version: "5.10-android12-0",
167    product_out_path: "boot-5.10.img",
168}
169
170// Build GKI APEX 5.10-android12-1 from $(PRODUCT_OUT)/boot-5.10.img
171// TODO(b/186647770): Delete when no devices install it.
172gki_apex {
173    name: "com.android.gki.kmi_5_10_android12_1_boot-5.10",
174    installable: false,
175    kmi_version: "5.10-android12-1",
176    product_out_path: "boot-5.10.img",
177}
178
179// Build GKI APEX 5.10-android12-unstable from $(PRODUCT_OUT)/boot-5.10.img
180gki_apex {
181    name: "com.android.gki.kmi_5_10_android12_unstable_boot-5.10",
182    installable: false,
183    kmi_version: "5.10-android12-unstable",
184    product_out_path: "boot-5.10.img",
185}
186
187// List of all test APEXes for GkiInstallTest. Append "_test_high" and "_test_low" for each
188// gki_apex with gen_test:true.
189filegroup {
190    name: "gki_install_test_files",
191    srcs: [
192        ":com.android.gki.kmi_5_4_android12_0_test_high",
193        ":com.android.gki.kmi_5_4_android12_0_test_low",
194        ":com.android.gki.kmi_5_10_android12_0_test_high",
195        ":com.android.gki.kmi_5_10_android12_0_test_low",
196        ":com.android.gki.kmi_5_10_android12_unstable_test_high",
197        ":com.android.gki.kmi_5_10_android12_unstable_test_low",
198    ],
199}
200