| # Copyright 2019 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/assembly/sshd_config.gni") |
| import("//build/board.gni") |
| import("//build/images/args.gni") |
| import("//build/images/paths.gni") |
| import("//build/images/vboot/vboot.gni") |
| import("//build/images/zedboot/zedboot_args.gni") |
| import("//build/info/info.gni") |
| import("//build/product.gni") |
| import("//build/testing/host_test_data.gni") |
| import("//src/storage/fshost/generated_fshost_config.gni") |
| import("//src/sys/core/build/core.gni") |
| |
| if (is_host) { |
| host_test_data("test_data") { |
| out_dir = get_label_info(":anything($target_toolchain)", "target_out_dir") |
| sources = [ |
| "${out_dir}/recovery-eng/fuchsia.zbi", |
| "${out_dir}/recovery-fdr/fuchsia.zbi", |
| "${out_dir}/recovery-installer/fuchsia.zbi", |
| ] |
| deps = [ |
| ":recovery-eng($target_toolchain)", |
| ":recovery-fdr($target_toolchain)", |
| ":recovery-installer($target_toolchain)", |
| ] |
| } |
| } |
| |
| if (is_fuchsia) { |
| assert(current_toolchain == default_toolchain, |
| "//build/images/* are only valid in the Fuchsia toolchain") |
| |
| # Parameters shared between recovery-eng and recovery-installer |
| recovery_base = { |
| testonly = true |
| image_name = "fuchsia" |
| generate_vbmeta = use_vbmeta |
| |
| ramdisk_in_zbi = true |
| |
| if (!fxfs_blob) { |
| generate_fvm = !bootfs_only |
| generate_fvm_fastboot = generate_fvm && assembly_generate_fvm_fastboot |
| generate_fvm_nand = generate_fvm && assembly_generate_fvm_nand |
| } else { |
| generate_fxfs = !bootfs_only |
| } |
| board_config_label = board_configuration_label |
| |
| additional_boot_args = |
| [ "virtcon.disable=true" ] + zedboot_additional_boot_args |
| |
| bootfs_labels = [ "//build/input:recovery_bootfs" ] |
| |
| if (custom_signing_script != "") { |
| inputs = custom_signing_script_inputs |
| generate_signed_zbi = true |
| } else if (use_vboot) { |
| inputs = vboot_action.inputs |
| generate_signed_zbi = true |
| } |
| } |
| |
| group("recovery") { |
| testonly = true |
| public_deps = [ |
| ":recovery-eng", |
| ":recovery-fastboot", |
| ":recovery-fdr", |
| ":recovery-installer", |
| ] |
| } |
| |
| # These are to temporarily switch back to using the bootstrap level so that the |
| # vendor assemblies can be moved to utility with it being the same as |
| # bootstrap |
| # TODO(122863) Remove use of transitional labels |
| core_realm_aib_pkgs = [] |
| core_realm_aib_shards = [] |
| core_realm_network_aib_pkgs = [ |
| # Newtorking itself |
| "//src/connectivity/network:for_transition", |
| "//src/security/bin/root_ssl_certificates:for_transition", |
| ] |
| core_realm_eng_aib_pkgs = [ |
| # Enable ffx support. |
| "//src/connectivity/network/mdns/bundles:services", # group for transition |
| |
| # Device side of zxdb & fidlcat: |
| "//src/developer/debug/debug_agent", |
| ] |
| core_realm_testing_aib_pkgs = [ |
| # SL4F for infra testing |
| "//src/testing/sl4f:for_transition", |
| "//src/sys/bin/start_sl4f:for_transition", |
| ] |
| core_realm_testing_aib_shards = [ |
| # SL4F for infra testing |
| "//src/testing/sl4f:sl4f_core_shard", |
| ] |
| |
| _core_realm_deps = |
| core_realm_aib_shards + [ |
| "//src/diagnostics/realm:core_shard", |
| "//src/firmware/fastboot-tcp:fastboot-tcp-core-shard", |
| "//src/firmware/fastboot-usb:fastboot-usb-core-shard", |
| "//src/recovery/factory_reset:factory_reset_core_shard", |
| "//src/ui/bin/brightness_manager:auto-brightness_core_shard", |
| ] |
| |
| core_realm_definition("core") { |
| deps = _core_realm_deps + |
| [ "//src/recovery/system:system_recovery_fdr_core_shard" ] |
| } |
| |
| core_realm_definition("core-eng") { |
| deps = |
| _core_realm_deps + core_realm_testing_aib_shards + [ |
| # required for SL4F |
| "//src/developer/memory/monitor:memory_monitor_core_shard", |
| "//src/factory/factory_store_providers:factory_store_providers_shard", |
| "//src/recovery/system:system_recovery_core_shard", |
| "//src/settings/service:setui_service_core_shard", |
| ] |
| } |
| |
| core_realm_definition("core-installer") { |
| deps = _core_realm_deps + |
| [ "//src/recovery/system:system_recovery_installer_core_shard" ] |
| } |
| |
| recovery_packages = board_recovery_package_labels + core_realm_aib_pkgs + |
| core_realm_network_aib_pkgs + |
| [ |
| "//src/recovery/factory_reset", |
| "//src/recovery/system:system_recovery", |
| "//src/ui/bin/brightness_manager:auto-brightness", |
| |
| # Flattened from //src/sys/pkg:recovery |
| "//src/sys/pkg/bin/omaha-client", |
| "//src/sys/pkg/bin/system-updater", |
| |
| # system-update-committer is a dependency of pkg-cache, |
| # but we don't want to do any verification in recovery |
| # mode, so we completely disable it. |
| "//src/sys/pkg/bin/system-update-committer:disable", |
| ] |
| |
| recovery_eng_packages = |
| recovery_packages + core_realm_eng_aib_pkgs + |
| core_realm_testing_aib_pkgs + |
| [ |
| "//src/cobalt/bin/app:cobalt", |
| "//src/cobalt/bin/app:cobalt_registry", |
| "//src/cobalt/bin/app:config", |
| |
| # The SWD stack for OTAs. |
| "//src/sys/pkg/lib/isolated-swd:isolated-swd-components", |
| |
| # Userspace fastboot for flashing |
| "//src/firmware/fastboot-tcp", |
| |
| # Support for hwinfo protocol to read regulatory region from factory. |
| "//src/factory/factory_store_providers", |
| |
| # Support privacy switch |
| "//src/settings/service:setui_service", |
| ] |
| |
| recovery_installer_packages = |
| recovery_eng_packages - [ "//src/recovery/system:system_recovery" ] + [ |
| "//src/recovery/system:system_recovery_installer", |
| "//src/firmware/fastboot-tcp:fastboot_tcp_mdns_config", |
| ] |
| |
| recovery_fdr_packages = recovery_packages |
| recovery_fdr_packages -= [ "//src/recovery/system:system_recovery" ] |
| recovery_fdr_packages += [ "//src/recovery/system:system_recovery_fdr" ] |
| |
| _storage_config = { |
| } |
| if (!fxfs_blob) { |
| _storage_config = { |
| storage = { |
| filesystems = { |
| volume = { |
| fvm = { |
| data = { |
| data_filesystem_format = data_filesystem_format |
| } |
| blob = { |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| product_assembly_configuration("for-eng") { |
| platform = { |
| build_type = "eng" |
| feature_set_level = "utility" |
| if (authorized_ssh_keys_path != false) { |
| development_support = { |
| authorized_ssh_keys_path = |
| rebase_path(authorized_ssh_keys_path, root_build_dir) |
| } |
| } |
| connectivity = { |
| wlan = { |
| legacy_privacy_support = true |
| } |
| } |
| forensics = { |
| feedback = { |
| remote_device_id_provider = true |
| } |
| } |
| forward_variables_from(_storage_config, "*") |
| } |
| product = { |
| } |
| } |
| |
| assembled_system("recovery-eng") { |
| forward_variables_from(recovery_base, "*") |
| namespace = "recovery-eng" |
| allow_eng_platform_bundle_use = true |
| base_packages = recovery_eng_packages |
| core_realm_definition = ":core-eng" |
| |
| product_assembly_config_label = ":for-eng" |
| } |
| |
| product_assembly_configuration("for-fastboot") { |
| platform = { |
| build_type = "eng" |
| feature_set_level = "utility" |
| if (authorized_ssh_keys_path != false) { |
| development_support = { |
| authorized_ssh_keys_path = |
| rebase_path(authorized_ssh_keys_path, root_build_dir) |
| } |
| } |
| connectivity = { |
| wlan = { |
| legacy_privacy_support = true |
| } |
| } |
| forward_variables_from(_storage_config, "*") |
| } |
| product = { |
| } |
| } |
| |
| # A minimal recovery image that runs userspace fastboot on tcp. |
| assembled_system("recovery-fastboot") { |
| forward_variables_from(recovery_base, "*") |
| namespace = "recovery-fastboot" |
| allow_eng_platform_bundle_use = true |
| base_packages = [] |
| core_realm_definition = ":core-eng" |
| |
| product_assembly_config_label = ":for-fastboot" |
| |
| base_packages = core_realm_aib_pkgs + core_realm_eng_aib_pkgs + |
| core_realm_network_aib_pkgs + |
| [ |
| "//src/firmware/fastboot-tcp", |
| "//src/firmware/fastboot-tcp:fastboot_tcp_mdns_config", |
| "//src/firmware/fastboot-usb", |
| ] |
| |
| bootfs_labels = [] |
| bootfs_labels = [ "//build/input:recovery_bootfs" ] |
| |
| if (recovery_is_recovery_fastboot) { |
| image_metadata_overrides = { |
| zbi = { |
| name = "zircon-r" |
| if (zircon_r_partition != "") { |
| fastboot_flash = [ zircon_r_partition ] |
| } |
| bootserver_pave = [ "--zirconr" ] |
| } |
| |
| if (sign_zbi) { |
| zbi_signed = { |
| name = "zircon-r.signed" |
| if (zircon_r_partition != "") { |
| fastboot_flash = [ zircon_r_partition ] |
| } |
| bootserver_pave = [ "--zirconr" ] |
| } |
| } |
| |
| if (use_vbmeta) { |
| vbmeta = { |
| name = "zircon-r" |
| if (vbmeta_r_partition != "") { |
| fastboot_flash = [ vbmeta_r_partition ] |
| } |
| bootserver_pave = [ "--vbmetar" ] |
| } |
| } |
| } |
| } |
| } |
| |
| product_assembly_configuration("for-fdr") { |
| platform = { |
| build_type = "user" |
| feature_set_level = "utility" |
| forward_variables_from(_storage_config, "*") |
| } |
| product = { |
| } |
| } |
| |
| assembled_system("recovery-fdr") { |
| image_name = "fuchsia" |
| namespace = "recovery-fdr" |
| |
| base_packages = recovery_fdr_packages |
| core_realm_definition = ":core" |
| generate_vbmeta = use_vbmeta |
| |
| if (!fxfs_blob) { |
| generate_fvm = !bootfs_only |
| generate_fvm_fastboot = generate_fvm && assembly_generate_fvm_fastboot |
| generate_fvm_nand = generate_fvm && assembly_generate_fvm_nand |
| } else { |
| generate_fxfs = !bootfs_only |
| } |
| |
| ramdisk_in_zbi = true |
| |
| additional_boot_args = [ "virtcon.disable=true" ] |
| cmdline = [] |
| |
| product_assembly_config_label = ":for-fdr" |
| board_config_label = board_configuration_label |
| |
| bootfs_labels = [ "//build/input:recovery_bootfs" ] |
| |
| if (custom_signing_script != "") { |
| inputs = custom_signing_script_inputs |
| generate_signed_zbi = true |
| } else if (use_vboot) { |
| inputs = vboot_action.inputs |
| generate_signed_zbi = true |
| } |
| } |
| |
| product_assembly_configuration("for-installer") { |
| platform = { |
| build_type = "eng" |
| feature_set_level = "utility" |
| if (authorized_ssh_keys_path != false) { |
| development_support = { |
| authorized_ssh_keys_path = |
| rebase_path(authorized_ssh_keys_path, root_build_dir) |
| } |
| } |
| connectivity = { |
| wlan = { |
| legacy_privacy_support = true |
| } |
| |
| # After issuing device reboot when `ffx target flash`, ffx will block |
| # on the first mdns respond from the target as a signal of re-discovery. |
| # It also seems to temporarily stop updating the target according to |
| # later responds that follow. If we are unlucky and this first responds |
| # is _fuchsia._udp instead of _fastboot._tcp, ffx will fail to |
| # recognize the device as being in the fastboot state. For now remove |
| # _fuchsia._udp service as a workaround in favor of _fastboot._tcp |
| # until we need both. |
| mdns = { |
| publish_fuchsia_dev_wired_service = false |
| } |
| } |
| forward_variables_from(_storage_config, "*") |
| } |
| product = { |
| } |
| } |
| |
| assembled_system("recovery-installer") { |
| forward_variables_from(recovery_base, "*") |
| namespace = "recovery-installer" |
| allow_eng_platform_bundle_use = true |
| base_packages = recovery_installer_packages |
| |
| product_assembly_config_label = ":for-installer" |
| |
| core_realm_definition = ":core-installer" |
| } |
| } |