|  | # Copyright 2020 The Fuchsia Authors | 
|  | # | 
|  | # Use of this source code is governed by a MIT-style | 
|  | # license that can be found in the LICENSE file or at | 
|  | # https://opensource.org/licenses/MIT | 
|  |  | 
|  | if (zx != "/") { | 
|  | import("//build/unification/global_variables.gni") | 
|  | } | 
|  |  | 
|  | # TODO(mcgrathr): declare_args() { qemu_boot_format = "multiboot"/"zeropage" } | 
|  |  | 
|  | if (current_cpu == "x64") { | 
|  | # Environment for building raw QEMU kernels. | 
|  | # x86-64 QEMU loads 32-bit (i686) binaries (Multiboot or Linux zero page). | 
|  | qemu_environment = "$zx/kernel/arch/x86/phys:kernel.phys32" | 
|  | } else { | 
|  | # Environment for building raw QEMU kernels (64-bit physical memory). | 
|  | qemu_environment = "$zx/kernel/phys:kernel.phys" | 
|  | if (zx != "/") { | 
|  | qemu_environment += "_$current_cpu" | 
|  | } | 
|  | } | 
|  |  | 
|  | if (toolchain.environment == "kernel.phys") { | 
|  | # What to link into a raw QEMU kernel executable (direct physical memory). | 
|  | qemu_deps = [ "$zx/kernel/phys:qemu-header" ] | 
|  | } else { | 
|  | assert(current_cpu == "x64") | 
|  | if (zx == "/") { | 
|  | assert(toolchain.environment_label == qemu_environment) | 
|  | } else { | 
|  | assert(toolchain.environment == get_label_info(qemu_environment, "name"), | 
|  | "Bad toolchain environment ${toolchain.environment}, expected " + | 
|  | get_label_info(qemu_environment, "name")) | 
|  | } | 
|  |  | 
|  | # What to link into a raw QEMU kernel executable (x86-32 Multiboot). | 
|  | qemu_deps = [ "$zx/kernel/arch/x86/phys:multiboot" ] | 
|  | } | 
|  |  | 
|  | # zbi_test() $timeout value for short-running tests launched via QEMU. | 
|  | qemu_short_timeout = 30 |