Skip to content

Commit

Permalink
Build oak_restricted_kernel_bin with Bazel - for bare metal only.
Browse files Browse the repository at this point in the history
Also, remove toolchain definition no longer needed as we can declare it with aspect gcc.

BUG: 334871992
Change-Id: Ic59b714cc68536377dc1732cd153adb14765d5c1
  • Loading branch information
ernoc committed Jun 21, 2024
1 parent f6b2b62 commit cf5cb87
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 126 deletions.
20 changes: 9 additions & 11 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -298,21 +298,19 @@ load("@aspect_gcc_toolchain//toolchain:defs.bzl", "ARCHS", "gcc_register_toolcha
gcc_register_toolchain(
name = "gcc_toolchain_x86_64",
target_arch = ARCHS.x86_64,
# target_compatible_with defaults to os:linux.
)

# --- Rust support ---

load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies", "rules_cc_toolchains")

rules_cc_dependencies()

rules_cc_toolchains()

register_toolchains(
"//bazel/toolchains:x86_64_unknown_none_toolchain",
gcc_register_toolchain(
name = "gcc_toolchain_x86_64_unknown_none", # Repository @gcc_toolchain_x86_64_unknown_none
target_arch = ARCHS.x86_64,
target_compatible_with = [
"@platforms//cpu:x86_64",
"@platforms//os:none",
],
)

# rules_rust
# --- Rust support ---

_RUST_NIGHTLY_VERSION = "nightly/2024-02-01"

Expand Down
36 changes: 0 additions & 36 deletions bazel/toolchains/BUILD

This file was deleted.

79 changes: 0 additions & 79 deletions bazel/toolchains/cc_toolchains.bzl

This file was deleted.

46 changes: 46 additions & 0 deletions oak_restricted_kernel_bin/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#
# Copyright 2024 The Project Oak Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

load("@rules_rust//rust:defs.bzl", "rust_binary")

package(
default_visibility = ["//visibility:public"],
licenses = ["notice"],
)

rust_binary(
name = "oak_restricted_kernel_bin_virtio_console_channel",
srcs = ["src/main.rs"],
crate_features = ["virtio_console_channel"],
linker_script = "//oak_restricted_kernel:layout.ld",
platform = "//:x86_64-unknown-none",
deps = [
"//oak_linux_boot_params",
"//oak_restricted_kernel:oak_restricted_kernel_virtio_console_channel",
],
)

rust_binary(
name = "oak_restricted_kernel_bin_simple_io_channel",
srcs = ["src/main.rs"],
crate_features = ["simple_io_channel"],
linker_script = "//oak_restricted_kernel:layout.ld",
platform = "//:x86_64-unknown-none",
deps = [
"//oak_linux_boot_params",
"//oak_restricted_kernel:oak_restricted_kernel_simple_io_channel",
],
)

0 comments on commit cf5cb87

Please sign in to comment.