| # 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/images/args.gni") |
| import("//build/images/boot.gni") |
| import("//build/images/custom_signing.gni") |
| import("//build/images/manifest.gni") |
| import("//build/images/vbmeta.gni") |
| import("//build/unification/future/images/devmgr_config.gni") |
| import("//build/zbi/zbi.gni") |
| |
| assert(current_toolchain == target_toolchain) |
| |
| # XXX: Temporary solution: we grab every package in the build and ensure that |
| # these are contributing to the bootfs_manifest that we generate. |
| generated_file("system_package.manifest_args") { |
| testonly = true |
| outputs = [ target_gen_dir + "/system_package.manifest_args" ] |
| data_keys = [ "system_image_rsps" ] |
| walk_keys = [ "system_image_barrier" ] |
| deps = [ "//build/images:packages" ] |
| deps += [ "//build/input:system_image" ] |
| } |
| |
| generate_manifest("boot.manifest") { |
| visibility = [ ":*" ] |
| testonly = true |
| |
| output_name = "boot.manifest" |
| |
| deps = [ ":system_package.manifest_args" ] |
| system_package_manifest_args = |
| get_target_outputs(":system_package.manifest_args") |
| sources = system_package_manifest_args |
| args = [ "@" + rebase_path(system_package_manifest_args[0], root_build_dir) ] |
| } |
| |
| action("devmgr_config.txt") { |
| testonly = true |
| |
| script = "../manifest.py" |
| outputs = [ "$target_out_dir/devmgr_config.txt" ] |
| args = [ "--output=" + rebase_path(outputs[0], root_build_dir) ] |
| deps = [ ":boot.manifest" ] |
| |
| foreach(entry, devmgr_config) { |
| args += [ "--entry=$entry" ] |
| } |
| } |
| |
| devmgr_config("devmgr_config") { |
| label = ":devmgr_config.txt" |
| testonly = true |
| } |
| |
| zbi("bringup") { |
| testonly = true |
| |
| output_dir = root_out_dir |
| |
| deps = [ |
| ":devmgr_config", |
| ":system_package.manifest_args", |
| "//build/input:bootfs", |
| "//build/unification/zbi:kernel", |
| ] |
| |
| metadata = { |
| images = [ |
| { |
| 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", |
| ] |
| } |
| }, |
| ] |
| |
| 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", |
| ] |
| } |
| } |
| |
| if (custom_signing_script != "") { |
| custom_signed_zbi("signed") { |
| output_name = "bringup.zbi" |
| testonly = true |
| deps = [ ":bringup" ] |
| zbi_outputs = get_target_outputs(":bringup") |
| zbi = [ zbi_outputs[0] ] |
| } |
| } |
| |
| if (use_vbmeta) { |
| vbmeta("bringup.vbmeta") { |
| output_name = "bringup" |
| testonly = true |
| if (custom_signing_script != "") { |
| deps = [ ":signed" ] |
| zbi_outputs = get_target_outputs(":signed") |
| zbi = [ zbi_outputs[0] ] |
| } else { |
| deps = [ ":bringup" ] |
| zbi_outputs = get_target_outputs(":bringup") |
| zbi = [ zbi_outputs[0] ] |
| } |
| |
| metadata = { |
| images = [ |
| { |
| name = "zircon-a" |
| path = "bringup.vbmeta" |
| type = "vbmeta" |
| |
| archive = true |
| bootserver_pave = [ "--vbmetaa" ] |
| }, |
| ] |
| } |
| } |
| } |