blob: cb5554400c025b7273ed575ed2dacd5ff4ee8740 [file] [edit]
# 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/assembly/assembled_system.gni")
import("//build/assembly/product_assembly_configuration.gni")
import("//build/board.gni")
import("//build/images/args.gni")
import("//build/images/paths.gni")
import("//build/product.gni")
import("//src/storage/fshost/generated_fshost_config.gni")
import("//src/sys/core/build/core.gni")
#########
#
# The Fuchsia Guest System Assembly Definition.
#
# The guest image is meant to be run in a VM hosted by the virtualization
# subsystem in Fuchsia (running a Fuchsia VM on top of Fuchsia).
#
# The _contents_ of the guest system should not vary based any of the
# global GN args that are set by the //product/<foo>.gni product-definition
# files. If it exists, it should always be the same regardless of the "main
# product" that is being built for, as it is its own product-like assembly.
#
# The primary use of the guest system is to test the virtualization subsystem.
# Its contents are based around that use-case.
#
# It needs:
# - General "eng" build-type support from the bringup / bootstrap level
# - serial access
# - virtcon
# - a shell
# - A netstack
# - ssh isn't required, but not prohibited
# - other connectivity components (e.g. bluetooth are not desired)
# - The virtio drivers
# - It's own vmm-specific board definition (which doesn't yet exist)
# NOTE: As this is not available on bringup builds, the guest image is made into
# no-op group in that build configuration, in order to work around ninja
# dependency tracking issues for incremental builds when changing from an
# `fx set core...` to `fx set bringup...`. When this happens, ninja tries to
# build dependencies it remembered from the `core` product, even if those are
# nonsense (or not buildable) for bringup.
#
# And so the use of an empty group when building for bringup is an optimization
# to make these targets fall out of the build graph in these situations, which
# reduces build times and flake rates.
#
# See: http://fxbug.dev/110852 for context.
if (labels.images == "//build/images/bringup") {
group("guest") {
testonly = true
}
} else {
# In all other builds, define the guest assembly.
# Guest's specific core realm (not based on core_realm_shards).
core_realm_definition("core") {
testonly = true
}
# Guest's specific product assembly. It's based on the minimal feature set
# and is specifically an "eng" build-type so that it can run tests.
product_assembly_configuration("product_assembly_config") {
platform = {
build_type = "eng"
feature_set_level = "utility"
storage = {
configure_fshost = true
filesystems = {
no_zxcrypt = true
volume = {
fvm = {
data = {
}
blob = {
}
}
}
}
}
}
}
# The guest image itself.
assembled_system("guest") {
testonly = true
generate_fvm = true
generate_fvm_fastboot = assembly_generate_fvm_fastboot
generate_fvm_nand = assembly_generate_fvm_nand
generate_vbmeta = use_vbmeta
namespace = "guest"
image_name = "fuchsia"
product_assembly_config_label = ":product_assembly_config"
board_config = board_information_for_assembly
board_config_label = board_configuration_label
# As `:product_assembly_config` specifies an `eng` build-type, the assembly
# needs to be allowed to use the "eng" platform bundles as deps / inputs.
allow_eng_platform_bundle_use = true
base_packages = [
"//src/performance/trace",
"//src/sys/core:component_id_index_no_restrict_storage",
"//src/sys/core:core_component_id_index",
"//src/virtualization/tests:virtualization_test_utils_pkg",
"//src/cobalt/bin/app:cobalt_registry",
"//src/cobalt/bin/app:config",
"//src/security/bin/root_ssl_certificates",
]
bootfs_labels = [
"//src/power/power-manager:base_config",
"//src/connectivity/ethernet/drivers/ethernet/netdevice-migration",
"//src/connectivity/ethernet/drivers/virtio:virtio_netdevice",
"//src/connectivity/network/drivers/network-device",
"//src/devices/block/drivers/virtio:virtio_block",
"//src/devices/block/drivers/virtio:virtio_scsi",
"//src/devices/board/drivers/machina",
"//src/devices/bus/drivers/pci:bus-pci",
"//src/devices/misc/drivers/virtio-rng:virtio_rng",
"//src/devices/serial/drivers/virtio-console:virtio_console",
"//src/devices/sysmem/drivers/sysmem",
"//src/graphics/display/drivers/coordinator",
"//src/graphics/display/drivers/virtio-guest:virtio_gpu",
"//src/storage/bin/minfs:minfs-component",
"//src/storage/bin/mount",
"//src/storage/bin/umount",
"//src/storage/fvm/driver",
"//src/sys/component_manager:component_manager_bootfs_config",
"//src/ui/input/drivers/hid",
"//src/ui/input/drivers/hid-input-report",
"//src/ui/input/drivers/virtio:virtio_input",
]
if (current_cpu == "x64") {
bootfs_labels += [
"//src/devices/block/drivers/ahci",
"//src/devices/block/drivers/mbr",
"//src/devices/board/drivers/x86:platform-bus-x86",
"//src/devices/i2c/drivers/intel-i2c",
"//src/devices/serial/drivers/uart16550",
]
}
include_component_id_index = true
core_realm_definition = ":core"
}
}