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
16package {
17    default_applicable_licenses: ["Android-Apache-2.0"],
18}
19
20bootstrap_go_package {
21    name: "cuttlefish-soong-rules",
22    pkgPath: "android/soong/cuttlefish",
23    deps: [
24        "blueprint",
25        "soong",
26        "soong-android",
27    ],
28    srcs: [
29        "cvd-host-package.go",
30    ],
31    pluginFor: ["soong_build"],
32}
33
34// Allow cvd-host-package.go to read custom action config variables
35// from ctx.Config().VendorConfig("cvd")
36soong_config_module_type {
37    name: "cvd_host_package_customization",
38    module_type: "cvd_host_package",
39    config_namespace: "cvd",
40    value_variables: [
41        "grub_config",
42        "launch_configs",
43        "custom_action_config",
44        "custom_action_servers",
45    ],
46}
47
48// Start of generated qemu_aarch64_linux_gnu_binary
49// Generated by gen_android_bp.py
50qemu_aarch64_linux_gnu_binary = [
51    "aarch64_linux_gnu_libc++.so.1_binary_for_qemu",
52    "aarch64_linux_gnu_libc++abi.so.1_binary_for_qemu",
53    "aarch64_linux_gnu_libepoxy.so.0_binary_for_qemu",
54    "aarch64_linux_gnu_libgbm.so.1_binary_for_qemu",
55    "aarch64_linux_gnu_libgfxstream_backend.so.0_binary_for_qemu",
56    "aarch64_linux_gnu_librutabaga_gfx_ffi.so.0_binary_for_qemu",
57    "aarch64_linux_gnu_libunwind.so.1_binary_for_qemu",
58    "aarch64_linux_gnu_libvirglrenderer.so.1_binary_for_qemu",
59    "aarch64_linux_gnu_libz.so.1_binary_for_qemu",
60    "aarch64_linux_gnu_qemu-system-aarch64_binary_for_qemu",
61    "aarch64_linux_gnu_qemu-system-riscv64_binary_for_qemu",
62    "aarch64_linux_gnu_qemu-system-x86_64_binary_for_qemu",
63]
64// End of generated qemu_aarch64_linux_gnu_binary
65
66// Start of generated qemu_aarch64_linux_gnu_resource
67// Generated by gen_android_bp.py
68qemu_aarch64_linux_gnu_resource = [
69    "aarch64_efi-virtio.rom_resource_for_qemu",
70    "aarch64_en-us_resource_for_qemu",
71    "aarch64_opensbi-riscv64-generic-fw_dynamic.bin_resource_for_qemu",
72]
73// End of generated qemu_aarch64_linux_gnu_resource
74
75// Start of generated qemu_x86_64_linux_gnu_binary
76// Generated by gen_android_bp.py
77qemu_x86_64_linux_gnu_binary = [
78    "x86_64_linux_gnu_libc++.so.1_binary_for_qemu",
79    "x86_64_linux_gnu_libepoxy.so.0_binary_for_qemu",
80    "x86_64_linux_gnu_libgbm.so.1_binary_for_qemu",
81    "x86_64_linux_gnu_libgfxstream_backend.so.0_binary_for_qemu",
82    "x86_64_linux_gnu_librutabaga_gfx_ffi.so.0_binary_for_qemu",
83    "x86_64_linux_gnu_libvirglrenderer.so.1_binary_for_qemu",
84    "x86_64_linux_gnu_libz.so.1_binary_for_qemu",
85    "x86_64_linux_gnu_qemu-system-aarch64_binary_for_qemu",
86    "x86_64_linux_gnu_qemu-system-riscv64_binary_for_qemu",
87    "x86_64_linux_gnu_qemu-system-x86_64_binary_for_qemu",
88]
89// End of generated qemu_x86_64_linux_gnu_binary
90
91// Start of generated qemu_x86_64_linux_gnu_resource
92// Generated by gen_android_bp.py
93qemu_x86_64_linux_gnu_resource = [
94    "x86_64_efi-virtio.rom_resource_for_qemu",
95    "x86_64_en-us_resource_for_qemu",
96    "x86_64_opensbi-riscv64-generic-fw_dynamic.bin_resource_for_qemu",
97]
98// End of generated qemu_x86_64_linux_gnu_resource
99
100cvd_host_tools = [
101    "acloud_translator",
102    "adb",
103    "adb_connector",
104    "allocd_client",
105    "assemble_cvd",
106    "avbtool",
107    "build_super_image",
108    "tcp_connector",
109    "casimir_control_server",
110    "common_crosvm",
111    "config_server",
112    "console_forwarder",
113    "control_env_proxy_server",
114    "crosvm",
115    "cvd_internal_display",
116    "cvd_internal_env",
117    "echo_server",
118    "cvd_internal_host_bugreport",
119    "cvd_internal_start",
120    "cvd_internal_status",
121    "cvd_internal_stop",
122    "cvd_host_bugreport",
123    "cvd_status",
124    "cvdremote",
125    "e2fsdroid",
126    "extract-ikconfig",
127    "extract-vmlinux",
128    "fastboot",
129    "fec",
130    "fsck.f2fs",
131    "gnss_grpc_proxy",
132    "health",
133    "kernel_log_monitor",
134    "launch_cvd",
135    "libgrpc++",
136    "libgrpc++_unsecure",
137    "log_tee",
138    "logcat_receiver",
139    "lpadd",
140    "lpmake",
141    "lpunpack",
142    "lz4",
143    "make_f2fs",
144    "metrics",
145    "metrics_launcher",
146    "mkbootfs",
147    "mkbootimg",
148    "mkenvimage_slim",
149    "mke2fs",
150    "mkuserimg_mke2fs",
151    "modem_simulator",
152    "ms-tpm-20-ref",
153    "mcopy",
154    "mmd",
155    "mtools",
156    "netsim",
157    "netsimd",
158    "newfs_msdos",
159    "openwrt_control_server",
160    "pica",
161    "powerbtn_cvd",
162    "powerwash_cvd",
163    "process_restarter",
164    "process_sandboxer",
165    "record_cvd",
166    "restart_cvd",
167    "root-canal",
168    "casimir",
169    "snapshot_util_cvd",
170    "run_cvd",
171    "screen_recording_server",
172    "secure_env",
173    "sefcontext_compile",
174    "cvd_send_id_disclosure",
175    "cvd_send_sms",
176    "cvd_update_location",
177    "cvd_update_security_algorithm",
178    "cvd_import_locations",
179    "simg2img",
180    "socket_vsock_proxy",
181    "stop_cvd",
182    "test_cvd_load_parser",
183    "tombstone_receiver",
184    "toybox",
185    "unpack_bootimg",
186    "webRTC",
187    "webrtc_operator",
188    "operator_proxy",
189    "wmediumd",
190    "wmediumd_gen_config",
191    "vulkan.pastel",
192    "automotive_vsock_proxy",
193    "vhost_device_vsock",
194    "vhal_proxy_server",
195]
196
197cvd_openwrt_images = [
198    "openwrt_kernel_x86_64",
199    "openwrt_rootfs_x86_64",
200    "openwrt_kernel_aarch64",
201    "openwrt_rootfs_aarch64",
202]
203
204cvd_host_tests = [
205    "cuttlefish_net_tests",
206    "modem_simulator_test",
207]
208
209cvd_host_webrtc_assets = [
210    "webrtc_adb.js",
211    "webrtc_app.js",
212    "webrtc_index.js",
213    "webrtc_controls.js",
214    "webrtc_cf.js",
215    "webrtc_server_connector.js",
216    "webrtc_index.html",
217    "webrtc_client.html",
218    "webrtc_rootcanal.js",
219    "webrtc_location.js",
220    "webrtc_touch.js",
221    "webrtc_server.crt",
222    "webrtc_server.key",
223    "webrtc_server.p12",
224    "webrtc_style.css",
225    "webrtc_index.css",
226    "webrtc_controls.css",
227    "webrtc_trusted.pem",
228]
229
230cvd_host_model_simulator_files = [
231    "iccprofile_for_sim0.xml_host",
232    "iccprofile_for_sim0_for_CtsCarrierApiTestCases.xml_host",
233    "numeric_operator.xml_host",
234]
235
236cvd_host_acloud_data = [
237    "default.config_host",
238]
239
240cvd_host_x86_64_crosvm = [
241    // Note: These should be uncommented out when backporting to older branches
242    // which only use the prebuilt and which do not build crosvm from source.
243    //"x86_64_linux_gnu_crosvm",
244    //"x86_64_linux_gnu_libdrm.so.2_for_crosvm",
245    //"x86_64_linux_gnu_libepoxy.so.0_for_crosvm",
246    //"x86_64_linux_gnu_libffi.so.7_for_crosvm",
247    //"x86_64_linux_gnu_libgbm.so.1_for_crosvm",
248    //"x86_64_linux_gnu_libgfxstream_backend.so_for_crosvm",
249    //"x86_64_linux_gnu_libminijail.so_for_crosvm",
250    //"x86_64_linux_gnu_libvirglrenderer.so.1_for_crosvm",
251    //"x86_64_linux_gnu_libwayland_client.so.0_for_crosvm",
252]
253
254// Note: these are prebuilts due to potential incompatibilities between Android
255// built host binaries and native host GPU libraries drivers.
256cvd_host_x86_64_graphics_detector = [
257    "x86_64_linux_gnu_gfxstream_graphics_detector_for_crosvm",
258]
259
260cvd_host_aarch64_graphics_detector = [
261    "aarch64_linux_gnu_gfxstream_graphics_detector_for_crosvm",
262]
263
264cvd_host_x86_64 = cvd_host_x86_64_graphics_detector + cvd_host_x86_64_crosvm + qemu_x86_64_linux_gnu_binary
265
266cvd_host_aarch64_crosvm = [
267    "aarch64_linux_gnu_crosvm",
268    "aarch64_linux_gnu_libdrm.so.2_for_crosvm",
269    "aarch64_linux_gnu_libepoxy.so.0_for_crosvm",
270    "aarch64_linux_gnu_libffi.so.7_for_crosvm",
271    "aarch64_linux_gnu_libgbm.so.1_for_crosvm",
272    "aarch64_linux_gnu_libgfxstream_backend.so_for_crosvm",
273    "aarch64_linux_gnu_libminijail.so_for_crosvm",
274    "aarch64_linux_gnu_libvirglrenderer.so.1_for_crosvm",
275    "aarch64_linux_gnu_libwayland_client.so.0_for_crosvm",
276]
277
278cvd_host_aarch64 = cvd_host_aarch64_crosvm + cvd_host_aarch64_graphics_detector + qemu_aarch64_linux_gnu_binary
279
280cvd_host_seccomp_policy_x86_64 = [
281    "9p_device.policy_x86_64",
282    "balloon_device.policy_x86_64",
283    "battery.policy_x86_64",
284    "block_device.policy_x86_64",
285    "block_device_vhost_user.policy_x86_64",
286    "coiommu_device.policy_x86_64",
287    "cras_audio_device.policy_x86_64",
288    "fs_device.policy_x86_64",
289    "fw_cfg_device.policy_x86_64",
290    "gpu_device.policy_x86_64",
291    "gpu_render_server.policy_x86_64",
292    "input_device.policy_x86_64",
293    "iommu_device.policy_x86_64",
294    "jail_warden.policy_x86_64",
295    "net_device.policy_x86_64",
296    "null_audio_device.policy_x86_64",
297    "pmem_device.policy_x86_64",
298    "rng_device.policy_x86_64",
299    "serial_device.policy_x86_64",
300    "serial_device_vhost_user.policy_x86_64",
301    "snd_cras_device.policy_x86_64",
302    "snd_null_device.policy_x86_64",
303    "vfio_device.policy_x86_64",
304    "vhost_net_device.policy_x86_64",
305    "vhost_vsock_device.policy_x86_64",
306    "video_device.policy_x86_64",
307    "vios_audio_device.policy_x86_64",
308    "vtpm_proxy_device.policy_x86_64",
309    "wl_device.policy_x86_64",
310    "xhci_device.policy_x86_64",
311]
312
313cvd_host_seccomp_policy_aarch64 = [
314    "9p_device.policy_aarch64",
315    "balloon_device.policy_aarch64",
316    "battery.policy_aarch64",
317    "block_device.policy_aarch64",
318    "coiommu_device.policy_aarch64",
319    "cras_audio_device.policy_aarch64",
320    "fs_device.policy_aarch64",
321    "gpu_device.policy_aarch64",
322    "gpu_render_server.policy_aarch64",
323    "input_device.policy_aarch64",
324    "net_device.policy_aarch64",
325    "null_audio_device.policy_aarch64",
326    "pmem_device.policy_aarch64",
327    "rng_device.policy_aarch64",
328    "serial_device.policy_aarch64",
329    "snd_cras_device.policy_aarch64",
330    "snd_null_device.policy_aarch64",
331    "vhost_net_device.policy_aarch64",
332    "vhost_scmi_device.policy_aarch64",
333    "vhost_vsock_device.policy_aarch64",
334    "video_device.policy_aarch64",
335    "vios_audio_device.policy_aarch64",
336    "wl_device.policy_aarch64",
337    "xhci_device.policy_aarch64",
338]
339
340cvd_host_bootloader = [
341    "bootloader_crosvm_x86_64",
342    "bootloader_crosvm_aarch64",
343    "bootloader_qemu_aarch64",
344    "bootloader_qemu_arm",
345    "bootloader_qemu_riscv64",
346    "bootloader_qemu_x86_64",
347]
348
349prebuilt_etc_host {
350    name: "cvd_avb_testkey_rsa2048",
351    filename: "cvd_avb_testkey_rsa2048.pem",
352    src: ":avb_testkey_rsa2048",
353}
354
355prebuilt_etc_host {
356    name: "cvd_avb_testkey_rsa4096",
357    filename: "cvd_avb_testkey_rsa4096.pem",
358    src: ":avb_testkey_rsa4096",
359}
360
361automotive_proxy_config = [
362    "automotive_proxy_config",
363]
364
365cvd_host_avb_testkey = [
366    "cvd_avb_pubkey_rsa2048",
367    "cvd_avb_pubkey_rsa4096",
368    "cvd_avb_testkey_rsa2048",
369    "cvd_avb_testkey_rsa4096",
370]
371
372cvd_host_netsim_gui_assets = [
373    "netsim_ui_index.html",
374    "netsim_ui_js_cube-sprite.js",
375    "netsim_ui_js_customize-map-button.js",
376    "netsim_ui_js_device-dragzone.js",
377    "netsim_ui_js_device-dropzone.js",
378    "netsim_ui_js_device-info.js",
379    "netsim_ui_js_device-list.js",
380    "netsim_ui_js_device-map.js",
381    "netsim_ui_js_device-observer.js",
382    "netsim_ui_js_license-info.js",
383    "netsim_ui_js_navigation-bar.js",
384    "netsim_ui_js_netsim-app.js",
385    "netsim_ui_js_packet-info.js",
386    "netsim_ui_js_pyramid-sprite.js",
387    "netsim_ui_tslib",
388    "netsim_ui_assets_grid-background.svg",
389    "netsim_ui_assets_hexagonal-background.png",
390    "netsim_ui_assets_netsim-logo-b.svg",
391    "netsim_ui_assets_netsim-logo.svg",
392    "netsim_ui_assets_polar-background.svg",
393]
394
395genrule {
396    name: "vk_swiftshader_icd.json",
397    srcs: [
398        "//external/swiftshader:swiftshader_icd_json_template",
399    ],
400    out: [
401        "vk_swiftshader_icd.json",
402    ],
403    // From Vulkan Loader documentation:
404    //
405    //   If "library_path" specifies a relative pathname, it is relative
406    //   to the path of the JSON manifest file.
407    //
408    // Our host package looks like:
409    //
410    //   <host package>/lib64/vulkan.pastel
411    //   <host package>/usr/share/vulkan/icd.d/vk_swiftshader_icd.json
412    //
413    // so need "../../../../lib64/vulkan.pastel".
414    cmd: "sed -e 's|$${ICD_LIBRARY_PATH}|../../../../lib64/vulkan.pastel.so|g' $(in) > $(out)",
415}
416
417prebuilt_usr_share_host {
418    name: "vk_swiftshader_icd_json_prebuilt",
419    filename: "vk_swiftshader_icd.json",
420    relative_install_path: "vulkan/icd.d",
421    src: ":vk_swiftshader_icd.json",
422}
423
424cvd_host_swiftshader_files = [
425    "vk_swiftshader_icd_json_prebuilt",
426]
427
428cvd_host_package_customization {
429    name: "cvd-host_package",
430    deps: cvd_host_tools +
431        cvd_host_tests,
432    multilib: {
433        common: {
434            deps: cvd_host_webrtc_assets +
435                cvd_host_avb_testkey +
436                cvd_host_model_simulator_files +
437                cvd_host_acloud_data +
438                cvd_host_bootloader +
439                cvd_host_swiftshader_files +
440                cvd_openwrt_images +
441                cvd_host_netsim_gui_assets +
442                automotive_proxy_config,
443        },
444    },
445
446    arch: {
447        x86_64: {
448            deps: cvd_host_x86_64,
449            multilib: {
450                common: {
451                    deps: cvd_host_seccomp_policy_x86_64 + qemu_x86_64_linux_gnu_resource,
452                },
453            },
454        },
455        arm64: {
456            deps: cvd_host_aarch64,
457            multilib: {
458                common: {
459                    deps: cvd_host_seccomp_policy_aarch64 + qemu_aarch64_linux_gnu_resource,
460                },
461            },
462        },
463    },
464    target: {
465        linux_musl: {
466            multilib: {
467                common: {
468                    deps: ["tzdata_host"],
469                },
470            },
471        },
472        linux_bionic_x86_64: {
473            enabled: false,
474        },
475        darwin: {
476            enabled: false,
477        },
478    },
479}
480