blob: 2c77270648cb221d5eb6aadb5dc9ffa24ec3af95 [file] [log] [blame]
# Copyright 2021 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/dev.gni")
import("//src/developer/ffx/build/ffx_action.gni")
# Check the bootfs filelist extracted from ZBI against a golden file.
#
# Parameters
#
# zbi
# Required: Path to the ZBI image to extract bootfs from.
# zbi_target
# Required: The target to build the 'zbi'.
# goldens
# Required: Path to a list of golden files that contain golden bootFS
# file list in the format of one file name per line. The actual bootFS
# filelist must match either one of the goldens. There should be only one
# golden file in this list for normal case and two golden files, one for
# the old golden file, one for the new golden file during a soft
# transition.
# deps, public_deps, data_deps (optional)
# Usual GN meaning.
template("verify_bootfs_filelist") {
assert(defined(invoker.zbi), "verify_bootfs_filelist() must specify zbi")
assert(defined(invoker.zbi_target),
"verify_bootfs_filelist() must specify zbi_target")
assert(defined(invoker.goldens),
"verify_kernel_cmdline() must specify goldens")
ffx_action(target_name) {
forward_variables_from(invoker,
[
"testonly",
"deps",
"public_deps",
"data_deps",
"visibility",
])
stamp_file = "$target_gen_dir/$target_name.verified"
inputs = [ invoker.zbi ]
inputs += invoker.goldens
outputs = [ stamp_file ]
args = [
"scrutiny",
"verify",
"bootfs",
"--zbi",
rebase_path(invoker.zbi, root_build_dir),
"--stamp",
rebase_path(stamp_file, root_build_dir),
]
foreach(golden, invoker.goldens) {
args += [
"--golden",
rebase_path(golden, root_build_dir),
]
}
if (!defined(invoker.deps)) {
deps = []
}
deps += [ invoker.zbi_target ]
}
}