| # Copyright 2025 The Fuchsia Authors | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| import("//build/dist/resource.gni") | |
| import("//build/rust/rustc_binary.gni") | |
| import("linux_test_init.gni") | |
| rustc_binary("assemble-initramfs") { | |
| edition = "2024" | |
| source_root = "assemble-initramfs.rs" | |
| sources = [ source_root ] | |
| deps = [ | |
| "//src/lib/assembly/assembled_system", | |
| "//src/lib/assembly/product_bundle", | |
| "//third_party/rust_crates:anyhow", | |
| "//third_party/rust_crates:argh", | |
| "//third_party/rust_crates:camino", | |
| "//third_party/rust_crates:cpio", | |
| "//third_party/rust_crates:serde", | |
| "//third_party/rust_crates:serde_json", | |
| ] | |
| configs += [ "//build/config/rust/lints:deny_unused_results" ] | |
| } | |
| # | |
| # Core resources intended for linux_test_initramfs() aggregation. | |
| # | |
| # This init process will replace itself with the crosvm process that runs the | |
| # the boot shim and ZBI - found at /data/kernel and /data/ramdisk, | |
| # respectively - in a protected VM. This is useful for exercising test logic | |
| # that does not try to prove what is happening within the VM after boot. | |
| # | |
| # When run in the context of a boot test, it becomes the responsibility of the | |
| # boot shim or ZBI to print the success string. | |
| linux_test_init("linux-test-init-crosvm-exec") { | |
| sources = [ "linux-test-init-crosvm-exec.cc" ] | |
| } | |
| if (current_cpu == "arm64") { | |
| # A target that can be used for the `qemu_kernel` parameter of `boot_test()`, | |
| # which in particular is used for those defined by `gki_pkvm_boot_test()`. | |
| group("gki") { | |
| testonly = true | |
| metadata = { | |
| emulator_support_aib_input = [ | |
| { | |
| label = get_label_info(":$target_name", "label_with_toolchain") | |
| path = rebase_path( | |
| "//prebuilt/virtualization/packages/aosp_gki/arm64/Image.gz", | |
| root_build_dir) | |
| }, | |
| ] | |
| } | |
| } | |
| resource("crosvm") { | |
| testonly = true | |
| allow_binary_output_dir = true | |
| sources = [ "//prebuilt/third_party/crosvm/linux-arm64/crosvm" ] | |
| outputs = [ "bin/crosvm" ] | |
| } | |
| # The well-known minimal runtime DSO set for any glibc-based binary. The | |
| # sysroots used for distributed Linux binaries (e.g. SDK tools) carefully | |
| # ensure that only these will be dynamically linked and crosvm is built with | |
| # the same controls. | |
| # | |
| # TODO(https://fxbug.dev/441317185): Replace with a dedicated runtime sysroot | |
| # when ready. | |
| resource("linux-runtime-sysroot") { | |
| testonly = true | |
| libs = [ | |
| "ld-linux-aarch64.so.1", | |
| "libBrokenLocale.so.1", | |
| "libanl.so.1", | |
| "libc.so.6", | |
| "libdl.so.2", | |
| "libm.so.6", | |
| "libnsl.so.1", | |
| "libnss_compat.so.2", | |
| "libnss_dns.so.2", | |
| "libnss_files.so.2", | |
| "libnss_hesiod.so.2", | |
| "libpthread.so.0", | |
| "libresolv.so.2", | |
| "librt.so.1", | |
| "libthread_db.so.1", | |
| "libutil.so.1", | |
| ] | |
| sources = [] | |
| foreach(lib, libs) { | |
| sources += [ "//prebuilt/third_party/sysroot/ubuntu20.04/lib/aarch64-linux-gnu/${lib}" ] | |
| } | |
| outputs = [ "lib/{{source_file_part}}" ] | |
| } | |
| } |