| # Copyright 2022 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("//zircon/prebuilt/config.gni") | |
| # This is the directory populated by //zircon/scripts/download-prebuilt. | |
| # Currently all Zircon firmware blobs are stored there. | |
| firmware_dir = "//zircon/prebuilt/downloads/firmware" | |
| # Declares firmware files to be added to manifests. | |
| # | |
| # Parameters | |
| # | |
| # sources (required) | |
| # List of paths to firmware files. | |
| # These paths must be relative to the directory holding all firmware files. | |
| template("firmware") { | |
| assert(defined(invoker.sources), "Must add some sources") | |
| mappings = [] | |
| foreach(source, invoker.sources) { | |
| name = get_path_info(source, "file") | |
| mappings += [ | |
| { | |
| source = rebase_path("$firmware_dir/$source", root_build_dir) | |
| destination = "lib/firmware/$name" | |
| label = get_label_info(":$target_name", "label_with_toolchain") | |
| }, | |
| ] | |
| } | |
| group(target_name) { | |
| metadata = { | |
| if (have_firmware) { | |
| # Used by the distribution_manifest template. | |
| distribution_entries = mappings | |
| } | |
| } | |
| } | |
| } |