| # Copyright 2026 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/components.gni") |
| import("//build/rust/rustc_library.gni") |
| |
| group("rust") { |
| public_deps = [ ":userboot" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":userboot-cmdline-tests", |
| ":userboot-program-tests", |
| ] |
| } |
| |
| rustc_library("userboot") { |
| edition = "2024" |
| sources = [ "src/lib.rs" ] |
| public_deps = [ ".." ] # Public to propagate static linking configs. |
| deps = [ |
| "//sdk/lib/c/rust", |
| "//sdk/rust/zx", |
| ] |
| } |
| |
| rustc_library("cmdline") { |
| edition = "2024" |
| with_unit_tests = true |
| source_root = "src/cmdline.rs" |
| sources = [ source_root ] |
| deps = [ "//third_party/rust_crates:anyhow" ] |
| } |
| |
| fuchsia_unittest_package("userboot-cmdline-tests") { |
| deps = [ ":cmdline_test" ] |
| } |
| |
| rustc_library("program") { |
| edition = "2024" |
| with_unit_tests = true |
| source_root = "src/program.rs" |
| sources = [ source_root ] |
| deps = [ |
| "//sdk/fidl/fuchsia.ldsvc:fuchsia.ldsvc_rust_next", |
| "//sdk/lib/c/rust", |
| "//sdk/rust/zx", |
| "//src/lib/elf_parse", |
| "//src/lib/fidl/rust_next/fidl_next", |
| "//src/lib/fuchsia-runtime", |
| "//src/lib/process_builder", |
| "//src/sys/lib/fuchsia-bootfs", |
| "//third_party/rust_crates:anyhow", |
| ] |
| test_deps = [ |
| "//sdk/fidl/fuchsia.kernel:fuchsia.kernel_rust", |
| "//src/lib/fuchsia", |
| "//src/lib/fuchsia-component", |
| "//third_party/rust_crates:zerocopy", |
| ] |
| } |
| |
| fuchsia_unittest_package("userboot-program-tests") { |
| manifest = "meta/userboot_program_tests.cml" |
| deps = [ ":program_test" ] |
| test_type = "system" |
| } |
| |
| rustc_library("bootfs") { |
| edition = "2024" |
| source_root = "src/bootfs.rs" |
| sources = [ source_root ] |
| deps = [ |
| "//sdk/lib/c/rust", |
| "//sdk/rust/zx", |
| "//src/firmware/lib/zbi-rs", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:crc32fast", |
| "//third_party/rust_crates:zerocopy", |
| "//third_party/rust_crates:zstd-safe", |
| "//third_party/zstd", |
| ] |
| } |