| # Copyright 2016 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/config/fuchsia/bootdata.gni") |
| import("//build/gn/packages.gni") |
| import("//build/toolchain/clang_toolchain.gni") |
| |
| declare_args() { |
| # Manifest files describing target libraries from toolchains. |
| # TODO(TO-471): This is ignored as a build argument and overridden below. |
| toolchain_manifests = [ "${clang_prefix}/../lib/${clang_target}.manifest" ] |
| |
| # Groups to include from the Zircon /boot manifest into /boot. |
| # This is either "all" or a comma-separated list of one or more of: |
| # core -- necessary to boot |
| # misc -- utilities in /bin |
| # test -- test binaries in /bin and /test |
| zircon_boot_groups = "core" |
| |
| # A list of labels for `bootdata` targets (see //build/bootdata.gni) |
| # to roll into the final bootable image. These targets must use the |
| # default `output_name` and `output_extension`. |
| extra_bootdata = [] |
| |
| # File containing kernel command line arguments to roll into the |
| # bootdata image used for booting. |
| kernel_cmdline_file = "" |
| |
| # A list of platforms, i.e. different Zircon kernels that were built. |
| # There will be a different `bootdata-${platform}.bin` built for each. |
| if (target_cpu == "x64") { |
| zircon_platforms = [ "x86" ] |
| } else { |
| zircon_platforms = [ target_cpu ] |
| } |
| |
| # The package key to use for signing the system package. New keys can be |
| # generated with the `pm` host command. |
| system_package_key = "//build/development.key" |
| |
| # The size of the minfs data partition image to create. Normally this image |
| # is added to FVM, and can therefore expand as needed. It must be at least |
| # 10mb (the default) in order to be succesfully initialized. |
| data_image_size = "10m" |
| |
| # Build boot images that prefer Zedboot over local boot. |
| always_zedboot = false |
| |
| # Whether to automatically generate BUILD.gn files for Zircon artifacts. |
| generate_zircon_gn_files = false |
| } |
| |
| declare_args() { |
| # Groups to include from the Zircon /boot manifest into /system |
| # (instead of into /boot like Zircon's own bootdata.bin does). |
| # Should not include any groups that are also in zircon_boot_groups, |
| # which see. If zircon_boot_groups is "all" then this should be "". |
| if (zircon_boot_groups == "all") { |
| zircon_system_groups = "" |
| } else { |
| # TODO(mcgrathr): Could default to "" for !is_debug, or "production |
| # build". Note including "test" here places all of Zircon's tests |
| # into /system/test, which means that Fuchsia bots run those tests |
| # too. |
| zircon_system_groups = "misc,test" |
| } |
| } |
| |
| if (zircon_boot_groups == "all") { |
| assert(zircon_system_groups == "", |
| "zircon_boot_groups already has everything") |
| } else { |
| assert(zircon_system_groups != "all" && zircon_system_groups != "core", |
| "zircon_system_groups cannot include core (or all)") |
| } |
| |
| # TODO(TO-471): The toolchain package will provide this file |
| # but it doesn't yet, so generate it with this kludge. |
| toolchain_manifests[0] = "${root_out_dir}/clang_toolchain.manifest" |
| action("generate_clang_toolchain_manifest") { |
| script = "toolchain_manifest.py" |
| outputs = [ |
| toolchain_manifests[0], |
| ] |
| inputs = [ |
| "${clang_prefix}/clang", |
| ] |
| args = [ |
| "--output", |
| rebase_path(outputs[0]), |
| "--prefix=$clang_prefix", |
| "--target=$clang_target", |
| "libc++.so.2", |
| "libc++abi.so.1", |
| "libunwind.so.1", |
| "asan/libc++.so.2", |
| "asan/libc++abi.so.1", |
| "asan/libunwind.so.1", |
| "libclang_rt.asan-${clang_cpu}.so", |
| "libclang_rt.ubsan_standalone-${clang_cpu}.so", |
| ] |
| } |
| |
| # Permit dependencies on testonly targets from packages. |
| testonly = true |
| |
| if (current_cpu == "x64") { |
| zircon_cpu = "x86-64" |
| } else { |
| zircon_cpu = current_cpu |
| } |
| |
| zircon_boot_manifest = |
| "//out/build-zircon/build-user-${zircon_cpu}/bootfs.manifest" |
| zircon_ulib_manifest = |
| "//out/build-zircon/build-user-${zircon_cpu}-ulib/bootfs.manifest" |
| |
| final_boot_manifest = "$root_out_dir/boot.manifest" |
| final_system_manifest = "$root_out_dir/system.manifest" |
| |
| # Keep the following in sync with the values in |
| # //scripts/devshell/lib/image_build_vars.sh |
| images_dir = "$root_out_dir/images" |
| system_package_dir = "$root_gen_dir/system.pkg" |
| system_package_meta_far = "$system_package_dir/meta.far" |
| system_package_cmdline = "$images_dir/cmdline.txt" |
| blobstore_image_path = "$images_dir/blobstore.blk" |
| data_image_path = "$images_dir/data.blk" |
| fvm_image_path = "$images_dir/fvm.blk" |
| fvm_sparse_image_path = "$images_dir/fvm.sparse.blk" |
| fvm_data_sparse_image_path = "$images_dir/fvm.data.sparse.blk" |
| |
| finalize_manifests_extra = [ |
| "elfinfo.py", |
| "manifest.py", |
| "variant.py", |
| "package_imports_resolver.py", |
| ] |
| |
| action("finalize_manifests") { |
| visibility = [ ":*" ] |
| |
| packages_file = "$target_gen_dir/packages" |
| system_manifest_file = "$target_gen_dir/system.bootfs.manifest" |
| build_id_file = "$root_out_dir/ids.txt" |
| |
| deps = exec_script("process_build_packages.py", |
| [ |
| "--targets-file", |
| rebase_path(packages_file), |
| "--system-manifest", |
| rebase_path(system_manifest_file), |
| "--packages", |
| fuchsia_packages, |
| "--build-root", |
| rebase_path(root_build_dir), |
| "--arch", |
| target_cpu, |
| ], |
| "list lines", |
| rebase_path(packages_imported)) |
| package_list = read_file(packages_file, "list lines") |
| |
| script = "finalize_manifests.py" |
| inputs = finalize_manifests_extra |
| |
| depfile = "$root_out_dir/finalize_manifests.d" |
| outputs = [ |
| final_boot_manifest, |
| final_system_manifest, |
| build_id_file, |
| ] |
| |
| sources = [] |
| args = [ |
| "--depfile=" + rebase_path(depfile, root_build_dir), |
| "--build-id-file=" + rebase_path(build_id_file, root_build_dir), |
| ] |
| |
| # First the toolchain and Zircon "ulib" manifests are pure auxiliaries: |
| # they just supply libraries that might satisfy dependencies. |
| |
| # TODO(TO-471): Remove this when toolchain_manifests are in the source tree. |
| deps += [ ":generate_clang_toolchain_manifest" ] |
| |
| sources += toolchain_manifests |
| foreach(manifest, toolchain_manifests) { |
| manifest_cwd = get_path_info(rebase_path(manifest), "dir") |
| args += [ |
| "--cwd=$manifest_cwd", |
| "--manifest=" + rebase_path(manifest), |
| ] |
| } |
| |
| sources += [ zircon_ulib_manifest ] |
| zircon_manifest_cwd = rebase_path("//out/build-zircon") |
| args += [ |
| "--cwd=$zircon_manifest_cwd", |
| "--manifest=" + rebase_path(zircon_ulib_manifest), |
| ] |
| |
| # Next, everything that will go into the final /boot manifest. |
| args += [ "--output=" + rebase_path(final_boot_manifest, root_build_dir) ] |
| |
| sources += [ zircon_boot_manifest ] |
| args += [ |
| "--cwd=$zircon_manifest_cwd", |
| "--groups=$zircon_boot_groups", |
| "--manifest=" + rebase_path(zircon_boot_manifest), |
| |
| # All the manifests generated by this build are relative to root_build_dir. |
| "--cwd=.", |
| "--groups=all", |
| ] |
| |
| # Finally, everything that will go into the final /system manifest. |
| args += [ |
| "--output=" + rebase_path(final_system_manifest, root_build_dir), |
| "--cwd=$zircon_manifest_cwd", |
| "--groups=$zircon_system_groups", |
| "--manifest=" + rebase_path(zircon_boot_manifest), |
| |
| # All the manifests generated by this build are relative to root_build_dir. |
| "--cwd=.", |
| "--groups=all", |
| ] |
| |
| # TODO(mcgrathr,jamesr): When process_build_packages.py drops support for |
| # package JSON files adding files directly, this can go away. |
| # GN won't let us make it a source because it's in the build directory |
| # but is written implicitly at gen time rather than by a proper action. |
| # We're relying on the depfile to notice its changes. |
| #sources += [ system_manifest_file ] |
| args += [ "--manifest=" + rebase_path(system_manifest_file) ] |
| |
| foreach(package, package_list) { |
| package_manifest = "$root_build_dir/package/$package/system_manifest" |
| |
| # GN won't let us make these sources because they're in the build |
| # directory but written implicitly at gen time rather than by a proper |
| # action. We're relying on the depfile to notice their changes. |
| #sources += [ package_manifest ] |
| |
| args += [ "--optional-manifest=" + rebase_path(package_manifest) ] |
| } |
| |
| foreach(package, package_list) { |
| package_manifest = "$root_build_dir/package/$package/archive_manifest" |
| final_manifest = "$root_build_dir/package/$package/final_archive_manifest" |
| |
| # GN won't let us make these sources because they're in the build |
| # directory but written implicitly at gen time rather than by a proper |
| # action. We're relying on the depfile to notice their changes. |
| #sources += [ package_manifest ] |
| |
| outputs += [ final_manifest ] |
| args += [ |
| "--standalone-output=" + rebase_path(final_manifest, root_build_dir), |
| "--manifest=" + rebase_path(package_manifest), |
| ] |
| } |
| } |
| |
| action("system.pkg") { |
| visibility = [ ":*" ] |
| pm_label = "//garnet/go/src/pm:pm_bin($host_toolchain)" |
| pkgsvr_label = "//garnet/go/src/pmd:pkgsvr_bin" |
| deps = [ |
| ":finalize_manifests", |
| pkgsvr_label, |
| pm_label, |
| ] |
| |
| pm_out_dir = get_label_info(pm_label, "root_out_dir") |
| pkgsvr_out_dir = get_label_info(pkgsvr_label, "root_out_dir") |
| |
| pm_bin = "$pm_out_dir/pm" |
| pkgsvr_bin = "$pkgsvr_out_dir/pkgsvr" |
| merkleroot_bin = "//out/build-zircon/tools/merkleroot" |
| |
| inputs = [ |
| merkleroot_bin, |
| pkgsvr_bin, |
| pm_bin, |
| system_package_key, |
| ] |
| |
| script = "//build/gn_run_binary.sh" |
| args = [ |
| clang_prefix, |
| rebase_path("system_package.py"), |
| "--system-manifest", |
| rebase_path(final_system_manifest), |
| "--system-package-dir", |
| rebase_path(system_package_dir), |
| "--system-package-key", |
| rebase_path(system_package_key), |
| "--pm", |
| rebase_path(pm_bin), |
| "--pkgsvr", |
| rebase_path(pkgsvr_bin), |
| "--merkleroot", |
| rebase_path(merkleroot_bin), |
| "--commandline", |
| rebase_path(system_package_cmdline), |
| ] |
| sources = [ |
| final_system_manifest, |
| ] |
| outputs = [ |
| system_package_cmdline, |
| system_package_dir, |
| system_package_meta_far, |
| ] |
| } |
| |
| action("blobstore.blk") { |
| visibility = [ ":*" ] |
| blobstore_bin = "//out/build-zircon/tools/blobstore" |
| |
| script = "//build/gn_run_binary.sh" |
| args = [ |
| clang_prefix, |
| rebase_path(blobstore_bin), |
| rebase_path(blobstore_image_path), |
| "create", |
| "--manifest", |
| rebase_path(final_system_manifest), |
| "--blob", |
| rebase_path(system_package_meta_far), |
| ] |
| sources = [ |
| final_system_manifest, |
| system_package_meta_far, |
| ] |
| inputs = [ |
| blobstore_bin, |
| ] |
| outputs = [ |
| blobstore_image_path, |
| ] |
| deps = [ |
| ":finalize_manifests", |
| ":system.pkg", |
| ] |
| } |
| |
| # Inject fixed kernel command-line arguments maintained in the source tree. |
| bootdata_cmdline("cmdline") { |
| visibility = [ ":*" ] |
| inputs = [ |
| "cmdline.txt", |
| ] |
| } |
| |
| # Let the build configuration choose some extra fixed command-line arguments. |
| if (kernel_cmdline_file != "") { |
| bootdata_cmdline("extra_cmdline") { |
| visibility = [ ":*" ] |
| inputs = [ |
| kernel_cmdline_file, |
| ] |
| } |
| } |
| |
| # Inject generated kernel command-line arguments depending on build artifacts. |
| bootdata_cmdline("systempkg_cmdline") { |
| visibility = [ ":*" ] |
| inputs = [ |
| system_package_cmdline, |
| ] |
| deps = [ |
| ":system.pkg", |
| ] |
| } |
| |
| # Package up the /boot filesystem along with Zircon's kernel bootdata. |
| # This `bootdata.bin` along with the Zircon kernel is enough to boot. |
| foreach(platform, zircon_platforms) { |
| bootdata("bootdata-${platform}") { |
| deps = [ |
| ":finalize_manifests", |
| ] |
| kernel_build_dir = "//out/build-zircon/build-${platform}" |
| inputs = [ |
| "$kernel_build_dir/kernel-bootdata.bin", |
| final_boot_manifest, |
| ] |
| boot = true |
| |
| deps += [ ":cmdline" ] |
| inputs += get_target_outputs(":cmdline") |
| |
| if (kernel_cmdline_file != "") { |
| deps += [ ":extra_cmdline" ] |
| inputs += get_target_outputs(":extra_cmdline") |
| } |
| } |
| |
| bootdata("bootdata-blobstore-${platform}") { |
| deps = [ |
| ":bootdata-${platform}", |
| ":systempkg_cmdline", |
| ] |
| |
| inputs = [] |
| foreach(label, deps) { |
| inputs += get_target_outputs(label) |
| } |
| } |
| } |
| |
| # Package up the /system filesystem. |
| bootdata("system_bootfs") { |
| deps = [ |
| ":finalize_manifests", |
| ] |
| inputs = [ |
| final_system_manifest, |
| ] |
| } |
| |
| # data.blk creates an empty but initialized minfs data partition. The partition |
| # is included in fvm.data.sparse.blk. |
| action("data.blk") { |
| minfs_path = "//out/build-zircon/tools/minfs" |
| inputs = [ |
| minfs_path, |
| ] |
| |
| sized_path = rebase_path(data_image_path) |
| sized_path = "${sized_path}@${data_image_size}" |
| |
| script = "//build/gn_run_binary.sh" |
| args = [ |
| clang_prefix, |
| rebase_path(minfs_path), |
| sized_path, |
| "create", |
| ] |
| outputs = [ |
| data_image_path, |
| ] |
| } |
| |
| # fvm.blk creates a non-sparse FVM partition image containing the blobstore |
| # partition produced by blobstore.blk. fvm.blk is primarily invoked and used by |
| # the qemu run, via `fx run-fvm`. |
| action("fvm.blk") { |
| visibility = [ ":*" ] |
| fvm_path = "//out/build-zircon/tools/fvm" |
| inputs = [ |
| blobstore_image_path, |
| fvm_path, |
| ] |
| deps = [ |
| ":blobstore.blk", |
| ] |
| |
| script = "//build/gn_run_binary.sh" |
| args = [ |
| clang_prefix, |
| rebase_path(fvm_path), |
| rebase_path(fvm_image_path), |
| "create", |
| "--blobstore", |
| rebase_path(blobstore_image_path), |
| ] |
| outputs = [ |
| fvm_image_path, |
| ] |
| } |
| |
| # This packs (compressed) fvm.blk into BOOTDATA_RAMDISK format, |
| # used by the netboot-* targets below. |
| bootdata_ramdisk("bootdata-fvm") { |
| visibility = [ ":*" ] |
| deps = [ |
| ":fvm.blk", |
| ] |
| inputs = [] |
| foreach(label, deps) { |
| inputs += get_target_outputs(label) |
| } |
| } |
| |
| # fvm.sparse.blk creates a sparse FVM partition image containing the blobstore |
| # partition produced by blobstore.blk. fvm.sparse.blk is primarily invoked and |
| # used by the paver boot, via `fx boot-paver`. |
| action("fvm.sparse.blk") { |
| visibility = [ ":*" ] |
| fvm_path = "//out/build-zircon/tools/fvm" |
| inputs = [ |
| blobstore_image_path, |
| fvm_path, |
| ] |
| deps = [ |
| ":blobstore.blk", |
| ] |
| |
| script = "//build/gn_run_binary.sh" |
| args = [ |
| clang_prefix, |
| rebase_path(fvm_path), |
| rebase_path(fvm_sparse_image_path), |
| "sparse", |
| "--blobstore", |
| rebase_path(blobstore_image_path), |
| ] |
| outputs = [ |
| fvm_sparse_image_path, |
| ] |
| } |
| |
| # fmv.data.sparse.blk is an FVM image containing only data.blk. It is |
| # used to pave new data partitions to a device. |
| action("fvm.data.sparse.blk") { |
| visibility = [ ":*" ] |
| fvm_path = "//out/build-zircon/tools/fvm" |
| inputs = [ |
| data_image_path, |
| fvm_path, |
| ] |
| deps = [ |
| ":data.blk", |
| ] |
| |
| script = "//build/gn_run_binary.sh" |
| args = [ |
| clang_prefix, |
| rebase_path(fvm_path), |
| rebase_path(fvm_data_sparse_image_path), |
| "sparse", |
| "--data", |
| rebase_path(data_image_path), |
| ] |
| outputs = [ |
| fvm_data_sparse_image_path, |
| ] |
| } |
| |
| # Build a "kernel partition" target for ChromeOS targets. |
| # |
| # Parameters |
| # |
| # deps (required) |
| # Must be bootdata labels defined earlier in the file. |
| # |
| # platform (required) |
| # zircon_platforms element. |
| # |
| template("vboot") { |
| output_name = "${target_name}.vboot" |
| action(output_name) { |
| futility_label = "//garnet/tools/vboot_reference:futility($host_toolchain)" |
| futility_out_dir = get_label_info(futility_label, "root_out_dir") |
| futility_bin = "$futility_out_dir/futility" |
| deps = [ |
| futility_label, |
| ] |
| |
| vboot_dir = "//third_party/vboot_reference" |
| kernel_keyblock = "$vboot_dir/tests/devkeys/kernel.keyblock" |
| private_keyblock = "$vboot_dir/tests/devkeys/kernel_data_key.vbprivk" |
| inputs = [ |
| kernel_keyblock, |
| private_keyblock, |
| ] |
| |
| bootdata_bins = [] |
| foreach(bootdata_label, invoker.deps) { |
| bootdata_bins += get_target_outputs(bootdata_label) |
| } |
| deps += invoker.deps |
| |
| bootdata_bin = bootdata_bins[0] |
| assert([ bootdata_bin ] == bootdata_bins) |
| |
| kernel_build_dir = "//out/build-zircon/build-${invoker.platform}" |
| zircon_bin = "$kernel_build_dir/zircon.bin" |
| |
| output = "$images_dir/$output_name" |
| outputs = [ |
| output, |
| ] |
| |
| script = "//build/gn_run_binary.sh" |
| args = [ |
| clang_prefix, |
| rebase_path(futility_bin), |
| "vbutil_kernel", |
| "--pack", |
| rebase_path(output), |
| "--keyblock", |
| rebase_path(kernel_keyblock), |
| "--signprivate", |
| rebase_path(private_keyblock), |
| "--bootloader", |
| rebase_path(bootdata_bin), |
| "--vmlinuz", |
| rebase_path(zircon_bin), |
| "--version", |
| "1", |
| "--flags", |
| "0x2", |
| ] |
| } |
| } |
| |
| # Build a "EFI System Partition" target for EFI targets. |
| # |
| # Parameters |
| # |
| # deps (optional) |
| # Must be bootdata labels defined earlier in the file. |
| # |
| # zircon_bin (optional) |
| # A zircon kernel |
| # |
| # zedboot (optional) |
| # A Zedboot bootdata label defined earlier in the file. |
| # |
| # cmdline (optional) |
| # A bootloader (Gigaboot) cmdline file to include in the EFI root. |
| # |
| template("esp") { |
| output_name = "${target_name}.esp.blk" |
| action(output_name) { |
| make_efi_label = "//garnet/go/src/make-efi:host($host_toolchain)" |
| deps = [ |
| make_efi_label, |
| ] |
| |
| mkfs_msdosfs_bin = "//out/build-zircon/tools/mkfs-msdosfs" |
| |
| make_efi_out_dir = get_label_info(make_efi_label, "root_out_dir") |
| make_efi_bin = "$make_efi_out_dir/make-efi" |
| |
| efi_image_path = "$images_dir/$output_name" |
| |
| inputs = [ |
| mkfs_msdosfs_bin, |
| ] |
| |
| script = "//build/gn_run_binary.sh" |
| args = [ |
| clang_prefix, |
| rebase_path(make_efi_bin), |
| "--output", |
| rebase_path(efi_image_path), |
| "--mkfs", |
| rebase_path(mkfs_msdosfs_bin), |
| ] |
| |
| if (defined(invoker.zircon_bin)) { |
| args += [ |
| "--zircon", |
| rebase_path(invoker.zircon_bin), |
| ] |
| } |
| |
| if (defined(invoker.deps)) { |
| bootdata_bins = [] |
| foreach(bootdata_label, invoker.deps) { |
| bootdata_bins += get_target_outputs(bootdata_label) |
| } |
| deps += invoker.deps |
| |
| bootdata_bin = bootdata_bins[0] |
| assert([ bootdata_bin ] == bootdata_bins) |
| |
| args += [ |
| "--bootdata", |
| rebase_path(bootdata_bin), |
| ] |
| } |
| |
| if (defined(invoker.zedboot)) { |
| zedboot_label = invoker.zedboot |
| zedboot_bins = get_target_outputs(zedboot_label) |
| zedboot_bin = zedboot_bins[0] |
| assert([ zedboot_bin ] == zedboot_bins) |
| args += [ |
| "--zedboot", |
| rebase_path(zedboot_bin), |
| ] |
| deps += [ zedboot_label ] |
| } |
| |
| if (defined(invoker.cmdline)) { |
| args += [ |
| "--cmdline", |
| rebase_path(invoker.cmdline), |
| ] |
| } |
| |
| if (target_cpu == "x64") { |
| kernel_build_dir = "//out/build-zircon/build-${invoker.platform}" |
| gigaboot_bin = "$kernel_build_dir/bootloader/bootx64.efi" |
| args += [ |
| "--efi-bootloader", |
| rebase_path(gigaboot_bin), |
| ] |
| inputs += [ gigaboot_bin ] |
| } |
| |
| outputs = [ |
| efi_image_path, |
| ] |
| } |
| } |
| |
| bootdata_cmdline("zedboot_cmdline") { |
| visibility = [ ":*" ] |
| inputs = [ |
| "zedboot_config", |
| ] |
| } |
| |
| # Construct a minimal manifest containing only the few user binaries |
| # that constitute zedboot, and the libraries they depend on. |
| # TODO(mcgrathr): This could be made smaller by constraining the drivers |
| # included, but we don't currently have a good way to determine the |
| # subset that is useful to Zedboot. |
| zedboot_manifest = "$root_out_dir/zedboot.manifest" |
| zedboot_binary_patterns = [ |
| # These are the core things needed for booting (local and netboot). |
| "bin/crashlogger", |
| "bin/devmgr", |
| "bin/dlog", |
| "bin/fshost", |
| "bin/netsvc", |
| "bin/virtual-console", |
| "driver/*", # Drivers automagically cause devhost to be brought in. |
| |
| # These are needed for installer runs. |
| "bin/blobstore", |
| "bin/install-disk-image", |
| "bin/minfs", |
| "bin/mount", |
| |
| # These are useful for debugging. |
| "bin/dd", |
| "bin/fixfs", |
| "bin/fsck*", |
| "bin/gpt", |
| "bin/killall", |
| "bin/lsblk", |
| "bin/lsdev", |
| "bin/lsusb", |
| "bin/mkfs*", |
| "bin/netdump", |
| "bin/ping", |
| "bin/ps", |
| "bin/sh", |
| "bin/umount", |
| ] |
| |
| action("zedboot_manifest") { |
| visibility = [ ":*" ] |
| |
| script = "finalize_manifests.py" |
| inputs = finalize_manifests_extra |
| |
| depfile = "$root_out_dir/zedboot_manifest.d" |
| build_id_file = "$root_out_dir/zedboot_ids.txt" |
| |
| outputs = [ |
| zedboot_manifest, |
| build_id_file, |
| ] |
| |
| zircon_manifest_cwd = rebase_path("//out/build-zircon") |
| sources = [ |
| zircon_boot_manifest, |
| ] |
| |
| args = [ |
| "--depfile=" + rebase_path(depfile, root_build_dir), |
| "--build-id-file=" + rebase_path(build_id_file, root_build_dir), |
| "--cwd=$zircon_manifest_cwd", |
| "--manifest=" + rebase_path(zircon_boot_manifest), |
| "--output=" + rebase_path(zedboot_manifest, root_build_dir), |
| ] |
| |
| foreach(pattern, zedboot_binary_patterns) { |
| args += [ "--binary=" + pattern ] |
| } |
| } |
| |
| foreach(platform, zircon_platforms) { |
| # zedboot-data-${platform}.bin is a Zircon BOOTDATA file containing the |
| # command line and BOOTFS pieces necessary to make Zircon be Zedboot. |
| bootdata("zedboot-data-${platform}") { |
| boot = true |
| deps = [ |
| ":zedboot_cmdline", |
| ":zedboot_manifest", |
| ] |
| kernel_build_dir = "//out/build-zircon/build-${platform}" |
| inputs = [ |
| "$kernel_build_dir/kernel-bootdata.bin", |
| ] |
| foreach(dep, deps) { |
| dep = get_target_outputs(dep) |
| inputs += [ dep[0] ] |
| } |
| } |
| |
| # This packs up a single BOOTDATA container that includes fvm.blk as a |
| # RAMDISK image. This can be used for network booting the full system |
| # without using any real storage. The system decompresses the fvm.blk |
| # image into memory and then sees that RAM disk just as if it were a |
| # real disk on the device. |
| bootdata("netboot-${platform}") { |
| deps = [ |
| ":bootdata-blobstore-${platform}", |
| ":bootdata-fvm", |
| ] |
| inputs = [] |
| foreach(label, deps) { |
| inputs += get_target_outputs(label) |
| } |
| } |
| |
| # ChromeOS vboot images. |
| vboot("zircon-${platform}") { |
| deps = [ |
| ":bootdata-blobstore-${platform}", |
| ] |
| } |
| |
| # NOTE(raggi): zircon.bin from //out/build-zircon/build-${platform} is not a |
| # bootdata image on ARM, as such, all targets that try to use it as such are |
| # disabled here. |
| if (target_cpu == "x64") { |
| # images/zedboot-${platform}.bin combines the kernel image itself with |
| # the BOOTDATA bits. This single file can be booted by Gigaboot. |
| bootdata("zedboot-${platform}") { |
| output_name = "images/$target_name" |
| deps = [ |
| ":zedboot-data-${platform}", |
| ] |
| kernel_build_dir = "//out/build-zircon/build-${platform}" |
| inputs = [ |
| "$kernel_build_dir/zircon.bin", |
| ] |
| foreach(label, deps) { |
| inputs += get_target_outputs(label) |
| } |
| } |
| |
| vboot("zedboot-${platform}") { |
| deps = [ |
| ":zedboot-data-${platform}", |
| ] |
| } |
| |
| # EFI ESP images. |
| esp("local-${platform}") { |
| if (always_zedboot) { |
| cmdline = "efi_zedboot_cmdline" |
| } else { |
| cmdline = "efi_local_cmdline" |
| } |
| zircon_bin = "//out/build-zircon/build-${platform}/zircon.bin" |
| zedboot = ":zedboot-${platform}" |
| deps = [ ":bootdata-blobstore-${platform}" ] |
| } |
| |
| esp("zedboot-${platform}") { |
| cmdline = "efi_zedboot_cmdline" |
| zedboot = ":zedboot-${platform}" |
| } |
| } |
| } |
| |
| group("zedboot") { |
| deps = [] |
| if (target_cpu == "x64") { |
| foreach(platform, zircon_platforms) { |
| deps += [ ":zedboot-${platform}" ] |
| } |
| } |
| } |
| |
| group("netboot") { |
| deps = [] |
| foreach(platform, zircon_platforms) { |
| deps += [ ":netboot-${platform}" ] |
| } |
| } |
| |
| group("images") { |
| deps = [ |
| ":blobstore.blk", |
| ":fvm.blk", |
| ":fvm.sparse.blk", |
| ":fvm.data.sparse.blk" |
| ] |
| |
| foreach(platform, zircon_platforms) { |
| deps += [ ":zircon-${platform}.vboot" ] |
| } |
| |
| if (target_cpu == "x64") { |
| foreach(platform, zircon_platforms) { |
| deps += [ |
| ":local-${platform}.esp.blk", |
| ":zedboot-${platform}.esp.blk", |
| ":zedboot-${platform}.vboot", |
| ] |
| } |
| } |
| } |
| |
| # DEPRECATED |
| # Roll those together into the image for booting with /system from RAM disk. |
| bootdata("mkbootfs") { |
| output_name = "user" |
| output_extension = "bootfs" |
| deps = [ |
| ":bootdata-${zircon_platforms[0]}", |
| ":system_bootfs", |
| ] |
| inputs = [] |
| foreach(label, deps) { |
| inputs += get_target_outputs(label) |
| } |
| deps += extra_bootdata |
| foreach(label, extra_bootdata) { |
| # get_target_outputs only works on labels defined in the same file. |
| # So just assume each `bootdata` target used the defaults so its |
| # output file is computable directly from the target name. |
| inputs += [ "$root_out_dir/" + get_label_info(label, "name") + ".bin" ] |
| } |
| } |
| |
| group("bootfs") { |
| deps = [ |
| ":mkbootfs", |
| ] |
| foreach(platform, zircon_platforms) { |
| deps += [ ":bootdata-${platform}" ] |
| } |
| } |
| |
| if (generate_zircon_gn_files) { |
| zircon_files = |
| exec_script("//build/zircon/list_source_files.py", [], "list lines") |
| |
| supporting_templates = [ |
| "//build/zircon/compiled_library.mako", |
| "//build/zircon/header.mako", |
| "//build/zircon/source_library.mako", |
| "//build/zircon/sysroot.mako", |
| ] |
| |
| exec_script("//build/zircon/create_gn_rules.py", |
| [ |
| "--out", |
| rebase_path("//zircon/public"), |
| "--zircon-build", |
| rebase_path("//out/build-zircon/build-user-${zircon_cpu}"), |
| ], |
| "", |
| zircon_files + supporting_templates) |
| } |
| |
| group("default") { |
| deps = [ ":images" ] + packages_labels |
| } |