| # 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/components.gni") |
| import("//build/rust/rustc_binary.gni") |
| import("//build/rust/rustc_macro.gni") |
| import("//build/rust/rustc_test.gni") |
| import("//src/starnix/kernel/starnix.gni") |
| import("//src/starnix/lib/gzip/gzip.gni") |
| import("//tools/protobuf/rust_proto_library.gni") |
| import("args.gni") |
| |
| group("kernel") { |
| deps = [ ":starnix_kernel_package" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| |
| deps = [ |
| ":starnix-tests", |
| ":starnix_kernel_bin-tests", |
| ":starnix_kernel_runner-tests", |
| ":starnix_lifecycle-tests", |
| ":starnix_logging-tests", |
| ":starnix_sync-tests", |
| "device/input:tests", |
| ] |
| } |
| |
| rustc_binary("starnix_kernel_bin") { |
| name = "starnix_kernel" |
| edition = "2021" |
| with_unit_tests = true |
| |
| # TODO(https://fxbug.dev/42059075): Re-enable starnix in these environments. |
| exclude_toolchain_tags = [ |
| "asan", |
| "hwasan", |
| ] |
| |
| source_root = "main.rs" |
| deps = [ |
| ":android_5.10_kernel_config", |
| ":starnix_core", |
| ":starnix_kernel_runner", |
| ":starnix_logging", |
| "//sdk/fidl/fuchsia.component.runner:fuchsia.component.runner_rust", |
| "//sdk/fidl/fuchsia.process.lifecycle:fuchsia.process.lifecycle_rust", |
| "//sdk/fidl/fuchsia.starnix.container:fuchsia.starnix.container_rust", |
| "//src/graphics/lib/magma/src/libmagma", |
| "//src/lib/diagnostics/inspect/runtime/rust", |
| "//src/lib/diagnostics/inspect/rust", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-runtime", |
| "//src/lib/trace/rust:trace", |
| "//src/lib/trace/rust:trace-provider", |
| "//src/starnix/lib/extended_pstate:lib", |
| "//src/starnix/lib/kill_job_on_panic", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:async-lock", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:tracing-mutex", |
| ] |
| |
| non_rust_deps = [ ":restricted_trampoline" ] |
| |
| sources = [ "main.rs" ] |
| |
| configs += [ "//build/config/rust/lints:clippy_warn_all" ] |
| configs += [ "//src/starnix/config:starnix_clippy_lints" ] |
| |
| disable_rustdoc = false |
| } |
| |
| rustc_library("starnix_core") { |
| name = "starnix_core" |
| edition = "2021" |
| version = "0.1.0" |
| with_unit_tests = true |
| source_root = "lib.rs" |
| |
| # TODO(https://fxbug.dev/42059075): Re-enable starnix in these environments. |
| exclude_toolchain_tags = [ |
| "asan", |
| "hwasan", |
| ] |
| |
| sources = [ |
| "arch/${current_cpu}/execution.rs", |
| "arch/${current_cpu}/loader.rs", |
| "arch/${current_cpu}/mod.rs", |
| "arch/${current_cpu}/registers.rs", |
| "arch/${current_cpu}/signal_handling.rs", |
| "arch/${current_cpu}/syscalls.rs", |
| "arch/${current_cpu}/task.rs", |
| "arch/${current_cpu}/vdso.rs", |
| "arch/mod.rs", |
| "bpf/fs.rs", |
| "bpf/helpers.rs", |
| "bpf/map.rs", |
| "bpf/mod.rs", |
| "bpf/program.rs", |
| "bpf/syscalls.rs", |
| "device/ashmem.rs", |
| "device/binder.rs", |
| "device/device_init.rs", |
| "device/framebuffer.rs", |
| "device/framebuffer_server.rs", |
| "device/kobject.rs", |
| "device/loop_device.rs", |
| "device/mem.rs", |
| "device/mod.rs", |
| "device/perfetto_consumer.rs", |
| "device/registry.rs", |
| "device/remote_binder.rs", |
| "device/sync_fence_registry.rs", |
| "device/sync_file.rs", |
| "device/terminal.rs", |
| "device/zram.rs", |
| "dynamic_thread_spawner.rs", |
| "execution/mod.rs", |
| "execution/restricted_executor.rs", |
| "execution/shared.rs", |
| "fs/devpts.rs", |
| "fs/devtmpfs.rs", |
| "fs/ext4/mod.rs", |
| "fs/ext4/pager.rs", |
| "fs/fuchsia/mod.rs", |
| "fs/fuchsia/remote.rs", |
| "fs/fuchsia/remote_bundle.rs", |
| "fs/fuchsia/syslog.rs", |
| "fs/fuchsia/timer.rs", |
| "fs/fuchsia/zxio.rs", |
| "fs/functionfs.rs", |
| "fs/layeredfs.rs", |
| "fs/mod.rs", |
| "fs/overlayfs.rs", |
| "fs/proc/fs.rs", |
| "fs/proc/mod.rs", |
| "fs/proc/pid_directory.rs", |
| "fs/proc/proc_directory.rs", |
| "fs/proc/sysctl.rs", |
| "fs/proc/sysrq.rs", |
| "fs/sysfs/bus_collection_directory.rs", |
| "fs/sysfs/cgroup.rs", |
| "fs/sysfs/class_collection_directory.rs", |
| "fs/sysfs/cpu_class_directory.rs", |
| "fs/sysfs/device_directory.rs", |
| "fs/sysfs/fs.rs", |
| "fs/sysfs/kernel_directory.rs", |
| "fs/sysfs/mod.rs", |
| "fs/sysfs/power_directory.rs", |
| "fs/sysfs/sys_fs_directory.rs", |
| "fs/tmpfs.rs", |
| "fs/tracefs/fs.rs", |
| "fs/tracefs/mod.rs", |
| "fs/tracefs/tracing_directory.rs", |
| "lib.rs", |
| "loader.rs", |
| "mm/futex_table.rs", |
| "mm/memory_manager.rs", |
| "mm/mod.rs", |
| "mm/syscalls.rs", |
| "mm/vmex_resource.rs", |
| "mm/vmo.rs", |
| "mutable_state.rs", |
| "power/manager.rs", |
| "power/mod.rs", |
| "power/state.rs", |
| "power/suspend_stats.rs", |
| "power/sync_on_suspend.rs", |
| "power/wakeup_count.rs", |
| "selinux/fs.rs", |
| "selinux/hooks/current_task_hooks.rs", |
| "selinux/hooks/mod.rs", |
| "selinux/hooks/thread_group_hooks.rs", |
| "selinux/mod.rs", |
| "signals/mod.rs", |
| "signals/signal_handling.rs", |
| "signals/signalfd.rs", |
| "signals/syscalls.rs", |
| "signals/types.rs", |
| "syscalls/misc.rs", |
| "syscalls/mod.rs", |
| "syscalls/table.rs", |
| "syscalls/time.rs", |
| "task/abstract_socket_namespace.rs", |
| "task/current_task.rs", |
| "task/interval_timer.rs", |
| "task/iptables.rs", |
| "task/kernel.rs", |
| "task/kernel_stats.rs", |
| "task/kernel_threads.rs", |
| "task/mod.rs", |
| "task/net.rs", |
| "task/pid_table.rs", |
| "task/process_group.rs", |
| "task/ptrace.rs", |
| "task/scheduler.rs", |
| "task/seccomp.rs", |
| "task/session.rs", |
| "task/syscalls.rs", |
| "task/syslog.rs", |
| "task/task.rs", |
| "task/thread_group.rs", |
| "task/timers.rs", |
| "task/uts_namespace.rs", |
| "task/waiter.rs", |
| "testing.rs", |
| "time/mod.rs", |
| "time/utc.rs", |
| "vdso/mod.rs", |
| "vdso/vdso_loader.rs", |
| "vfs/aio.rs", |
| "vfs/anon_node.rs", |
| "vfs/buffers/io_buffers.rs", |
| "vfs/buffers/message_queue.rs", |
| "vfs/buffers/message_types.rs", |
| "vfs/buffers/mod.rs", |
| "vfs/dir_entry.rs", |
| "vfs/directory_file.rs", |
| "vfs/dirent_sink.rs", |
| "vfs/dynamic_file.rs", |
| "vfs/epoll.rs", |
| "vfs/eventfd.rs", |
| "vfs/fd_number.rs", |
| "vfs/fd_table.rs", |
| "vfs/file_object.rs", |
| "vfs/file_server.rs", |
| "vfs/file_system.rs", |
| "vfs/file_write_guard.rs", |
| "vfs/fs_args.rs", |
| "vfs/fs_context.rs", |
| "vfs/fs_node.rs", |
| "vfs/fsverity.rs", |
| "vfs/fuse.rs", |
| "vfs/inotify.rs", |
| "vfs/mod.rs", |
| "vfs/namespace.rs", |
| "vfs/path.rs", |
| "vfs/pidfd.rs", |
| "vfs/pipe.rs", |
| "vfs/record_locks.rs", |
| "vfs/rw_queue.rs", |
| "vfs/simple_file.rs", |
| "vfs/socket/iptables_utils.rs", |
| "vfs/socket/mod.rs", |
| "vfs/socket/socket.rs", |
| "vfs/socket/socket_backed_by_zxio.rs", |
| "vfs/socket/socket_file.rs", |
| "vfs/socket/socket_fs.rs", |
| "vfs/socket/socket_generic_netlink/messages.rs", |
| "vfs/socket/socket_generic_netlink/mod.rs", |
| "vfs/socket/socket_generic_netlink/nl80211.rs", |
| "vfs/socket/socket_netlink.rs", |
| "vfs/socket/socket_types.rs", |
| "vfs/socket/socket_unix.rs", |
| "vfs/socket/socket_vsock.rs", |
| "vfs/socket/syscalls.rs", |
| "vfs/splice.rs", |
| "vfs/static_directory.rs", |
| "vfs/stubs.rs", |
| "vfs/symlink_node.rs", |
| "vfs/syscalls.rs", |
| "vfs/vec_directory.rs", |
| "vfs/vmo_file.rs", |
| "vfs/wd_number.rs", |
| "vfs/xattr.rs", |
| ] |
| |
| deps = [ |
| ":perfetto_consumer_proto", |
| ":starnix_lifecycle", |
| ":starnix_logging", |
| ":starnix_sync", |
| ":vdso-data($bionic_linux_toolchain)", |
| "//sdk/fidl/fuchsia.buildinfo:fuchsia.buildinfo_rust", |
| "//sdk/fidl/fuchsia.diagnostics:fuchsia.diagnostics_rust", |
| "//sdk/fidl/fuchsia.element:fuchsia.element_rust", |
| "//sdk/fidl/fuchsia.fs:fuchsia.fs_rust", |
| "//sdk/fidl/fuchsia.hardware.adb:fuchsia.hardware.adb_rust", |
| "//sdk/fidl/fuchsia.hardware.power.statecontrol:fuchsia.hardware.power.statecontrol_rust", |
| "//sdk/fidl/fuchsia.io:fuchsia.io_rust", |
| "//sdk/fidl/fuchsia.kernel:fuchsia.kernel_rust", |
| "//sdk/fidl/fuchsia.math:fuchsia.math_rust", |
| "//sdk/fidl/fuchsia.net.filter:fuchsia.net.filter_rust", |
| "//sdk/fidl/fuchsia.posix:fuchsia.posix_rust", |
| "//sdk/fidl/fuchsia.posix.socket:fuchsia.posix.socket_rust", |
| "//sdk/fidl/fuchsia.posix.socket.packet:fuchsia.posix.socket.packet_rust", |
| "//sdk/fidl/fuchsia.posix.socket.raw:fuchsia.posix.socket.raw_rust", |
| "//sdk/fidl/fuchsia.power.broker:fuchsia.power.broker_rust", |
| "//sdk/fidl/fuchsia.power.suspend:fuchsia.power.suspend_rust", |
| "//sdk/fidl/fuchsia.power.system:fuchsia.power.system_rust", |
| "//sdk/fidl/fuchsia.process:fuchsia.process_rust", |
| "//sdk/fidl/fuchsia.scheduler:fuchsia.scheduler_rust", |
| "//sdk/fidl/fuchsia.session.power:fuchsia.session.power_rust", |
| "//sdk/fidl/fuchsia.starnix.binder:fuchsia.starnix.binder_rust", |
| "//sdk/fidl/fuchsia.sysinfo:fuchsia.sysinfo_rust", |
| "//sdk/fidl/fuchsia.sysmem:fuchsia.sysmem_rust", |
| "//sdk/fidl/fuchsia.ui.composition:fuchsia.ui.composition_rust", |
| "//sdk/fidl/fuchsia.ui.display.singleton:fuchsia.ui.display.singleton_rust", |
| "//sdk/fidl/fuchsia.ui.views:fuchsia.ui.views_rust", |
| "//src/connectivity/lib/net-types", |
| "//src/connectivity/network/netlink", |
| "//src/connectivity/wlan/wlanix:fuchsia.wlan.wlanix_rust", |
| "//src/graphics/lib/magma/src/libmagma", |
| "//src/lib/async-utils", |
| "//src/lib/debug/rust", |
| "//src/lib/dense-map", |
| "//src/lib/diagnostics/data/rust", |
| "//src/lib/diagnostics/inspect/contrib/rust", |
| "//src/lib/diagnostics/inspect/rust", |
| "//src/lib/fdio/rust:fdio", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-fs", |
| "//src/lib/fuchsia-runtime", |
| "//src/lib/mundane", |
| "//src/lib/process_builder", |
| "//src/lib/trace/rust:trace", |
| "//src/lib/trace/rust:trace-observer", |
| "//src/lib/ui/flatland-frame-scheduling:flatland-frame-scheduling-lib", |
| "//src/lib/ui/fuchsia-framebuffer", |
| "//src/lib/ui/fuchsia-scenic", |
| "//src/lib/vulkan", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//src/starnix/kernel/device/fidl:fuchsia.starnix.device_rust", |
| "//src/starnix/lib/ebpf", |
| "//src/starnix/lib/extended_pstate:lib", |
| "//src/starnix/lib/filter_methods_macro", |
| "//src/starnix/lib/linux_uapi", |
| "//src/starnix/lib/range_map", |
| "//src/starnix/lib/selinux/common", |
| "//src/starnix/lib/selinux/core", |
| "//src/starnix/lib/selinux/policy", |
| "//src/starnix/lib/starnix-syscalls", |
| "//src/starnix/lib/starnix-uapi", |
| "//src/starnix/lib/syncio", |
| "//src/starnix/lib/usercopy", |
| "//src/storage/ext4/lib/metadata", |
| "//src/storage/ext4/read-only:ext4-read-only", |
| "//src/storage/lib/vfs/rust:vfs", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:assert_matches", |
| "//third_party/rust_crates:async-trait", |
| "//third_party/rust_crates:bit-vec", |
| "//third_party/rust_crates:bitflags", |
| "//third_party/rust_crates:bstr", |
| "//third_party/rust_crates:byteorder", |
| "//third_party/rust_crates:derivative", |
| "//third_party/rust_crates:dyn-clone", |
| "//third_party/rust_crates:fragile", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:itertools", |
| "//third_party/rust_crates:linked-hash-map", |
| "//third_party/rust_crates:lock_api", |
| "//third_party/rust_crates:macro_rules_attribute", |
| "//third_party/rust_crates:maplit", |
| "//third_party/rust_crates:memchr", |
| "//third_party/rust_crates:memoffset", |
| "//third_party/rust_crates:netlink-packet-core", |
| "//third_party/rust_crates:netlink-packet-generic", |
| "//third_party/rust_crates:netlink-packet-route", |
| "//third_party/rust_crates:netlink-packet-sock-diag", |
| "//third_party/rust_crates:netlink-packet-utils", |
| "//third_party/rust_crates:num-derive", |
| "//third_party/rust_crates:num-traits", |
| "//third_party/rust_crates:once_cell", |
| "//third_party/rust_crates:paste", |
| "//third_party/rust_crates:pin-project", |
| "//third_party/rust_crates:prost", |
| "//third_party/rust_crates:rand", |
| "//third_party/rust_crates:ref-cast", |
| "//third_party/rust_crates:regex", |
| "//third_party/rust_crates:scopeguard", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:serde_json", |
| "//third_party/rust_crates:slab", |
| "//third_party/rust_crates:smallvec", |
| "//third_party/rust_crates:static_assertions", |
| "//third_party/rust_crates:tracing-mutex", |
| "//third_party/rust_crates:utf8parse", |
| "//third_party/rust_crates:zerocopy", |
| ] |
| |
| if (current_cpu == "arm64") { |
| deps += [ ":vdso-helpers-arm" ] |
| } |
| |
| test_deps = [ |
| "//src/lib/fuchsia", |
| "//src/lib/fuchsia-fs", |
| "//src/lib/test_util", |
| "//src/storage/ext4/tests:test_img", |
| "//src/storage/fxfs/platform:fxfs-testing", |
| "//third_party/rust_crates:rand", |
| "//third_party/rust_crates:test-case", |
| "//third_party/rust_crates:tracing-mutex", |
| ] |
| |
| features = [] |
| if (starnix_syscall_stats) { |
| features += [ "syscall_stats" ] |
| } |
| if (starnix_unified_aspace) { |
| features += [ "unified_aspace" ] |
| } |
| if (starnix_enable_alternate_anon_allocs) { |
| features += [ "alternate_anon_allocs" ] |
| } |
| inputs = [ |
| "//src/starnix/lib/selinux/testdata/micro_policies/hooks_tests_policy.pp", |
| ] |
| configs += [ "//src/starnix/config:starnix_clippy_lints" ] |
| } |
| |
| rustc_library("starnix_kernel_runner") { |
| name = "starnix_kernel_runner" |
| edition = "2021" |
| version = "0.1.0" |
| with_unit_tests = true |
| source_root = "runner/lib.rs" |
| |
| # TODO(https://fxbug.dev/42059075): Re-enable starnix in these environments. |
| exclude_toolchain_tags = [ |
| "asan", |
| "hwasan", |
| ] |
| |
| sources = [ |
| "runner/component_runner.rs", |
| "runner/container.rs", |
| "runner/features.rs", |
| "runner/lib.rs", |
| "runner/serve_protocols.rs", |
| ] |
| |
| deps = [ |
| ":starnix_core", |
| ":starnix_kernel_config", |
| ":starnix_logging", |
| ":starnix_sync", |
| "//sdk/fidl/fuchsia.component:fuchsia.component_rust", |
| "//sdk/fidl/fuchsia.component.runner:fuchsia.component.runner_rust", |
| "//sdk/fidl/fuchsia.element:fuchsia.element_rust", |
| "//sdk/fidl/fuchsia.io:fuchsia.io_rust", |
| "//sdk/fidl/fuchsia.scheduler:fuchsia.scheduler_rust", |
| "//sdk/fidl/fuchsia.starnix.container:fuchsia.starnix.container_rust", |
| "//sdk/fidl/fuchsia.sysinfo:fuchsia.sysinfo_rust", |
| "//sdk/fidl/fuchsia.ui.composition:fuchsia.ui.composition_rust", |
| "//sdk/fidl/fuchsia.ui.input3:fuchsia.ui.input3_rust", |
| "//sdk/fidl/fuchsia.ui.policy:fuchsia.ui.policy_rust", |
| "//sdk/fidl/fuchsia.ui.views:fuchsia.ui.views_rust", |
| "//src/graphics/lib/magma/src/libmagma", |
| "//src/lib/diagnostics/inspect/contrib/rust", |
| "//src/lib/diagnostics/inspect/rust", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-runtime", |
| "//src/lib/ui/fuchsia-scenic", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//src/starnix/kernel/device/fidl:fuchsia.starnix.device_rust", |
| "//src/starnix/kernel/device/gpu", |
| "//src/starnix/kernel/device/gralloc", |
| "//src/starnix/kernel/device/input:input-device", |
| "//src/starnix/kernel/device/magma:magma-device", |
| "//src/starnix/lib/selinux/core", |
| "//src/starnix/lib/starnix-uapi", |
| "//src/sys/lib/runner", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:bstr", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:rand", |
| ] |
| |
| test_deps = [ "//src/lib/fuchsia" ] |
| |
| configs += [ "//src/starnix/config:starnix_clippy_lints" ] |
| } |
| |
| rustc_library("starnix_lifecycle") { |
| name = "starnix_lifecycle" |
| edition = "2021" |
| version = "0.1.0" |
| with_unit_tests = true |
| source_root = "lifecycle/lib.rs" |
| |
| sources = [ |
| "lifecycle/atomic_counter.rs", |
| "lifecycle/delayed_releaser.rs", |
| "lifecycle/drop_notifier.rs", |
| "lifecycle/lib.rs", |
| ] |
| |
| deps = [ |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//src/starnix/lib/starnix-uapi", |
| "//third_party/rust_crates:paste", |
| ] |
| |
| test_deps = [ |
| "//src/lib/fuchsia", |
| "//third_party/rust_crates:futures", |
| ] |
| |
| configs += [ "//src/starnix/config:starnix_clippy_lints" ] |
| } |
| |
| rustc_library("starnix_logging") { |
| name = "starnix_logging" |
| edition = "2021" |
| version = "0.1.0" |
| with_unit_tests = true |
| source_root = "logging/lib.rs" |
| |
| sources = [ |
| "logging/core_dump_list.rs", |
| "logging/lib.rs", |
| "logging/logging.rs", |
| "logging/not_found.rs", |
| "logging/stubs.rs", |
| "logging/trace.rs", |
| ] |
| |
| deps = [ |
| ":starnix_sync", |
| "//src/lib/diagnostics/inspect/contrib/rust", |
| "//src/lib/diagnostics/inspect/rust", |
| "//src/lib/trace/rust:trace", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//src/starnix/lib/starnix-uapi", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:bstr", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:once_cell", |
| "//third_party/rust_crates:regex", |
| "//third_party/rust_crates:tracing", |
| ] |
| |
| test_deps = [ "//third_party/rust_crates:pretty_assertions" ] |
| |
| features = [] |
| if (starnix_disable_logging) { |
| features += [ "disable_logging" ] |
| } |
| if (starnix_enable_tracing) { |
| features += [ "tracing" ] |
| } |
| if (starnix_enable_tracing_firehose) { |
| features += [ "tracing_firehose" ] |
| } |
| if (starnix_enable_trace_and_debug_logs_in_release) { |
| features += [ "trace_and_debug_logs_in_release" ] |
| } |
| |
| configs += [ "//src/starnix/config:starnix_clippy_lints" ] |
| } |
| |
| rustc_library("starnix_sync") { |
| name = "starnix_sync" |
| edition = "2021" |
| version = "0.1.0" |
| with_unit_tests = true |
| source_root = "sync/lib.rs" |
| |
| deps = [ |
| "//src/lib/fuchsia-sync", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:lock_api", |
| "//third_party/rust_crates:once_cell", |
| "//third_party/rust_crates:static_assertions", |
| "//third_party/rust_crates:tracing-mutex", |
| ] |
| |
| test_deps = [ |
| "//src/lib/fuchsia", |
| "//third_party/rust_crates:test-case", |
| ] |
| |
| sources = [ |
| "sync/atomic_time.rs", |
| "sync/interruptible_event.rs", |
| "sync/lib.rs", |
| "sync/lock_ordering.rs", |
| "sync/lock_relations.rs", |
| "sync/lock_sequence.rs", |
| "sync/lock_traits.rs", |
| "sync/locks.rs", |
| "sync/port_event.rs", |
| ] |
| |
| configs += [ "//src/starnix/config:starnix_clippy_lints" ] |
| } |
| |
| rust_proto_library("perfetto_consumer_proto") { |
| sources = [ |
| "//third_party/perfetto/protos/perfetto/ipc/consumer_port.proto", |
| "//third_party/perfetto/protos/perfetto/ipc/wire_protocol.proto", |
| ] |
| packages = [ "perfetto.protos" ] |
| include_dirs = [ "//third_party/perfetto" ] |
| } |
| |
| static_library("restricted_trampoline") { |
| sources = [ "execution/trampoline_${current_cpu}.S" ] |
| } |
| |
| resource("starnix-test-files") { |
| sources = [ |
| "data/testfile.txt", |
| "data/testfile2.txt", |
| ] |
| outputs = [ "data/{{source_file_part}}" ] |
| } |
| |
| # vDSO |
| |
| config("vdso_config") { |
| cflags = [ "-fPIC" ] |
| ldflags = [ |
| "-shared", |
| |
| # Make sure libc is not linked into the vDSO. Header-only use is OK. |
| "-nostdlib", |
| ] |
| |
| # Force LTO so that functions are inlined when appropriate even across |
| # different compilation units. |
| if (!is_debug) { |
| configs = [ "//build/config/lto:thinlto" ] |
| } |
| |
| # Use a custom linker script to ensure only one PT_LOAD header. |
| vdso_linker_script = "vdso/vdso.ld" |
| vdso_version_script = "vdso/vdso-${current_cpu}.map" |
| ldflags += [ |
| "-Wl,--hash-style=both", |
| "-Wl,-T," + rebase_path(vdso_linker_script, root_build_dir), |
| "-Wl,--version-script," + rebase_path(vdso_version_script, root_build_dir), |
| ] |
| } |
| |
| source_set("vdso-calculate-utc") { |
| sources = [ "vdso/vdso-calculate-utc.cc" ] |
| deps = [ |
| "//zircon/system/public", |
| "//zircon/system/ulib/affine", |
| ] |
| configs += [ ":vdso_config" ] |
| } |
| |
| if (current_cpu == "arm64") { |
| static_library("vdso-helpers-arm") { |
| sources = [ "vdso/get_raw_ticks_arm.cc" ] |
| deps = [ "//zircon/system/public" ] |
| } |
| } |
| |
| loadable_module("vdso") { |
| sources = [ |
| "vdso/vdso-${current_cpu}.cc", |
| "vdso/vdso-common.cc", |
| ] |
| deps = [ |
| ":vdso-calculate-utc", |
| "//zircon/system/public", |
| "//zircon/system/ulib/affine", |
| ] |
| |
| if (current_cpu == "arm64") { |
| deps += [ ":vdso-helpers-arm" ] |
| } |
| |
| output_name = "libvdso" |
| configs += [ ":vdso_config" ] |
| if (is_linux) { |
| # By default, Linux host libraries statically link libc++. Since this library specifies nostdlib |
| # this option is unused and generates a warning. |
| configs -= [ "//build/config/linux:implicit-host-libs" ] |
| } |
| |
| exclude_toolchain_tags = [ "instrumented" ] |
| } |
| |
| resource("vdso-data") { |
| sources = [ "$root_out_dir/libvdso.so" ] |
| outputs = [ "data/libvdso.so" ] |
| deps = [ ":vdso" ] |
| } |
| |
| # Components |
| |
| # The starnix kernel manifest, used by all containers. |
| fuchsia_component_manifest("starnix_kernel_manifest") { |
| manifest = "meta/starnix_kernel.cml" |
| component_name = "starnix_kernel" |
| } |
| |
| # The starnix kernel configuration library, used by the Rust binary to parse configuration. |
| fuchsia_structured_config_rust_lib("starnix_kernel_config") { |
| cm_label = ":starnix_kernel_manifest" |
| } |
| |
| gzip("gzip_android_5.10_kernel_config") { |
| input = "data/config" |
| output = "$target_gen_dir/config.gz" |
| } |
| |
| resource("android_5.10_kernel_config") { |
| sources = [ "$target_gen_dir/config.gz" ] |
| outputs = [ "data/config.gz" ] |
| deps = [ ":gzip_android_5.10_kernel_config" ] |
| } |
| |
| fuchsia_component("starnix_kernel") { |
| cm_label = ":starnix_kernel_manifest" |
| deps = [ ":starnix_kernel_bin" ] |
| } |
| |
| fuchsia_structured_config_values("kernel_config") { |
| cm_label = ":starnix_kernel_manifest" |
| values_source = "//src/starnix/kernel/meta/config.json5" |
| } |
| |
| # Packages |
| |
| fuchsia_package("starnix_kernel_package") { |
| package_name = "starnix_kernel" |
| deps = [ |
| ":kernel_config", |
| ":starnix_kernel", |
| ":starnix_kernel_manifest", |
| "//src/starnix/containers:default_init", |
| ] |
| } |
| |
| fuchsia_unittest_package("starnix-tests") { |
| manifest = "meta/starnix-tests.cml" |
| deps = [ |
| ":starnix-test-files", |
| ":starnix_core_test", |
| "//src/starnix/examples/hello_starnix:bin", |
| ] |
| test_specs = { |
| log_settings = { |
| # Tests exercise failure cases, so ERROR logs are expected. |
| max_severity = "ERROR" |
| } |
| } |
| test_type = "system" |
| } |
| |
| fuchsia_unittest_package("starnix_kernel_bin-tests") { |
| deps = [ ":starnix_kernel_bin_test" ] |
| manifest = "meta/starnix_kernel_bin-tests.cml" |
| } |
| |
| fuchsia_unittest_package("starnix_kernel_runner-tests") { |
| deps = [ ":starnix_kernel_runner_test" ] |
| manifest = "meta/starnix_kernel_runner-tests.cml" |
| test_specs = { |
| log_settings = { |
| # Tests exercise failure cases, so ERROR logs are expected. |
| max_severity = "ERROR" |
| } |
| } |
| } |
| |
| fuchsia_unittest_package("starnix_lifecycle-tests") { |
| deps = [ ":starnix_lifecycle_test" ] |
| } |
| |
| fuchsia_unittest_package("starnix_logging-tests") { |
| deps = [ ":starnix_logging_test" ] |
| } |
| |
| fuchsia_unittest_package("starnix_sync-tests") { |
| deps = [ ":starnix_sync_test" ] |
| } |