blob: 7d0f5e9fe9c8e8e4d1c05fa09917d46c969a5a1d [file] [log] [blame]
# Copyright 2023 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/compiled_action.gni")
import("//build/dist/distribution_manifest.gni")
# Convert a ext4 image into something that can be included in a package. It can then be mounted
# within Starnix using the remote_bundle mount type. For example, a system image could be mounted
# with a specification of:
#
# /:remote_bundle:data/system
#
# If the image contains elf binaries, then you should use a prefix starting with "data" to avoid
# verification failures: Fuchsia does not like Linux elf binaries, but will skip checking anything
# in "data".
#
# Parameters
#
# input (required)
# The path of the image.
#
# prefix (required)
# The path that the bundle will be found at within the package.
#
# deps
# testonly
template("ext4_to_pkg") {
assert(defined(invoker.input), "input must be defined for ext4_to_pkg")
assert(defined(invoker.prefix), "prefix must be defined for ext4_to_pkg")
_gen_dir = "$target_gen_dir/$target_name"
_fini_manifest = "$_gen_dir/manifest.fini"
compiled_action("$target_name-fini") {
forward_variables_from(invoker,
[
"deps",
"testonly",
])
depfile = "$target_gen_dir/$target_name.d"
tool = "//src/storage/ext4/bin:ext4_to_pkg"
sources = [ invoker.input ]
outputs = [ _fini_manifest ]
args = [
rebase_path(sources[0], root_build_dir),
rebase_path(_gen_dir, root_build_dir),
invoker.prefix,
"-d",
rebase_path(depfile, root_build_dir),
]
}
distribution_entries_from_fini(target_name) {
file = _fini_manifest
deps = [ ":$target_name-fini" ]
}
}