blob: bafff0d85d9b251059522bcf8c9780da567cad56 [file] [log] [blame]
# Copyright 2020 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/images/args.gni")
import("//build/images/custom_signing.gni")
import("//build/images/vboot/vboot.gni")
assert(current_toolchain == default_toolchain,
"//build/images/* are only valid in the Fuchsia toolchain")
bringup_base = {
testonly = true
output_dir = root_build_dir
generate_fvm = false
include_component_id_index = true
include_shell_commands = false
include_config_data = false
cmdline_deps = [ "//build/input:bootfs" ]
base_packages = []
base_driver_packages = [
"//:developer_base_driver_packages",
"//:legacy_base_driver_packages",
]
bootfs_labels = base_driver_packages + [
"//build/input:bootfs",
"//build/input/board:system_image_deps",
"//:developer_base_packages",
"//:developer_cache_packages",
"//:developer_universe_packages",
]
_ignored = {
import("//build/dev.gni")
import("//build/product.gni")
all_empty = true
if (dev_system_image_deps != []) {
print("dev_system_image_deps not empty: ${dev_system_image_deps}")
all_empty = false
}
if (product_system_image_deps != []) {
print("product_system_image_deps not empty: ${product_system_image_deps}")
all_empty = false
}
assert(all_empty)
}
}
# This target generates a (potentially signed) bringup ZBI and a corresponding
# Vbmeta. Unfortunately, the resulting ZBI cannot be passed directly into a
# fastboot boot invocation, as this command expects the image it is passed to
# be a concatenation of the ZBI and Vbmeta. The bringup_fastboot target below
# is responsible for generating that image.
assembled_system("bringup_non_fastboot") {
forward_variables_from(bringup_base, "*")
image_name = "bringup"
if (custom_signing_script != "") {
zbi_signing_script = custom_signing_script
zbi_signing_script_deps = [ "//build/images/custom_signing:deps" ]
} else if (use_vboot) {
zbi_signing_script = vboot_action.script
zbi_signing_args = vboot_action.args
zbi_signing_script_deps = vboot_action.deps
inputs = vboot_action.inputs
}
metadata = {
images = [
{
label = get_label_info(":$target_name", "label_with_toolchain")
name = "zircon-a"
path = "bringup.zbi"
type = "zbi"
archive = true
bootserver_pave = []
# Bringup builds always mexec from the paver
bootserver_pave += [ "--boot" ]
if (custom_signing_script == "" && !use_vboot) {
bootserver_pave += [
"--zircona",
# TODO(fxbug.dev/32475): `dm reboot-recovery` boots from zircon-b instead of
# zircon-r, so for now zedboot is being paved to this slot.
# "--zirconb",
]
}
},
]
if (use_vbmeta) {
images += [
{
label = get_label_info(":$target_name", "label_with_toolchain")
name = "zircon-a"
path = "bringup.vbmeta"
type = "vbmeta"
archive = true
bootserver_pave = [ "--vbmetaa" ]
},
]
}
image_paths = [
"IMAGE_ZIRCONA_ZBI=bringup.zbi",
# TODO(mcgrathr): The complete ZBI can be used with a separate
# kernel too, the kernel image in it will just be ignored. So
# just use the primary ZBI for this until all uses are
# converted to using the ZBI alone. Then remove this as
# IMAGE_BOOT_RAM variable should no longer be in use.
"IMAGE_BOOT_RAM=bringup.zbi",
]
images += [
{
archive = true
bootserver_netboot = [ "--boot" ]
name = "fuchsia"
path = "bringup.zbi"
type = "zbi"
},
]
image_paths += [
"IMAGE_NETBOOT_RAM=bringup.zbi",
"IMAGE_NETBOOT_ZBI=bringup.zbi",
]
}
}
# Builds a bringup image that we can RAM boot with fastboot boot.
assembled_system("bringup_fastboot") {
forward_variables_from(bringup_base, "*")
zbi_signing_script = "concat_zbi_and_vbmeta.sh"
zbi_signing_args = []
if (use_vbmeta || use_vboot) {
assembly_out_dir = rebase_path(target_out_dir, root_build_dir)
zbi_signing_args = [
"-v",
"${assembly_out_dir}/${target_name}/bringup_fastboot.vbmeta",
]
}
if (custom_signing_script != "") {
rebased_script = rebase_path(custom_signing_script, root_build_dir)
zbi_signing_args += [ "-s ${rebased_script}" ]
zbi_signing_script_deps = [ "//build/images/custom_signing:deps" ]
} else if (use_vboot) {
rebased_script = rebase_path(vboot_action.script, root_build_dir)
zbi_signing_args += [ "-s ${rebased_script}" ] + vboot_action.args
zbi_signing_script_deps = vboot_action.deps
inputs = vboot_action.inputs
}
metadata = {
images = [
{
fastboot_boot = [ "boot" ]
name = "fuchsia"
path = "bringup_fastboot.zbi.signed"
type = "zbi_fastboot"
},
]
}
}
group("bringup") {
testonly = true
deps = [ ":bringup_fastboot" ]
public_deps = [ ":bringup_non_fastboot" ]
}