| # Copyright 2017 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/components.gni") |
| import("//build/testing/environments.gni") |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":vmm_tests" ] |
| } |
| |
| group("vmm_tests") { |
| testonly = true |
| deps = [ |
| ":device_tests_package", |
| ":vmm_unittests_package", |
| ] |
| } |
| |
| source_set("lib") { |
| visibility = [ ":*" ] |
| |
| sources = [ |
| "bits.h", |
| "controller/virtio_balloon.cc", |
| "controller/virtio_balloon.h", |
| "controller/virtio_block.cc", |
| "controller/virtio_block.h", |
| "controller/virtio_console.cc", |
| "controller/virtio_console.h", |
| "controller/virtio_gpu.cc", |
| "controller/virtio_gpu.h", |
| "controller/virtio_input.cc", |
| "controller/virtio_input.h", |
| "controller/virtio_magma.cc", |
| "controller/virtio_magma.h", |
| "controller/virtio_net.cc", |
| "controller/virtio_net.h", |
| "controller/virtio_rng.cc", |
| "controller/virtio_rng.h", |
| "controller/virtio_wl.cc", |
| "controller/virtio_wl.h", |
| "dev_mem.h", |
| "guest.cc", |
| "guest.h", |
| "guest_impl.cc", |
| "guest_impl.h", |
| "io.cc", |
| "io.h", |
| "linux.cc", |
| "linux.h", |
| "pci.cc", |
| "pci.h", |
| "platform_device.h", |
| "sysinfo.h", |
| "vcpu.cc", |
| "vcpu.h", |
| "virtio_device.h", |
| "virtio_pci.cc", |
| "virtio_pci.h", |
| "virtio_queue_waiter.cc", |
| "virtio_queue_waiter.h", |
| "virtio_vsock.cc", |
| "virtio_vsock.h", |
| "zircon.cc", |
| "zircon.h", |
| ] |
| |
| if (current_cpu == "arm64") { |
| sources += [ |
| "arch/arm64/gic_distributor.cc", |
| "arch/arm64/gic_distributor.h", |
| "arch/arm64/pl011.cc", |
| "arch/arm64/pl011.h", |
| "arch/arm64/pl031.cc", |
| "arch/arm64/pl031.h", |
| ] |
| } else if (current_cpu == "x64") { |
| sources += [ |
| "arch/x64/acpi.cc", |
| "arch/x64/acpi.h", |
| "arch/x64/acpi_priv.h", |
| "arch/x64/decode.cc", |
| "arch/x64/decode.h", |
| "arch/x64/e820.cc", |
| "arch/x64/e820.h", |
| "arch/x64/i8250.cc", |
| "arch/x64/i8250.h", |
| "arch/x64/io_apic.cc", |
| "arch/x64/io_apic.h", |
| "arch/x64/io_port.cc", |
| "arch/x64/io_port.h", |
| "arch/x64/page_table.cc", |
| "arch/x64/page_table.h", |
| ] |
| } |
| |
| configs += [ "//build/config:all_source" ] |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.virtualization", |
| "//sdk/fidl/fuchsia.virtualization.hardware", |
| "//sdk/lib/fdio", |
| "//src/graphics/lib/magma/include/virtio", |
| "//src/lib/fsl", |
| "//src/lib/ui/base_view", |
| "//src/virtualization/third_party/fdt", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/zbitl", |
| ] |
| |
| public_deps = [ |
| "//sdk/fidl/fuchsia.hardware.ethernet:fuchsia.hardware.ethernet_c", |
| "//sdk/fidl/fuchsia.kernel", |
| "//sdk/fidl/fuchsia.sysinfo", |
| "//sdk/lib/stdcompat", |
| "//sdk/lib/sys/cpp", |
| "//src/devices/pci/lib/pci", |
| "//src/lib/ddk", |
| "//src/virtualization/bin/vmm/device", |
| "//third_party/acpica:headers", |
| "//zircon/public/lib/zx", |
| "//zircon/system/ulib/trace", |
| "//zircon/system/ulib/virtio", |
| ] |
| |
| # TODO(fxb/58162): delete the below and fix compiler warnings |
| configs += [ "//build/config:Wno-conversion" ] |
| } |
| |
| executable("bin") { |
| output_name = "vmm" |
| |
| sources = [ "main.cc" ] |
| |
| deps = [ |
| ":lib", |
| "//src/virtualization/lib/guest_config", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/trace-provider:trace-provider-with-fdio", |
| ] |
| |
| configs += [ "//build/config:all_source" ] |
| } |
| |
| resource("vmm-resources") { |
| if (target_cpu == "arm64") { |
| sources = [ "arch/arm64/dts/board.dtb" ] |
| } |
| if (target_cpu == "x64") { |
| sources = [ |
| "arch/x64/asl/dsdt.aml", |
| "arch/x64/asl/mcfg.aml", |
| ] |
| } |
| outputs = [ "data/{{source_file_part}}" ] |
| } |
| |
| fuchsia_package_with_single_component("vmm") { |
| manifest = "meta/vmm.cmx" |
| deps = [ |
| ":bin", |
| ":vmm-resources", |
| ] |
| } |
| |
| executable("vmm_unittests") { |
| visibility = [ ":*" ] |
| testonly = true |
| |
| sources = [ |
| "dev_mem_unittest.cc", |
| "pci_unittest.cc", |
| "phys_mem_fake.h", |
| "virtio_device_fake.h", |
| "virtio_queue_fake.cc", |
| "virtio_queue_fake.h", |
| "virtio_queue_unittest.cc", |
| "virtio_queue_waiter_unittest.cc", |
| "virtio_vsock_unittest.cc", |
| ] |
| |
| if (current_cpu == "x64") { |
| sources += [ |
| "arch/x64/decode_unittest.cc", |
| "arch/x64/page_table_unittest.cc", |
| ] |
| } |
| |
| deps = [ |
| ":lib", |
| "//garnet/public/lib/gtest", |
| "//src/lib/fxl/test:gtest_main", |
| "//third_party/googletest:gmock", |
| ] |
| } |
| |
| fuchsia_unittest_component("device_unittests_component") { |
| component_name = "device_unittests" |
| manifest = "meta/device_unittests.cmx" |
| deps = [ "device:device_unittests" ] |
| } |
| |
| fuchsia_unittest_component("vmm_unittests_component") { |
| component_name = "vmm_unittests" |
| deps = [ ":vmm_unittests" ] |
| } |
| |
| fuchsia_test_package("vmm_unittests_package") { |
| package_name = "vmm_unittests" |
| test_components = [ |
| ":device_unittests_component", |
| ":vmm_unittests_component", |
| ] |
| test_specs = { |
| log_settings = { |
| max_severity = "ERROR" |
| } |
| } |
| } |
| |
| fuchsia_unittest_package("device_tests_package") { |
| package_name = "device_tests" |
| manifest = "meta/device_tests.cmx" |
| deps = [ "device:device_tests" ] |
| test_specs = { |
| environments = [ nuc_env ] |
| } |
| } |