| # Copyright 2018 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("//src/graphics/lib/gbm/gbm.gni") |
| import("//src/virtualization/buildtools/linux_paths.gni") |
| import("//src/virtualization/buildtools/romfs_image.gni") |
| |
| extras_image = "$target_out_dir/linux/extras.img" |
| resource("extras_img") { |
| sources = [ extras_image ] |
| outputs = [ "data/{{source_file_part}}" ] |
| } |
| |
| declare_args() { |
| # Default values for the guest network configuration. |
| # |
| # These are currently hard-coded to match what is setup in the virtio-net |
| # device. |
| # |
| # See //src/virtualization/bin/vmm/device/virtio_net.cc for more details. |
| linux_runner_ip = "10.0.0.2" |
| linux_runner_gateway = "10.0.0.1" |
| linux_runner_netmask = "255.255.255.0" |
| |
| # If `true`, adds additional testonly content to extras.img, which will be |
| # built and mounted inside the container at /mnt/chromeos. |
| linux_runner_extras_tests = false |
| |
| # If `true`, all block devices that would normally load as READ_WRITE will |
| # be loaded as VOLATILE_WRITE. This is useful when working on changes to |
| # the linux kernel as crashes and panics can sometimes corrupt the images. |
| linux_runner_volatile_block = false |
| |
| # Point this to the location of external files to be included as extras |
| linux_runner_user_extras = [] |
| } |
| |
| config("linux_runner_net_config") { |
| defines = [ |
| "LINUX_RUNNER_IP_DEFAULT=\"" + linux_runner_ip + "\"", |
| "LINUX_RUNNER_GATEWAY_DEFAULT=\"" + linux_runner_gateway + "\"", |
| "LINUX_RUNNER_NETMASK_DEFAULT=\"" + linux_runner_netmask + "\"", |
| ] |
| } |
| |
| source_set("lib") { |
| sources = [ |
| "crash_listener.h", |
| "guest.cc", |
| "guest.h", |
| "linux_component.cc", |
| "linux_component.h", |
| "linux_runner.cc", |
| "linux_runner.h", |
| "log_collector.cc", |
| "log_collector.h", |
| "ports.h", |
| ] |
| public_configs = [ ":linux_runner_net_config" ] |
| public_deps = [ |
| "//sdk/fidl/fuchsia.sys", |
| "//sdk/fidl/fuchsia.ui.app", |
| "//sdk/fidl/fuchsia.virtualization", |
| "//sdk/fidl/fuchsia.wayland", |
| "//sdk/lib/fit-promise", |
| "//sdk/lib/sys/cpp", |
| "//sdk/lib/virtualization", |
| "//src/lib/fsl", |
| "//src/lib/fxl", |
| "//src/lib/storage/vfs/cpp", |
| "//src/virtualization/lib/grpc", |
| "//src/virtualization/lib/guest_config", |
| "//src/virtualization/packages/biscotti_guest/third_party/protos:vm_cc_proto", |
| "//third_party/grpc:grpc++", |
| "//third_party/protobuf:protobuf_lite", |
| "//zircon/public/lib/async-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/fzl", |
| "//zircon/system/ulib/trace-provider:trace-provider-with-fdio", |
| ] |
| if (linux_runner_volatile_block) { |
| defines = [ "USE_VOLATILE_BLOCK" ] |
| } |
| } |
| |
| icd_filename = "libvulkan_intel.so" |
| icd_manifest = "${target_gen_dir}/magma.json" |
| |
| action("icd_manifest") { |
| visibility = [ ":*" ] |
| script = "//src/graphics/lib/magma/scripts/gen_icd_manifest.sh" |
| args = [ |
| "${icd_filename}", |
| rebase_path(icd_manifest, root_build_dir), |
| ] |
| outputs = [ icd_manifest ] |
| } |
| |
| romfs_image("extras") { |
| deps = [ |
| ":extras_img", |
| ":icd_manifest", |
| "//src/lib/vulkan:vulkan_headers_and_loader(${linux_lib_toolchain})", |
| ] |
| |
| inputs = [ |
| "${icd_manifest}", |
| "${linux_lib_path}/libvulkan.so", # Vulkan Loader |
| ] |
| |
| if (linux_runner_extras_tests) { |
| testonly = true |
| |
| deps += [ |
| "//src/graphics/examples:vkcube-on-wayland(${linux_exe_toolchain})", |
| "//src/graphics/lib/gbm", |
| "//src/graphics/lib/magma/tests/integration:virtmagma_abi_conformance_tests(${linux_exe_toolchain})", |
| "//src/graphics/lib/magma/tests_linux/unit_tests:virtmagma_image_tests(${linux_exe_toolchain})", |
| "//src/graphics/lib/magma/tests_linux/unit_tests:virtmagma_unit_tests_linux(${linux_exe_toolchain})", |
| "//src/graphics/lib/magma/tests_linux/unit_tests:virtmagma_vulkan_unit_tests(${linux_exe_toolchain})", |
| "//src/graphics/tests/vkgbm(${linux_exe_toolchain})", |
| "//src/lib/vulkan:vulkaninfo(${linux_exe_toolchain})", |
| ] |
| |
| inputs += [ |
| "${linux_exe_path}/virtmagma_unit_tests_linux", |
| "${linux_exe_path}/virtmagma_vulkan_unit_tests", |
| "${linux_exe_path}/virtmagma_abi_conformance_tests", |
| "${linux_exe_path}/cube-wayland", |
| "${linux_exe_path}/vulkaninfo", |
| "${linux_exe_path}/virtmagma_image_tests", |
| "${linux_exe_path}/vkgbm", |
| "${gbm_lib_path}", |
| ] |
| |
| inputs += linux_runner_user_extras |
| } |
| |
| if (current_cpu == "x64") { |
| deps += [ "//third_party/mesa/src/intel/vulkan:vulkan_intel(${linux_lib_toolchain})" ] |
| |
| inputs += [ "${linux_lib_path}/${icd_filename}" ] |
| } |
| |
| output = extras_image |
| } |
| |
| executable("bin") { |
| output_name = "linux_runner" |
| |
| sources = [ "main.cc" ] |
| |
| deps = [ ":lib" ] |
| } |
| |
| fuchsia_package_with_single_component("linux_runner") { |
| if (linux_runner_extras_tests) { |
| testonly = true |
| } |
| |
| deps = [ |
| ":bin", |
| ":extras", |
| ] |
| |
| manifest = "meta/linux_runner.cmx" |
| } |
| |
| executable("linux_runner_unittests") { |
| visibility = [ ":*" ] |
| testonly = true |
| |
| sources = [ "guest_unittest.cc" ] |
| |
| deps = [ |
| ":lib", |
| "//garnet/public/lib/gtest", |
| "//sdk/lib/sys/cpp/testing:unit", |
| "//sdk/lib/virtualization/testing", |
| "//src/lib/fxl/test:gtest_main", |
| "//src/storage/memfs", |
| ] |
| } |
| |
| fuchsia_unittest_package("linux_runner_tests") { |
| deps = [ ":linux_runner_unittests" ] |
| |
| test_specs = { |
| environments = basic_envs |
| } |
| } |