Merge "Give log_stats the same logfile opening interface as log cat."
diff --git a/.bazelrc b/.bazelrc
index 1e65f3a..65af315 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -1,7 +1,9 @@
-# Use our CROSSTOOL.
-build --crosstool_top=//tools/cpp:toolchain
-# Don't switch HOST compilers.
-build --host_crosstool_top=//tools/cpp:toolchain
+# Use platforms to build our code.
+build --incompatible_enable_cc_toolchain_resolution
+
+# For now we only support building on x86 Linux so we can hard-code the host
+# platform.
+build --host_platform=//tools/platforms:linux_x86
 
 # Always include debug information in the non-.stripped binaries.
 build --strip=never
@@ -18,6 +20,12 @@
 build --noincompatible_py3_is_default
 build --noincompatible_py2_outputs_are_suffixed
 
+# Shortcuts for selecting the target platform.
+build:k8 --platforms=//tools/platforms:linux_x86
+build:roborio --platforms=//tools/platforms:linux_roborio
+build:armhf-debian --platforms=//tools/platforms:linux_armhf
+build:cortex-m4f --platforms=//tools/platforms:cortex_m4f
+
 build:asan --copt -fsanitize=address
 build:asan --linkopt -fsanitize=address --linkopt -ldl
 build:asan --platform_suffix=-asan
@@ -71,7 +79,6 @@
 build --sandbox_fake_hostname=true
 build --sandbox_fake_username=true
 
-build --auto_cpu_environment_group=//tools:cpus
 startup --host_jvm_args=-Dbazel.DigestFunction=SHA1
 
 common --watchfs
diff --git a/README.md b/README.md
index 95c9467..7bddeba 100644
--- a/README.md
+++ b/README.md
@@ -106,16 +106,16 @@
   * Build and test everything (on the host system, for the roborio target-- note, this may take a while):
 ```
 bazel test //...
-bazel build --cpu=roborio -c opt //...
+bazel build --config=roborio -c opt //...
 ```
   * Build the code for a specific robot:
 ```console
 # For the roborio:
-bazel build --cpu=roborio -c opt //y2020/...
+bazel build --config=roborio -c opt //y2020/...
 ```
 ```
 # For the raspberry pi:
-bazel build --cpu=armhf-debian -c opt //y2020/...
+bazel build --config=armhf-debian -c opt //y2020/...
 ```
 
   * Configuring a roborio: Freshly imaged roboRIOs need to be configured to run the 971 code
@@ -127,12 +127,12 @@
   * Download code to a robot:
 ```console
 # For the roborio
-bazel run --cpu=roborio -c opt //y2020:download_stripped -- roboRIO-971-frc.local
+bazel run --config=roborio -c opt //y2020:download_stripped -- roboRIO-971-frc.local
 ```
 This assumes the roborio is reachable at `roboRIO-971-frc.local`.  If that does not work, you can try with a static IP address like `10.9.71.2` (see troubleshooting below)
 ```console
 # For the raspberry pi's
-bazel run --cpu=armhf-debian -c opt //y2020:pi_download_stripped -- 10.9.71.101
+bazel run --config=armhf-debian -c opt //y2020:pi_download_stripped -- 10.9.71.101
 ```
 NOTE:
   1. The raspberry pi's require that you have your ssh key installed on them in order to copy code over
@@ -142,7 +142,7 @@
     1. Generally if you want to update what's running on the robot, you can use the `download_stripped` (or `pi_download_stripped`) targets.  These will rsync only the changed files, and so are pretty efficient.
     2. If you have a need to compile a specific module, you can build stripped versions of the individual modules by adding "_stripped" to the module name.  For example, to build the calibration code (`//y2020/vision:calibration`) for the pi (`armhf-debian`), run:
     ```console
-    bazel run --cpu=armhf-debian -c opt //y2020/vision:calibration_stripped
+    bazel run --config=armhf-debian -c opt //y2020/vision:calibration_stripped
     ```
     You will then need to manually copy the resulting file over to the robot.
 
@@ -204,7 +204,7 @@
 This allows you to use the alias to `ping`, `ssh`, or run commands like:
 ```
 # Download code to robot #7971's raspberry pi #2
-bazel run --cpu=armhf-debian -c opt //y2020:download_stripped -- pi-7971-2
+bazel run --config=armhf-debian -c opt //y2020:download_stripped -- pi-7971-2
 ```
 
 ### Roborio Kernel Traces
diff --git a/WORKSPACE b/WORKSPACE
index 464d2e2..b9031fb 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -118,6 +118,31 @@
 
 generate_repositories_for_debs(lzma_arm64_debs)
 
+register_toolchains(
+    "//tools/cpp:cc-toolchain-k8",
+    "//tools/cpp:cc-toolchain-armhf-debian",
+    "//tools/cpp:cc-toolchain-roborio",
+    "//tools/cpp:cc-toolchain-cortex-m4f",
+    # Find a good way to select between these two M4F toolchains.
+    #"//tools/cpp:cc-toolchain-cortex-m4f-k22",
+)
+
+http_archive(
+    name = "platforms",
+    sha256 = "3c4057c53b64dd3f2c753e0a80bbb6ccb29fb437910200c911dd51454baf619b",
+    url = "https://www.frc971.org/Build-Dependencies/platforms_10b4d2bdde25ea1e66c02c3f83a6d921000a7272.zip",
+    strip_prefix = "platforms-10b4d2bdde25ea1e66c02c3f83a6d921000a7272",
+)
+
+http_archive(
+    name = "bazel_skylib",
+    urls = [
+        "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz",
+        "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz",
+    ],
+    sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c",
+)
+
 http_archive(
     name = "python_repo",
     build_file = "@//debian:python.BUILD",
@@ -461,7 +486,7 @@
     name = 'api-cpp',
     visibility = ['//visibility:public'],
     srcs = ['linux/athena/static/libCTRE_Phoenix.a'],
-    restricted_to = ['@//tools:roborio'],
+    target_compatible_with = ['@//tools/platforms/hardware:roborio'],
     deps = [
       '@ctre_phoenix_core_headers//:core',
       '@ctre_phoenix_core_athena//:core',
@@ -498,7 +523,7 @@
     name = 'diagnostics',
     visibility = ['//visibility:public'],
     srcs = ['linux/athena/static/libCTRE_PhoenixDiagnostics.a'],
-    restricted_to = ['@//tools:roborio'],
+    target_compatible_with = ['@//tools/platforms/hardware:roborio'],
     deps = [
       '@ctre_phoenix_core_headers//:core',
       '@ctre_phoenix_core_athena//:core',
@@ -535,7 +560,7 @@
     name = 'cci',
     visibility = ['//visibility:public'],
     srcs = ['linux/athena/static/libCTRE_PhoenixCCI.a'],
-    restricted_to = ['@//tools:roborio'],
+    target_compatible_with = ['@//tools/platforms/hardware:roborio'],
 )
 """,
     sha256 = "e5d9b58072002dbd2daa8cc8d42e047e5c90d26bd5a2b1d63dc1b89112ac3837",
@@ -568,7 +593,7 @@
     name = 'core',
     visibility = ['//visibility:public'],
     srcs = ['linux/athena/static/libCTRE_PhoenixCore.a'],
-    restricted_to = ['@//tools:roborio'],
+    target_compatible_with = ['@//tools/platforms/hardware:roborio'],
 )
 """,
     sha256 = "cd827bc68c0f4ef2fe6c363a7f9f5a08f7d944b574c65a2c7fb823686501f43f",
diff --git a/aos/BUILD b/aos/BUILD
index 9a62e66..beeb2b0 100644
--- a/aos/BUILD
+++ b/aos/BUILD
@@ -1,4 +1,3 @@
-load("//tools:environments.bzl", "mcu_cpus")
 load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library", "flatbuffer_py_library", "flatbuffer_ts_library")
 
 filegroup(
@@ -43,7 +42,6 @@
     hdrs = [
         "commonmath.h",
     ],
-    compatible_with = mcu_cpus,
     visibility = ["//visibility:public"],
 )
 
@@ -52,12 +50,14 @@
     hdrs = [
         "byteorder.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -66,7 +66,6 @@
     hdrs = [
         "macros.h",
     ],
-    compatible_with = mcu_cpus,
     visibility = ["//visibility:public"],
 )
 
@@ -75,6 +74,7 @@
     hdrs = [
         "gtest_prod.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -83,6 +83,7 @@
     hdrs = [
         "network_port.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -91,6 +92,7 @@
     hdrs = [
         "unique_malloc_ptr.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -102,6 +104,7 @@
     hdrs = [
         "condition.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos/ipc_lib:aos_sync",
@@ -115,6 +118,7 @@
     srcs = [
         "condition_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":condition",
         "//aos:die",
@@ -137,6 +141,7 @@
     hdrs = [
         "die.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos:macros",
@@ -149,6 +154,7 @@
     srcs = [
         "die_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":die",
         "//aos/testing:googletest",
@@ -163,6 +169,7 @@
     hdrs = [
         "event.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos/ipc_lib:aos_sync",
@@ -177,6 +184,7 @@
     srcs = [
         "event_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":event",
         "//aos/testing:googletest",
@@ -190,6 +198,7 @@
     srcs = [
         "dump_rtprio.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/logging",
         "//aos/logging:implementations",
@@ -205,6 +214,7 @@
     hdrs = [
         "complex_thread_local.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos:die",
@@ -217,6 +227,7 @@
     srcs = [
         "complex_thread_local_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":complex_thread_local",
         "//aos/logging",
@@ -232,6 +243,7 @@
     hdrs = [
         "init.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":realtime",
@@ -248,6 +260,7 @@
     hdrs = [
         "realtime.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":thread_local",
@@ -259,12 +272,14 @@
     name = "configuration_fbs",
     srcs = ["configuration.fbs"],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
 flatbuffer_ts_library(
     name = "configuration_ts_fbs",
     srcs = ["configuration.fbs"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -279,6 +294,7 @@
         "Map",
         "Node",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -290,6 +306,7 @@
     hdrs = [
         "configuration.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":configuration_fbs",
@@ -310,12 +327,14 @@
     hdrs = [
         "make_unique.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
 flatbuffer_ts_library(
     name = "json_to_flatbuffer_flatbuffer_ts",
     srcs = ["json_to_flatbuffer.fbs"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//aos:__subpackages__"],
 )
 
@@ -323,6 +342,7 @@
     name = "json_to_flatbuffer_flatbuffer",
     srcs = ["json_to_flatbuffer.fbs"],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//aos:__subpackages__"],
 )
 
@@ -330,6 +350,7 @@
     name = "flatbuffer_utils",
     srcs = ["flatbuffer_utils.cc"],
     hdrs = ["flatbuffer_utils.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "@com_github_google_flatbuffers//:flatbuffers",
     ],
@@ -339,6 +360,7 @@
     name = "json_tokenizer",
     srcs = ["json_tokenizer.cc"],
     hdrs = ["json_tokenizer.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "@com_github_google_glog//:glog",
         "@com_google_absl//absl/strings",
@@ -352,6 +374,7 @@
         "json_to_flatbuffer.cc",
     ],
     hdrs = ["json_to_flatbuffer.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":fast_string_builder",
@@ -369,6 +392,7 @@
     srcs = [
         "json_to_flatbuffer_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":json_to_flatbuffer",
         ":json_to_flatbuffer_flatbuffer",
@@ -384,6 +408,7 @@
     data = [
         ":json_to_flatbuffer_flatbuffer_reflection_out",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":json_to_flatbuffer",
         ":json_to_flatbuffer_flatbuffer",
@@ -398,6 +423,7 @@
     srcs = ["flatbuffer_merge.cc"],
     hdrs = ["flatbuffer_merge.h"],
     copts = ["-Wno-cast-align"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":flatbuffer_utils",
@@ -411,6 +437,7 @@
     srcs = [
         "flatbuffer_merge_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":flatbuffer_merge",
         ":json_to_flatbuffer",
@@ -427,6 +454,7 @@
     hdrs = [
         "flatbuffers.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos:macros",
@@ -448,6 +476,7 @@
         "//aos/events:pong.bfbs",
         "//aos/testdata:test_configs",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":configuration",
         "//aos/testing:googletest",
@@ -460,6 +489,7 @@
     srcs = [
         "config_flattener.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":configuration",
@@ -474,6 +504,7 @@
     srcs = [
         "aos_dump.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":configuration",
@@ -489,6 +520,7 @@
     srcs = [
         "aos_graph_nodes.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":configuration",
@@ -507,6 +539,7 @@
     hdrs = [
         "ftrace.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "@com_github_google_glog//:glog",
@@ -521,6 +554,7 @@
     hdrs = [
         "fast_string_builder.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "@com_github_google_glog//:glog",
         "@com_google_absl//absl/strings",
@@ -533,6 +567,7 @@
     hdrs = [
         "thread_local.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -541,6 +576,7 @@
     srcs = [
         "realtime_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":realtime",
diff --git a/aos/actions/BUILD b/aos/actions/BUILD
index 14592cf..7898353 100644
--- a/aos/actions/BUILD
+++ b/aos/actions/BUILD
@@ -13,6 +13,7 @@
         "actions.h",
         "actor.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":actions_fbs",
         "//aos/controls:control_loop",
@@ -26,18 +27,21 @@
     name = "actions_fbs",
     srcs = ["actions.fbs"],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
     name = "test_action_fbs",
     srcs = ["test_action.fbs"],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
     name = "test_action2_fbs",
     srcs = ["test_action2.fbs"],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 aos_config(
@@ -48,6 +52,7 @@
         ":test_action_fbs",
         ":test_action2_fbs",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/events:config",
     ],
@@ -59,6 +64,7 @@
         "action_test.cc",
     ],
     data = [":action_test_config"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":action_lib",
         ":actions_fbs",
diff --git a/aos/config.bzl b/aos/config.bzl
index a11efd5..57d6af3 100644
--- a/aos/config.bzl
+++ b/aos/config.bzl
@@ -5,7 +5,7 @@
     "transitive_src",
 ])
 
-def aos_config(name, src, flatbuffers = [], deps = [], visibility = None, testonly = False):
+def aos_config(name, src, flatbuffers = [], deps = [], visibility = None, testonly = False, target_compatible_with = None):
     _aos_config(
         name = name,
         src = src,
@@ -13,6 +13,7 @@
         flatbuffers = [expand_label(flatbuffer) + "_reflection_out" for flatbuffer in flatbuffers],
         visibility = visibility,
         testonly = testonly,
+        target_compatible_with = target_compatible_with,
     )
 
 def _aos_config_impl(ctx):
diff --git a/aos/containers/BUILD b/aos/containers/BUILD
index 9e527cd..70d98f1 100644
--- a/aos/containers/BUILD
+++ b/aos/containers/BUILD
@@ -1,12 +1,11 @@
 package(default_visibility = ["//visibility:public"])
 
-load("//tools:environments.bzl", "mcu_cpus")
-
 cc_library(
     name = "ring_buffer",
     hdrs = [
         "ring_buffer.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_test(
@@ -14,6 +13,7 @@
     srcs = [
         "ring_buffer_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":ring_buffer",
         "//aos/testing:googletest",
@@ -25,6 +25,7 @@
     hdrs = [
         "priority_queue.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_test(
@@ -32,6 +33,7 @@
     srcs = [
         "priority_queue_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":priority_queue",
         "//aos/testing:googletest",
@@ -43,7 +45,6 @@
     hdrs = [
         "sized_array.h",
     ],
-    compatible_with = mcu_cpus,
 )
 
 cc_test(
@@ -51,6 +52,7 @@
     srcs = [
         "sized_array_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":sized_array",
         "//aos/testing:googletest",
@@ -62,6 +64,7 @@
     hdrs = [
         "resizeable_buffer.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "@com_github_google_glog//:glog",
     ],
@@ -72,6 +75,7 @@
     srcs = [
         "resizeable_buffer_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":resizeable_buffer",
         "//aos/testing:googletest",
diff --git a/aos/controls/BUILD b/aos/controls/BUILD
index 7172cbb..14890d4 100644
--- a/aos/controls/BUILD
+++ b/aos/controls/BUILD
@@ -1,7 +1,6 @@
 package(default_visibility = ["//visibility:public"])
 
 load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
-load("//tools:environments.bzl", "mcu_cpus")
 
 cc_library(
     name = "control_loop_test",
@@ -12,6 +11,7 @@
     hdrs = [
         "control_loop_test.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos:flatbuffers",
         "//aos:json_to_flatbuffer",
@@ -25,27 +25,20 @@
 )
 
 cc_library(
-    name = "polytope_uc",
-    hdrs = [
-        "polytope.h",
-    ],
-    restricted_to = mcu_cpus,
-    deps = [
-        "@org_tuxfamily_eigen//:eigen",
-    ],
-)
-
-cc_library(
     name = "polytope",
     hdrs = [
         "polytope.h",
     ],
     deps = [
-        "//aos/logging",
-        "//third_party/cddlib",
-        "@com_github_google_glog//:glog",
         "@org_tuxfamily_eigen//:eigen",
-    ],
+    ] + select({
+        "@platforms//os:linux": [
+            "//aos/logging",
+            "//third_party/cddlib",
+            "@com_github_google_glog//:glog",
+        ],
+        "//conditions:default": [],
+    }),
 )
 
 cc_test(
@@ -53,6 +46,7 @@
     srcs = [
         "polytope_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":polytope",
         "//aos/testing:googletest",
@@ -66,6 +60,7 @@
     srcs = [
         "control_loops.fbs",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_library(
@@ -77,6 +72,7 @@
     hdrs = [
         "control_loop.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/events:event_loop",
         "//aos/events:shm_event_loop",
@@ -96,6 +92,7 @@
     hdrs = [
         "quaternion_utils.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "@com_github_google_glog//:glog",
         "@org_tuxfamily_eigen//:eigen",
@@ -107,6 +104,7 @@
     srcs = [
         "quaternion_utils_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":quaternion_utils",
         "//aos/testing:googletest",
diff --git a/aos/events/BUILD b/aos/events/BUILD
index c408b7b..95e6cdc 100644
--- a/aos/events/BUILD
+++ b/aos/events/BUILD
@@ -7,6 +7,7 @@
     name = "test_message_fbs",
     srcs = ["test_message.fbs"],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -16,29 +17,34 @@
     includes = [
         "//aos:configuration_fbs_includes",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
     name = "ping_fbs",
     srcs = ["ping.fbs"],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_ts_library(
     name = "ping_ts_fbs",
     srcs = ["ping.fbs"],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
     name = "pong_fbs",
     srcs = ["pong.fbs"],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_library(
     name = "epoll",
     srcs = ["epoll.cc"],
     hdrs = ["epoll.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos/time",
@@ -49,6 +55,7 @@
 cc_test(
     name = "epoll_test",
     srcs = ["epoll_test.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":epoll",
         "//aos/testing:googletest",
@@ -67,6 +74,7 @@
         "channel_preallocated_allocator.h",
         "event_loop.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":event_loop_fbs",
@@ -92,6 +100,7 @@
     hdrs = [
         "ping_lib.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":event_loop",
         ":ping_fbs",
@@ -107,6 +116,7 @@
         "ping.cc",
     ],
     data = [":pingpong_config"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":ping_lib",
         ":shm_event_loop",
@@ -126,6 +136,7 @@
         "//aos/starter:starter_fbs",
         "//aos/starter:starter_rpc_fbs",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 aos_config(
@@ -135,6 +146,7 @@
         ":ping_fbs",
         ":pong_fbs",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":config"],
 )
 
@@ -149,6 +161,7 @@
         "//aos/network:timestamp_fbs",
         "//aos/network:message_bridge_server_fbs",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":config"],
 )
 
@@ -160,6 +173,7 @@
     hdrs = [
         "pong_lib.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":event_loop",
         ":ping_fbs",
@@ -174,6 +188,7 @@
         "pong.cc",
     ],
     data = [":pingpong_config"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":ping_fbs",
         ":pong_fbs",
@@ -190,6 +205,7 @@
     name = "pingpong_test",
     srcs = ["pingpong_test.cc"],
     data = [":pingpong_config"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":ping_lib",
         ":pong_lib",
@@ -204,6 +220,7 @@
     name = "timing_statistics",
     srcs = ["timing_statistics.cc"],
     hdrs = ["timing_statistics.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":event_loop_fbs",
         "//aos:configuration",
@@ -214,6 +231,7 @@
 cc_test(
     name = "timing_statistics_test",
     srcs = ["timing_statistics_test.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":timing_statistics",
         "//aos:configuration",
@@ -226,6 +244,7 @@
     name = "shm_event_loop",
     srcs = ["shm_event_loop.cc"],
     hdrs = ["shm_event_loop.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":aos_logging",
@@ -248,6 +267,7 @@
     name = "shm_event_loop_test",
     srcs = ["shm_event_loop_test.cc"],
     shard_count = 16,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":event_loop_param_test",
         ":shm_event_loop",
@@ -260,6 +280,7 @@
     testonly = True,
     srcs = ["event_loop_param_test.cc"],
     hdrs = ["event_loop_param_test.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":event_loop",
         ":test_message_fbs",
@@ -273,6 +294,7 @@
     srcs = ["simulated_event_loop_test.cc"],
     data = [":multinode_pingpong_config"],
     shard_count = 4,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":event_loop_param_test",
         ":message_counter",
@@ -287,6 +309,7 @@
     name = "simple_channel",
     srcs = ["simple_channel.cc"],
     hdrs = ["simple_channel.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos:configuration_fbs",
         "@com_github_google_flatbuffers//:flatbuffers",
@@ -307,6 +330,7 @@
         "simulated_event_loop.h",
         "simulated_network_bridge.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":aos_logging",
@@ -326,6 +350,7 @@
 cc_test(
     name = "event_scheduler_test",
     srcs = ["event_scheduler_test.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":simulated_event_loop",
         "//aos/testing:googletest",
@@ -341,6 +366,7 @@
     hdrs = [
         "aos_logging.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":event_loop",
@@ -352,6 +378,7 @@
 cc_library(
     name = "message_counter",
     hdrs = ["message_counter.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":event_loop",
diff --git a/aos/events/logging/BUILD b/aos/events/logging/BUILD
index f4c4ceb..40e6626 100644
--- a/aos/events/logging/BUILD
+++ b/aos/events/logging/BUILD
@@ -8,6 +8,7 @@
     includes = [
         "//aos:configuration_fbs_includes",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -21,11 +22,13 @@
         "logfile_sorting.h",
         "logfile_utils.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":buffer_encoder",
         ":uuid",
         ":logger_fbs",
+        ":lzma_encoder",
         "//aos:configuration",
         "//aos:flatbuffer_merge",
         "//aos:flatbuffers",
@@ -36,11 +39,7 @@
         "@com_github_google_flatbuffers//:flatbuffers",
         "@com_github_google_glog//:glog",
         "@com_google_absl//absl/types:span",
-    ] + select({
-        "//tools:cpu_k8": [":lzma_encoder"],
-        "//tools:cpu_aarch64": [":lzma_encoder"],
-        "//conditions:default": [],
-    }),
+    ],
 )
 
 cc_binary(
@@ -49,6 +48,7 @@
     srcs = [
         "logfile_utils_out_of_space_test_runner.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":logfile_utils",
         "//aos:init",
@@ -65,6 +65,7 @@
     data = [
         ":logfile_utils_out_of_space_test_runner",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "@bazel_tools//tools/bash/runfiles",
     ],
@@ -78,6 +79,7 @@
     hdrs = [
         "buffer_encoder.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":logger_fbs",
@@ -94,6 +96,7 @@
         "buffer_encoder_test.cc",
     ],
     shard_count = 4,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":buffer_encoder",
         ":buffer_encoder_param_test",
@@ -102,29 +105,15 @@
     ],
 )
 
-# TODO(Brian): Properly restrict this to specific platforms and
-# un-conditionalize the srcs and hdrs once we have support for that which
-# interacts with select properly.
 cc_library(
     name = "lzma_encoder",
-    srcs = select({
-        "//tools:cpu_k8": [
-            "lzma_encoder.cc",
-        ],
-        "//tools:cpu_aarch64": [
-            "lzma_encoder.cc",
-        ],
-        "//conditions:default": [],
-    }),
-    hdrs = select({
-        "//tools:cpu_k8": [
-            "lzma_encoder.h",
-        ],
-        "//tools:cpu_aarch64": [
-            "lzma_encoder.h",
-        ],
-        "//conditions:default": [],
-    }),
+    srcs = [
+        "lzma_encoder.cc",
+    ],
+    hdrs = [
+        "lzma_encoder.h",
+    ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":buffer_encoder",
@@ -143,11 +132,8 @@
     srcs = [
         "lzma_encoder_test.cc",
     ],
-    restricted_to = [
-        "//tools:k8",
-        "//tools:aarch64",
-    ],
     shard_count = 4,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":buffer_encoder_param_test",
         ":lzma_encoder",
@@ -165,6 +151,7 @@
     hdrs = [
         "buffer_encoder_param_test.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":logfile_utils",
         ":logger_fbs",
@@ -186,6 +173,7 @@
         "log_namer.h",
         "logger.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":logfile_utils",
@@ -211,6 +199,7 @@
     srcs = [
         "log_cat.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":logger",
@@ -229,6 +218,7 @@
     srcs = [
         "log_edit.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":logger",
         "//aos:configuration",
@@ -245,6 +235,7 @@
     srcs = [
         "log_stats.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":logger",
         "//aos:configuration",
@@ -262,6 +253,7 @@
     srcs = [
         "logger_main.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":logger",
@@ -285,6 +277,7 @@
         "//aos/network:message_bridge_server_fbs",
         "//aos/network:timestamp_fbs",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = ["//aos/events:config"],
 )
 
@@ -301,6 +294,7 @@
         "//aos/events:pingpong_config",
     ],
     shard_count = 5,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":logger",
         "//aos/events:message_counter",
@@ -316,11 +310,13 @@
     name = "uuid",
     srcs = ["uuid.cc"],
     hdrs = ["uuid.h"],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_test(
     name = "uuid_test",
     srcs = ["uuid_test.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":uuid",
         "//aos/testing:googletest",
@@ -330,6 +326,7 @@
 cc_test(
     name = "logfile_utils_test",
     srcs = ["logfile_utils_test.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":logfile_utils",
         ":test_message_fbs",
@@ -342,4 +339,5 @@
     name = "test_message_fbs",
     srcs = ["test_message.fbs"],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
diff --git a/aos/input/BUILD b/aos/input/BUILD
index 24e6381..fafe39d 100644
--- a/aos/input/BUILD
+++ b/aos/input/BUILD
@@ -8,6 +8,7 @@
     hdrs = [
         "joystick_input.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/events:event_loop",
         "//aos/input:driver_station_data",
@@ -24,6 +25,7 @@
     hdrs = [
         "drivetrain_input.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos:math",
         "//aos/input:driver_station_data",
@@ -44,6 +46,7 @@
     hdrs = [
         "driver_station_data.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/robot_state:joystick_state_fbs",
         "@com_github_google_glog//:glog",
@@ -54,6 +57,7 @@
     name = "action_joystick_input",
     srcs = ["action_joystick_input.cc"],
     hdrs = ["action_joystick_input.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":drivetrain_input",
         "//aos:init",
diff --git a/aos/ipc_lib/BUILD b/aos/ipc_lib/BUILD
index 0fb307a..7799cdc 100644
--- a/aos/ipc_lib/BUILD
+++ b/aos/ipc_lib/BUILD
@@ -9,6 +9,7 @@
     linkopts = [
         "-lpthread",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos:macros",
@@ -27,6 +28,7 @@
     hdrs = [
         "core_lib.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":aos_sync",
@@ -45,6 +47,7 @@
     linkopts = [
         "-lrt",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":aos_sync",
@@ -61,6 +64,7 @@
     hdrs = [
         "shared_mem_types.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":aos_sync",
     ],
@@ -74,6 +78,7 @@
     tags = [
         "manual",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":core_lib",
         "//aos:die",
@@ -93,6 +98,7 @@
         "ipc_comparison.cc",
     ],
     linkopts = ["-lrt"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos:condition",
         "//aos:event",
@@ -112,6 +118,7 @@
     hdrs = [
         "signalfd.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "@com_github_google_glog//:glog",
@@ -123,6 +130,7 @@
     srcs = [
         "signalfd_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":signalfd",
         "//aos/testing:googletest",
@@ -135,6 +143,7 @@
     name = "index",
     srcs = ["index.cc"],
     hdrs = ["index.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "@com_github_google_glog//:glog",
@@ -144,6 +153,7 @@
 cc_test(
     name = "index_test",
     srcs = ["index_test.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":index",
         "//aos/testing:googletest",
@@ -158,6 +168,7 @@
         "lockless_queue_memory.h",
     ],
     hdrs = ["lockless_queue.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":aos_sync",
@@ -181,6 +192,7 @@
     hdrs = [
         "queue_racer.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":lockless_queue",
         "//aos:event",
@@ -192,6 +204,7 @@
     name = "lockless_queue_test",
     timeout = "eternal",
     srcs = ["lockless_queue_test.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":lockless_queue",
         ":queue_racer",
@@ -206,6 +219,7 @@
 cc_test(
     name = "lockless_queue_death_test",
     srcs = ["lockless_queue_death_test.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":lockless_queue",
         ":queue_racer",
@@ -224,6 +238,7 @@
     hdrs = [
         "data_alignment.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "@com_github_google_glog//:glog",
@@ -234,6 +249,7 @@
     name = "latency_lib",
     srcs = ["latency_lib.cc"],
     hdrs = ["latency_lib.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos:realtime",
         "//aos/logging",
@@ -247,6 +263,7 @@
     srcs = [
         "signal_stress.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":latency_lib",
         "//aos:init",
@@ -260,6 +277,7 @@
     srcs = [
         "futex_latency.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":latency_lib",
         "//aos:condition",
@@ -274,6 +292,7 @@
     srcs = [
         "named_pipe_latency.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":latency_lib",
         "//aos:init",
@@ -287,6 +306,7 @@
     srcs = [
         "eventfd_latency.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":latency_lib",
         "//aos:init",
@@ -300,6 +320,7 @@
     srcs = [
         "print_lockless_queue_memory.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":lockless_queue",
diff --git a/aos/libc/BUILD b/aos/libc/BUILD
index 35b6629..cc54670 100644
--- a/aos/libc/BUILD
+++ b/aos/libc/BUILD
@@ -8,6 +8,7 @@
     hdrs = [
         "aos_strsignal.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos:thread_local",
         "@com_github_google_glog//:glog",
@@ -19,6 +20,7 @@
     srcs = [
         "aos_strsignal_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":aos_strsignal",
         "//aos/testing:googletest",
@@ -33,6 +35,7 @@
     hdrs = [
         "dirname.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_test(
@@ -40,6 +43,7 @@
     srcs = [
         "dirname_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":dirname",
         "//aos/testing:googletest",
@@ -54,6 +58,7 @@
     hdrs = [
         "aos_strerror.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos:thread_local",
     ],
@@ -64,6 +69,7 @@
     srcs = [
         "aos_strerror_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":aos_strerror",
         "//aos/testing:googletest",
diff --git a/aos/logging/BUILD b/aos/logging/BUILD
index a9fcb14..cf0c370 100644
--- a/aos/logging/BUILD
+++ b/aos/logging/BUILD
@@ -14,6 +14,7 @@
         "interface.h",
         "logging.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":printf_formats",
@@ -36,6 +37,7 @@
     srcs = ["log_namer.cc"],
     hdrs = ["log_namer.h"],
     copts = ["-Wno-format-nonliteral"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos:configuration",
@@ -48,6 +50,7 @@
     hdrs = [
         "sizes.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_test(
@@ -55,6 +58,7 @@
     srcs = [
         "implementations_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":implementations",
         ":logging",
@@ -68,6 +72,7 @@
     hdrs = [
         "printf_formats.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos:macros",
@@ -76,6 +81,7 @@
 
 cc_library(
     name = "implementations",
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":logging",
@@ -86,5 +92,6 @@
     name = "log_message_fbs",
     srcs = ["log_message.fbs"],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/aos/mutex/BUILD b/aos/mutex/BUILD
index bdfb8fc..d079a02 100644
--- a/aos/mutex/BUILD
+++ b/aos/mutex/BUILD
@@ -8,6 +8,7 @@
     hdrs = [
         "mutex.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/ipc_lib:aos_sync",
         "//aos/type_traits",
@@ -20,6 +21,7 @@
     srcs = [
         "mutex_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":mutex",
         "//aos/testing:googletest",
diff --git a/aos/network/BUILD b/aos/network/BUILD
index c725ab7..4818aa2 100644
--- a/aos/network/BUILD
+++ b/aos/network/BUILD
@@ -11,6 +11,7 @@
     includes = [
         "//aos:configuration_fbs_includes",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_ts_library(
@@ -19,6 +20,7 @@
     includes = [
         "//aos:configuration_fbs_includes",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -28,6 +30,7 @@
     includes = [
         "//aos:configuration_fbs_includes",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -38,6 +41,7 @@
         ":message_bridge_server_fbs_includes",
         "//aos:configuration_fbs_includes",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -47,6 +51,7 @@
     includes = [
         "//aos:configuration_fbs_includes",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_library(
@@ -57,6 +62,7 @@
     hdrs = [
         "team_number.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/util:string_to_num",
         "@com_github_google_glog//:glog",
@@ -68,6 +74,7 @@
     srcs = [
         "team_number_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":team_number",
         "//aos:configuration",
@@ -87,6 +94,7 @@
         # The casts required to read datastructures from sockets trip -Wcast-align.
         "-Wno-cast-align",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos:unique_malloc_ptr",
         "//aos/util:file",
@@ -106,6 +114,7 @@
     copts = [
         "-Wno-cast-align",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":sctp_lib",
         "//third_party/lksctp-tools:sctp",
@@ -120,6 +129,7 @@
     hdrs = [
         "message_bridge_protocol.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":connect_fbs",
         "//aos:configuration",
@@ -137,6 +147,7 @@
     hdrs = [
         "message_bridge_server_status.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":message_bridge_client_fbs",
         ":message_bridge_server_fbs",
@@ -160,6 +171,7 @@
     copts = [
         "-Wno-cast-align",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":connect_fbs",
         ":message_bridge_client_fbs",
@@ -181,6 +193,7 @@
     srcs = [
         "message_bridge_server.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":message_bridge_server_lib",
         "//aos:init",
@@ -200,6 +213,7 @@
     copts = [
         "-Wno-cast-align",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":sctp_lib",
         "//third_party/lksctp-tools:sctp",
@@ -214,6 +228,7 @@
     hdrs = [
         "message_bridge_client_status.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":message_bridge_client_fbs",
         ":message_bridge_server_fbs",
@@ -235,6 +250,7 @@
     copts = [
         "-Wno-cast-align",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":connect_fbs",
         ":message_bridge_client_fbs",
@@ -256,6 +272,7 @@
     copts = [
         "-Wno-cast-align",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":message_bridge_client_lib",
         "//aos:init",
@@ -275,18 +292,21 @@
         "//aos/network:message_bridge_server_fbs",
         "//aos/network:timestamp_fbs",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = ["//aos/events:config"],
 )
 
 aos_config(
     name = "message_bridge_test_server_config",
     src = "message_bridge_test_server.json",
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":message_bridge_test_common_config"],
 )
 
 aos_config(
     name = "message_bridge_test_client_config",
     src = "message_bridge_test_client.json",
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":message_bridge_test_common_config"],
 )
 
@@ -300,6 +320,7 @@
         ":message_bridge_test_server_config",
     ],
     shard_count = 5,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":message_bridge_client_lib",
         ":message_bridge_server_lib",
@@ -320,6 +341,7 @@
         ":connect_fbs_includes",
         "//aos:configuration_fbs_includes",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_ts_library(
@@ -329,12 +351,14 @@
         ":connect_fbs_includes",
         "//aos:configuration_fbs_includes",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_library(
     name = "web_proxy_utils",
     srcs = ["web_proxy_utils.cc"],
     hdrs = ["web_proxy_utils.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":connect_fbs",
         ":web_proxy_fbs",
@@ -352,6 +376,7 @@
         "-DWEBRTC_POSIX",
         "-Wno-unused-parameter",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":connect_fbs",
         ":web_proxy_fbs",
@@ -370,6 +395,7 @@
         include = ["www_defaults/**/*"],
         exclude = ["www/**/*"],
     ),
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_binary(
@@ -384,6 +410,7 @@
         "//aos/network/www:main_bundle.min.js",
         "@com_github_google_flatbuffers//:flatjs",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":gen_embedded",
         ":web_proxy",
@@ -399,6 +426,7 @@
     name = "timestamp_filter",
     srcs = ["timestamp_filter.cc"],
     hdrs = ["timestamp_filter.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos:configuration",
         "//aos/time",
@@ -412,6 +440,7 @@
     srcs = [
         "timestamp_filter_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":timestamp_filter",
         "//aos:json_to_flatbuffer",
diff --git a/aos/network/www/BUILD b/aos/network/www/BUILD
index 4987a30..8142e24 100644
--- a/aos/network/www/BUILD
+++ b/aos/network/www/BUILD
@@ -1,5 +1,5 @@
 load("@npm_bazel_typescript//:defs.bzl", "ts_library")
-load("@build_bazel_rules_nodejs//:defs.bzl", "rollup_bundle", "nodejs_binary")
+load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary", "rollup_bundle")
 load("//aos:config.bzl", "aos_config")
 
 filegroup(
@@ -17,6 +17,7 @@
         "config_handler.ts",
         "proxy.ts",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos:configuration_ts_fbs",
@@ -32,6 +33,7 @@
         "main.ts",
         "ping_handler.ts",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":proxy",
         "//aos/events:ping_ts_fbs",
@@ -42,6 +44,7 @@
     name = "main_bundle",
     enable_code_splitting = False,
     entry_point = "main.ts",
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//aos:__subpackages__"],
     deps = [
         ":main",
@@ -57,6 +60,7 @@
         "flatbuffers.js",
     ],
     cmd = "cp $(location @com_github_google_flatbuffers//:flatjs) $@",
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//aos:__subpackages__"],
 )
 
@@ -65,6 +69,7 @@
     srcs = [
         "reflection_test_main.ts",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":reflection_ts",
         "//aos:configuration_ts_fbs",
@@ -77,6 +82,7 @@
 ts_library(
     name = "reflection_ts",
     srcs = ["reflection.ts"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos:configuration_ts_fbs",
@@ -90,6 +96,7 @@
     srcs = [
         "plotter.ts",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -98,6 +105,7 @@
     srcs = [
         "graph_main.ts",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":plotter",
         ":proxy",
@@ -112,6 +120,7 @@
     name = "graph_main_bundle",
     enable_code_splitting = False,
     entry_point = "graph_main.ts",
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":graph_main",
     ],
@@ -124,6 +133,7 @@
         "//aos:configuration_fbs",
         "//aos:json_to_flatbuffer_flatbuffer",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/events:config",
     ],
@@ -133,6 +143,7 @@
     name = "reflection_test_bundle",
     enable_code_splitting = False,
     entry_point = "reflection_test_main.ts",
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":reflection_test_main",
     ],
@@ -150,4 +161,5 @@
         "//aos/network:web_proxy_main",
         "//y2020:config",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
diff --git a/aos/protobuf/BUILD b/aos/protobuf/BUILD
index 4d6a107..6e61139 100644
--- a/aos/protobuf/BUILD
+++ b/aos/protobuf/BUILD
@@ -4,6 +4,7 @@
     name = "stack_arena",
     srcs = ["stack_arena.cc"],
     hdrs = ["stack_arena.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/logging",
         "@com_google_protobuf//:protobuf",
@@ -13,6 +14,7 @@
 cc_test(
     name = "stack_arena_test",
     srcs = ["stack_arena_test.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":stack_arena",
         "//aos/logging",
diff --git a/aos/robot_state/BUILD b/aos/robot_state/BUILD
index 9748e1b..663c8c6 100644
--- a/aos/robot_state/BUILD
+++ b/aos/robot_state/BUILD
@@ -7,12 +7,14 @@
     name = "robot_state_fbs",
     srcs = ["robot_state.fbs"],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
     name = "joystick_state_fbs",
     srcs = ["joystick_state.fbs"],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 aos_config(
@@ -22,6 +24,7 @@
         "//aos/robot_state:joystick_state_fbs",
         "//aos/robot_state:robot_state_fbs",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = ["//aos/events:config"],
 )
diff --git a/aos/scoped/BUILD b/aos/scoped/BUILD
index 1ec0f1b..fb867c6 100644
--- a/aos/scoped/BUILD
+++ b/aos/scoped/BUILD
@@ -8,6 +8,7 @@
     hdrs = [
         "scoped_fd.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos:macros",
         "@com_github_google_glog//:glog",
diff --git a/aos/seasocks/BUILD b/aos/seasocks/BUILD
index ae8d402..e9a98c7 100644
--- a/aos/seasocks/BUILD
+++ b/aos/seasocks/BUILD
@@ -3,6 +3,7 @@
     srcs = [
         "gen_embedded.py",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -10,6 +11,7 @@
     name = "seasocks_logger",
     srcs = ["seasocks_logger.cc"],
     hdrs = ["seasocks_logger.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos/logging",
diff --git a/aos/seasocks/gen_embedded.bzl b/aos/seasocks/gen_embedded.bzl
index bb27e52..7d67249 100644
--- a/aos/seasocks/gen_embedded.bzl
+++ b/aos/seasocks/gen_embedded.bzl
@@ -41,11 +41,12 @@
   srcs: Files to allow loading.
 """
 
-def gen_embedded(name, srcs, visibility = None):
+def gen_embedded(name, srcs, visibility = None, target_compatible_with = None):
     _do_gen_embedded(
         name = name + "__do_gen",
         visibility = ["//visibility:private"],
         srcs = srcs,
+        target_compatible_with = target_compatible_with,
     )
     native.cc_library(
         name = name,
@@ -57,4 +58,5 @@
         deps = [
             "@//third_party/seasocks",
         ],
+        target_compatible_with = target_compatible_with,
     )
diff --git a/aos/starter/BUILD b/aos/starter/BUILD
index 401d421..52fd62a 100644
--- a/aos/starter/BUILD
+++ b/aos/starter/BUILD
@@ -15,6 +15,7 @@
     srcs = [
         "starter.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos:init",
         "//aos:unique_malloc_ptr",
@@ -33,6 +34,7 @@
     name = "starterd_lib",
     srcs = ["starterd_lib.cc"],
     hdrs = ["starterd_lib.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":starter_fbs",
         ":starter_rpc_fbs",
@@ -51,6 +53,7 @@
         "//aos/events:pingpong_config",
         "//aos/events:pong",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":starter_rpc_lib",
         ":starterd_lib",
@@ -64,6 +67,7 @@
 cc_binary(
     name = "starterd",
     srcs = ["starterd.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":starterd_lib",
         "//aos:init",
@@ -74,6 +78,7 @@
     name = "starter_rpc_lib",
     srcs = ["starter_rpc_lib.cc"],
     hdrs = ["starter_rpc_lib.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":starter_fbs",
         ":starter_rpc_fbs",
@@ -86,6 +91,7 @@
 cc_binary(
     name = "starter_cmd",
     srcs = ["starter_cmd.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":starter_rpc_lib",
         "@com_github_google_glog//:glog",
@@ -96,6 +102,7 @@
     name = "starter_fbs",
     srcs = ["starter.fbs"],
     gen_reflections = True,
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -103,5 +110,6 @@
     name = "starter_rpc_fbs",
     srcs = ["starter_rpc.fbs"],
     gen_reflections = True,
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/aos/stl_mutex/BUILD b/aos/stl_mutex/BUILD
index 51229d4..bc1e428 100644
--- a/aos/stl_mutex/BUILD
+++ b/aos/stl_mutex/BUILD
@@ -5,6 +5,7 @@
     hdrs = [
         "stl_mutex.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/ipc_lib:aos_sync",
         "@com_github_google_glog//:glog",
@@ -16,6 +17,7 @@
     srcs = [
         "stl_mutex_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":stl_mutex",
         "//aos:die",
diff --git a/aos/testdata/BUILD b/aos/testdata/BUILD
index 816ad7e..2971664 100644
--- a/aos/testdata/BUILD
+++ b/aos/testdata/BUILD
@@ -35,21 +35,25 @@
     "empty.json"
   ]
 }""" + "'> $@",
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 aos_config(
     name = "empty_config",
     src = "empty.json",
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 aos_config(
     name = "generated_config",
     src = "generated.json",
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":empty_config"],
 )
 
 aos_config(
     name = "generated_config_flattener_test",
     src = "generated_config_test.json",
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":generated_config"],
 )
diff --git a/aos/testing/BUILD b/aos/testing/BUILD
index 4b2631a..116acc0 100644
--- a/aos/testing/BUILD
+++ b/aos/testing/BUILD
@@ -4,6 +4,7 @@
     srcs = [
         "gtest_main.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos:init",
@@ -22,6 +23,7 @@
     hdrs = [
         "test_logging.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":googletest",
@@ -37,6 +39,7 @@
     srcs = [
         "test_logging_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":googletest",
         ":test_logging",
@@ -53,6 +56,7 @@
     hdrs = [
         "prevent_exit.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "@com_github_google_glog//:glog",
@@ -68,6 +72,7 @@
     hdrs = [
         "test_shm.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":test_logging",
@@ -85,6 +90,7 @@
     hdrs = [
         "random_seed.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -93,5 +99,6 @@
     testonly = True,
     srcs = ["tmpdir.cc"],
     hdrs = ["tmpdir.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/aos/time/BUILD b/aos/time/BUILD
index c9f8d6d..c0bd99d 100644
--- a/aos/time/BUILD
+++ b/aos/time/BUILD
@@ -1,5 +1,3 @@
-load("//tools:environments.bzl", "mcu_cpus")
-
 cc_library(
     name = "time",
     srcs = [
@@ -9,25 +7,10 @@
         "time.h",
     ],
     visibility = ["//visibility:public"],
-    deps = [
-        "@com_github_google_glog//:glog",
-    ],
-)
-
-# TODO(Brian): Remove this hack once bazel chases deps through selects correctly.
-cc_library(
-    name = "time_mcu",
-    srcs = [
-        "time.cc",
-    ],
-    hdrs = [
-        "time.h",
-    ],
-    restricted_to = mcu_cpus,
-    visibility = ["//visibility:public"],
-    deps = [
-        "//motors/core",
-    ],
+    deps = select({
+        "@platforms//os:linux": ["@com_github_google_glog//:glog"],
+        "//conditions:default": ["//motors/core"],
+    }),
 )
 
 cc_test(
@@ -35,6 +18,7 @@
     srcs = [
         "time_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":time",
         "//aos/logging",
diff --git a/aos/type_traits/BUILD b/aos/type_traits/BUILD
index e5590b0..ce517b3 100644
--- a/aos/type_traits/BUILD
+++ b/aos/type_traits/BUILD
@@ -1,13 +1,10 @@
 package(default_visibility = ["//visibility:public"])
 
-load("//tools:environments.bzl", "mcu_cpus")
-
 cc_library(
     name = "type_traits",
     hdrs = [
         "type_traits.h",
     ],
-    compatible_with = mcu_cpus,
 )
 
 cc_test(
@@ -15,6 +12,7 @@
     srcs = [
         "type_traits_test.cpp",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":type_traits",
         "//aos/testing:googletest",
diff --git a/aos/util/BUILD b/aos/util/BUILD
index 01be701..f0a65d9 100644
--- a/aos/util/BUILD
+++ b/aos/util/BUILD
@@ -1,13 +1,10 @@
 package(default_visibility = ["//visibility:public"])
 
-load("//tools:environments.bzl", "mcu_cpus")
-
 cc_library(
     name = "bitpacking",
     hdrs = [
         "bitpacking.h",
     ],
-    compatible_with = mcu_cpus,
     visibility = ["//visibility:public"],
     deps = [
         "//third_party/GSL",
@@ -19,6 +16,7 @@
     srcs = [
         "bitpacking_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":bitpacking",
         "//aos/testing:googletest",
@@ -30,6 +28,7 @@
     srcs = [
         "trapezoid_profile.py",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":python_init",
     ],
@@ -43,6 +42,7 @@
     hdrs = [
         "run_command.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/logging",
     ],
@@ -53,6 +53,7 @@
     srcs = [
         "run_command_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":run_command",
         "//aos/logging",
@@ -63,6 +64,7 @@
 cc_library(
     name = "math",
     hdrs = ["math.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "@org_tuxfamily_eigen//:eigen",
     ],
@@ -71,6 +73,7 @@
 cc_test(
     name = "math_test",
     srcs = ["math_test.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":math",
         "//aos/testing:googletest",
@@ -82,6 +85,7 @@
     hdrs = [
         "death_test_log_implementation.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/logging:implementations",
     ],
@@ -95,6 +99,7 @@
     hdrs = [
         "inet_addr.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos:byteorder",
         "//aos:network_port",
@@ -109,6 +114,7 @@
     hdrs = [
         "phased_loop.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/time",
         "@com_github_google_glog//:glog",
@@ -120,6 +126,7 @@
     hdrs = [
         "log_interval.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/logging",
         "//aos/time",
@@ -131,6 +138,7 @@
     hdrs = [
         "string_to_num.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_test(
@@ -138,6 +146,7 @@
     srcs = [
         "string_to_num_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":string_to_num",
         "//aos/testing:googletest",
@@ -155,6 +164,7 @@
     linkopts = [
         "-lm",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/logging",
         "//aos/time",
@@ -167,6 +177,7 @@
     srcs = [
         "trapezoid_profile_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":trapezoid_profile",
         "//aos/testing:googletest",
@@ -181,6 +192,7 @@
     hdrs = [
         "wrapping_counter.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_test(
@@ -188,6 +200,7 @@
     srcs = [
         "wrapping_counter_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":wrapping_counter",
         "//aos/testing:googletest",
@@ -199,6 +212,7 @@
     hdrs = [
         "options.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_test(
@@ -206,6 +220,7 @@
     srcs = [
         "options_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":options",
         "//aos/testing:googletest",
@@ -217,6 +232,7 @@
     hdrs = [
         "compiler_memory_barrier.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_library(
@@ -224,6 +240,7 @@
     hdrs = [
         "global_factory.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_test(
@@ -231,6 +248,7 @@
     srcs = [
         "global_factory_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":global_factory",
         "//aos/testing:googletest",
@@ -242,6 +260,7 @@
     srcs = [
         "phased_loop_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":phased_loop",
         "//aos/testing:googletest",
@@ -257,6 +276,7 @@
     hdrs = [
         "file.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/scoped:scoped_fd",
         "@com_github_google_glog//:glog",
@@ -270,6 +290,7 @@
     srcs = [
         "file_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":file",
         "//aos/testing:googletest",
@@ -279,6 +300,7 @@
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = ["//aos:python_init"],
 )
diff --git a/aos/vision/blob/BUILD b/aos/vision/blob/BUILD
index e025ed3..2efd99e 100644
--- a/aos/vision/blob/BUILD
+++ b/aos/vision/blob/BUILD
@@ -1,4 +1,5 @@
-load("//tools/build_rules:gtk_dependent.bzl", "gtk_dependent_cc_binary", "gtk_dependent_cc_library")
+load("//tools:platforms.bzl", "platforms")
+load("//tools/build_rules:gtk_dependent.bzl", "gtk_dependent_cc_library")
 
 package(default_visibility = ["//visibility:public"])
 
@@ -6,6 +7,7 @@
     name = "range_image",
     srcs = ["range_image.cc"],
     hdrs = ["range_image.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/vision/debug:overlay",
         "//aos/vision/image:image_types",
@@ -18,12 +20,14 @@
 cc_library(
     name = "region_alloc",
     hdrs = ["region_alloc.h"],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_library(
     name = "contour",
     srcs = ["contour.cc"],
     hdrs = ["contour.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":range_image",
         ":region_alloc",
@@ -40,6 +44,7 @@
     hdrs = [
         "threshold.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":range_image",
         "//aos/logging",
@@ -52,6 +57,7 @@
     srcs = [
         "threshold_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":range_image",
         ":threshold",
@@ -64,10 +70,10 @@
     name = "hierarchical_contour_merge",
     srcs = ["hierarchical_contour_merge.cc"],
     hdrs = ["hierarchical_contour_merge.h"],
-    restricted_to = [
-        "//tools:k8",
-        "//tools:armhf-debian",
-    ],
+    target_compatible_with = platforms.any_of([
+        "@platforms//cpu:x86_64",
+        "//tools/platforms/hardware:raspberry_pi",
+    ]),
     deps = [
         ":contour",
         ":disjoint_set",
@@ -79,12 +85,14 @@
 cc_library(
     name = "disjoint_set",
     hdrs = ["disjoint_set.h"],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_library(
     name = "find_blob",
     srcs = ["find_blob.cc"],
     hdrs = ["find_blob.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":disjoint_set",
         ":range_image",
@@ -98,6 +106,7 @@
     name = "codec",
     srcs = ["codec.cc"],
     hdrs = ["codec.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":range_image",
         "//aos/vision/debug:overlay",
@@ -109,6 +118,7 @@
 cc_test(
     name = "codec_test",
     srcs = ["codec_test.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":codec",
         "//aos/testing:googletest",
@@ -119,6 +129,7 @@
     name = "move_scale",
     srcs = ["move_scale.cc"],
     hdrs = ["move_scale.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":range_image",
         "//aos/vision/image:image_types",
@@ -129,6 +140,7 @@
     name = "test_utils",
     srcs = ["test_utils.cc"],
     hdrs = ["test_utils.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":range_image",
     ],
@@ -138,6 +150,7 @@
     name = "transpose",
     srcs = ["transpose.cc"],
     hdrs = ["transpose.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":range_image",
     ],
@@ -146,6 +159,7 @@
 cc_test(
     name = "transpose_test",
     srcs = ["transpose_test.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":test_utils",
         ":transpose",
@@ -156,6 +170,7 @@
 gtk_dependent_cc_library(
     name = "stream_view",
     hdrs = ["stream_view.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":range_image",
         "//aos/vision/debug:debug_window",
diff --git a/aos/vision/debug/BUILD b/aos/vision/debug/BUILD
index 05d93ad..08d549e 100644
--- a/aos/vision/debug/BUILD
+++ b/aos/vision/debug/BUILD
@@ -1,10 +1,11 @@
-load("//tools/build_rules:gtk_dependent.bzl", "gtk_dependent_cc_binary", "gtk_dependent_cc_library")
+load("//tools/build_rules:gtk_dependent.bzl", "gtk_dependent_cc_library")
 
 package(default_visibility = ["//visibility:public"])
 
 cc_library(
     name = "overlay",
     hdrs = ["overlay.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/vision/image:image_types",
         "//aos/vision/math:segment",
@@ -16,6 +17,7 @@
     name = "debug_window",
     srcs = ["debug_window.cc"],
     hdrs = ["debug_window.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":overlay",
         "//aos/vision/image:image_types",
@@ -34,6 +36,7 @@
         "tcp-source.cc",
     ],
     hdrs = ["debug_framework.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/logging",
         "//aos/logging:implementations",
diff --git a/aos/vision/download/BUILD b/aos/vision/download/BUILD
index f22c18b..1352713 100644
--- a/aos/vision/download/BUILD
+++ b/aos/vision/download/BUILD
@@ -3,5 +3,6 @@
     srcs = [
         "downloader.py",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/aos/vision/events/BUILD b/aos/vision/events/BUILD
index a991968..c722acc 100644
--- a/aos/vision/events/BUILD
+++ b/aos/vision/events/BUILD
@@ -1,4 +1,4 @@
-load("//tools/build_rules:gtk_dependent.bzl", "gtk_dependent_cc_binary", "gtk_dependent_cc_library")
+load("//tools/build_rules:gtk_dependent.bzl", "gtk_dependent_cc_library")
 
 package(default_visibility = ["//visibility:public"])
 
@@ -6,6 +6,7 @@
     name = "epoll_events",
     srcs = ["epoll_events.cc"],
     hdrs = ["epoll_events.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/logging",
         "//aos/scoped:scoped_fd",
@@ -16,6 +17,7 @@
 cc_library(
     name = "socket_types",
     hdrs = ["socket_types.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/vision/events:tcp_server",
         "//aos/vision/image:image_types",
@@ -26,12 +28,14 @@
 cc_library(
     name = "intrusive_free_list",
     hdrs = ["intrusive_free_list.h"],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_library(
     name = "tcp_server",
     srcs = ["tcp_server.cc"],
     hdrs = ["tcp_server.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":epoll_events",
         ":intrusive_free_list",
@@ -42,6 +46,7 @@
     name = "tcp_client",
     srcs = ["tcp_client.cc"],
     hdrs = ["tcp_client.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":epoll_events"],
 )
 
@@ -49,6 +54,7 @@
     name = "udp",
     srcs = ["udp.cc"],
     hdrs = ["udp.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos:macros",
         "//aos/scoped:scoped_fd",
@@ -59,6 +65,7 @@
 cc_test(
     name = "udp_test",
     srcs = ["udp_test.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":udp",
         "//aos/testing:googletest",
@@ -68,6 +75,7 @@
 gtk_dependent_cc_library(
     name = "gtk_event",
     srcs = ["gtk_event.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":epoll_events",
         "//aos/logging",
diff --git a/aos/vision/image/BUILD b/aos/vision/image/BUILD
index 9b6d30a..054b262 100644
--- a/aos/vision/image/BUILD
+++ b/aos/vision/image/BUILD
@@ -5,6 +5,7 @@
 cc_library(
     name = "image_types",
     hdrs = ["image_types.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "@com_google_absl//absl/strings",
     ],
@@ -13,6 +14,7 @@
 cc_proto_library(
     name = "camera_params",
     srcs = ["camera_params.proto"],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_library(
@@ -22,6 +24,7 @@
         "V4L2.h",
         "reader.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":camera_params",
         ":image_types",
@@ -34,6 +37,7 @@
     name = "jpeg_routines",
     srcs = ["jpeg_routines.cc"],
     hdrs = ["jpeg_routines.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":image_types",
         "//aos/logging",
@@ -45,6 +49,7 @@
     name = "image_dataset",
     srcs = ["image_dataset.cc"],
     hdrs = ["image_dataset.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":image_types",
     ],
@@ -54,6 +59,7 @@
     name = "image_stream",
     srcs = ["image_stream.cc"],
     hdrs = ["image_stream.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/logging",
         "//aos/vision/events:epoll_events",
diff --git a/aos/vision/math/BUILD b/aos/vision/math/BUILD
index 2c71e8f..fd7d876 100644
--- a/aos/vision/math/BUILD
+++ b/aos/vision/math/BUILD
@@ -3,6 +3,7 @@
 cc_library(
     name = "segment",
     hdrs = ["segment.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":vector"],
 )
 
@@ -11,6 +12,7 @@
     hdrs = [
         "vector.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "@org_tuxfamily_eigen//:eigen",
     ],
@@ -22,6 +24,7 @@
     srcs = [
         "vector_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":vector",
         "//aos/testing:googletest",
diff --git a/aos/vision/tools/BUILD b/aos/vision/tools/BUILD
index 2ef3244..4be7fd7 100644
--- a/aos/vision/tools/BUILD
+++ b/aos/vision/tools/BUILD
@@ -3,6 +3,7 @@
 gtk_dependent_cc_binary(
     name = "jpeg_vision_test",
     srcs = ["jpeg_vision_test.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/logging",
         "//aos/logging:implementations",
@@ -22,6 +23,7 @@
 cc_binary(
     name = "camera_primer",
     srcs = ["camera_primer.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/logging",
         "//aos/logging:implementations",
diff --git a/build_tests/BUILD b/build_tests/BUILD
index 950b2f5..0766256 100644
--- a/build_tests/BUILD
+++ b/build_tests/BUILD
@@ -7,6 +7,7 @@
     srcs = [
         "gflags.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "@com_github_gflags_gflags//:gflags",
     ],
@@ -17,6 +18,7 @@
     srcs = [
         "tcmalloc.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 sh_test(
@@ -28,11 +30,13 @@
     data = [
         ":tcmalloc_build_test_binary",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_proto_library(
     name = "proto_build_test_library",
     srcs = ["proto.proto"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":proto_build_test_library_base",
         "@com_google_protobuf//:cc_wkt_protos",
@@ -42,6 +46,7 @@
 cc_proto_library(
     name = "proto_build_test_library_base",
     srcs = ["proto_base.proto"],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_test(
@@ -50,6 +55,7 @@
     srcs = [
         "proto.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":proto_build_test_library",
         "//aos/testing:googletest",
@@ -64,21 +70,24 @@
         "Foo",
         "Bar",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
 py_test(
     name = "python_fbs",
     srcs = ["python_fbs.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":test_python_fbs"],
 )
 
 py_test(
     name = "python3_opencv",
     srcs = ["python_opencv.py"],
-    python_version = "PY3",
     main = "python_opencv.py",
+    python_version = "PY3",
     srcs_version = "PY2AND3",
+    target_compatible_with = ["@platforms//os:linux"],
     deps = ["@opencv_contrib_nonfree_amd64//:python_opencv"],
 )
 
@@ -86,5 +95,6 @@
     name = "python_jinja2",
     srcs = ["python_jinja2.py"],
     srcs_version = "PY2AND3",
+    target_compatible_with = ["@platforms//os:linux"],
     deps = ["@python_jinja2"],
 )
diff --git a/debian/BUILD b/debian/BUILD
index b893511..348163e 100644
--- a/debian/BUILD
+++ b/debian/BUILD
@@ -115,9 +115,10 @@
     srcs = [
         "download_packages.py",
     ],
-    python_version = "PY3",
     main = "download_packages.py",
+    python_version = "PY3",
     srcs_version = "PY2AND3",
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 download_packages(
@@ -134,6 +135,7 @@
         "python3-numpy",
         "python3-scipy",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 download_packages(
@@ -152,6 +154,7 @@
         "gcc",
         "gfortran",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 download_packages(
@@ -159,6 +162,7 @@
     packages = [
         "patch",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 download_packages(
@@ -166,6 +170,7 @@
     packages = [
         "pandoc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 download_packages(
@@ -176,6 +181,7 @@
         "libusb-1.0-0-dev",
         "libusb-dev",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 download_packages(
@@ -183,6 +189,7 @@
     packages = [
         "g++-mingw-w64-x86-64",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 download_packages(
@@ -190,6 +197,7 @@
     packages = [
         "patchelf",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 download_packages(
@@ -212,6 +220,7 @@
         "python3-matplotlib",
         "python3-tk",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 # This list was obtained by manually looking at the output from:
@@ -229,6 +238,7 @@
         "libtinfo5",
         "zlib1g",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 download_packages(
@@ -251,6 +261,7 @@
         "python3-gi-cairo",
         "python3-shapely",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 download_packages(
@@ -258,66 +269,79 @@
     packages = [
         "m4",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 generate_deb_tarball(
     name = "python",
     files = python_debs,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 generate_deb_tarball(
     name = "clang_6p0",
     files = clang_debs,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 generate_deb_tarball(
     name = "patch",
     files = patch_debs,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 generate_deb_tarball(
     name = "rsync",
     files = rsync_debs,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 generate_deb_tarball(
     name = "ssh_v3",
     files = ssh_debs,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 generate_deb_tarball(
     name = "pandoc",
     files = pandoc_debs,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 generate_deb_tarball(
     name = "libusb",
     files = libusb_debs,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 generate_deb_tarball(
     name = "mingw_compiler",
     files = mingw_compiler_debs,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 generate_deb_tarball(
     name = "patchelf",
     files = patchelf_debs,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 generate_deb_tarball(
     name = "matplotlib",
     files = matplotlib_debs,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 generate_deb_tarball(
     name = "arm_frc_gnueabi_deps",
     files = arm_frc_gnueabi_deps_debs,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 generate_deb_tarball(
     name = "python_gtk",
     files = python_gtk_debs,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 # Starting point for opencv package list below.
@@ -363,6 +387,7 @@
         "libopencv-viz-dev",
         "libopencv-viz3.2",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 # This list was generated with download_packages.py on armhf and then
@@ -370,27 +395,32 @@
 generate_deb_tarball(
     name = "opencv_armhf_v3",
     files = opencv_armhf_debs,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 # This was hand-written based on opencv_armhf.bzl.
 generate_deb_tarball(
     name = "opencv_amd64",
     files = opencv_amd64_debs,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 generate_deb_tarball(
     name = "gstreamer_amd64",
     files = gstreamer_amd64_debs,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 generate_deb_tarball(
     name = "gstreamer_armhf",
     files = gstreamer_armhf_debs,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 generate_deb_tarball(
     name = "m4",
     files = m4_debs,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 download_packages(
@@ -398,16 +428,19 @@
     packages = [
         "liblzma-dev",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 generate_deb_tarball(
     name = "lzma_amd64",
     files = lzma_amd64_debs,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 generate_deb_tarball(
     name = "lzma_arm64",
     files = lzma_arm64_debs,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 exports_files([
diff --git a/debian/libusb.BUILD b/debian/libusb.BUILD
index 7c41058..ea82ce4 100644
--- a/debian/libusb.BUILD
+++ b/debian/libusb.BUILD
@@ -23,6 +23,6 @@
     includes = [
         "usr/include",
     ],
-    restricted_to = ["@//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     visibility = ["//visibility:public"],
 )
diff --git a/debian/matplotlib.bzl b/debian/matplotlib.bzl
index 7032745..e647682 100644
--- a/debian/matplotlib.bzl
+++ b/debian/matplotlib.bzl
@@ -240,6 +240,6 @@
             ":usr/share/matplotlib/mpl-data/matplotlibrc",
         ] + native.glob(["etc/**"]),
         imports = ["usr/lib/python" + version + "/dist-packages", version, "."],
-        restricted_to = ["@//tools:k8"],
+        target_compatible_with = ["@platforms//cpu:x86_64"],
         visibility = ["//visibility:public"],
     )
diff --git a/debian/ni-libraries-2018.BUILD b/debian/ni-libraries-2018.BUILD
index ca17626..6f703ff 100644
--- a/debian/ni-libraries-2018.BUILD
+++ b/debian/ni-libraries-2018.BUILD
@@ -14,6 +14,6 @@
         "include",
     ],
     linkstatic = True,
-    restricted_to = ["@//tools:roborio"],
+    target_compatible_with = ["@//tools/platforms/hardware:roborio"],
     visibility = ["//visibility:public"],
 )
diff --git a/debian/ni-libraries.BUILD b/debian/ni-libraries.BUILD
index 9661248..78252a6 100644
--- a/debian/ni-libraries.BUILD
+++ b/debian/ni-libraries.BUILD
@@ -18,6 +18,6 @@
     ],
     linkopts = ["-ldl"],
     linkstatic = True,
-    restricted_to = ["@//tools:roborio"],
+    target_compatible_with = ["@//tools/platforms/hardware:roborio"],
     visibility = ["//visibility:public"],
 )
diff --git a/debian/packages.bzl b/debian/packages.bzl
index 987f77f..2914388 100644
--- a/debian/packages.bzl
+++ b/debian/packages.bzl
@@ -24,7 +24,7 @@
 
 # TODO(phil): Deal with armhf packages. Right now only works for amd64.
 
-def download_packages(name, packages, excludes = [], force_includes = []):
+def download_packages(name, packages, excludes = [], force_includes = [], target_compatible_with = None):
     """Downloads a set of packages as well as their dependencies.
 
     You can also specify excludes in case some of the dependencies are meta
@@ -52,6 +52,7 @@
         # would like it to.
         cmd = "$(location //debian:download_packages) %s %s %s | tee $@ >&2" %
               (force_includes, excludes_list, package_list),
+        target_compatible_with = target_compatible_with,
     )
 
 def _convert_deb_to_target(deb):
@@ -80,7 +81,7 @@
                 downloaded_file_path = f,
             )
 
-def generate_deb_tarball(name, files):
+def generate_deb_tarball(name, files, target_compatible_with = None):
     """Takes all debs in the dictionary and generates one tarball from them.
 
     This can then be uploaded and used as another WORKSPACE entry.
@@ -95,10 +96,12 @@
                 srcs = ["@%s//file" % dep],
                 outs = ["extracted_%s.tar" % dep],
                 cmd = "dpkg-deb --fsys-tarfile $(SRCS) > $@",
+                target_compatible_with = target_compatible_with,
             )
 
     pkg_tar(
         name = name,
         extension = "tar.gz",
         deps = ["extracted_%s.tar" % dep for dep in deps],
+        target_compatible_with = target_compatible_with,
     )
diff --git a/debian/python_gtk.BUILD b/debian/python_gtk.BUILD
index e1cdc99..48b924d 100644
--- a/debian/python_gtk.BUILD
+++ b/debian/python_gtk.BUILD
@@ -162,6 +162,6 @@
         "rpathed/usr/lib/x86_64-linux-gnu/libgeos_c.so",
     ],
     imports = ["usr/lib/python3/dist-packages"],
-    restricted_to = ["@//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     visibility = ["//visibility:public"],
 )
diff --git a/debian/slycot.BUILD b/debian/slycot.BUILD
index a384ebd..9ef3055 100644
--- a/debian/slycot.BUILD
+++ b/debian/slycot.BUILD
@@ -14,7 +14,7 @@
     srcs = ["slycot/src/_wrapper.pyf"],
     outs = ["slycot/src/_fortranwrapper.pyf"],
     cmd = "cat $(SRCS) | sed 's/_wrapper/_fortranwrapper/' > $(OUTS)",
-    restricted_to = ["@//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
 )
 
 # The contents of the file telling f2py how to translate various types. The
@@ -60,7 +60,7 @@
             "-i $(OUTS)",
         ]),
     ]),
-    restricted_to = ["@//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     tools = [
         "@python_repo//:f2py",
     ],
@@ -81,7 +81,7 @@
         "-Wno-unused-function",
         "-Wno-unused-but-set-variable",
     ],
-    restricted_to = ["@//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":slicot",
         "@python_repo//:python2.7_f2py",
@@ -97,7 +97,7 @@
     name = "slycot/_fortranwrapper.so",
     linkshared = True,
     linkstatic = True,
-    restricted_to = ["@//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":slicot",
         ":slycot_c",
@@ -128,7 +128,7 @@
         ":slycot/_fortranwrapper.so",
     ],
     imports = ["."],
-    restricted_to = ["@//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     visibility = ["//visibility:public"],
 )
 
diff --git a/documentation/BUILD b/documentation/BUILD
index 569ce64..5099a7d 100644
--- a/documentation/BUILD
+++ b/documentation/BUILD
@@ -3,4 +3,5 @@
 pandoc_html(
     name = "index",
     src = "README.md",
+    target_compatible_with = ["@platforms//os:linux"],
 )
diff --git a/documentation/tutorials/BUILD b/documentation/tutorials/BUILD
index 5816444..d94d255 100644
--- a/documentation/tutorials/BUILD
+++ b/documentation/tutorials/BUILD
@@ -14,4 +14,5 @@
 [pandoc_html(
     name = article_name,
     src = article_name + ".md",
+    target_compatible_with = ["@platforms//os:linux"],
 ) for article_name in articles]
diff --git a/documentation/tutorials/download-code-to-the-robot.md b/documentation/tutorials/download-code-to-the-robot.md
index 4f667cc..c73e3db 100644
--- a/documentation/tutorials/download-code-to-the-robot.md
+++ b/documentation/tutorials/download-code-to-the-robot.md
@@ -20,7 +20,7 @@
 
 2. Download the code
 ```console
-bazel run --cpu=roborio --compilation_mode=opt //y2018:download -- admin@roboRIO-971-frc.local
+bazel run --config=roborio --compilation_mode=opt //y2018:download -- admin@roboRIO-971-frc.local
 ```
 
 3. TODO: How to run the code using the driver station.
diff --git a/frc971/BUILD b/frc971/BUILD
index 563f05e..d6a3af8 100644
--- a/frc971/BUILD
+++ b/frc971/BUILD
@@ -1,13 +1,10 @@
 package(default_visibility = ["//visibility:public"])
 
-load("//tools:environments.bzl", "mcu_cpus")
-
 cc_library(
     name = "shifter_hall_effect",
     hdrs = [
         "shifter_hall_effect.h",
     ],
-    compatible_with = mcu_cpus,
 )
 
 cc_library(
@@ -15,10 +12,12 @@
     hdrs = [
         "constants.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/frc971/analysis/BUILD b/frc971/analysis/BUILD
index 2686bcd..61355b0 100644
--- a/frc971/analysis/BUILD
+++ b/frc971/analysis/BUILD
@@ -11,7 +11,7 @@
         "plotter.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":python_init",
         "@matplotlib_repo//:matplotlib2.7",
@@ -21,6 +21,7 @@
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = ["//frc971:python_init"],
 )
 
@@ -28,7 +29,7 @@
     name = "py_log_reader.so",
     srcs = ["py_log_reader.cc"],
     linkshared = True,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos:configuration",
         "//aos:json_to_flatbuffer",
@@ -47,13 +48,14 @@
         ":py_log_reader.so",
         "@sample_logfile//file",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = ["//aos:configuration_fbs_python"],
 )
 
 py_proto_library(
     name = "plot_config_proto",
     srcs = ["plot_config.proto"],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 py_binary(
@@ -62,7 +64,7 @@
     data = [
         ":py_log_reader.so",
     ] + glob(["plot_configs/**"]),
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":plot_config_proto",
         ":python_init",
@@ -76,6 +78,6 @@
     data = [
         "@sample_logfile//file",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":plot"],
 )
diff --git a/frc971/autonomous/BUILD b/frc971/autonomous/BUILD
index 12698a9..414f817 100644
--- a/frc971/autonomous/BUILD
+++ b/frc971/autonomous/BUILD
@@ -7,6 +7,7 @@
     name = "auto_fbs",
     srcs = ["auto.fbs"],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -14,6 +15,7 @@
     name = "auto_mode_fbs",
     srcs = ["auto_mode.fbs"],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -25,6 +27,7 @@
     hdrs = [
         "base_autonomous_actor.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":auto_fbs",
         "//aos/actions:action_lib",
@@ -47,5 +50,6 @@
         ":auto_fbs",
         ":auto_mode_fbs",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/frc971/codelab/BUILD b/frc971/codelab/BUILD
index ddc5466..c50a2c1 100644
--- a/frc971/codelab/BUILD
+++ b/frc971/codelab/BUILD
@@ -8,6 +8,7 @@
     testonly = 1,
     srcs = ["basic_test.cc"],
     data = [":config"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":basic",
         ":basic_goal_fbs",
@@ -26,6 +27,7 @@
     name = "basic",
     srcs = ["basic.cc"],
     hdrs = ["basic.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":basic_goal_fbs",
         ":basic_output_fbs",
@@ -41,6 +43,7 @@
         "basic_goal.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -49,6 +52,7 @@
         "basic_output.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -57,6 +61,7 @@
         "basic_status.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -65,6 +70,7 @@
         "basic_position.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 aos_config(
@@ -76,6 +82,7 @@
         ":basic_status_fbs",
         ":basic_output_fbs",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/robot_state:config",
     ],
diff --git a/frc971/config/BUILD b/frc971/config/BUILD
index 098d1f8..dbb81b9 100644
--- a/frc971/config/BUILD
+++ b/frc971/config/BUILD
@@ -11,5 +11,6 @@
         ":sctp.ko",
         "@arm_frc_linux_gnueabi_repo//:compiler_pieces",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/frc971/control_loops/BUILD b/frc971/control_loops/BUILD
index 7d3b915..1945db9 100644
--- a/frc971/control_loops/BUILD
+++ b/frc971/control_loops/BUILD
@@ -1,7 +1,6 @@
 package(default_visibility = ["//visibility:public"])
 
 load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
-load("//tools:environments.bzl", "mcu_cpus")
 
 cc_library(
     name = "team_number_test_environment",
@@ -12,6 +11,7 @@
     hdrs = [
         "team_number_test_environment.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/network:team_number",
         "//aos/testing:googletest",
@@ -23,6 +23,7 @@
     srcs = [
         "hybrid_state_feedback_loop_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":hybrid_state_feedback_loop",
         "//aos/testing:googletest",
@@ -32,6 +33,7 @@
 cc_library(
     name = "pose",
     hdrs = ["pose.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/util:math",
         "@org_tuxfamily_eigen//:eigen",
@@ -41,6 +43,7 @@
 cc_test(
     name = "pose_test",
     srcs = ["pose_test.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":pose",
         "//aos/testing:googletest",
@@ -52,6 +55,7 @@
     hdrs = [
         "hall_effect_tracker.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":control_loops_fbs",
     ],
@@ -62,7 +66,6 @@
     srcs = [
         "control_loops.fbs",
     ],
-    compatible_with = mcu_cpus,
 )
 
 cc_test(
@@ -70,6 +73,7 @@
     srcs = [
         "position_sensor_sim_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":control_loops_fbs",
         ":position_sensor_sim",
@@ -90,6 +94,7 @@
     linkopts = [
         "-lm",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":control_loops_fbs",
         ":gaussian_noise",
@@ -108,21 +113,7 @@
     linkopts = [
         "-lm",
     ],
-)
-
-cc_library(
-    name = "coerce_goal_uc",
-    srcs = [
-        "coerce_goal.cc",
-    ],
-    hdrs = [
-        "coerce_goal.h",
-    ],
-    restricted_to = mcu_cpus,
-    deps = [
-        "//aos/controls:polytope_uc",
-        "@org_tuxfamily_eigen//:eigen",
-    ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_library(
@@ -133,9 +124,10 @@
     hdrs = [
         "coerce_goal.h",
     ],
-    linkopts = [
-        "-lm",
-    ],
+    linkopts = select({
+        "@platforms//os:linux": ["-lm"],
+        "//conditions:default": [],
+    }),
     deps = [
         "//aos/controls:polytope",
         "@org_tuxfamily_eigen//:eigen",
@@ -150,6 +142,7 @@
     linkopts = [
         "-lm",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":coerce_goal",
         "//aos/controls:polytope",
@@ -158,20 +151,6 @@
     ],
 )
 
-# TODO(austin): Select isn't working right.  We should be able to remove
-# logging conditionally with select and have CPU constraints work correctly.
-cc_library(
-    name = "state_feedback_loop_uc",
-    hdrs = [
-        "state_feedback_loop.h",
-    ],
-    restricted_to = mcu_cpus,
-    deps = [
-        "//aos:macros",
-        "@org_tuxfamily_eigen//:eigen",
-    ],
-)
-
 cc_library(
     name = "state_feedback_loop",
     hdrs = [
@@ -179,9 +158,11 @@
     ],
     deps = [
         "//aos:macros",
-        "//aos/logging",
         "@org_tuxfamily_eigen//:eigen",
-    ],
+    ] + select({
+        "@platforms//os:linux": ["//aos/logging"],
+        "//conditions:default": [],
+    }),
 )
 
 cc_library(
@@ -189,6 +170,7 @@
     hdrs = [
         "hybrid_state_feedback_loop.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":c2d",
         ":state_feedback_loop",
@@ -204,6 +186,7 @@
     hdrs = [
         "simple_capped_state_feedback_loop.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":state_feedback_loop",
         "@org_tuxfamily_eigen//:eigen",
@@ -215,6 +198,7 @@
     hdrs = [
         "runge_kutta.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "@org_tuxfamily_eigen//:eigen",
     ],
@@ -225,6 +209,7 @@
     srcs = [
         "runge_kutta_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":runge_kutta",
         "//aos/testing:googletest",
@@ -237,6 +222,7 @@
     hdrs = [
         "fixed_quadrature.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_test(
@@ -244,6 +230,7 @@
     srcs = [
         "fixed_quadrature_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":fixed_quadrature",
         "//aos/testing:googletest",
@@ -258,6 +245,7 @@
     includes = [
         ":control_loops_fbs_includes",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_library(
@@ -268,6 +256,7 @@
     hdrs = [
         "profiled_subsystem.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":control_loops_fbs",
         ":profiled_subsystem_fbs",
@@ -284,6 +273,7 @@
     hdrs = [
         "jacobian.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "@org_tuxfamily_eigen//:eigen",
     ],
@@ -294,6 +284,7 @@
     srcs = [
         "jacobian_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":jacobian",
         "//aos/testing:googletest",
@@ -306,6 +297,7 @@
     srcs = [
         "c2d_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":c2d",
@@ -319,6 +311,7 @@
     hdrs = [
         "c2d.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos/time",
@@ -331,6 +324,7 @@
     hdrs = [
         "dlqr.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "@org_tuxfamily_eigen//:eigen",
@@ -341,6 +335,7 @@
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = ["//frc971:python_init"],
 )
@@ -348,6 +343,7 @@
 cc_library(
     name = "binomial",
     hdrs = ["binomial.h"],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_test(
@@ -355,6 +351,7 @@
     srcs = [
         "binomial_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":binomial",
         "//aos/testing:googletest",
@@ -370,6 +367,7 @@
     hdrs = [
         "capped_test_plant.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":state_feedback_loop",
         "//aos/testing:googletest",
@@ -381,6 +379,7 @@
     hdrs = [
         "static_zeroing_single_dof_profiled_subsystem.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//frc971/control_loops:profiled_subsystem",
     ],
@@ -395,6 +394,7 @@
         "static_zeroing_single_dof_profiled_subsystem_test_integral_plant.cc",
     ],
     cmd = "$(location //frc971/control_loops/python:static_zeroing_single_dof_profiled_subsystem_test) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//frc971/control_loops/python:static_zeroing_single_dof_profiled_subsystem_test",
     ],
@@ -410,6 +410,7 @@
         "static_zeroing_single_dof_profiled_subsystem_test_integral_plant.h",
         "static_zeroing_single_dof_profiled_subsystem_test_plant.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":state_feedback_loop",
     ],
@@ -424,6 +425,7 @@
         ":control_loops_fbs_includes",
         ":profiled_subsystem_fbs_includes",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_test(
@@ -431,6 +433,7 @@
     srcs = [
         "static_zeroing_single_dof_profiled_subsystem_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":capped_test_plant",
         ":position_sensor_sim",
diff --git a/frc971/control_loops/drivetrain/BUILD b/frc971/control_loops/drivetrain/BUILD
index ed905cf..042c8d8 100644
--- a/frc971/control_loops/drivetrain/BUILD
+++ b/frc971/control_loops/drivetrain/BUILD
@@ -2,13 +2,11 @@
 
 load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library", "flatbuffer_ts_library")
 load("//aos:config.bzl", "aos_config")
-load("//tools:environments.bzl", "mcu_cpus")
-load("//tools/build_rules:select.bzl", "compiler_select", "cpu_select")
+load("//tools/build_rules:select.bzl", "cpu_select")
 
 flatbuffer_cc_library(
     name = "drivetrain_goal_fbs",
     srcs = ["drivetrain_goal.fbs"],
-    compatible_with = mcu_cpus,
     gen_reflections = 1,
     includes = ["//frc971/control_loops:control_loops_fbs_includes"],
 )
@@ -16,21 +14,18 @@
 flatbuffer_cc_library(
     name = "drivetrain_output_fbs",
     srcs = ["drivetrain_output.fbs"],
-    compatible_with = mcu_cpus,
     gen_reflections = 1,
 )
 
 flatbuffer_cc_library(
     name = "drivetrain_position_fbs",
     srcs = ["drivetrain_position.fbs"],
-    compatible_with = mcu_cpus,
     gen_reflections = 1,
 )
 
 flatbuffer_cc_library(
     name = "drivetrain_status_fbs",
     srcs = ["drivetrain_status.fbs"],
-    compatible_with = mcu_cpus,
     gen_reflections = 1,
     includes = ["//frc971/control_loops:control_loops_fbs_includes"],
 )
@@ -39,6 +34,7 @@
     name = "drivetrain_status_ts_fbs",
     srcs = ["drivetrain_status.fbs"],
     includes = ["//frc971/control_loops:control_loops_fbs_includes"],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 genrule(
@@ -46,7 +42,6 @@
     srcs = ["drivetrain_goal.fbs"],
     outs = ["drivetrain_goal_float.fbs"],
     cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)",
-    compatible_with = mcu_cpus,
 )
 
 genrule(
@@ -54,7 +49,6 @@
     srcs = ["drivetrain_position.fbs"],
     outs = ["drivetrain_position_float.fbs"],
     cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)",
-    compatible_with = mcu_cpus,
 )
 
 genrule(
@@ -62,7 +56,6 @@
     srcs = ["drivetrain_output.fbs"],
     outs = ["drivetrain_output_float.fbs"],
     cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)",
-    compatible_with = mcu_cpus,
 )
 
 genrule(
@@ -70,13 +63,11 @@
     srcs = ["drivetrain_status.fbs"],
     outs = ["drivetrain_status_float.fbs"],
     cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)",
-    compatible_with = mcu_cpus,
 )
 
 flatbuffer_cc_library(
     name = "drivetrain_goal_float_fbs",
     srcs = ["drivetrain_goal_float.fbs"],
-    compatible_with = mcu_cpus,
     gen_reflections = 1,
     includes = ["//frc971/control_loops:control_loops_fbs_includes"],
 )
@@ -84,21 +75,18 @@
 flatbuffer_cc_library(
     name = "drivetrain_output_float_fbs",
     srcs = ["drivetrain_output_float.fbs"],
-    compatible_with = mcu_cpus,
     gen_reflections = 1,
 )
 
 flatbuffer_cc_library(
     name = "drivetrain_position_float_fbs",
     srcs = ["drivetrain_position_float.fbs"],
-    compatible_with = mcu_cpus,
     gen_reflections = 1,
 )
 
 flatbuffer_cc_library(
     name = "drivetrain_status_float_fbs",
     srcs = ["drivetrain_status_float.fbs"],
-    compatible_with = mcu_cpus,
     gen_reflections = 1,
     includes = ["//frc971/control_loops:control_loops_fbs_includes"],
 )
@@ -109,12 +97,14 @@
     flatbuffers = [
         ":drivetrain_status_fbs",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
 aos_config(
     name = "simulation_config",
     src = "drivetrain_simulation_config.json",
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":config",
@@ -136,6 +126,7 @@
         "//frc971/wpilib:imu_fbs",
         "//frc971/wpilib:imu_batch_fbs",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos/robot_state:config",
@@ -149,14 +140,17 @@
     ],
     deps = [
         "//frc971:shifter_hall_effect",
-        "//frc971/control_loops:hybrid_state_feedback_loop",
         "//frc971/control_loops:state_feedback_loop",
-    ],
+    ] + select({
+        "@platforms//os:linux": ["//frc971/control_loops:hybrid_state_feedback_loop"],
+        "//conditions:default": [],
+    }),
 )
 
 cc_library(
     name = "hybrid_ekf",
     hdrs = ["hybrid_ekf.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":drivetrain_config",
         "//aos:math",
@@ -171,6 +165,7 @@
 cc_test(
     name = "hybrid_ekf_test",
     srcs = ["hybrid_ekf_test.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":drivetrain_test_lib",
         ":hybrid_ekf",
@@ -185,11 +180,13 @@
     name = "localizer_fbs",
     srcs = ["localizer.fbs"],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_library(
     name = "localizer",
     hdrs = ["localizer.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":drivetrain_config",
         ":drivetrain_status_fbs",
@@ -204,7 +201,6 @@
     hdrs = [
         "gear.h",
     ],
-    compatible_with = mcu_cpus,
 )
 
 cc_library(
@@ -215,6 +211,7 @@
     hdrs = [
         "splinedrivetrain.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":distance_spline",
         ":drivetrain_config",
@@ -238,6 +235,7 @@
     hdrs = [
         "line_follow_drivetrain.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":drivetrain_config",
         ":drivetrain_goal_fbs",
@@ -260,7 +258,7 @@
     name = "line_follow_drivetrain_test",
     srcs = ["line_follow_drivetrain_test.cc"],
     linkstatic = True,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":drivetrain_config",
         ":drivetrain_test_lib",
@@ -281,6 +279,7 @@
     hdrs = [
         "ssdrivetrain.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":drivetrain_config",
         ":drivetrain_goal_fbs",
@@ -309,58 +308,34 @@
     hdrs = [
         "polydrivetrain.h",
     ],
+    copts = select({
+        "@platforms//os:none": ["-Wno-type-limits"],
+        "//conditions:default": [],
+    }),
     deps = [
         ":drivetrain_config",
-        ":drivetrain_goal_fbs",
-        ":drivetrain_output_fbs",
-        ":drivetrain_position_fbs",
-        ":drivetrain_status_fbs",
         ":gear",
         "//aos:math",
         "//aos/controls:polytope",
-        "//aos/robot_state:robot_state_fbs",
-        "//aos/util:log_interval",
         "//frc971/control_loops:coerce_goal",
         "//frc971/control_loops:control_loops_fbs",
         "//frc971/control_loops:state_feedback_loop",
-    ],
-)
-
-cc_library(
-    name = "drivetrain_config_uc",
-    hdrs = [
-        "drivetrain_config.h",
-    ],
-    restricted_to = mcu_cpus,
-    deps = [
-        "//frc971:shifter_hall_effect",
-        "//frc971/control_loops:state_feedback_loop_uc",
-    ],
-)
-
-cc_library(
-    name = "polydrivetrain_uc",
-    srcs = [
-        "polydrivetrain.cc",
-    ],
-    hdrs = [
-        "polydrivetrain.h",
-    ],
-    copts = ["-Wno-type-limits"],
-    restricted_to = mcu_cpus,
-    deps = [
-        ":drivetrain_config_uc",
-        ":drivetrain_goal_float_fbs",
-        ":drivetrain_output_float_fbs",
-        ":drivetrain_position_float_fbs",
-        ":drivetrain_status_float_fbs",
-        ":gear",
-        "//aos:math",
-        "//aos/controls:polytope_uc",
-        "//frc971/control_loops:coerce_goal_uc",
-        "//frc971/control_loops:control_loops_fbs",
-        "//frc971/control_loops:state_feedback_loop_uc",
-    ],
+    ] + select({
+        "@platforms//os:linux": [
+            ":drivetrain_goal_fbs",
+            ":drivetrain_output_fbs",
+            ":drivetrain_position_fbs",
+            ":drivetrain_status_fbs",
+            "//aos/robot_state:robot_state_fbs",
+            "//aos/util:log_interval",
+        ],
+        "@platforms//os:none": [
+            ":drivetrain_goal_float_fbs",
+            ":drivetrain_output_float_fbs",
+            ":drivetrain_position_float_fbs",
+            ":drivetrain_status_float_fbs",
+        ],
+    }),
 )
 
 genrule(
@@ -370,6 +345,7 @@
         "down_estimator.cc",
     ],
     cmd = "$(location //frc971/control_loops/python:down_estimator) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//frc971/control_loops/python:down_estimator",
     ],
@@ -384,6 +360,7 @@
     hdrs = [
         "down_estimator.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//frc971/control_loops:state_feedback_loop",
     ],
@@ -397,6 +374,7 @@
     hdrs = [
         "drivetrain.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":down_estimator",
         ":drivetrain_goal_fbs",
@@ -433,6 +411,7 @@
             ],
             "arm": [],
         }),
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":drivetrain_config",
         ":drivetrain_goal_fbs",
@@ -471,6 +450,7 @@
             "arm": [],
         }),
     linkstatic = True,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":drivetrain_config",
         ":drivetrain_lib",
@@ -506,7 +486,6 @@
         "integral_haptic_trigger.cc",
     ],
     cmd = "$(location //frc971/control_loops/python:haptic_wheel) $(OUTS)",
-    compatible_with = mcu_cpus,
     tools = [
         "//frc971/control_loops/python:haptic_wheel",
     ],
@@ -514,26 +493,6 @@
 )
 
 cc_library(
-    name = "haptic_input_uc",
-    srcs = [
-        "haptic_trigger.cc",
-        "haptic_wheel.cc",
-        "integral_haptic_trigger.cc",
-        "integral_haptic_wheel.cc",
-    ],
-    hdrs = [
-        "haptic_trigger.h",
-        "haptic_wheel.h",
-        "integral_haptic_trigger.h",
-        "integral_haptic_wheel.h",
-    ],
-    restricted_to = mcu_cpus,
-    deps = [
-        "//frc971/control_loops:state_feedback_loop_uc",
-    ],
-)
-
-cc_library(
     name = "haptic_wheel",
     srcs = [
         "haptic_trigger.cc",
@@ -556,6 +515,7 @@
     name = "spline",
     srcs = ["spline.cc"],
     hdrs = ["spline.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//frc971/control_loops:binomial",
         "@org_tuxfamily_eigen//:eigen",
@@ -566,6 +526,7 @@
     name = "spline.so",
     srcs = ["libspline.cc"],
     linkshared = True,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":distance_spline",
         ":spline",
@@ -582,7 +543,7 @@
     srcs = [
         "spline_test.cc",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":spline",
         "//aos/testing:googletest",
@@ -595,6 +556,7 @@
     name = "distance_spline",
     srcs = ["distance_spline.cc"],
     hdrs = ["distance_spline.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":spline",
         "//aos/logging",
@@ -616,6 +578,7 @@
             "arm": [],
         }),
     linkstatic = True,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":distance_spline",
         "//aos/testing:googletest",
@@ -633,6 +596,7 @@
     name = "trajectory",
     srcs = ["trajectory.cc"],
     hdrs = ["trajectory.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":distance_spline",
         ":drivetrain_config",
@@ -650,7 +614,7 @@
     srcs = [
         "trajectory_plot.cc",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":distance_spline",
         ":trajectory",
@@ -676,6 +640,7 @@
             "arm": [],
         }),
     linkstatic = True,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":trajectory",
         ":drivetrain_test_lib",
@@ -700,6 +665,7 @@
     hdrs = [
         "improved_down_estimator.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":drivetrain_config",
         ":drivetrain_status_fbs",
@@ -718,6 +684,7 @@
     srcs = [
         "improved_down_estimator_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":drivetrain_test_lib",
         "//aos/controls:quaternion_utils",
@@ -731,6 +698,7 @@
 cc_library(
     name = "camera",
     srcs = ["camera.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos/containers:sized_array",
@@ -741,6 +709,7 @@
 cc_test(
     name = "camera_test",
     srcs = ["camera_test.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":camera",
         "//aos/testing:googletest",
diff --git a/frc971/control_loops/python/BUILD b/frc971/control_loops/python/BUILD
index 7953474..7851397 100644
--- a/frc971/control_loops/python/BUILD
+++ b/frc971/control_loops/python/BUILD
@@ -6,7 +6,7 @@
         "haptic_wheel.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         "//external:python-gflags",
         "//external:python-glog",
@@ -28,7 +28,7 @@
         "//third_party/cddlib:_cddlib.so",
         "@python_repo//:scipy",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-glog",
@@ -42,7 +42,7 @@
         "polytope_test.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":controls",
         ":python_init",
@@ -55,7 +55,7 @@
         "down_estimator.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":controls",
         ":python_init",
@@ -68,7 +68,7 @@
     srcs = [
         "drivetrain.py",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":controls",
         ":python_init",
@@ -84,6 +84,7 @@
     data = [
         "//frc971/control_loops/drivetrain:spline.so",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":python_init",
     ],
@@ -94,6 +95,7 @@
     srcs = [
         "lib_spline_test.py",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":libspline",
         ":python_init",
@@ -105,7 +107,7 @@
     srcs = [
         "polydrivetrain.py",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":controls",
         ":drivetrain",
@@ -117,6 +119,7 @@
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = ["//frc971/control_loops:python_init"],
 )
@@ -127,7 +130,7 @@
         "spline.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         "//external:python-gflags",
         "//external:python-glog",
@@ -140,7 +143,7 @@
 py_library(
     name = "linear_system",
     srcs = ["linear_system.py"],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     visibility = ["//visibility:public"],
     deps = [
         ":controls",
@@ -153,7 +156,7 @@
 py_library(
     name = "angular_system",
     srcs = ["angular_system.py"],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     visibility = ["//visibility:public"],
     deps = [
         ":controls",
@@ -175,7 +178,7 @@
         "spline_writer.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     visibility = ["//visibility:public"],
     deps = [
         ":basic_window",
@@ -192,7 +195,7 @@
         "basic_window.py",
         "color.py",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     visibility = ["//visibility:public"],
     deps = [
         ":python_init",
@@ -205,7 +208,7 @@
     srcs = [
         "color.py",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     visibility = ["//visibility:public"],
     deps = [
         ":python_init",
@@ -218,7 +221,7 @@
         "static_zeroing_single_dof_profiled_subsystem_test.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":controls",
         ":linear_system",
diff --git a/frc971/control_loops/voltage_cap/BUILD b/frc971/control_loops/voltage_cap/BUILD
index 2aa1dea..1bf2b8d 100644
--- a/frc971/control_loops/voltage_cap/BUILD
+++ b/frc971/control_loops/voltage_cap/BUILD
@@ -8,6 +8,7 @@
     hdrs = [
         "voltage_cap.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_test(
@@ -15,6 +16,7 @@
     srcs = [
         "voltage_cap_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":voltage_cap",
         "//aos/testing:googletest",
diff --git a/frc971/downloader.bzl b/frc971/downloader.bzl
index 7f188dd..aebcb87 100644
--- a/frc971/downloader.bzl
+++ b/frc971/downloader.bzl
@@ -8,7 +8,7 @@
         data = [],
         dirs = None,
         default_target = None,
-        restricted_to = ["//tools:roborio"],
+        target_compatible_with = ["@//tools/platforms/hardware:roborio"],
         target_type = "roborio"):
     """Sets up the standard robot download targets.
 
@@ -29,7 +29,7 @@
         dirs = dirs,
         target_type = target_type,
         default_target = default_target,
-        restricted_to = restricted_to,
+        target_compatible_with = target_compatible_with,
     )
 
     aos_downloader(
@@ -44,5 +44,5 @@
         dirs = dirs,
         target_type = target_type,
         default_target = default_target,
-        restricted_to = restricted_to,
+        target_compatible_with = target_compatible_with,
     )
diff --git a/frc971/downloader/BUILD b/frc971/downloader/BUILD
index 1aab653..58f8cdc 100644
--- a/frc971/downloader/BUILD
+++ b/frc971/downloader/BUILD
@@ -8,5 +8,6 @@
         "@ssh",
         "@ssh//:scp",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/frc971/queues/BUILD b/frc971/queues/BUILD
index 4005092..44ee59e 100644
--- a/frc971/queues/BUILD
+++ b/frc971/queues/BUILD
@@ -8,6 +8,7 @@
         "gyro.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -16,4 +17,5 @@
         "gyro_uid.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
diff --git a/frc971/shooter_interpolation/BUILD b/frc971/shooter_interpolation/BUILD
index cce93e1..8a63f5d 100644
--- a/frc971/shooter_interpolation/BUILD
+++ b/frc971/shooter_interpolation/BUILD
@@ -6,6 +6,7 @@
     hdrs = [
         "interpolation.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -14,6 +15,7 @@
     srcs = [
         "interpolation_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":interpolation",
         "//aos/testing:googletest",
diff --git a/frc971/wpilib/BUILD b/frc971/wpilib/BUILD
index 21472f8..e7c52bf 100644
--- a/frc971/wpilib/BUILD
+++ b/frc971/wpilib/BUILD
@@ -9,6 +9,7 @@
         "logging.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_library(
@@ -19,7 +20,7 @@
     hdrs = [
         "encoder_and_potentiometer.h",
     ],
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     deps = [
         ":dma",
         ":dma_edge_counting",
@@ -37,7 +38,7 @@
     hdrs = [
         "dma_edge_counting.h",
     ],
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     deps = [
         ":dma",
         "//aos/logging",
@@ -53,7 +54,7 @@
     hdrs = [
         "interrupt_edge_counting.h",
     ],
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     deps = [
         "//aos:init",
         "//aos/logging",
@@ -73,7 +74,7 @@
         "buffered_pcm.h",
         "buffered_solenoid.h",
     ],
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     deps = [
         "//aos/logging",
         "//third_party:wpilib",
@@ -90,7 +91,7 @@
     ],
     # This library uses some deprecated parts of the SPI API.
     copts = ["-Wno-deprecated-declarations"],
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     deps = [
         "//aos/logging",
         "//aos/time",
@@ -106,7 +107,7 @@
     hdrs = [
         "gyro_sender.h",
     ],
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     deps = [
         ":gyro_interface",
         "//aos:init",
@@ -128,6 +129,7 @@
         "loop_output_handler_test.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 aos_config(
@@ -137,6 +139,7 @@
         ":pdp_values_fbs",
         ":logging_fbs",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 aos_config(
@@ -145,6 +148,7 @@
     flatbuffers = [
         ":loop_output_handler_test_fbs",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/events:config",
     ],
@@ -158,6 +162,7 @@
     hdrs = [
         "loop_output_handler.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos:init",
         "//aos/events:event_loop",
@@ -176,6 +181,7 @@
     data = [
         ":loop_output_handler_test_config",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":loop_output_handler",
         ":loop_output_handler_test_fbs",
@@ -193,7 +199,7 @@
     hdrs = [
         "joystick_sender.h",
     ],
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     deps = [
         "//aos:init",
         "//aos/events:shm_event_loop",
@@ -212,7 +218,7 @@
     hdrs = [
         "wpilib_interface.h",
     ],
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     deps = [
         "//aos/events:event_loop",
         "//aos/robot_state:robot_state_fbs",
@@ -226,6 +232,7 @@
         "pdp_values.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_library(
@@ -236,7 +243,7 @@
     hdrs = [
         "pdp_fetcher.h",
     ],
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     deps = [
         ":pdp_values_fbs",
         "//aos:init",
@@ -252,7 +259,7 @@
     hdrs = [
         "wpilib_robot_base.h",
     ],
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     deps = [
         "//third_party:wpilib",
     ],
@@ -264,6 +271,7 @@
         "imu.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -275,6 +283,7 @@
     includes = [
         ":imu_fbs_includes",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_library(
@@ -285,7 +294,7 @@
     hdrs = [
         "ADIS16470.h",
     ],
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     deps = [
         ":fpga_time_conversion",
         ":imu_batch_fbs",
@@ -309,7 +318,7 @@
     ],
     # This library uses some deprecated parts of the SPI API.
     copts = ["-Wno-deprecated-declarations"],
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     deps = [
         ":fpga_time_conversion",
         ":imu_fbs",
@@ -332,7 +341,7 @@
     hdrs = [
         "dma.h",
     ],
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     deps = [
         "//third_party:wpilib",
     ],
@@ -346,6 +355,7 @@
     hdrs = [
         "spi_rx_clearer.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/logging",
     ],
@@ -359,7 +369,7 @@
     hdrs = [
         "sensor_reader.h",
     ],
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     deps = [
         ":dma",
         ":dma_edge_counting",
@@ -386,7 +396,7 @@
     hdrs = [
         "drivetrain_writer.h",
     ],
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     deps = [
         ":loop_output_handler",
         "//aos:math",
@@ -404,7 +414,7 @@
     hdrs = [
         "fpga_time_conversion.h",
     ],
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     deps = [
         "//aos/time",
         "//aos/util:compiler_memory_barrier",
diff --git a/frc971/wpilib/ahal/BUILD b/frc971/wpilib/ahal/BUILD
index 44341b7..350aa90 100644
--- a/frc971/wpilib/ahal/BUILD
+++ b/frc971/wpilib/ahal/BUILD
@@ -8,13 +8,14 @@
         "const char *WPILibVersion = \"2018-frc971\";",
         "EOF",
     ]),
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_library(
     name = "ahal",
     srcs = glob(["*.cc"]) + [":wpilib_version"],
     hdrs = glob(["*.h"]),
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     visibility = ["//third_party:__pkg__"],
     deps = [
         "//aos:make_unique",
diff --git a/frc971/zeroing/BUILD b/frc971/zeroing/BUILD
index df85290..cd90e8d 100644
--- a/frc971/zeroing/BUILD
+++ b/frc971/zeroing/BUILD
@@ -1,12 +1,11 @@
 package(default_visibility = ["//visibility:public"])
 
-load("//tools:environments.bzl", "mcu_cpus")
-
 cc_library(
     name = "averager",
     hdrs = [
         "averager.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "@com_github_google_glog//:glog",
         "@org_tuxfamily_eigen//:eigen",
@@ -18,6 +17,7 @@
     srcs = [
         "averager_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":averager",
         "//aos/testing:googletest",
@@ -33,6 +33,7 @@
     hdrs = [
         "imu_zeroer.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":averager",
         "//frc971/control_loops:control_loops_fbs",
@@ -48,6 +49,7 @@
     srcs = [
         "imu_zeroer_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":imu_zeroer",
         "//aos:flatbuffers",
@@ -59,22 +61,23 @@
 cc_library(
     name = "zeroing",
     srcs = [
+        "absolute_and_absolute_encoder.cc",
         "absolute_encoder.cc",
         "hall_effect_and_position.cc",
         "pot_and_absolute_encoder.cc",
         "pot_and_index.cc",
         "pulse_index.cc",
-        "absolute_and_absolute_encoder.cc",
     ],
     hdrs = [
+        "absolute_and_absolute_encoder.h",
         "absolute_encoder.h",
         "hall_effect_and_position.h",
         "pot_and_absolute_encoder.h",
         "pot_and_index.h",
         "pulse_index.h",
         "zeroing.h",
-        "absolute_and_absolute_encoder.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":wrap",
         "//aos/logging",
@@ -87,15 +90,16 @@
 cc_test(
     name = "zeroing_test",
     srcs = [
+        "absolute_and_absolute_encoder_test.cc",
         "absolute_encoder_test.cc",
         "hall_effect_and_position_test.cc",
         "pot_and_absolute_encoder_test.cc",
         "pot_and_index_test.cc",
         "pulse_index_test.cc",
         "relative_encoder_test.cc",
-        "absolute_and_absolute_encoder_test.cc",
         "zeroing_test.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":zeroing",
         "//aos/testing:googletest",
@@ -113,7 +117,6 @@
     hdrs = [
         "wrap.h",
     ],
-    compatible_with = mcu_cpus,
 )
 
 cc_test(
@@ -121,6 +124,7 @@
     srcs = [
         "wrap_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":wrap",
         "//aos/testing:googletest",
@@ -132,6 +136,7 @@
     srcs = [
         "unwrap_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":wrap",
         "//aos/testing:googletest",
diff --git a/motors/BUILD b/motors/BUILD
index 8fe5ff6..b606bf7 100644
--- a/motors/BUILD
+++ b/motors/BUILD
@@ -1,5 +1,4 @@
 load("//motors:macros.bzl", "hex_from_elf")
-load("//tools:environments.bzl", "mcu_cpus")
 
 cc_library(
     name = "motor",
@@ -9,7 +8,7 @@
     hdrs = [
         "motor.h",
     ],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     visibility = ["//visibility:public"],
     deps = [
         ":algorithms",
@@ -27,7 +26,7 @@
     hdrs = [
         "util.h",
     ],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     visibility = ["//visibility:public"],
     deps = [
         "//motors/core",
@@ -52,6 +51,7 @@
         "$@",
         "$<",
     ]),
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "@pandoc",
         "@pandoc//:all_files",
@@ -66,7 +66,6 @@
     hdrs = [
         "algorithms.h",
     ],
-    compatible_with = mcu_cpus,
 )
 
 cc_test(
@@ -74,6 +73,7 @@
     srcs = [
         "algorithms_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":algorithms",
         "//aos/testing:googletest",
@@ -88,7 +88,6 @@
     hdrs = [
         "math.h",
     ],
-    compatible_with = mcu_cpus,
     visibility = ["//visibility:public"],
 )
 
@@ -97,6 +96,7 @@
     srcs = [
         "math_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":math",
         "//aos/testing:googletest",
@@ -108,7 +108,7 @@
     srcs = [
         "button_board.cc",
     ],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     deps = [
         ":util",
         "//motors/core",
@@ -123,7 +123,7 @@
 
 hex_from_elf(
     name = "button_board",
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
 )
 
 cc_binary(
@@ -132,7 +132,7 @@
         "simple_receiver.cc",
     ],
     copts = ["-Wno-type-limits"],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     deps = [
         ":util",
         "//motors/core",
@@ -146,7 +146,7 @@
 
 hex_from_elf(
     name = "simpler_receiver",
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
 )
 
 cc_binary(
@@ -155,7 +155,7 @@
         "simpler_receiver.cc",
     ],
     copts = ["-Wno-type-limits"],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     deps = [
         ":util",
         "//motors/core",
@@ -167,11 +167,12 @@
 
 hex_from_elf(
     name = "simple_receiver",
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
 )
 
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/motors/big/BUILD b/motors/big/BUILD
index 062828f..58fa295 100644
--- a/motors/big/BUILD
+++ b/motors/big/BUILD
@@ -1,12 +1,11 @@
 load("//motors:macros.bzl", "hex_from_elf")
-load("//tools:environments.bzl", "mcu_cpus")
 
 cc_binary(
     name = "medium_salsa.elf",
     srcs = [
         "medium_salsa.cc",
     ],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     deps = [
         ":motor_controls",
         "//motors:motor",
@@ -20,7 +19,7 @@
 
 hex_from_elf(
     name = "medium_salsa",
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
 )
 
 cc_library(
@@ -31,7 +30,7 @@
     hdrs = [
         "motor_controls.h",
     ],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     deps = [
         "//motors:math",
         "//motors:motor",
diff --git a/motors/core/BUILD b/motors/core/BUILD
index 092c540..d5e7cca 100644
--- a/motors/core/BUILD
+++ b/motors/core/BUILD
@@ -1,5 +1,3 @@
-load("//tools:environments.bzl", "mcu_cpus")
-
 filegroup(
     name = "linkerscripts",
     srcs = [
@@ -23,7 +21,7 @@
         "reg_debug.h",
         "time.h",
     ],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     visibility = ["//visibility:public"],
 )
 
@@ -32,7 +30,7 @@
     hdrs = [
         "semihosting.h",
     ],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     visibility = ["//visibility:public"],
     deps = [
         "//third_party/GSL",
@@ -47,7 +45,7 @@
     hdrs = [
         "itm.h",
     ],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     visibility = ["//visibility:public"],
     deps = [
         ":core",
diff --git a/motors/deploy_joystick.sh b/motors/deploy_joystick.sh
index db0d855..b5af72e 100755
--- a/motors/deploy_joystick.sh
+++ b/motors/deploy_joystick.sh
@@ -1,4 +1,4 @@
 #!/bin/bash
 # Deploy to the driver station side of the pistol grip.
 
-bazel build --cpu=cortex-m4f -c opt //motors/pistol_grip:drivers_station.hex && bazel run //motors/teensy_loader_cli -- --mcu=mk64fx512 -s $(readlink -f bazel-bin/motors/pistol_grip/drivers_station.hex)
+bazel build --config=cortex-m4f -c opt //motors/pistol_grip:drivers_station.hex && bazel run //motors/teensy_loader_cli -- --mcu=mk64fx512 -s $(readlink -f bazel-bin/motors/pistol_grip/drivers_station.hex)
diff --git a/motors/fet12/BUILD b/motors/fet12/BUILD
index 5d25c41..ac9849b 100644
--- a/motors/fet12/BUILD
+++ b/motors/fet12/BUILD
@@ -1,5 +1,4 @@
 load("//motors:macros.bzl", "hex_from_elf")
-load("//tools:environments.bzl", "mcu_cpus")
 
 cc_binary(
     name = "fet12.elf",
@@ -7,7 +6,7 @@
         "current_equalization.h",
         "fet12.cc",
     ],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     deps = [
         ":motor_controls",
         "//motors:motor",
@@ -25,7 +24,7 @@
         "current_equalization.h",
         "fet12v2.cc",
     ],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     deps = [
         ":motor_controls",
         "//motors:motor",
@@ -40,7 +39,7 @@
 
 hex_from_elf(
     name = "fet12",
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
 )
 
 cc_binary(
@@ -48,7 +47,7 @@
     srcs = [
         "power_wheels.cc",
     ],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     deps = [
         "//motors:util",
         "//motors/core",
@@ -60,7 +59,7 @@
 
 hex_from_elf(
     name = "power_wheels",
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
 )
 
 cc_library(
@@ -71,7 +70,7 @@
     hdrs = [
         "motor_controls.h",
     ],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     deps = [
         "//motors:math",
         "//motors:motor",
@@ -88,6 +87,7 @@
     data = [
         "@python_repo//:scipy",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 py_binary(
@@ -99,6 +99,7 @@
         ":calib_sensors",
         "@python_repo//:scipy",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 genrule(
@@ -122,6 +123,6 @@
         "$(location calib_data_6030c.csv)",
         "> \"$@\"",
     ]),
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     tools = ["current_equalize"],
 )
diff --git a/motors/macros.bzl b/motors/macros.bzl
index 6b15f00..0ff7c8d 100644
--- a/motors/macros.bzl
+++ b/motors/macros.bzl
@@ -1,4 +1,4 @@
-def hex_from_elf(name, restricted_to = None):
+def hex_from_elf(name, target_compatible_with = None):
     native.genrule(
         name = name,
         srcs = ["%s.elf" % name],
@@ -6,6 +6,6 @@
         cmd = "$(OBJCOPY) -O ihex $< $@",
         executable = True,
         output_to_bindir = True,
-        restricted_to = restricted_to,
+        target_compatible_with = target_compatible_with,
         toolchains = ["@bazel_tools//tools/cpp:current_cc_toolchain"],
     )
diff --git a/motors/peripheral/BUILD b/motors/peripheral/BUILD
index c8b63e9..a42d502 100644
--- a/motors/peripheral/BUILD
+++ b/motors/peripheral/BUILD
@@ -1,5 +1,3 @@
-load("//tools:environments.bzl", "mcu_cpus")
-
 cc_library(
     name = "adc",
     srcs = [
@@ -8,7 +6,7 @@
     hdrs = [
         "adc.h",
     ],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     visibility = ["//visibility:public"],
     deps = [
         ":configuration",
@@ -22,7 +20,7 @@
     hdrs = [
         "configuration.h",
     ],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     visibility = ["//visibility:public"],
 )
 
@@ -34,7 +32,7 @@
     hdrs = [
         "can.h",
     ],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     visibility = ["//visibility:public"],
     deps = [
         "//motors:util",
@@ -45,7 +43,6 @@
 cc_library(
     name = "uart_buffer",
     hdrs = ["uart_buffer.h"],
-    compatible_with = mcu_cpus,
     visibility = ["//visibility:public"],
     deps = [
         "//third_party/GSL",
@@ -57,6 +54,7 @@
     srcs = [
         "uart_buffer_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":uart_buffer",
         "//aos/testing:googletest",
@@ -67,7 +65,7 @@
     name = "uart",
     srcs = ["uart.cc"],
     hdrs = ["uart.h"],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     visibility = ["//visibility:public"],
     deps = [
         ":uart_buffer",
@@ -82,7 +80,7 @@
     name = "adc_dma",
     srcs = ["adc_dma.cc"],
     hdrs = ["adc_dma.h"],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     visibility = ["//visibility:public"],
     deps = [
         ":configuration",
@@ -95,7 +93,7 @@
     name = "spi",
     srcs = ["spi.cc"],
     hdrs = ["spi.h"],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     visibility = ["//visibility:public"],
     deps = [
         ":uart_buffer",
diff --git a/motors/pistol_grip/BUILD b/motors/pistol_grip/BUILD
index d00404e..f12badb 100644
--- a/motors/pistol_grip/BUILD
+++ b/motors/pistol_grip/BUILD
@@ -1,12 +1,11 @@
 load("//motors:macros.bzl", "hex_from_elf")
-load("//tools:environments.bzl", "mcu_cpus")
 
 cc_binary(
     name = "drivers_station.elf",
     srcs = [
         "drivers_station.cc",
     ],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     deps = [
         "//motors:util",
         "//motors/core",
@@ -21,7 +20,7 @@
 
 hex_from_elf(
     name = "drivers_station",
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
 )
 
 cc_binary(
@@ -35,10 +34,10 @@
         "vtable_wheel0.cc",
         "vtable_wheel1.cc",
     ],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     deps = [
         ":motor_controls",
-        "//frc971/control_loops/drivetrain:haptic_input_uc",
+        "//frc971/control_loops/drivetrain:haptic_wheel",
         "//motors:motor",
         "//motors:util",
         "//motors/core",
@@ -50,7 +49,7 @@
 
 hex_from_elf(
     name = "controller",
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
 )
 
 cc_binary(
@@ -58,7 +57,7 @@
     srcs = [
         "usb_forward.cc",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         # Don't add anything else here. :usb_forward_windows still has to build it
         # without any other dependencies.
@@ -82,6 +81,7 @@
         "$@",
     ]),
     output_to_bindir = True,
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "usb_forward_windows_build.sh",
         "@mingw_compiler//:all_files",
@@ -96,7 +96,7 @@
     hdrs = [
         "motor_controls.h",
     ],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     visibility = ["//visibility:public"],
     deps = [
         "//motors:math",
diff --git a/motors/print/BUILD b/motors/print/BUILD
index 26d8e45..df27ce2 100644
--- a/motors/print/BUILD
+++ b/motors/print/BUILD
@@ -1,11 +1,9 @@
-load("//tools:environments.bzl", "mcu_cpus")
-
 cc_library(
     name = "print",
     hdrs = [
         "print.h",
     ],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos/containers:sized_array",
@@ -22,7 +20,7 @@
     hdrs = [
         "uart.h",
     ],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     visibility = ["//visibility:public"],
     deps = [
         ":print",
@@ -39,7 +37,7 @@
     hdrs = [
         "itm.h",
     ],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     visibility = ["//visibility:public"],
     deps = [
         ":print",
@@ -55,7 +53,7 @@
     hdrs = [
         "semihosting.h",
     ],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     visibility = ["//visibility:public"],
     deps = [
         ":print",
@@ -71,7 +69,7 @@
     hdrs = [
         "usb.h",
     ],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     visibility = ["//visibility:public"],
     deps = [
         ":print",
diff --git a/motors/python/BUILD b/motors/python/BUILD
index 5eafc3a..4925d4c 100644
--- a/motors/python/BUILD
+++ b/motors/python/BUILD
@@ -7,7 +7,7 @@
         "@python_repo//:scipy",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -23,7 +23,7 @@
         "haptic_phase_current.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -35,6 +35,7 @@
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = ["//motors:python_init"],
 )
diff --git a/motors/seems_reasonable/BUILD b/motors/seems_reasonable/BUILD
index ccd4c36..a9eb95b 100644
--- a/motors/seems_reasonable/BUILD
+++ b/motors/seems_reasonable/BUILD
@@ -1,12 +1,10 @@
-load("//tools:environments.bzl", "mcu_cpus")
-
 py_binary(
     name = "drivetrain",
     srcs = [
         "drivetrain.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -22,7 +20,7 @@
         "polydrivetrain.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -40,7 +38,7 @@
         "kalman_drivetrain_motor_plant.cc",
     ],
     cmd = "$(location :drivetrain) $(OUTS)",
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     tools = [
         ":drivetrain",
     ],
@@ -57,7 +55,7 @@
         "hybrid_velocity_drivetrain.cc",
     ],
     cmd = "$(location :polydrivetrain) $(OUTS)",
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     tools = [
         ":polydrivetrain",
     ],
@@ -74,11 +72,11 @@
         "drivetrain_dog_motor_plant.h",
         "polydrivetrain_dog_motor_plant.h",
     ],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     visibility = ["//visibility:public"],
     deps = [
-        "//frc971/control_loops:state_feedback_loop_uc",
-        "//frc971/control_loops/drivetrain:polydrivetrain_uc",
+        "//frc971/control_loops:state_feedback_loop",
+        "//frc971/control_loops/drivetrain:polydrivetrain",
     ],
 )
 
@@ -86,7 +84,6 @@
     name = "spring",
     srcs = ["spring.cc"],
     hdrs = ["spring.h"],
-    compatible_with = mcu_cpus,
     visibility = ["//visibility:public"],
     deps = ["//frc971/zeroing:wrap"],
 )
@@ -96,6 +93,7 @@
     srcs = [
         "spring_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":spring",
         "//aos/testing:googletest",
@@ -105,6 +103,7 @@
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = ["//motors:python_init"],
 )
diff --git a/motors/teensy_loader_cli/BUILD b/motors/teensy_loader_cli/BUILD
index eb68399..eea314c 100644
--- a/motors/teensy_loader_cli/BUILD
+++ b/motors/teensy_loader_cli/BUILD
@@ -7,7 +7,7 @@
         "-DUSE_LIBUSB",
         "-Wno-format-nonliteral",
     ],
-    restricted_to = ["@//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         "@libusb",
     ],
diff --git a/motors/usb/BUILD b/motors/usb/BUILD
index 3e92a16..1446e91 100644
--- a/motors/usb/BUILD
+++ b/motors/usb/BUILD
@@ -1,5 +1,3 @@
-load("//tools:environments.bzl", "mcu_cpus")
-
 cc_library(
     name = "legacy",
     srcs = [
@@ -18,7 +16,7 @@
     defines = [
         "USB_SERIAL=1",
     ],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     visibility = ["//visibility:public"],
     deps = [
         "//motors/core",
@@ -33,7 +31,7 @@
     hdrs = [
         "usb.h",
     ],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     visibility = ["//visibility:public"],
     deps = [
         ":constants",
@@ -51,7 +49,7 @@
     hdrs = [
         "cdc.h",
     ],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     visibility = ["//visibility:public"],
     deps = [
         ":queue",
@@ -69,7 +67,7 @@
     hdrs = [
         "interrupt_out.h",
     ],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     visibility = ["//visibility:public"],
     deps = [
         ":usb",
@@ -86,7 +84,6 @@
     hdrs = [
         "queue.h",
     ],
-    compatible_with = mcu_cpus,
 )
 
 cc_test(
@@ -94,6 +91,7 @@
     srcs = [
         "queue_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":queue",
         "//aos/testing:googletest",
@@ -105,7 +103,6 @@
     hdrs = [
         "constants.h",
     ],
-    compatible_with = mcu_cpus,
 )
 
 cc_test(
@@ -113,6 +110,7 @@
     srcs = [
         "constants_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":constants",
         "//aos/testing:googletest",
@@ -127,7 +125,7 @@
     hdrs = [
         "hid.h",
     ],
-    restricted_to = mcu_cpus,
+    target_compatible_with = ["@platforms//os:none"],
     visibility = ["//visibility:public"],
     deps = [
         ":usb",
diff --git a/third_party/BUILD b/third_party/BUILD
index 8bd83d7..4ecad0d 100644
--- a/third_party/BUILD
+++ b/third_party/BUILD
@@ -1,23 +1,30 @@
+load("//tools:platforms.bzl", "platforms")
 load("//tools/build_rules:select.bzl", "cpu_select")
 
+# Incompatible library in case one isn't available for a specific architecture.
+cc_library(
+    name = "unavailable",
+    target_compatible_with = ["@platforms//:incompatible"],
+)
+
 cc_library(
     name = "wpilib",
     linkstatic = True,
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     visibility = ["//visibility:public"],
     deps = ["//frc971/wpilib/ahal"],
 )
 
 cc_library(
     name = "wpilib_hal",
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     visibility = ["//visibility:public"],
     deps = ["//third_party/allwpilib:hal"],
 )
 
 cc_library(
     name = "phoenix",
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     visibility = ["//visibility:public"],
     deps = [
         "@ctre_phoenix_api_cpp_athena//:api-cpp",
@@ -31,80 +38,61 @@
 
 cc_library(
     name = "opencv",
-    restricted_to = [
-        "//tools:k8",
-        "//tools:armhf-debian",
-    ],
     visibility = ["//visibility:public"],
     deps = select({
         "//tools:cpu_k8": ["@opencv_k8//:opencv"],
         "//tools:cpu_armhf": ["@opencv_armhf//:opencv"],
-        "//conditions:default": [],
+        "//conditions:default": [":unavailable"],
     }),
 )
 
 cc_library(
     name = "gstreamer",
-    restricted_to = [
-        "//tools:k8",
-        "//tools:armhf-debian",
-    ],
     visibility = ["//visibility:public"],
     deps = select({
         "//tools:cpu_k8": ["@gstreamer_k8//:gstreamer"],
         "//tools:cpu_armhf": ["@gstreamer_armhf//:gstreamer"],
-        "//conditions:default": [],
+        "//conditions:default": [":unavailable"],
     }),
 )
 
 cc_library(
     name = "halide",
-    restricted_to = [
-        "//tools:k8",
-        "//tools:armhf-debian",
-    ],
     visibility = ["//visibility:public"],
     deps = select({
         "//tools:cpu_k8": ["@halide_k8//:halide"],
         "//tools:cpu_armhf": ["@halide_armhf//:halide"],
-        "//conditions:default": [],
+        "//conditions:default": [":unavailable"],
     }),
 )
 
 cc_library(
     name = "halide_gengen",
-    restricted_to = [
-        "//tools:k8",
-        "//tools:armhf-debian",
-    ],
     visibility = ["//visibility:public"],
     # It's the same file in either version, but we'll pick the native version
     # to minimize the chances of needing to download the other version unnecessarily.
     deps = select({
         "//tools:cpu_k8": ["@halide_k8//:gengen"],
         "//tools:cpu_armhf": ["@halide_armhf//:gengen"],
-        "//conditions:default": [],
+        "//conditions:default": [":unavailable"],
     }),
 )
 
 cc_library(
     name = "halide_runtime",
-    restricted_to = [
-        "//tools:k8",
-        "//tools:armhf-debian",
-    ],
     visibility = ["//visibility:public"],
     # It's the same file in either version, but we'll pick the native version
     # to minimize the chances of needing to download the other version unnecessarily.
     deps = select({
         "//tools:cpu_k8": ["@halide_k8//:runtime"],
         "//tools:cpu_armhf": ["@halide_armhf//:runtime"],
-        "//conditions:default": [],
+        "//conditions:default": [":unavailable"],
     }),
 )
 
 cc_library(
     name = "webrtc",
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = cpu_select({
         "amd64": ["@webrtc_x64//:webrtc"],
@@ -114,14 +102,12 @@
     }),
 )
 
-# TODO(Brian): Properly restrict this to specific platforms and remove the
-# default deps once we have support for that which interacts with select properly.
 cc_library(
     name = "lzma",
     visibility = ["//visibility:public"],
     deps = select({
         "//tools:cpu_k8": ["@lzma_amd64//:lib"],
         "//tools:cpu_aarch64": ["@lzma_arm64//:lib"],
-        "//conditions:default": [],
+        "//conditions:default": [":unavailable"],
     }),
 )
diff --git a/third_party/Catch2/BUILD b/third_party/Catch2/BUILD
index 5dab07c..f318a06 100644
--- a/third_party/Catch2/BUILD
+++ b/third_party/Catch2/BUILD
@@ -7,5 +7,6 @@
     name = "Catch2",
     hdrs = ["catch/catch.hpp"],
     includes = ["."],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/GSL/BUILD b/third_party/GSL/BUILD
index 62a28f3..cd85e93 100644
--- a/third_party/GSL/BUILD
+++ b/third_party/GSL/BUILD
@@ -1,11 +1,9 @@
 licenses(["notice"])
 
-load("//tools:environments.bzl", "mcu_cpus")
 
 cc_library(
     name = "GSL",
     hdrs = glob(["include/**"]),
-    compatible_with = mcu_cpus,
     includes = ["include"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/GSL/tests/BUILD b/third_party/GSL/tests/BUILD
index 503a29f..4a0fcc6 100644
--- a/third_party/GSL/tests/BUILD
+++ b/third_party/GSL/tests/BUILD
@@ -26,6 +26,7 @@
         "-frtti",
         "-DGSL_THROW_ON_CONTRACT_VIOLATION",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":test",
         "//third_party/Catch2",
@@ -42,6 +43,7 @@
     copts = _copts + [
         "-DGSL_TERMINATE_ON_CONTRACT_VIOLATION",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":test",
         "//third_party/Catch2",
@@ -58,6 +60,7 @@
         "-frtti",
         "-DGSL_THROW_ON_CONTRACT_VIOLATION",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//third_party/Catch2",
         "//third_party/GSL",
diff --git a/third_party/allwpilib/BUILD b/third_party/allwpilib/BUILD
index 61f6098..bee2e64 100644
--- a/third_party/allwpilib/BUILD
+++ b/third_party/allwpilib/BUILD
@@ -34,6 +34,7 @@
     srcs = [
         "generate_FRCUsageReporting.py",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 genrule(
@@ -53,6 +54,7 @@
         "$(location hal/src/generate/ResourceType.txt)",
         "$(location hal/src/main/native/include/hal/FRCUsageReporting.h)",
     ]),
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         ":generate_FRCUsageReporting",
     ],
@@ -79,7 +81,7 @@
         "-Wno-cast-align",
     ],
     includes = _hal_header_dirs,
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     visibility = ["//third_party:__pkg__"],
     deps = [
         "//aos/logging",
diff --git a/third_party/allwpilib/wpiutil/BUILD b/third_party/allwpilib/wpiutil/BUILD
index 98ed173..8c1b8db 100644
--- a/third_party/allwpilib/wpiutil/BUILD
+++ b/third_party/allwpilib/wpiutil/BUILD
@@ -23,6 +23,6 @@
     includes = [
         "src/main/native/include",
     ],
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/bazel/BUILD b/third_party/bazel/BUILD
index 282cdad..4ff89c7 100644
--- a/third_party/bazel/BUILD
+++ b/third_party/bazel/BUILD
@@ -8,5 +8,6 @@
     srcs = [
         "protos/extra_actions_base_pb2.py",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/blasfeo/BUILD b/third_party/blasfeo/BUILD
index f6efd3c..1b6f8c1 100644
--- a/third_party/blasfeo/BUILD
+++ b/third_party/blasfeo/BUILD
@@ -79,7 +79,7 @@
     includes = [
         "include",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     textual_hdrs = [
         "blas/x_blas2_diag_lib.c",
     ],
diff --git a/third_party/boostorg/algorithm/BUILD b/third_party/boostorg/algorithm/BUILD
index 2531e98..8efc7ca 100644
--- a/third_party/boostorg/algorithm/BUILD
+++ b/third_party/boostorg/algorithm/BUILD
@@ -4,6 +4,7 @@
     name = "algorithm",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//third_party/boostorg/assert",
diff --git a/third_party/boostorg/any/BUILD b/third_party/boostorg/any/BUILD
index c260ecc..892d710 100644
--- a/third_party/boostorg/any/BUILD
+++ b/third_party/boostorg/any/BUILD
@@ -4,5 +4,6 @@
     name = "any",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/array/BUILD b/third_party/boostorg/array/BUILD
index 448d164..2dbb0e9 100644
--- a/third_party/boostorg/array/BUILD
+++ b/third_party/boostorg/array/BUILD
@@ -4,5 +4,6 @@
     name = "array",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/assert/BUILD b/third_party/boostorg/assert/BUILD
index 3aa13e1..db94e30 100644
--- a/third_party/boostorg/assert/BUILD
+++ b/third_party/boostorg/assert/BUILD
@@ -4,5 +4,6 @@
     name = "assert",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/atomic/BUILD b/third_party/boostorg/atomic/BUILD
index d28c896..a9aff83 100644
--- a/third_party/boostorg/atomic/BUILD
+++ b/third_party/boostorg/atomic/BUILD
@@ -4,5 +4,6 @@
     name = "atomic",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/bind/BUILD b/third_party/boostorg/bind/BUILD
index 71d64c2..d34bb82 100644
--- a/third_party/boostorg/bind/BUILD
+++ b/third_party/boostorg/bind/BUILD
@@ -4,5 +4,6 @@
     name = "bind",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/concept_check/BUILD b/third_party/boostorg/concept_check/BUILD
index e232b94..5dab6d7 100644
--- a/third_party/boostorg/concept_check/BUILD
+++ b/third_party/boostorg/concept_check/BUILD
@@ -4,5 +4,6 @@
     name = "concept_check",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/config/BUILD b/third_party/boostorg/config/BUILD
index 8b23ec2..093853d 100644
--- a/third_party/boostorg/config/BUILD
+++ b/third_party/boostorg/config/BUILD
@@ -4,6 +4,7 @@
     name = "config",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//third_party/boostorg/core",
diff --git a/third_party/boostorg/container/BUILD b/third_party/boostorg/container/BUILD
index e6813ba..f36f44b 100644
--- a/third_party/boostorg/container/BUILD
+++ b/third_party/boostorg/container/BUILD
@@ -4,5 +4,6 @@
     name = "container",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/container_hash/BUILD b/third_party/boostorg/container_hash/BUILD
index fcaef6c..0d44824 100644
--- a/third_party/boostorg/container_hash/BUILD
+++ b/third_party/boostorg/container_hash/BUILD
@@ -4,5 +4,6 @@
     name = "container_hash",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/core/BUILD b/third_party/boostorg/core/BUILD
index c93902b..51ea944 100644
--- a/third_party/boostorg/core/BUILD
+++ b/third_party/boostorg/core/BUILD
@@ -4,6 +4,7 @@
     name = "core",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//third_party/boostorg/static_assert",
diff --git a/third_party/boostorg/detail/BUILD b/third_party/boostorg/detail/BUILD
index d317109..94496ee 100644
--- a/third_party/boostorg/detail/BUILD
+++ b/third_party/boostorg/detail/BUILD
@@ -4,5 +4,6 @@
     name = "detail",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/foreach/BUILD b/third_party/boostorg/foreach/BUILD
index 25dce16..38dd8ab 100644
--- a/third_party/boostorg/foreach/BUILD
+++ b/third_party/boostorg/foreach/BUILD
@@ -4,5 +4,6 @@
     name = "foreach",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/format/BUILD b/third_party/boostorg/format/BUILD
index 96be264..e0c4123 100644
--- a/third_party/boostorg/format/BUILD
+++ b/third_party/boostorg/format/BUILD
@@ -4,5 +4,6 @@
     name = "format",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/function/BUILD b/third_party/boostorg/function/BUILD
index 92b7c11..e6e3ba3 100644
--- a/third_party/boostorg/function/BUILD
+++ b/third_party/boostorg/function/BUILD
@@ -4,5 +4,6 @@
     name = "function",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/function_types/BUILD b/third_party/boostorg/function_types/BUILD
index 50bbf55..31985ae 100644
--- a/third_party/boostorg/function_types/BUILD
+++ b/third_party/boostorg/function_types/BUILD
@@ -4,5 +4,6 @@
     name = "function_types",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/functional/BUILD b/third_party/boostorg/functional/BUILD
index 6f0c2d6..3d6b28a 100644
--- a/third_party/boostorg/functional/BUILD
+++ b/third_party/boostorg/functional/BUILD
@@ -4,5 +4,6 @@
     name = "functional",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/fusion/BUILD b/third_party/boostorg/fusion/BUILD
index e0e1e33..9a12bff 100644
--- a/third_party/boostorg/fusion/BUILD
+++ b/third_party/boostorg/fusion/BUILD
@@ -4,5 +4,6 @@
     name = "fusion",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/integer/BUILD b/third_party/boostorg/integer/BUILD
index daddbaf..a8b38dc 100644
--- a/third_party/boostorg/integer/BUILD
+++ b/third_party/boostorg/integer/BUILD
@@ -4,5 +4,6 @@
     name = "integer",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/iterator/BUILD b/third_party/boostorg/iterator/BUILD
index fa0d26d..5bb18d7 100644
--- a/third_party/boostorg/iterator/BUILD
+++ b/third_party/boostorg/iterator/BUILD
@@ -4,5 +4,6 @@
     name = "iterator",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/lexical_cast/BUILD b/third_party/boostorg/lexical_cast/BUILD
index 76185fe..9013614 100644
--- a/third_party/boostorg/lexical_cast/BUILD
+++ b/third_party/boostorg/lexical_cast/BUILD
@@ -4,5 +4,6 @@
     name = "lexical_cast",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/math/BUILD b/third_party/boostorg/math/BUILD
index cbc8581..97214f5 100644
--- a/third_party/boostorg/math/BUILD
+++ b/third_party/boostorg/math/BUILD
@@ -4,5 +4,6 @@
     name = "math",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/move/BUILD b/third_party/boostorg/move/BUILD
index e39c98b..8f09042 100644
--- a/third_party/boostorg/move/BUILD
+++ b/third_party/boostorg/move/BUILD
@@ -4,5 +4,6 @@
     name = "move",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/mpl/BUILD b/third_party/boostorg/mpl/BUILD
index d6c9685..72aefbb 100644
--- a/third_party/boostorg/mpl/BUILD
+++ b/third_party/boostorg/mpl/BUILD
@@ -4,5 +4,6 @@
     name = "mpl",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/multi_array/BUILD b/third_party/boostorg/multi_array/BUILD
index 89cac9e..e1ef0d3 100644
--- a/third_party/boostorg/multi_array/BUILD
+++ b/third_party/boostorg/multi_array/BUILD
@@ -4,5 +4,6 @@
     name = "multi_array",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/multi_index/BUILD b/third_party/boostorg/multi_index/BUILD
index 143fb0a..28ad13b 100644
--- a/third_party/boostorg/multi_index/BUILD
+++ b/third_party/boostorg/multi_index/BUILD
@@ -4,5 +4,6 @@
     name = "multi_index",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/numeric_conversion/BUILD b/third_party/boostorg/numeric_conversion/BUILD
index 053f6fc..900452c 100644
--- a/third_party/boostorg/numeric_conversion/BUILD
+++ b/third_party/boostorg/numeric_conversion/BUILD
@@ -4,5 +4,6 @@
     name = "numeric_conversion",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/odeint/BUILD b/third_party/boostorg/odeint/BUILD
index 0f5dfac..3900fb0 100644
--- a/third_party/boostorg/odeint/BUILD
+++ b/third_party/boostorg/odeint/BUILD
@@ -4,6 +4,7 @@
     name = "odeint",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//third_party/boostorg/assert",
diff --git a/third_party/boostorg/optional/BUILD b/third_party/boostorg/optional/BUILD
index b355d53..df2d1be 100644
--- a/third_party/boostorg/optional/BUILD
+++ b/third_party/boostorg/optional/BUILD
@@ -4,6 +4,7 @@
     name = "optional",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//third_party/boostorg/assert",
diff --git a/third_party/boostorg/predef/BUILD b/third_party/boostorg/predef/BUILD
index 9c04b7e..d245379 100644
--- a/third_party/boostorg/predef/BUILD
+++ b/third_party/boostorg/predef/BUILD
@@ -4,5 +4,6 @@
     name = "predef",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/preprocessor/BUILD b/third_party/boostorg/preprocessor/BUILD
index 7c7499a..d7d06d2 100644
--- a/third_party/boostorg/preprocessor/BUILD
+++ b/third_party/boostorg/preprocessor/BUILD
@@ -4,5 +4,6 @@
     name = "preprocessor",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/property_tree/BUILD b/third_party/boostorg/property_tree/BUILD
index 536ec40..fee61af 100644
--- a/third_party/boostorg/property_tree/BUILD
+++ b/third_party/boostorg/property_tree/BUILD
@@ -4,6 +4,7 @@
     name = "property_tree",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//third_party/boostorg/any",
diff --git a/third_party/boostorg/range/BUILD b/third_party/boostorg/range/BUILD
index b68cee7..7b96045 100644
--- a/third_party/boostorg/range/BUILD
+++ b/third_party/boostorg/range/BUILD
@@ -4,5 +4,6 @@
     name = "range",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/serialization/BUILD b/third_party/boostorg/serialization/BUILD
index 5f60759..87c8467 100644
--- a/third_party/boostorg/serialization/BUILD
+++ b/third_party/boostorg/serialization/BUILD
@@ -4,5 +4,6 @@
     name = "serialization",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/smart_ptr/BUILD b/third_party/boostorg/smart_ptr/BUILD
index f2f1352..46ced1b 100644
--- a/third_party/boostorg/smart_ptr/BUILD
+++ b/third_party/boostorg/smart_ptr/BUILD
@@ -4,5 +4,6 @@
     name = "smart_ptr",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/static_assert/BUILD b/third_party/boostorg/static_assert/BUILD
index da56484..f579b4a 100644
--- a/third_party/boostorg/static_assert/BUILD
+++ b/third_party/boostorg/static_assert/BUILD
@@ -4,5 +4,6 @@
     name = "static_assert",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/throw_exception/BUILD b/third_party/boostorg/throw_exception/BUILD
index 32998e8..153d8e2 100644
--- a/third_party/boostorg/throw_exception/BUILD
+++ b/third_party/boostorg/throw_exception/BUILD
@@ -4,6 +4,7 @@
     name = "throw_exception",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//third_party/boostorg/assert",
diff --git a/third_party/boostorg/tuple/BUILD b/third_party/boostorg/tuple/BUILD
index 040c778..ba44766 100644
--- a/third_party/boostorg/tuple/BUILD
+++ b/third_party/boostorg/tuple/BUILD
@@ -4,5 +4,6 @@
     name = "tuple",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/type_index/BUILD b/third_party/boostorg/type_index/BUILD
index 3801d5c..6731eea 100644
--- a/third_party/boostorg/type_index/BUILD
+++ b/third_party/boostorg/type_index/BUILD
@@ -4,5 +4,6 @@
     name = "type_index",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/type_traits/BUILD b/third_party/boostorg/type_traits/BUILD
index 672a32c..a8c8fb0 100644
--- a/third_party/boostorg/type_traits/BUILD
+++ b/third_party/boostorg/type_traits/BUILD
@@ -4,5 +4,6 @@
     name = "type_traits",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/typeof/BUILD b/third_party/boostorg/typeof/BUILD
index 781e0e1..da04272 100644
--- a/third_party/boostorg/typeof/BUILD
+++ b/third_party/boostorg/typeof/BUILD
@@ -4,5 +4,6 @@
     name = "typeof",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/ublas/BUILD b/third_party/boostorg/ublas/BUILD
index 4544f9f..2bccf3a 100644
--- a/third_party/boostorg/ublas/BUILD
+++ b/third_party/boostorg/ublas/BUILD
@@ -4,5 +4,6 @@
     name = "ublas",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/units/BUILD b/third_party/boostorg/units/BUILD
index 26e5dbb..e3c2aa2 100644
--- a/third_party/boostorg/units/BUILD
+++ b/third_party/boostorg/units/BUILD
@@ -4,5 +4,6 @@
     name = "units",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/boostorg/utility/BUILD b/third_party/boostorg/utility/BUILD
index 8d38605..2136e67 100644
--- a/third_party/boostorg/utility/BUILD
+++ b/third_party/boostorg/utility/BUILD
@@ -4,5 +4,6 @@
     name = "utility",
     hdrs = glob(["include/**"]),
     includes = ["include"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/cddlib/BUILD b/third_party/cddlib/BUILD
index fa2f50a..08684fc 100644
--- a/third_party/cddlib/BUILD
+++ b/third_party/cddlib/BUILD
@@ -31,6 +31,7 @@
         "gcc": ["-Wno-unused-but-set-variable"],
         "clang": [],
     }),
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -38,6 +39,7 @@
     name = "_cddlib.so",
     linkshared = True,
     linkstatic = False,
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [":cddlib"],
 )
diff --git a/third_party/cimg/BUILD b/third_party/cimg/BUILD
index 0dfc79b..fc73f38 100644
--- a/third_party/cimg/BUILD
+++ b/third_party/cimg/BUILD
@@ -6,6 +6,7 @@
         "CImg.h",
         "plugins/*.h",
     ]),
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//third_party/libjpeg",
diff --git a/third_party/ct/BUILD b/third_party/ct/BUILD
index ad7ce4b..39af5d7 100644
--- a/third_party/ct/BUILD
+++ b/third_party/ct/BUILD
@@ -268,7 +268,7 @@
         "ct_core/include/external",
         "ct_optcon/include",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     visibility = ["//visibility:public"],
     deps = [
         "//third_party/boostorg/algorithm",
diff --git a/third_party/eigen/BUILD b/third_party/eigen/BUILD
index 54c5cd1..02f259d 100644
--- a/third_party/eigen/BUILD
+++ b/third_party/eigen/BUILD
@@ -1,7 +1,5 @@
 licenses(["notice"])
 
-load("@//tools:environments.bzl", "mcu_cpus")
-
 cc_library(
     name = "eigen",
     srcs = glob(["Eigen/src/**/*.h"]),
@@ -20,7 +18,6 @@
     ) + ["unsupported/Eigen/MatrixFunctions"] + glob([
         "unsupported/Eigen/src/MatrixFunctions/*.h",
     ]),
-    compatible_with = mcu_cpus,
     includes = ["."],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/empty_config_h/BUILD b/third_party/empty_config_h/BUILD
index d1a8093..3cd587c 100644
--- a/third_party/empty_config_h/BUILD
+++ b/third_party/empty_config_h/BUILD
@@ -5,5 +5,6 @@
     hdrs = [
         "config.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//third_party:__subpackages__"],
 )
diff --git a/third_party/flatbuffers/BUILD b/third_party/flatbuffers/BUILD
index 3114495..57f2b8e 100644
--- a/third_party/flatbuffers/BUILD
+++ b/third_party/flatbuffers/BUILD
@@ -1,11 +1,9 @@
-licenses(["notice"])
-
-load("@//tools:environments.bzl", "mcu_cpus")
-
 package(
     default_visibility = ["//visibility:public"],
 )
 
+licenses(["notice"])
+
 exports_files([
     "LICENSE",
     "tsconfig.json",
@@ -79,7 +77,6 @@
         "include/flatbuffers/stl_emulation.h",
         "include/flatbuffers/util.h",
     ],
-    compatible_with = mcu_cpus,
     linkstatic = 1,
     strip_include_prefix = "/include",
 )
diff --git a/third_party/flatbuffers/build_defs.bzl b/third_party/flatbuffers/build_defs.bzl
index f496dab..5994848 100644
--- a/third_party/flatbuffers/build_defs.bzl
+++ b/third_party/flatbuffers/build_defs.bzl
@@ -53,8 +53,10 @@
         reflection_visibility = None,
         compatible_with = None,
         restricted_to = None,
+        target_compatible_with = None,
         output_to_bindir = False):
-    """Generates code files for reading/writing the given flatbuffers in the requested language using the public compiler.
+    """Generates code files for reading/writing the given flatbuffers in the
+    requested language using the public compiler.
 
     Args:
       name: Rule name.
@@ -74,6 +76,8 @@
         built for, in addition to default-supported environments.
       restricted_to: Optional, The list of environments this rule can be built
         for, instead of default-supported environments.
+      target_compatible_with: Optional, the list of constraints the target
+        platform must satisfy for this target to be considered compatible.
       output_to_bindir: Passed to genrule for output to bin directory.
 
 
@@ -109,6 +113,7 @@
         cmd = genrule_cmd,
         compatible_with = compatible_with,
         restricted_to = restricted_to,
+        target_compatible_with = target_compatible_with,
         message = "Generating flatbuffer files for %s:" % (name),
     )
     if reflection_name:
@@ -136,6 +141,7 @@
             tools = [flatc_path],
             compatible_with = compatible_with,
             restricted_to = restricted_to,
+            target_compatible_with = target_compatible_with,
             cmd = reflection_genrule_cmd,
             message = "Generating flatbuffer reflection binary for %s:" % (name),
         )
@@ -158,6 +164,7 @@
         visibility = None,
         compatible_with = None,
         restricted_to = None,
+        target_compatible_with = None,
         srcs_filegroup_visibility = None,
         gen_reflections = False):
     '''A cc_library with the generated reader/writers for the given flatbuffer definitions.
@@ -177,6 +184,8 @@
           (e.g. --gen-mutable).
       visibility: The visibility of the generated cc_library. By default, use the
           default visibility of the project.
+      target_compatible_with: Optional, the list of constraints the target
+        platform must satisfy for this target to be considered compatible.
       srcs_filegroup_visibility: The visibility of the generated srcs filegroup.
           By default, use the value of the visibility parameter above.
       gen_reflections: Optional, if true this will generate the flatbuffer
@@ -240,6 +249,7 @@
         includes = includes,
         include_paths = include_paths,
         flatc_args = flatc_args,
+        target_compatible_with = target_compatible_with,
         compatible_with = compatible_with,
         restricted_to = restricted_to,
         reflection_name = reflection_name,
@@ -262,6 +272,7 @@
         includes = [],
         compatible_with = compatible_with,
         restricted_to = restricted_to,
+        target_compatible_with = target_compatible_with,
         linkstatic = 1,
         visibility = visibility,
     )
@@ -282,6 +293,7 @@
         namespace,
         tables,
         compatible_with = None,
+        target_compatible_with = None,
         includes = [],
         include_paths = DEFAULT_INCLUDE_PATHS,
         flatc_args = DEFAULT_FLATC_ARGS,
@@ -315,12 +327,14 @@
         include_paths = include_paths,
         flatc_args = flatc_args,
         compatible_with = compatible_with,
+        target_compatible_with = target_compatible_with,
     )
     native.py_library(
         name = name,
         srcs = python_files,
         visibility = visibility,
         compatible_with = compatible_with,
+        target_compatible_with = target_compatible_with,
         imports = ["."],
         deps = ["@com_github_google_flatbuffers//:flatpy"],
     )
@@ -329,6 +343,7 @@
         name,
         srcs,
         compatible_with = None,
+        target_compatible_with = None,
         includes = [],
         include_paths = DEFAULT_INCLUDE_PATHS,
         flatc_args = DEFAULT_FLATC_TS_ARGS,
@@ -351,12 +366,14 @@
         include_paths = include_paths,
         flatc_args = flatc_args,
         compatible_with = compatible_with,
+        target_compatible_with = target_compatible_with,
     )
     ts_library(
         name = name,
         srcs = outs,
         visibility = visibility,
         compatible_with = compatible_with,
+        target_compatible_with = target_compatible_with,
         deps = [
             "@npm//@types",
         ],
diff --git a/third_party/flatbuffers/grpc/src/compiler/BUILD b/third_party/flatbuffers/grpc/src/compiler/BUILD
index d3ffd1f..12972c7 100644
--- a/third_party/flatbuffers/grpc/src/compiler/BUILD
+++ b/third_party/flatbuffers/grpc/src/compiler/BUILD
@@ -1,4 +1,3 @@
-
 package(
     default_visibility = ["//visibility:public"],
 )
diff --git a/third_party/flatbuffers/src/BUILD b/third_party/flatbuffers/src/BUILD
index 41968b6..63f0426 100644
--- a/third_party/flatbuffers/src/BUILD
+++ b/third_party/flatbuffers/src/BUILD
@@ -2,7 +2,6 @@
     default_visibility = ["//visibility:private"],
 )
 
-
 # Public flatc library to compile flatbuffer files at runtime.
 cc_library(
     name = "flatbuffers",
diff --git a/third_party/flatbuffers/tests/BUILD b/third_party/flatbuffers/tests/BUILD
index 203a08c..6fbda6b 100644
--- a/third_party/flatbuffers/tests/BUILD
+++ b/third_party/flatbuffers/tests/BUILD
@@ -14,13 +14,13 @@
         "namespace_test/namespace_test2_generated.h",
         "native_type_test_impl.cpp",
         "native_type_test_impl.h",
+        "optional_scalars_generated.h",
         "test.cpp",
         "test_assert.cpp",
         "test_assert.h",
         "test_builder.cpp",
         "test_builder.h",
         "union_vector/union_vector_generated.h",
-        "optional_scalars_generated.h",
     ],
     copts = [
         "-DFLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE",
@@ -43,6 +43,7 @@
         ":monsterdata_test.golden",
         ":monsterdata_test.json",
         ":native_type_test.fbs",
+        ":optional_scalars.fbs",
         ":prototest/imported.proto",
         ":prototest/test.golden",
         ":prototest/test.proto",
@@ -54,7 +55,6 @@
         ":unicode_test.json",
         ":union_vector/union_vector.fbs",
         ":union_vector/union_vector.json",
-        ":optional_scalars.fbs",
     ],
     includes = [
         "",
diff --git a/third_party/gmp/BUILD b/third_party/gmp/BUILD
index 42c04d6..d4ce062 100644
--- a/third_party/gmp/BUILD
+++ b/third_party/gmp/BUILD
@@ -37,10 +37,11 @@
         "arm",
         "generic",
     ],
-    "@//tools:cpu_cortex_m4f_k22": [
-        "arm",
-        "generic",
-    ],
+    # TODO(phil): Support this properly.
+    #"@//tools:cpu_cortex_m4f_k22": [
+    #    "arm",
+    #    "generic",
+    #],
 }
 
 # gmp's tools leak memory on purpose. Just skip asan for them.
@@ -51,6 +52,7 @@
     srcs = file_from_architecture(architecture_paths, "gmp.h"),
     outs = ["gmp.h"],
     cmd = "cp $< $@",
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 genrule(
@@ -58,6 +60,7 @@
     srcs = file_from_architecture(architecture_paths, "config.m4"),
     outs = ["config.m4"],
     cmd = "cp $< $@",
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 copts_common = [
@@ -100,6 +103,7 @@
 
 cc_library(
     name = "bootstrap",
+    target_compatible_with = ["@platforms//os:linux"],
     textual_hdrs = [
         "bootstrap.c",
         "mini-gmp/mini-gmp.c",
@@ -112,6 +116,7 @@
     srcs = ["gen-fac.c"],
     copts = copts,
     features = tool_features,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":bootstrap"],
 )
 
@@ -126,6 +131,7 @@
     name = "fac_table_h",
     outs = ["fac_table.h"],
     cmd = "$(location :gen-fac) " + limb_bits + " " + nail_bits + " > $@",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [":gen-fac"],
 )
 
@@ -134,6 +140,7 @@
     srcs = ["gen-fib.c"],
     copts = copts,
     features = tool_features,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":bootstrap"],
 )
 
@@ -141,6 +148,7 @@
     name = "fib_table_h",
     outs = ["fib_table.h"],
     cmd = "$(location :gen-fib) header " + limb_bits + " " + nail_bits + " > $@",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [":gen-fib"],
 )
 
@@ -148,6 +156,7 @@
     name = "fib_table_c",
     outs = ["mpn/fib_table.c"],
     cmd = "$(location :gen-fib) table " + limb_bits + " " + nail_bits + " > $@",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [":gen-fib"],
 )
 
@@ -156,6 +165,7 @@
     srcs = ["gen-bases.c"],
     copts = copts,
     features = tool_features,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":bootstrap"],
 )
 
@@ -163,6 +173,7 @@
     name = "mp_bases_h",
     outs = ["mp_bases.h"],
     cmd = "$(location :gen-bases) header " + limb_bits + " " + nail_bits + " > $@",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [":gen-bases"],
 )
 
@@ -170,6 +181,7 @@
     name = "mp_bases_c",
     outs = ["mpn/mp_bases.c"],
     cmd = "$(location :gen-bases) table " + limb_bits + " " + nail_bits + " > $@",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [":gen-bases"],
 )
 
@@ -178,6 +190,7 @@
     srcs = ["gen-trialdivtab.c"],
     copts = copts,
     features = tool_features,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":bootstrap"],
 )
 
@@ -185,6 +198,7 @@
     name = "trialdivtab_h",
     outs = ["trialdivtab.h"],
     cmd = "$(location :gen-trialdivtab) " + limb_bits + " 8000 > $@",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [":gen-trialdivtab"],
 )
 
@@ -192,6 +206,7 @@
     name = "gen-jacobitab",
     srcs = ["gen-jacobitab.c"],
     copts = copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":bootstrap"],
 )
 
@@ -199,6 +214,7 @@
     name = "jacobitab_h",
     outs = ["mpn/jacobitab.h"],
     cmd = "$(location :gen-jacobitab) > $@",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [":gen-jacobitab"],
 )
 
@@ -206,6 +222,7 @@
     name = "gen-psqr",
     srcs = ["gen-psqr.c"],
     copts = copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":bootstrap"],
 )
 
@@ -213,6 +230,7 @@
     name = "perfsqr_h",
     outs = ["mpn/perfsqr.h"],
     cmd = "$(location :gen-psqr) " + limb_bits + " " + nail_bits + " > $@",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [":gen-psqr"],
 )
 
@@ -453,6 +471,7 @@
     mpn_m4_cc_library(
         name = x,
         architecture_paths = architecture_paths,
+        target_compatible_with = ["@platforms//os:linux"],
     )
     for x in gmp_mpn_functions
 ]
@@ -493,6 +512,7 @@
         "-Wno-unused-command-line-argument",
         "-Wa,--noexecstack",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 # TODO(austin): Can we run these through the mpn_m4_cc_library and get operation baked in without work?
@@ -502,6 +522,7 @@
         "mpn/fib_table.c",
     ],
     copts = copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":mpn_core"],
 )
 
@@ -511,11 +532,13 @@
         "mpn/mp_bases.c",
     ],
     copts = copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":mpn_core"],
 )
 
 cc_library(
     name = "mpn",
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":fib_table",
         ":mp_bases",
@@ -692,6 +715,7 @@
         "mpz/xor.c",
     ],
     copts = copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":mpn",
     ],
@@ -734,6 +758,7 @@
         "mpq/swap.c",
     ],
     copts = copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":mpn",
     ],
@@ -813,6 +838,7 @@
         "mpf/urandomb.c",
     ],
     copts = copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":mpn",
     ],
@@ -844,6 +870,7 @@
         "printf/vsprintf.c",
     ],
     copts = copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":mpn",
     ],
@@ -863,6 +890,7 @@
         "scanf/vsscanf.c",
     ],
     copts = copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":mpn",
     ],
@@ -887,6 +915,7 @@
         "rand/randsdui.c",
     ],
     copts = copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":mpn",
     ],
@@ -908,6 +937,7 @@
         "cxx/osmpz.cc",
     ],
     copts = ccopts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":mpn",
     ],
@@ -916,6 +946,7 @@
 cc_library(
     name = "gmp",
     includes = ["."],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":cxx",
@@ -941,6 +972,7 @@
               "amd64": "amd64call.asm",
           }) +
           " > $${ROOT}/$@",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "@m4_v1.4.18//:bin",
         "@m4_v1.4.18//:lib",
@@ -977,6 +1009,7 @@
         ".",
         "tests",
     ] + ["mpn/" + p for p in architecture_paths],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":gmp"],
 )
 
@@ -984,6 +1017,7 @@
     name = "tests/" + x,
     srcs = ["tests/" + x + ".c"],
     copts = copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":testlib"],
 ) for x in [
     "t-bswap",
@@ -1000,6 +1034,7 @@
     name = "tests/mpn/" + x,
     srcs = ["tests/mpn/" + x + ".c"],
     copts = copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":testlib"],
 ) for x in [
     "t-asmtype",
@@ -1058,6 +1093,7 @@
     name = "tests/mpz/" + x,
     srcs = ["tests/mpz/" + x + ".c"],
     copts = copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":testlib"],
 ) for x in [
     "reuse",
@@ -1130,6 +1166,7 @@
     name = "tests/mpq/" + x,
     srcs = ["tests/mpq/" + x + ".c"],
     copts = copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":testlib"],
 ) for x in [
     "t-aors",
@@ -1153,6 +1190,7 @@
     name = "tests/mpf/" + x,
     srcs = ["tests/mpf/" + x + ".c"],
     copts = copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":testlib"],
 ) for x in [
     "t-dm2exp",
@@ -1189,6 +1227,7 @@
     name = "tests/rand/" + x,
     srcs = ["tests/rand/" + x + ".c"],
     copts = copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":testlib"],
 ) for x in [
     "t-iset",
@@ -1204,6 +1243,7 @@
     name = "tests/misc/" + x,
     srcs = ["tests/misc/" + x + ".c"],
     copts = copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":testlib"],
 ) for x in [
     "t-printf",
@@ -1215,6 +1255,7 @@
     name = "tests/cxx/" + x,
     srcs = ["tests/cxx/" + x + ".cc"],
     copts = copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":testlib"],
 ) for x in [
     "t-binary",
diff --git a/third_party/gmp/mpn.bzl b/third_party/gmp/mpn.bzl
index 039725f..668df8d 100644
--- a/third_party/gmp/mpn.bzl
+++ b/third_party/gmp/mpn.bzl
@@ -56,7 +56,8 @@
         srcs,
         hdrs = [],
         copts = [],
-        deps = []):
+        deps = [],
+        target_compatible_with = None):
     native.cc_library(
         name = name,
         srcs = srcs,
@@ -70,6 +71,7 @@
             "-DOPERATION_" + name,
         ],
         deps = deps,
+        target_compatible_with = target_compatible_with,
     )
 
 def _m4_mpn_function_impl(ctx):
@@ -164,7 +166,7 @@
         result[key] = ["-I" + current_directory() + "/config/" + architecture_paths[key][0] + "/"]
     return select(result)
 
-def mpn_m4_cc_library(name, architecture_paths):
+def mpn_m4_cc_library(name, architecture_paths, target_compatible_with = None):
     # Search architecture_paths in order from 0 to N.
     # From there, search starting with the main name, then start looking at the alternatives.
     # And then look for .c or .asm
@@ -190,4 +192,5 @@
         operation = name,
         files = select(architecture_globs),
         deps = native.glob(["**/*.m4", "**/*.asm"]) + ["config.m4"],
+        target_compatible_with = target_compatible_with,
     )
diff --git a/third_party/google-benchmark/test/BUILD b/third_party/google-benchmark/test/BUILD
index 8d1ef8d..4ab8633 100644
--- a/third_party/google-benchmark/test/BUILD
+++ b/third_party/google-benchmark/test/BUILD
@@ -10,17 +10,17 @@
     "-fstrict-aliasing",
 ]
 
-PER_SRC_COPTS = ({
+PER_SRC_COPTS = {
     "cxx03_test.cc": ["-std=c++03"],
     # Some of the issues with DoNotOptimize only occur when optimization is enabled
     "donotoptimize_test.cc": ["-O3"],
-})
+}
 
 TEST_ARGS = ["--benchmark_min_time=0.01"]
 
-PER_SRC_TEST_ARGS = ({
+PER_SRC_TEST_ARGS = {
     "user_counters_tabular_test.cc": ["--benchmark_counters_tabular=true"],
-})
+}
 
 cc_library(
     name = "output_test_helper",
diff --git a/third_party/gperftools/BUILD b/third_party/gperftools/BUILD
index de30a96..7813282 100644
--- a/third_party/gperftools/BUILD
+++ b/third_party/gperftools/BUILD
@@ -142,6 +142,7 @@
         "-lpthread",
     ],
     nocopts = "-std=gnu\\+\\+1y",
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//third_party/empty_config_h",
@@ -158,6 +159,7 @@
         "src/tests/testutil.h",
     ],
     copts = common_copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":tcmalloc",
     ],
@@ -173,6 +175,7 @@
     defines = [
         "NO_TCMALLOC_SAMPLES",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":tcmalloc",
     ],
@@ -185,6 +188,7 @@
         "src/tests/atomicops_unittest.cc",
     ],
     copts = common_copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":tcmalloc",
     ],
@@ -197,6 +201,7 @@
         "src/tests/stacktrace_unittest.cc",
     ],
     copts = common_copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":tcmalloc",
     ],
@@ -213,6 +218,7 @@
         #Add this back in when we upgrade clang.
         #'-Wno-mismatched-new-delete',
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":tcmalloc",
         ":testutil",
@@ -228,6 +234,7 @@
     copts = common_copts + [
         "-fno-builtin",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":tcmalloc",
     ],
@@ -240,6 +247,7 @@
         "src/tests/addressmap_unittest.cc",
     ],
     copts = common_copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":tcmalloc",
     ],
@@ -254,6 +262,7 @@
     copts = common_copts + [
         "-fno-builtin",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":tcmalloc",
     ],
@@ -266,6 +275,7 @@
         "src/tests/packed-cache_test.cc",
     ],
     copts = common_copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":tcmalloc",
     ],
@@ -278,6 +288,7 @@
         "src/tests/frag_unittest.cc",
     ],
     copts = common_copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":tcmalloc",
     ],
@@ -290,6 +301,7 @@
         "src/tests/markidle_unittest.cc",
     ]),
     copts = common_copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":tcmalloc",
         ":testutil",
@@ -303,6 +315,7 @@
         "src/tests/current_allocated_bytes_test.cc",
     ],
     copts = common_copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":tcmalloc",
     ],
@@ -320,6 +333,7 @@
         ],
         "clang": [],
     }),
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":tcmalloc",
         ":testutil",
@@ -333,6 +347,7 @@
         "src/tests/malloc_extension_test.cc",
     ]),
     copts = common_copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":tcmalloc",
     ],
@@ -345,6 +360,7 @@
         "src/tests/malloc_extension_c_test.c",
     ]),
     copts = common_copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":tcmalloc",
     ],
@@ -357,6 +373,7 @@
         "src/tests/memalign_unittest.cc",
     ]),
     copts = common_copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":tcmalloc",
         ":testutil",
@@ -370,6 +387,7 @@
         "src/tests/page_heap_test.cc",
     ],
     copts = common_copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":tcmalloc",
     ],
@@ -382,6 +400,7 @@
         "src/tests/pagemap_unittest.cc",
     ]),
     copts = common_copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":tcmalloc",
     ],
@@ -394,6 +413,7 @@
         "src/tests/realloc_unittest.cc",
     ],
     copts = common_copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":tcmalloc",
     ],
@@ -406,6 +426,7 @@
         "src/tests/stack_trace_table_test.cc",
     ],
     copts = common_copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":tcmalloc",
     ],
@@ -418,6 +439,7 @@
         "src/tests/thread_dealloc_unittest.cc",
     ],
     copts = common_copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":tcmalloc",
         ":testutil",
@@ -446,6 +468,7 @@
         "src/tests/large_heap_fragmentation_unittest.cc",
     ]),
     copts = common_copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":tcmalloc",
     ],
@@ -458,6 +481,7 @@
         "src/tests/raw_printer_test.cc",
     ],
     copts = common_copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":tcmalloc",
     ],
@@ -470,6 +494,7 @@
         "src/tests/getpc_test.cc",
     ]),
     copts = common_copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":tcmalloc",
     ],
@@ -482,6 +507,7 @@
         "src/tests/profiledata_unittest.cc",
     ],
     copts = common_copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":tcmalloc",
     ],
@@ -495,6 +521,7 @@
     ],
     copts = common_copts,
     flaky = True,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":tcmalloc",
     ],
@@ -507,6 +534,7 @@
         "src/tests/heap-profiler_unittest.cc",
     ],
     copts = common_copts,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":tcmalloc",
     ],
@@ -521,6 +549,7 @@
     copts = common_copts + [
         "-Wno-type-limits",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":tcmalloc",
     ],
diff --git a/third_party/hpipm/BUILD b/third_party/hpipm/BUILD
index f152d5a..adae276 100644
--- a/third_party/hpipm/BUILD
+++ b/third_party/hpipm/BUILD
@@ -66,7 +66,7 @@
         "-Wno-unused-parameter",
     ],
     includes = ["include"],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     textual_hdrs = [
         "ocp_qp/x_ocp_qp_sol.c",
         "dense_qp/x_dense_qp.c",
diff --git a/third_party/jsont/BUILD b/third_party/jsont/BUILD
index dc1d03d..be9e94d 100644
--- a/third_party/jsont/BUILD
+++ b/third_party/jsont/BUILD
@@ -9,6 +9,7 @@
         "jsont.h",
     ],
     includes = ["."],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -24,5 +25,6 @@
         ],
         "//conditions:default": [],
     }),
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":jsont"],
 )
diff --git a/third_party/libevent/BUILD b/third_party/libevent/BUILD
index 347ec0b..744a019 100644
--- a/third_party/libevent/BUILD
+++ b/third_party/libevent/BUILD
@@ -169,6 +169,7 @@
         ".",
         "include",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     textual_hdrs = [
         "arc4random.c",
     ],
diff --git a/third_party/libjpeg/BUILD b/third_party/libjpeg/BUILD
index f5b2d12..0b34cb7 100644
--- a/third_party/libjpeg/BUILD
+++ b/third_party/libjpeg/BUILD
@@ -77,5 +77,6 @@
         "//conditions:default": [],
     }),
     includes = ["src/main/c"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/lksctp-tools/BUILD b/third_party/lksctp-tools/BUILD
index b127b77..f6edcb5 100644
--- a/third_party/lksctp-tools/BUILD
+++ b/third_party/lksctp-tools/BUILD
@@ -9,6 +9,7 @@
         "src/include/netinet/sctp.h",
     ],
     cmd = "cp $< $@",
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_library(
@@ -31,5 +32,6 @@
     includes = [
         "src/include",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/matplotlib-cpp/BUILD b/third_party/matplotlib-cpp/BUILD
index 95f7192..4f1f004 100644
--- a/third_party/matplotlib-cpp/BUILD
+++ b/third_party/matplotlib-cpp/BUILD
@@ -9,7 +9,7 @@
         "@matplotlib_repo//:matplotlib3",
         "@python_repo//:all_files",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "@python_repo//:python3.5_lib",
@@ -21,7 +21,7 @@
     srcs = [
         "examples/basic.cpp",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "matplotlib-cpp",
     ],
@@ -32,7 +32,7 @@
     srcs = [
         "examples/animation.cpp",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "matplotlib-cpp",
     ],
diff --git a/third_party/protobuf/protobuf.bzl b/third_party/protobuf/protobuf.bzl
index a125606..ae3ea54 100644
--- a/third_party/protobuf/protobuf.bzl
+++ b/third_party/protobuf/protobuf.bzl
@@ -209,7 +209,7 @@
         internal_bootstrap_hack=False,
         use_grpc_plugin=False,
         default_runtime="@com_google_protobuf//:protobuf",
-        compatible_with = None,
+        target_compatible_with = None,
         copts = [],
         **kargs):
   """Bazel rule to create a C++ protobuf library from proto source files
@@ -277,7 +277,7 @@
       plugin_language="grpc",
       gen_cc=1,
       outs=outs,
-      compatible_with = compatible_with,
+      target_compatible_with = target_compatible_with,
       visibility=["//visibility:public"],
   )
 
@@ -293,7 +293,7 @@
       deps=cc_libs + deps,
       includes=includes,
       copts = COPTS + copts,
-      compatible_with = compatible_with,
+      target_compatible_with = target_compatible_with,
       **kargs)
 
 def internal_gen_well_known_protos_java(srcs):
diff --git a/third_party/pycrc/BUILD b/third_party/pycrc/BUILD
index 50a21e1..5c71234 100644
--- a/third_party/pycrc/BUILD
+++ b/third_party/pycrc/BUILD
@@ -9,6 +9,7 @@
         "pycrc_main.py",
     ],
     cmd = "cp $< $@",
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 py_binary(
@@ -21,5 +22,6 @@
     imports = ["."],
     legacy_create_init = False,
     main = "pycrc_main.py",
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/third_party/seasocks/BUILD b/third_party/seasocks/BUILD
index e2b13eb..db37def 100644
--- a/third_party/seasocks/BUILD
+++ b/third_party/seasocks/BUILD
@@ -23,5 +23,6 @@
         "-Wno-unused-parameter",
     ],
     includes = ["src/main/c"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/tools/BUILD b/tools/BUILD
index 50c9141..3acd443 100644
--- a/tools/BUILD
+++ b/tools/BUILD
@@ -7,44 +7,47 @@
     name = "compiler_clang",
     flag_values = {
         "@bazel_tools//tools/cpp:compiler": "clang",
-    }
+    },
 )
 
 config_setting(
     name = "compiler_gcc",
     flag_values = {
         "@bazel_tools//tools/cpp:compiler": "gcc",
-    }
+    },
 )
 
+# TODO(phil): Get rid of these and just use the constraint values directly
+# everywhere.
 config_setting(
     name = "cpu_k8",
-    values = {"cpu": "k8"},
+    constraint_values = ["@platforms//cpu:x86_64"],
 )
 
 config_setting(
     name = "cpu_roborio",
-    values = {"cpu": "roborio"},
+    constraint_values = ["@//tools/platforms/hardware:roborio"],
 )
 
 config_setting(
     name = "cpu_cortex_m4f",
-    values = {"cpu": "cortex-m4f"},
+    constraint_values = ["@//tools/platforms/hardware:cortex_m4f"],
 )
 
-config_setting(
-    name = "cpu_cortex_m4f_k22",
-    values = {"cpu": "cortex-m4f-k22"},
-)
+# TODO(phil): Re-enable this with proper support.
+#config_setting(
+#    name = "cpu_cortex_m4f_k22",
+#    constraint_values = ["@platforms//cpu:?"],
+#)
 
 config_setting(
     name = "cpu_armhf",
-    values = {"cpu": "armhf-debian"},
+    constraint_values = ["@//tools/platforms/hardware:raspberry_pi"],
 )
 
 config_setting(
     name = "cpu_aarch64",
-    values = {"cpu": "aarch64"},
+    constraint_values = ["@platforms//cpu:arm64"],
 )
 
 config_setting(
@@ -61,33 +64,3 @@
     name = "has_ubsan",
     values = {"define": "have_ubsan=true"},
 )
-
-environment(name = "k8")
-
-environment(name = "armhf-debian")
-
-environment(name = "roborio")
-
-environment(name = "cortex-m4f")
-
-environment(name = "cortex-m4f-k22")
-
-environment(name = "aarch64")
-
-environment_group(
-    name = "cpus",
-    defaults = [
-        ":k8",
-        ":roborio",
-        ":aarch64",
-        ":armhf-debian",
-    ],
-    environments = [
-        ":k8",
-        ":roborio",
-        ":armhf-debian",
-        ":cortex-m4f",
-        ":cortex-m4f-k22",
-        ":aarch64",
-    ],
-)
diff --git a/tools/actions/BUILD b/tools/actions/BUILD
index 46c9541..7c69bfb 100644
--- a/tools/actions/BUILD
+++ b/tools/actions/BUILD
@@ -3,6 +3,7 @@
     srcs = [
         "generate_compile_command.py",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//third_party/bazel:extra_actions_proto_py",
     ],
@@ -14,6 +15,7 @@
     mnemonics = [
         "CppCompile",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -24,6 +26,7 @@
     out_templates = [
         "$(ACTION_ID)_compile_command",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         ":generate_compile_command",
     ],
diff --git a/tools/build_rules/BUILD b/tools/build_rules/BUILD
index 8ad7018..cf27ca0 100644
--- a/tools/build_rules/BUILD
+++ b/tools/build_rules/BUILD
@@ -1,12 +1,14 @@
 sh_binary(
     name = "quiet_success",
     srcs = ["quiet_success.sh"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
 py_binary(
     name = "jinja2_generator",
     srcs = ["jinja2_generator.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = ["@python_jinja2"],
 )
diff --git a/tools/build_rules/fortran.bzl b/tools/build_rules/fortran.bzl
index 9e6e789..d55f1c1 100644
--- a/tools/build_rules/fortran.bzl
+++ b/tools/build_rules/fortran.bzl
@@ -1,109 +1,5 @@
 load("@//tools/build_rules:select.bzl", "compiler_select")
 
-def _single_fortran_object_impl(ctx):
-    toolchain_cflags = (ctx.fragments.cpp.compiler_options([]) +
-                        ctx.fragments.cpp.c_options +
-                        ctx.fragments.cpp.unfiltered_compiler_options([]) +
-                        [
-                            "-fPIC",
-                            "-Wno-maybe-uninitialized",
-                            "-Wno-unused-dummy-argument",
-                            "-Wno-conversion",
-                            "-Wno-unused-variable",
-                            "-Wno-character-truncation",
-                        ])
-
-    cmd = toolchain_cflags + ["-c", ctx.file.src.path, "-o", ctx.outputs.pic_o.path]
-    filtered_cmd = []
-
-    # Strip out the C/C++/Clang specific flags.
-    exclude_flags = [
-        "-fcolor-diagnostics",
-        "-Wswitch-enum",
-        "-Wpointer-arith",
-        "-Wcast-qual",
-        "-Wwrite-strings",
-        "-Wsign-compare",
-        "-Wformat=2",
-        "-Werror",
-        "-Wextra",
-        "-Wno-builtin-macro-redefined",
-        "-Wunused-local-typedefs",
-        "-D__has_feature(x)=0",
-        "-fmacro-backtrace-limit=0",
-    ]
-
-    for flag in cmd:
-        if flag not in exclude_flags and not (flag.startswith("-fsanitize") or
-                                              flag.startswith("-fno-sanitize")):
-            filtered_cmd.append(flag)
-
-    ctx.action(
-        inputs = [ctx.file.src] + ctx.files._cc_toolchain,
-        outputs = [ctx.outputs.pic_o],
-        mnemonic = "Fortran",
-        executable = ctx.fragments.cpp.compiler_executable,
-        arguments = filtered_cmd,
-        progress_message = "Building %s" % ctx.outputs.pic_o.short_path,
-    )
-
-def _define_fortran_output(src):
-    if not src.name.endswith(".f"):
-        fail("Fortran files must end in '.f'", "src")
-
-    fortran_file_base = src.name[:-2]
-    return {
-        "pic_o": fortran_file_base + ".pic.o",
-    }
-
-_single_fortran_object = rule(
-    attrs = {
-        "src": attr.label(
-            allow_single_file = [".f"],
-        ),
-        "cc_libs": attr.label_list(providers = ["cc"]),
-        # TODO(Brian): Replace this with something more fine-grained from the
-        # configuration fragment or something.
-        "_cc_toolchain": attr.label(
-            default = Label("@//tools/cpp:toolchain"),
-        ),
-    },
-    fragments = [
-        "cpp",
-    ],
-    outputs = _define_fortran_output,
-    implementation = _single_fortran_object_impl,
-)
-
-def fortran_library(name, srcs, deps = [], visibility = None):
-    """Builds a shared library from a set of fortran files.
-
-    Args:
-      srcs: list of fortran files ending in .f
-      deps: cc_library or fortran_library dependencies.
-    """
-    pic_o_files = []
-    for src in srcs:
-        pic_o_file = src[:-2] + ".pic.o"
-        _single_fortran_object(
-            name = name + "_" + pic_o_file,
-            src = src,
-            visibility = ["//visibility:private"],
-            restricted_to = ["@//tools:k8"],
-        )
-        pic_o_files.append(pic_o_file)
-
-    native.cc_library(
-        name = name,
-        deps = deps,
-        srcs = pic_o_files,
-        linkopts = [
-            "-lgfortran",
-        ],
-        visibility = visibility,
-        restricted_to = ["@//tools:k8"],
-    )
-
 f2c_copts = compiler_select({
     "clang": [
         "-Wno-incompatible-pointer-types-discards-qualifiers",
diff --git a/tools/build_rules/pandoc.bzl b/tools/build_rules/pandoc.bzl
index bc63bac..ad47ccc 100644
--- a/tools/build_rules/pandoc.bzl
+++ b/tools/build_rules/pandoc.bzl
@@ -6,7 +6,7 @@
   src: Markdown file to convert. Only one file can be specified.
 """
 
-def pandoc_html(name, src):
+def pandoc_html(name, src, target_compatible_with = None):
     output = name + ".html"
     native.genrule(
         name = name,
@@ -15,4 +15,5 @@
         cmd = "$(location @pandoc//:pandoc_wrapper) -s $< -o $@",
         tools = ["@pandoc//:all_files", "@pandoc//:pandoc_wrapper"],
         executable = True,
+        target_compatible_with = target_compatible_with,
     )
diff --git a/tools/build_rules/select.bzl b/tools/build_rules/select.bzl
index 1c48eb7..23addf5 100644
--- a/tools/build_rules/select.bzl
+++ b/tools/build_rules/select.bzl
@@ -46,7 +46,8 @@
         "@//tools:cpu_roborio": values["roborio"],
         "@//tools:cpu_armhf": values["armhf"],
         "@//tools:cpu_cortex_m4f": values["cortex-m"],
-        "@//tools:cpu_cortex_m4f_k22": values["cortex-m"],
+        # TODO(phil): Support this properly.
+        #"@//tools:cpu_cortex_m4f_k22": values["cortex-m"],
     })
 
 """A select wrapper for address space sizes.
@@ -66,7 +67,8 @@
         "@//tools:cpu_roborio": values["32"],
         "@//tools:cpu_armhf": values["32"],
         "@//tools:cpu_cortex_m4f": values["32"],
-        "@//tools:cpu_cortex_m4f_k22": values["32"],
+        # TODO(phil): Support this properly.
+        #"@//tools:cpu_cortex_m4f_k22": values["32"],
     })
 
 """A select wrapper for compilers.
diff --git a/tools/ci/run-tests.sh b/tools/ci/run-tests.sh
index fd92ea3..ef4cff8 100755
--- a/tools/ci/run-tests.sh
+++ b/tools/ci/run-tests.sh
@@ -16,21 +16,21 @@
 # bugs with Eigen.
 tools/bazel --output_base=../k8_output_base test \
     ${COMMON} \
-    --cpu=k8 \
+    --config=k8 \
     --config=eigen \
     ${TARGETS}
 
 tools/bazel --output_base=../roborio_output_base build \
     ${COMMON} \
-    --cpu=roborio \
+    --config=roborio \
     ${TARGETS}
 
 tools/bazel --output_base=../armhf-debian_output_base build \
     ${COMMON} \
-    --cpu=armhf-debian \
+    --config=armhf-debian \
     ${TARGETS}
 
 tools/bazel --output_base=../cortex-m4f_output_base build \
     ${COMMON} \
-    --cpu=cortex-m4f \
+    --config=cortex-m4f \
     ${M4F_TARGETS}
diff --git a/tools/cpp/BUILD b/tools/cpp/BUILD
index d370750..4f0e6d9 100644
--- a/tools/cpp/BUILD
+++ b/tools/cpp/BUILD
@@ -2,16 +2,25 @@
 
 package(default_visibility = ["//visibility:public"])
 
-[cc_toolchain_config(
-    name = "{}_toolchain_config".format(cpu),
-    cpu = cpu,
-) for cpu in
-    ["armeabi-v7a", "armhf-debian", "cortex-m4f", "cortex-m4f-k22", "k8", "roborio"]
+[
+    cc_toolchain_config(
+        name = "{}_toolchain_config".format(cpu),
+        cpu = cpu,
+    )
+    for cpu in [
+        "armeabi-v7a",
+        "armhf-debian",
+        "cortex-m4f",
+        "cortex-m4f-k22",
+        "k8",
+        "roborio",
+    ]
 ]
 
 cc_library(
     name = "empty_main",
     srcs = ["empty_main.c"],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_library(
@@ -20,13 +29,15 @@
         "//tools:has_asan": [],
         "//tools:has_tsan": [],
         "//tools:cpu_cortex_m4f": [],
-        "//tools:cpu_cortex_m4f_k22": [],
+        # TODO(phil): Support this properly.
+        #"//tools:cpu_cortex_m4f_k22": [],
         "//conditions:default": ["//third_party/gperftools:tcmalloc"],
     }),
 )
 
 cc_library(
     name = "stl",
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 filegroup(
@@ -34,18 +45,6 @@
     srcs = [],
 )
 
-# This is the entry point for --crosstool_top.
-cc_toolchain_suite(
-    name = "toolchain",
-    toolchains = {
-        "k8": ":cc-compiler-k8",
-        "roborio": ":cc-compiler-roborio",
-        "armhf-debian": "cc-compiler-armhf-debian",
-        "cortex-m4f": "cc-compiler-cortex-m4f",
-        "cortex-m4f-k22": "cc-compiler-cortex-m4f-k22",
-    },
-)
-
 # Compiler inputs given by --copt etc in //tools:bazel.rc.
 filegroup(
     name = "flags_compiler_inputs",
@@ -111,16 +110,30 @@
 cc_toolchain(
     name = "cc-compiler-k8",
     all_files = ":clang_6p0_all_files",
+    ar_files = ":clang_6p0_ar_files",
+    as_files = ":clang_6p0_compiler_files",
     compiler_files = ":clang_6p0_compiler_files",
     dwp_files = ":empty",
     linker_files = ":clang_6p0_linker_files",
-    ar_files = ":clang_6p0_ar_files",
-    as_files = ":clang_6p0_compiler_files",
     objcopy_files = "//tools/cpp/clang_6p0:objcopy",
     strip_files = ":clang_6p0_strip_files",
     supports_param_files = 1,
-    toolchain_identifier = "k8_linux",
     toolchain_config = ":k8_toolchain_config",
+    toolchain_identifier = "k8_linux",
+)
+
+toolchain(
+    name = "cc-toolchain-k8",
+    exec_compatible_with = [
+        "@platforms//os:linux",
+        "@platforms//cpu:x86_64",
+    ],
+    target_compatible_with = [
+        "@platforms//os:linux",
+        "@platforms//cpu:x86_64",
+    ],
+    toolchain = ":cc-compiler-k8",
+    toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
 )
 
 filegroup(
@@ -173,16 +186,30 @@
 cc_toolchain(
     name = "cc-compiler-roborio",
     all_files = ":roborio-compiler-files",
+    ar_files = ":roborio_ar_files",
+    as_files = ":roborio_compiler_files",
     compiler_files = ":roborio_compiler_files",
     dwp_files = ":empty",
     linker_files = ":roborio_linker_files",
-    ar_files = ":roborio_ar_files",
-    as_files = ":roborio_compiler_files",
     objcopy_files = "//tools/cpp/arm-frc-linux-gnueabi:objcopy",
     strip_files = ":roborio_strip_files",
     supports_param_files = 1,
-    toolchain_identifier = "roborio_linux",
     toolchain_config = ":roborio_toolchain_config",
+    toolchain_identifier = "roborio_linux",
+)
+
+toolchain(
+    name = "cc-toolchain-roborio",
+    exec_compatible_with = [
+        "@platforms//os:linux",
+        "@platforms//cpu:x86_64",
+    ],
+    target_compatible_with = [
+        "@platforms//os:linux",
+        "//tools/platforms/hardware:roborio",
+    ],
+    toolchain = ":cc-compiler-roborio",
+    toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
 )
 
 filegroup(
@@ -240,16 +267,30 @@
 cc_toolchain(
     name = "cc-compiler-armhf-debian",
     all_files = ":linaro-gcc-files",
+    ar_files = "linaro_linux_ar_files",
+    as_files = "linaro_linux_compiler_files",
     compiler_files = ":linaro_linux_compiler_files",
     dwp_files = ":empty",
     linker_files = ":linaro_linux_linker_files",
-    ar_files = "linaro_linux_ar_files",
-    as_files = "linaro_linux_compiler_files",
     objcopy_files = "//tools/cpp/linaro_linux_gcc:objcopy",
     strip_files = ":linaro_linux_strip_files",
     supports_param_files = 1,
-    toolchain_identifier = "clang_linux_armhf",
     toolchain_config = ":armhf-debian_toolchain_config",
+    toolchain_identifier = "clang_linux_armhf",
+)
+
+toolchain(
+    name = "cc-toolchain-armhf-debian",
+    exec_compatible_with = [
+        "@platforms//os:linux",
+        "@platforms//cpu:x86_64",
+    ],
+    target_compatible_with = [
+        "@platforms//os:linux",
+        "//tools/platforms/hardware:raspberry_pi",
+    ],
+    toolchain = ":cc-compiler-armhf-debian",
+    toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
 )
 
 filegroup(
@@ -292,15 +333,29 @@
 cc_toolchain(
     name = "cc-compiler-cortex-m4f",
     all_files = ":gcc_arm_none_eabi_none_files",
+    ar_files = ":gcc_arm_none_eabi_ar_files",
     compiler_files = ":gcc_arm_none_eabi_compiler_files",
     dwp_files = ":empty",
     linker_files = ":gcc_arm_none_eabi_linker_files",
-    ar_files = ":gcc_arm_none_eabi_ar_files",
     objcopy_files = "//tools/cpp/gcc_arm_none_eabi:objcopy",
     strip_files = "//tools/cpp/gcc_arm_none_eabi:strip",
     supports_param_files = 1,
-    toolchain_identifier = "cortex-m4f",
     toolchain_config = ":cortex-m4f_toolchain_config",
+    toolchain_identifier = "cortex-m4f",
+)
+
+toolchain(
+    name = "cc-toolchain-cortex-m4f",
+    exec_compatible_with = [
+        "@platforms//os:linux",
+        "@platforms//cpu:x86_64",
+    ],
+    target_compatible_with = [
+        "@platforms//os:none",
+        "//tools/platforms/hardware:cortex_m4f",
+    ],
+    toolchain = ":cc-compiler-cortex-m4f",
+    toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
 )
 
 cc_toolchain(
@@ -312,6 +367,20 @@
     objcopy_files = ":empty",
     strip_files = ":empty",
     supports_param_files = 1,
-    toolchain_identifier = "cortex-m4f-k22",
     toolchain_config = ":cortex-m4f-k22_toolchain_config",
+    toolchain_identifier = "cortex-m4f-k22",
+)
+
+toolchain(
+    name = "cc-toolchain-cortex-m4f-k22",
+    exec_compatible_with = [
+        "@platforms//os:linux",
+        "@platforms//cpu:x86_64",
+    ],
+    target_compatible_with = [
+        "@platforms//os:none",
+        "//tools/platforms/hardware:cortex_m4f",
+    ],
+    toolchain = ":cc-compiler-cortex-m4f-k22",
+    toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
 )
diff --git a/tools/environments.bzl b/tools/environments.bzl
deleted file mode 100644
index c82a01b..0000000
--- a/tools/environments.bzl
+++ /dev/null
@@ -1,6 +0,0 @@
-# Contains some helpers for working with environments.
-
-mcu_cpus = [
-    "@//tools:cortex-m4f",
-    "@//tools:cortex-m4f-k22",
-]
diff --git a/tools/platforms.bzl b/tools/platforms.bzl
new file mode 100644
index 0000000..fb2f69d
--- /dev/null
+++ b/tools/platforms.bzl
@@ -0,0 +1,11 @@
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+def _any_of(constraint_values):
+    return selects.with_or({
+        tuple(constraint_values): [],
+        "//conditions:default": ["@platforms//:incompatible"],
+    })
+
+platforms = struct(
+    any_of = _any_of,
+)
diff --git a/tools/platforms/BUILD b/tools/platforms/BUILD
new file mode 100644
index 0000000..65563bf
--- /dev/null
+++ b/tools/platforms/BUILD
@@ -0,0 +1,45 @@
+package(default_visibility = ["//visibility:public"])
+
+platform(
+    name = "linux_x86",
+    constraint_values = [
+        "@platforms//os:linux",
+        "@platforms//cpu:x86_64",
+    ],
+)
+
+platform(
+    name = "linux_armhf",
+    constraint_values = [
+        "@platforms//os:linux",
+        "@platforms//cpu:armv7",
+        "//tools/platforms/hardware:raspberry_pi",
+    ],
+)
+
+platform(
+    name = "linux_arm64",
+    constraint_values = [
+        "@platforms//os:linux",
+        "@platforms//cpu:arm64",
+    ],
+)
+
+platform(
+    name = "linux_roborio",
+    constraint_values = [
+        "@platforms//os:linux",
+        "@platforms//cpu:armv7",
+        "//tools/platforms/hardware:roborio",
+    ],
+)
+
+platform(
+    name = "cortex_m4f",
+    constraint_values = [
+        "@platforms//os:none",
+        "//tools/platforms/hardware:cortex_m4f",
+    ],
+)
+
+# TODO(phil): Create something for "cortex-m4f-k22" builds.
diff --git a/tools/platforms/hardware/BUILD b/tools/platforms/hardware/BUILD
new file mode 100644
index 0000000..521b243
--- /dev/null
+++ b/tools/platforms/hardware/BUILD
@@ -0,0 +1,21 @@
+# Additional constraint values not available in @platforms. Use these in things
+# like select() statements or target_compatible_with.
+
+package(default_visibility = ["//visibility:public"])
+
+constraint_setting(name = "hardware")
+
+constraint_value(
+    name = "raspberry_pi",
+    constraint_setting = ":hardware",
+)
+
+constraint_value(
+    name = "roborio",
+    constraint_setting = ":hardware",
+)
+
+constraint_value(
+    name = "cortex_m4f",
+    constraint_setting = ":hardware",
+)
diff --git a/y2012/BUILD b/y2012/BUILD
index ff6d3f2..cc0a406 100644
--- a/y2012/BUILD
+++ b/y2012/BUILD
@@ -5,6 +5,7 @@
     srcs = [
         "joystick_reader.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos:init",
         "//aos/actions:action_lib",
@@ -26,6 +27,7 @@
         "//y2012/control_loops/drivetrain",
         "//y2012/control_loops/accessories",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_binary(
@@ -33,7 +35,7 @@
     srcs = [
         "wpilib_interface.cc",
     ],
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     deps = [
         "//aos:init",
         "//aos:make_unique",
@@ -70,5 +72,6 @@
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/y2012/control_loops/BUILD b/y2012/control_loops/BUILD
index 613ddd4..1cf6e97 100644
--- a/y2012/control_loops/BUILD
+++ b/y2012/control_loops/BUILD
@@ -1,6 +1,7 @@
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = ["//y2012:python_init"],
 )
diff --git a/y2012/control_loops/accessories/BUILD b/y2012/control_loops/accessories/BUILD
index 65a6d1d..02a15f1 100644
--- a/y2012/control_loops/accessories/BUILD
+++ b/y2012/control_loops/accessories/BUILD
@@ -7,6 +7,7 @@
     srcs = [
         "accessories.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":accessories_fbs",
         "//aos:init",
@@ -20,4 +21,5 @@
     srcs = [
         "accessories.fbs",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
diff --git a/y2012/control_loops/drivetrain/BUILD b/y2012/control_loops/drivetrain/BUILD
index 35d596a..cd575ea 100644
--- a/y2012/control_loops/drivetrain/BUILD
+++ b/y2012/control_loops/drivetrain/BUILD
@@ -9,6 +9,7 @@
         "kalman_drivetrain_motor_plant.cc",
     ],
     cmd = "$(location //y2012/control_loops/python:drivetrain) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2012/control_loops/python:drivetrain",
     ],
@@ -26,6 +27,7 @@
         "hybrid_velocity_drivetrain.cc",
     ],
     cmd = "$(location //y2012/control_loops/python:polydrivetrain) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2012/control_loops/python:polydrivetrain",
     ],
@@ -46,6 +48,7 @@
         "kalman_drivetrain_motor_plant.h",
         "polydrivetrain_dog_motor_plant.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//frc971/control_loops:hybrid_state_feedback_loop",
         "//frc971/control_loops:state_feedback_loop",
@@ -60,6 +63,7 @@
     hdrs = [
         "drivetrain_base.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":polydrivetrain_plants",
         "//frc971:shifter_hall_effect",
@@ -73,6 +77,7 @@
     srcs = [
         "drivetrain_main.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":drivetrain_base",
         "//aos:init",
diff --git a/y2012/control_loops/python/BUILD b/y2012/control_loops/python/BUILD
index f10d6fa..1bceece 100644
--- a/y2012/control_loops/python/BUILD
+++ b/y2012/control_loops/python/BUILD
@@ -6,7 +6,7 @@
         "drivetrain.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -22,7 +22,7 @@
         "polydrivetrain.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -37,7 +37,7 @@
         "drivetrain.py",
         "polydrivetrain.py",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         "//external:python-gflags",
         "//external:python-glog",
@@ -48,6 +48,7 @@
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = ["//y2012/control_loops:python_init"],
 )
diff --git a/y2014/BUILD b/y2014/BUILD
index c77a019..4332a63 100644
--- a/y2014/BUILD
+++ b/y2014/BUILD
@@ -9,6 +9,7 @@
     hdrs = [
         "constants.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos/logging",
@@ -26,6 +27,7 @@
     srcs = [
         "joystick_reader.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":constants",
         "//aos:init",
@@ -55,6 +57,7 @@
         "//y2014/control_loops/shooter:shooter",
         "//y2014/actors:binaries",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_binary(
@@ -62,6 +65,7 @@
     srcs = [
         "hot_goal_reader.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos:byteorder",
         "//aos:init",
@@ -85,6 +89,7 @@
         "//y2014/control_loops/claw:claw_position_fbs",
         "//y2014/control_loops/claw:claw_status_fbs",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos/robot_state:config",
@@ -97,7 +102,7 @@
     srcs = [
         "wpilib_interface.cc",
     ],
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     deps = [
         ":constants",
         "//aos:init",
@@ -139,5 +144,6 @@
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/y2014/actors/BUILD b/y2014/actors/BUILD
index 82255ab..ab27aac 100644
--- a/y2014/actors/BUILD
+++ b/y2014/actors/BUILD
@@ -24,6 +24,7 @@
     hdrs = [
         "shoot_actor.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos/actions:action_lib",
@@ -41,6 +42,7 @@
     srcs = [
         "shoot_actor_main.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":shoot_action_lib",
         "//aos:init",
@@ -56,6 +58,7 @@
     hdrs = [
         "autonomous_actor.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/actions:action_lib",
         "//aos/events:event_loop",
@@ -78,6 +81,7 @@
     srcs = [
         "autonomous_actor_main.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":autonomous_action_lib",
         "//aos:init",
diff --git a/y2014/control_loops/BUILD b/y2014/control_loops/BUILD
index 995a4c7..bbb88e0 100644
--- a/y2014/control_loops/BUILD
+++ b/y2014/control_loops/BUILD
@@ -1,6 +1,7 @@
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = ["//y2014:python_init"],
 )
diff --git a/y2014/control_loops/claw/BUILD b/y2014/control_loops/claw/BUILD
index 2ae59b0..f8865a5 100644
--- a/y2014/control_loops/claw/BUILD
+++ b/y2014/control_loops/claw/BUILD
@@ -8,6 +8,7 @@
         "claw_goal.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -19,6 +20,7 @@
     includes = [
         "//frc971/control_loops:control_loops_fbs_includes",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -27,6 +29,7 @@
         "claw_output.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -35,6 +38,7 @@
         "claw_status.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 genrule(
@@ -44,6 +48,7 @@
         "claw_motor_plant.cc",
     ],
     cmd = "$(location //y2014/control_loops/python:claw) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2014/control_loops/python:claw",
     ],
@@ -63,6 +68,7 @@
     linkopts = [
         "-lm",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":claw_goal_fbs",
         ":claw_output_fbs",
@@ -84,6 +90,7 @@
         "claw_lib_test.cc",
     ],
     data = ["//y2014:config"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":claw_goal_fbs",
         ":claw_lib",
@@ -102,6 +109,7 @@
     srcs = [
         "claw_main.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":claw_lib",
         "//aos:init",
diff --git a/y2014/control_loops/drivetrain/BUILD b/y2014/control_loops/drivetrain/BUILD
index c458208..f331b37 100644
--- a/y2014/control_loops/drivetrain/BUILD
+++ b/y2014/control_loops/drivetrain/BUILD
@@ -9,6 +9,7 @@
         "kalman_drivetrain_motor_plant.cc",
     ],
     cmd = "$(location //y2014/control_loops/python:drivetrain) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2014/control_loops/python:drivetrain",
     ],
@@ -26,6 +27,7 @@
         "hybrid_velocity_drivetrain.cc",
     ],
     cmd = "$(location //y2014/control_loops/python:polydrivetrain) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2014/control_loops/python:polydrivetrain",
     ],
@@ -46,6 +48,7 @@
         "kalman_drivetrain_motor_plant.h",
         "polydrivetrain_dog_motor_plant.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//frc971/control_loops:hybrid_state_feedback_loop",
         "//frc971/control_loops:state_feedback_loop",
@@ -60,6 +63,7 @@
     hdrs = [
         "drivetrain_base.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":polydrivetrain_plants",
         "//frc971/control_loops/drivetrain:drivetrain_config",
@@ -72,6 +76,7 @@
     srcs = [
         "drivetrain_main.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":drivetrain_base",
         "//aos:init",
diff --git a/y2014/control_loops/python/BUILD b/y2014/control_loops/python/BUILD
index cba8cea..60488b4 100644
--- a/y2014/control_loops/python/BUILD
+++ b/y2014/control_loops/python/BUILD
@@ -6,7 +6,7 @@
         "drivetrain.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -22,7 +22,7 @@
         "polydrivetrain.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -37,7 +37,7 @@
         "drivetrain.py",
         "polydrivetrain.py",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//external:python-gflags",
         "//external:python-glog",
@@ -53,7 +53,7 @@
         "claw.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":polydrivetrain_lib",
         ":python_init",
@@ -70,7 +70,7 @@
         "shooter.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -86,7 +86,7 @@
         "extended_lqr.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -99,6 +99,7 @@
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = ["//y2014/control_loops:python_init"],
 )
diff --git a/y2014/control_loops/shooter/BUILD b/y2014/control_loops/shooter/BUILD
index ed95317..9f71e95 100644
--- a/y2014/control_loops/shooter/BUILD
+++ b/y2014/control_loops/shooter/BUILD
@@ -8,6 +8,7 @@
         "shooter_goal.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -19,6 +20,7 @@
     includes = [
         "//frc971/control_loops:control_loops_fbs_includes",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -27,6 +29,7 @@
         "shooter_output.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -35,6 +38,7 @@
         "shooter_status.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 genrule(
@@ -46,6 +50,7 @@
         "unaugmented_shooter_motor_plant.h",
     ],
     cmd = "$(location //y2014/control_loops/python:shooter) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2014/control_loops/python:shooter",
     ],
@@ -67,6 +72,7 @@
     linkopts = [
         "-lm",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":shooter_goal_fbs",
         ":shooter_output_fbs",
@@ -85,6 +91,7 @@
         "shooter_lib_test.cc",
     ],
     data = ["//y2014:config"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":shooter_goal_fbs",
         ":shooter_lib",
@@ -103,6 +110,7 @@
     srcs = [
         "shooter_main.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":shooter_lib",
         "//aos:init",
diff --git a/y2014/queues/BUILD b/y2014/queues/BUILD
index dba212d..294e2be 100644
--- a/y2014/queues/BUILD
+++ b/y2014/queues/BUILD
@@ -8,6 +8,7 @@
         "auto_mode.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -16,4 +17,5 @@
         "hot_goal.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
diff --git a/y2014_bot3/BUILD b/y2014_bot3/BUILD
index 6d1f3fd..c2a1793 100644
--- a/y2014_bot3/BUILD
+++ b/y2014_bot3/BUILD
@@ -5,6 +5,7 @@
     srcs = [
         "joystick_reader.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos:init",
         "//aos/actions:action_lib",
@@ -27,6 +28,7 @@
         "//y2014_bot3/control_loops/drivetrain:drivetrain",
         "//y2014_bot3/control_loops/rollers:rollers",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_binary(
@@ -34,7 +36,7 @@
     srcs = [
         "wpilib_interface.cc",
     ],
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     deps = [
         "//aos:init",
         "//aos:make_unique",
@@ -68,5 +70,6 @@
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/y2014_bot3/actors/BUILD b/y2014_bot3/actors/BUILD
index ad60458..d90d388 100644
--- a/y2014_bot3/actors/BUILD
+++ b/y2014_bot3/actors/BUILD
@@ -6,6 +6,7 @@
     hdrs = [
         "autonomous_actor.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/actions:action_lib",
         "//aos/events:event_loop",
@@ -22,6 +23,7 @@
     srcs = [
         "autonomous_actor_main.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":autonomous_action_lib",
diff --git a/y2014_bot3/control_loops/BUILD b/y2014_bot3/control_loops/BUILD
index 8df2481..30fb1ec 100644
--- a/y2014_bot3/control_loops/BUILD
+++ b/y2014_bot3/control_loops/BUILD
@@ -1,6 +1,7 @@
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = ["//y2014_bot3:python_init"],
 )
diff --git a/y2014_bot3/control_loops/drivetrain/BUILD b/y2014_bot3/control_loops/drivetrain/BUILD
index 7060ac1..9a5bb53 100644
--- a/y2014_bot3/control_loops/drivetrain/BUILD
+++ b/y2014_bot3/control_loops/drivetrain/BUILD
@@ -9,6 +9,7 @@
         "kalman_drivetrain_motor_plant.cc",
     ],
     cmd = "$(location //y2014_bot3/control_loops/python:drivetrain) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2014_bot3/control_loops/python:drivetrain",
     ],
@@ -26,6 +27,7 @@
         "hybrid_velocity_drivetrain.cc",
     ],
     cmd = "$(location //y2014_bot3/control_loops/python:polydrivetrain) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2014_bot3/control_loops/python:polydrivetrain",
     ],
@@ -46,6 +48,7 @@
         "kalman_drivetrain_motor_plant.h",
         "polydrivetrain_dog_motor_plant.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//frc971/control_loops:hybrid_state_feedback_loop",
         "//frc971/control_loops:state_feedback_loop",
@@ -60,6 +63,7 @@
     hdrs = [
         "drivetrain_base.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":polydrivetrain_plants",
         "//frc971:shifter_hall_effect",
@@ -72,6 +76,7 @@
     srcs = [
         "drivetrain_main.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":drivetrain_base",
         "//aos:init",
diff --git a/y2014_bot3/control_loops/python/BUILD b/y2014_bot3/control_loops/python/BUILD
index 83e7bba..b63ca0a 100644
--- a/y2014_bot3/control_loops/python/BUILD
+++ b/y2014_bot3/control_loops/python/BUILD
@@ -6,7 +6,7 @@
         "drivetrain.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -22,7 +22,7 @@
         "polydrivetrain.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -34,6 +34,7 @@
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = ["//y2014_bot3/control_loops:python_init"],
 )
diff --git a/y2014_bot3/control_loops/rollers/BUILD b/y2014_bot3/control_loops/rollers/BUILD
index e0d7dc6..2f9d7c4 100644
--- a/y2014_bot3/control_loops/rollers/BUILD
+++ b/y2014_bot3/control_loops/rollers/BUILD
@@ -8,6 +8,7 @@
         "rollers_goal.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -16,6 +17,7 @@
         "rollers_position.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -24,6 +26,7 @@
         "rollers_output.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -32,6 +35,7 @@
         "rollers_status.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_library(
@@ -42,6 +46,7 @@
     hdrs = [
         "rollers.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":rollers_goal_fbs",
         ":rollers_output_fbs",
@@ -57,6 +62,7 @@
     srcs = [
         "rollers_main.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":rollers_lib",
         "//aos:init",
diff --git a/y2016/BUILD b/y2016/BUILD
index 6944d4f..8c695c8 100644
--- a/y2016/BUILD
+++ b/y2016/BUILD
@@ -9,6 +9,7 @@
     hdrs = [
         "constants.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos/logging",
@@ -27,6 +28,7 @@
     srcs = [
         "joystick_reader.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":constants",
         "//aos:init",
@@ -69,6 +71,7 @@
         "//y2016/actors:vision_align_action",
         "//y2016/vision:target_receiver",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 aos_config(
@@ -89,6 +92,7 @@
         "//y2016/actors:vision_align_action_fbs",
         "//y2016/actors:superstructure_action_fbs",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos/robot_state:config",
@@ -103,7 +107,7 @@
     srcs = [
         "wpilib_interface.cc",
     ],
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     deps = [
         ":constants",
         "//aos:init",
@@ -149,5 +153,6 @@
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/y2016/actors/BUILD b/y2016/actors/BUILD
index f80128d..6a8c915 100644
--- a/y2016/actors/BUILD
+++ b/y2016/actors/BUILD
@@ -16,6 +16,7 @@
         "superstructure_action.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -27,6 +28,7 @@
     hdrs = [
         "superstructure_actor.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":superstructure_action_fbs",
         "//aos/actions:action_lib",
@@ -44,6 +46,7 @@
     srcs = [
         "superstructure_actor_main.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":superstructure_action_fbs",
         ":superstructure_action_lib",
@@ -60,6 +63,7 @@
     hdrs = [
         "autonomous_actor.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":vision_align_action_lib",
         "//aos/actions:action_lib",
@@ -81,6 +85,7 @@
     srcs = [
         "autonomous_actor_main.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":autonomous_action_lib",
         "//aos:init",
@@ -93,6 +98,7 @@
         "vision_align_action.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -104,6 +110,7 @@
     hdrs = [
         "vision_align_actor.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":vision_align_action_fbs",
         "//aos:math",
@@ -126,6 +133,7 @@
     srcs = [
         "vision_align_actor_main.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":vision_align_action_fbs",
         ":vision_align_action_lib",
diff --git a/y2016/control_loops/BUILD b/y2016/control_loops/BUILD
index de3bfeb..ddc39d4 100644
--- a/y2016/control_loops/BUILD
+++ b/y2016/control_loops/BUILD
@@ -1,6 +1,7 @@
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = ["//y2016:python_init"],
 )
diff --git a/y2016/control_loops/drivetrain/BUILD b/y2016/control_loops/drivetrain/BUILD
index e706f25..0988e03 100644
--- a/y2016/control_loops/drivetrain/BUILD
+++ b/y2016/control_loops/drivetrain/BUILD
@@ -7,6 +7,7 @@
         "kalman_drivetrain_motor_plant.cc",
     ],
     cmd = "$(location //y2016/control_loops/python:drivetrain) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2016/control_loops/python:drivetrain",
     ],
@@ -23,6 +24,7 @@
         "hybrid_velocity_drivetrain.cc",
     ],
     cmd = "$(location //y2016/control_loops/python:polydrivetrain) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2016/control_loops/python:polydrivetrain",
     ],
@@ -42,6 +44,7 @@
         "kalman_drivetrain_motor_plant.h",
         "polydrivetrain_dog_motor_plant.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//frc971/control_loops:hybrid_state_feedback_loop",
@@ -57,6 +60,7 @@
     hdrs = [
         "drivetrain_base.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":polydrivetrain_plants",
@@ -71,6 +75,7 @@
     srcs = [
         "drivetrain_main.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":drivetrain_base",
diff --git a/y2016/control_loops/python/BUILD b/y2016/control_loops/python/BUILD
index 65964fd..6c2c02d 100644
--- a/y2016/control_loops/python/BUILD
+++ b/y2016/control_loops/python/BUILD
@@ -6,7 +6,7 @@
         "drivetrain.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -22,7 +22,7 @@
         "polydrivetrain.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -37,7 +37,7 @@
         "drivetrain.py",
         "polydrivetrain.py",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     visibility = ["//visibility:public"],
     deps = [
         ":python_init",
@@ -55,7 +55,7 @@
         "shooter.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -71,7 +71,7 @@
         "intake.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -87,7 +87,7 @@
         "shoulder.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//aos/util:py_trapezoid_profile",
@@ -104,7 +104,7 @@
         "wrist.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//aos/util:py_trapezoid_profile",
@@ -120,7 +120,7 @@
     srcs = [
         "wrist.py",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         "//aos/util:py_trapezoid_profile",
         "//external:python-gflags",
@@ -134,7 +134,7 @@
     srcs = [
         "shoulder.py",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         "//aos/util:py_trapezoid_profile",
         "//external:python-gflags",
@@ -149,7 +149,7 @@
     srcs = [
         "arm.py",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":shoulder_lib",
         ":wrist_lib",
@@ -167,7 +167,7 @@
         "arm.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         ":shoulder_lib",
@@ -182,6 +182,7 @@
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = ["//y2016/control_loops:python_init"],
 )
diff --git a/y2016/control_loops/shooter/BUILD b/y2016/control_loops/shooter/BUILD
index 3ffc9cc..a6cf134 100644
--- a/y2016/control_loops/shooter/BUILD
+++ b/y2016/control_loops/shooter/BUILD
@@ -8,6 +8,7 @@
         "shooter_goal.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -16,6 +17,7 @@
         "shooter_position.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -24,6 +26,7 @@
         "shooter_output.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -32,6 +35,7 @@
         "shooter_status.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 genrule(
@@ -43,6 +47,7 @@
         "shooter_integral_plant.cc",
     ],
     cmd = "$(location //y2016/control_loops/python:shooter) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2016/control_loops/python:shooter",
     ],
@@ -59,6 +64,7 @@
         "shooter_integral_plant.h",
         "shooter_plant.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//frc971/control_loops:state_feedback_loop",
     ],
@@ -72,6 +78,7 @@
     hdrs = [
         "shooter.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":shooter_goal_fbs",
         ":shooter_output_fbs",
@@ -88,6 +95,7 @@
         "shooter_lib_test.cc",
     ],
     data = ["//y2016:config"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":shooter_goal_fbs",
         ":shooter_lib",
@@ -106,6 +114,7 @@
     srcs = [
         "shooter_main.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":shooter_goal_fbs",
         ":shooter_lib",
diff --git a/y2016/control_loops/superstructure/BUILD b/y2016/control_loops/superstructure/BUILD
index aecfd98..cb07ebe 100644
--- a/y2016/control_loops/superstructure/BUILD
+++ b/y2016/control_loops/superstructure/BUILD
@@ -8,6 +8,7 @@
         "superstructure_goal.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -19,6 +20,7 @@
     includes = [
         "//frc971/control_loops:control_loops_fbs_includes",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -27,6 +29,7 @@
         "superstructure_output.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -38,6 +41,7 @@
     includes = [
         "//frc971/control_loops:control_loops_fbs_includes",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 genrule(
@@ -49,6 +53,7 @@
         "integral_intake_plant.cc",
     ],
     cmd = "$(location //y2016/control_loops/python:intake) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2016/control_loops/python:intake",
     ],
@@ -64,6 +69,7 @@
         "integral_arm_plant.cc",
     ],
     cmd = "$(location //y2016/control_loops/python:arm) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2016/control_loops/python:arm",
     ],
@@ -84,6 +90,7 @@
         "integral_arm_plant.h",
         "integral_intake_plant.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//frc971/control_loops:state_feedback_loop",
     ],
@@ -99,6 +106,7 @@
         "superstructure.h",
         "superstructure_controls.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":superstructure_goal_fbs",
         ":superstructure_output_fbs",
@@ -123,6 +131,7 @@
         "superstructure_lib_test.cc",
     ],
     data = ["//y2016:config"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":superstructure_goal_fbs",
         ":superstructure_lib",
@@ -143,6 +152,7 @@
     srcs = [
         "superstructure_main.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":superstructure_lib",
         "//aos:init",
diff --git a/y2016/dashboard/BUILD b/y2016/dashboard/BUILD
index 9e8198a..0dc3ad4 100644
--- a/y2016/dashboard/BUILD
+++ b/y2016/dashboard/BUILD
@@ -7,6 +7,7 @@
         ["www_defaults/**/*"],
         exclude = ["www/**/*"],
     ),
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 aos_downloader_dir(
@@ -15,6 +16,7 @@
         "www/**/*",
     ]),
     dir = "www",
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -24,6 +26,7 @@
         "dashboard.cc",
         "dashboard.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":gen_embedded",
diff --git a/y2016/queues/BUILD b/y2016/queues/BUILD
index 5c51a41..337ea96 100644
--- a/y2016/queues/BUILD
+++ b/y2016/queues/BUILD
@@ -8,4 +8,5 @@
         "ball_detector.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
diff --git a/y2016/vision/BUILD b/y2016/vision/BUILD
index 072b6ca..2a8031d 100644
--- a/y2016/vision/BUILD
+++ b/y2016/vision/BUILD
@@ -1,6 +1,7 @@
 load("@com_google_protobuf//:protobuf.bzl", "cc_proto_library")
 load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
 load("//tools/build_rules:gtk_dependent.bzl", "gtk_dependent_cc_binary", "gtk_dependent_cc_library")
+load("//tools:platforms.bzl", "platforms")
 
 flatbuffer_cc_library(
     name = "vision_fbs",
@@ -8,17 +9,20 @@
         "vision.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
 cc_proto_library(
     name = "vision_data",
     srcs = ["vision_data.proto"],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_proto_library(
     name = "calibration",
     srcs = ["calibration.proto"],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 _calibration_values_embedded_before = """
@@ -60,6 +64,7 @@
         "cat $(location :calibration.pb) | sed 's/\"/\\\\\"/g ; s/^/\"/g ; s/$$/\\\\n\"/g' >> $@",
         "echo '%s' >> $@" % _calibration_values_embedded_after,
     ]),
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_library(
@@ -71,6 +76,7 @@
     hdrs = [
         "stereo_geometry.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":calibration",
         "//aos/logging",
@@ -81,10 +87,10 @@
 cc_binary(
     name = "target_sender",
     srcs = ["target_sender.cc"],
-    restricted_to = [
-        "//tools:k8",
-        "//tools:armhf-debian",
-    ],
+    target_compatible_with = platforms.any_of([
+        "@platforms//cpu:x86_64",
+        "//tools/platforms/hardware:raspberry_pi",
+    ]),
     deps = [
         ":calibration",
         ":stereo_geometry",
@@ -106,10 +112,10 @@
     name = "blob_filters",
     srcs = ["blob_filters.cc"],
     hdrs = ["blob_filters.h"],
-    restricted_to = [
-        "//tools:k8",
-        "//tools:armhf-debian",
-    ],
+    target_compatible_with = platforms.any_of([
+        "@platforms//cpu:x86_64",
+        "//tools/platforms/hardware:raspberry_pi",
+    ]),
     visibility = ["//visibility:public"],
     deps = [
         "//aos/vision/blob:codec",
@@ -127,6 +133,7 @@
     srcs = [
         "target_receiver.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":stereo_geometry",
@@ -146,10 +153,10 @@
 gtk_dependent_cc_binary(
     name = "debug_receiver",
     srcs = ["debug_receiver.cc"],
-    restricted_to = [
-        "//tools:k8",
-        "//tools:armhf-debian",
-    ],
+    target_compatible_with = platforms.any_of([
+        "@platforms//cpu:x86_64",
+        "//tools/platforms/hardware:raspberry_pi",
+    ]),
     visibility = ["//visibility:public"],
     deps = [
         ":blob_filters",
diff --git a/y2016/vision/tools/BUILD b/y2016/vision/tools/BUILD
index edbfca5..62ed6b4 100644
--- a/y2016/vision/tools/BUILD
+++ b/y2016/vision/tools/BUILD
@@ -1,12 +1,13 @@
 load("//tools/build_rules:gtk_dependent.bzl", "gtk_dependent_cc_binary", "gtk_dependent_cc_library")
+load("//tools:platforms.bzl", "platforms")
 
 gtk_dependent_cc_binary(
     name = "blob_stream_replay",
     srcs = ["blob_stream_replay.cc"],
-    restricted_to = [
-        "//tools:k8",
-        "//tools:armhf-debian",
-    ],
+    target_compatible_with = platforms.any_of([
+        "@platforms//cpu:x86_64",
+        "//tools/platforms/hardware:raspberry_pi",
+    ]),
     deps = [
         "//aos/vision/blob:range_image",
         "//aos/vision/blob:stream_view",
diff --git a/y2017/BUILD b/y2017/BUILD
index 3c1fe21..a43654d 100644
--- a/y2017/BUILD
+++ b/y2017/BUILD
@@ -9,6 +9,7 @@
     hdrs = [
         "constants.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos/logging",
@@ -30,6 +31,7 @@
     srcs = [
         "joystick_reader.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":constants",
         "//aos:init",
@@ -56,6 +58,7 @@
         "//y2017/control_loops/superstructure:superstructure_status_fbs",
         "//y2017/vision:vision_fbs",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos/robot_state:config",
@@ -68,7 +71,7 @@
     srcs = [
         "wpilib_interface.cc",
     ],
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     deps = [
         ":constants",
         "//aos:init",
@@ -114,10 +117,12 @@
         "//y2017/control_loops/superstructure:superstructure",
         "//y2017/actors:autonomous_action",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/y2017/actors/BUILD b/y2017/actors/BUILD
index 3b3e0a2..de1c594 100644
--- a/y2017/actors/BUILD
+++ b/y2017/actors/BUILD
@@ -15,6 +15,7 @@
     hdrs = [
         "autonomous_actor.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/actions:action_lib",
         "//aos/events:event_loop",
@@ -34,6 +35,7 @@
     srcs = [
         "autonomous_actor_main.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":autonomous_action_lib",
         "//aos:init",
diff --git a/y2017/control_loops/BUILD b/y2017/control_loops/BUILD
index d34fcab..d88a2bf 100644
--- a/y2017/control_loops/BUILD
+++ b/y2017/control_loops/BUILD
@@ -1,6 +1,7 @@
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = ["//y2017:python_init"],
 )
diff --git a/y2017/control_loops/drivetrain/BUILD b/y2017/control_loops/drivetrain/BUILD
index 46af643..86d923f 100644
--- a/y2017/control_loops/drivetrain/BUILD
+++ b/y2017/control_loops/drivetrain/BUILD
@@ -9,6 +9,7 @@
         "kalman_drivetrain_motor_plant.cc",
     ],
     cmd = "$(location //y2017/control_loops/python:drivetrain) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2017/control_loops/python:drivetrain",
     ],
@@ -26,6 +27,7 @@
         "hybrid_velocity_drivetrain.cc",
     ],
     cmd = "$(location //y2017/control_loops/python:polydrivetrain) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2017/control_loops/python:polydrivetrain",
     ],
@@ -46,6 +48,7 @@
         "kalman_drivetrain_motor_plant.h",
         "polydrivetrain_dog_motor_plant.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//frc971/control_loops:hybrid_state_feedback_loop",
         "//frc971/control_loops:state_feedback_loop",
@@ -60,6 +63,7 @@
     hdrs = [
         "drivetrain_base.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":polydrivetrain_plants",
         "//frc971:shifter_hall_effect",
@@ -73,6 +77,7 @@
     srcs = [
         "drivetrain_main.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":drivetrain_base",
         "//aos:init",
diff --git a/y2017/control_loops/python/BUILD b/y2017/control_loops/python/BUILD
index 6afb242..4de8144 100644
--- a/y2017/control_loops/python/BUILD
+++ b/y2017/control_loops/python/BUILD
@@ -6,7 +6,7 @@
         "drivetrain.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -22,7 +22,7 @@
         "polydrivetrain.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -37,7 +37,7 @@
         "drivetrain.py",
         "polydrivetrain.py",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         "//external:python-gflags",
         "//external:python-glog",
@@ -52,7 +52,7 @@
         "shooter.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -68,7 +68,7 @@
         "indexer.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -83,7 +83,7 @@
         "intake.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -99,7 +99,7 @@
         "turret.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//aos/util:py_trapezoid_profile",
@@ -116,7 +116,7 @@
         "hood.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//aos/util:py_trapezoid_profile",
@@ -132,7 +132,7 @@
     srcs = [
         "turret.py",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         "//aos/util:py_trapezoid_profile",
         "//external:python-gflags",
@@ -146,7 +146,7 @@
     srcs = [
         "indexer.py",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         "//external:python-gflags",
         "//external:python-glog",
@@ -160,7 +160,7 @@
         "column.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":indexer_lib",
         ":python_init",
@@ -175,6 +175,7 @@
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = ["//y2017/control_loops:python_init"],
 )
diff --git a/y2017/control_loops/superstructure/BUILD b/y2017/control_loops/superstructure/BUILD
index 7107e23..fa835c1 100644
--- a/y2017/control_loops/superstructure/BUILD
+++ b/y2017/control_loops/superstructure/BUILD
@@ -11,6 +11,7 @@
     includes = [
         "//frc971/control_loops:control_loops_fbs_includes",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -22,6 +23,7 @@
     includes = [
         "//frc971/control_loops:control_loops_fbs_includes",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -34,6 +36,7 @@
         "//frc971/control_loops:control_loops_fbs_includes",
         "//frc971/control_loops:profiled_subsystem_fbs_includes",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -42,6 +45,7 @@
         "superstructure_output.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_library(
@@ -52,6 +56,7 @@
     hdrs = [
         "superstructure.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":superstructure_goal_fbs",
         ":superstructure_output_fbs",
@@ -74,6 +79,7 @@
         "superstructure_lib_test.cc",
     ],
     data = ["//y2017:config"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":superstructure_goal_fbs",
         ":superstructure_lib",
@@ -98,6 +104,7 @@
     srcs = [
         "superstructure_main.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":superstructure_lib",
         "//aos:init",
@@ -113,6 +120,7 @@
     hdrs = [
         "vision_time_adjuster.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/containers:ring_buffer",
         "//frc971/control_loops:control_loops_fbs",
@@ -129,6 +137,7 @@
         "vision_time_adjuster_test.cc",
     ],
     data = ["//y2017:config"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":vision_time_adjuster",
         "//aos/events:simulated_event_loop",
@@ -143,6 +152,7 @@
     hdrs = [
         "vision_distance_average.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/containers:ring_buffer",
         "//aos/time",
@@ -155,6 +165,7 @@
     srcs = [
         "vision_distance_average_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":vision_distance_average",
         "//aos:flatbuffers",
diff --git a/y2017/control_loops/superstructure/column/BUILD b/y2017/control_loops/superstructure/column/BUILD
index 63dd98c..e59d1e6 100644
--- a/y2017/control_loops/superstructure/column/BUILD
+++ b/y2017/control_loops/superstructure/column/BUILD
@@ -9,6 +9,7 @@
         "stuck_column_integral_plant.cc",
     ],
     cmd = "$(location //y2017/control_loops/python:column) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2017/control_loops/python:column",
     ],
@@ -26,6 +27,7 @@
         "column_plant.h",
         "stuck_column_integral_plant.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//frc971/control_loops:state_feedback_loop",
@@ -40,6 +42,7 @@
     hdrs = [
         "column.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":column_plants",
@@ -63,6 +66,7 @@
     hdrs = [
         "column_zeroing.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//frc971:constants",
         "//frc971/control_loops:profiled_subsystem_fbs",
@@ -79,6 +83,7 @@
     srcs = [
         "column_zeroing_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":column_zeroing",
         "//aos/testing:test_shm",
diff --git a/y2017/control_loops/superstructure/hood/BUILD b/y2017/control_loops/superstructure/hood/BUILD
index c3f6ef0..8f162a7 100644
--- a/y2017/control_loops/superstructure/hood/BUILD
+++ b/y2017/control_loops/superstructure/hood/BUILD
@@ -7,6 +7,7 @@
         "hood_integral_plant.cc",
     ],
     cmd = "$(location //y2017/control_loops/python:hood) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2017/control_loops/python:hood",
     ],
@@ -22,6 +23,7 @@
         "hood_integral_plant.h",
         "hood_plant.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//frc971/control_loops:state_feedback_loop",
@@ -36,6 +38,7 @@
     hdrs = [
         "hood.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":hood_plants",
diff --git a/y2017/control_loops/superstructure/intake/BUILD b/y2017/control_loops/superstructure/intake/BUILD
index 43f4927..550c241 100644
--- a/y2017/control_loops/superstructure/intake/BUILD
+++ b/y2017/control_loops/superstructure/intake/BUILD
@@ -7,6 +7,7 @@
         "intake_integral_plant.cc",
     ],
     cmd = "$(location //y2017/control_loops/python:intake) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2017/control_loops/python:intake",
     ],
@@ -22,6 +23,7 @@
         "intake_integral_plant.h",
         "intake_plant.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//frc971/control_loops:state_feedback_loop",
@@ -36,6 +38,7 @@
     hdrs = [
         "intake.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":intake_plants",
diff --git a/y2017/control_loops/superstructure/shooter/BUILD b/y2017/control_loops/superstructure/shooter/BUILD
index d83e34b..49fa341 100644
--- a/y2017/control_loops/superstructure/shooter/BUILD
+++ b/y2017/control_loops/superstructure/shooter/BUILD
@@ -9,6 +9,7 @@
         "shooter_integral_plant.cc",
     ],
     cmd = "$(location //y2017/control_loops/python:shooter) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2017/control_loops/python:shooter",
     ],
@@ -24,6 +25,7 @@
         "shooter_integral_plant.h",
         "shooter_plant.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//frc971/control_loops:hybrid_state_feedback_loop",
@@ -39,6 +41,7 @@
     hdrs = [
         "shooter.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":shooter_plants",
diff --git a/y2017/vision/BUILD b/y2017/vision/BUILD
index a71fc8a..62e2278 100644
--- a/y2017/vision/BUILD
+++ b/y2017/vision/BUILD
@@ -1,5 +1,5 @@
 load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
-load("//tools/build_rules:gtk_dependent.bzl", "gtk_dependent_cc_binary", "gtk_dependent_cc_library")
+load("//tools/build_rules:gtk_dependent.bzl", "gtk_dependent_cc_binary")
 load("@com_google_protobuf//:protobuf.bzl", "cc_proto_library")
 
 package(default_visibility = ["//visibility:public"])
@@ -10,17 +10,20 @@
         "vision.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
 cc_proto_library(
     name = "vision_result",
     srcs = ["vision_result.proto"],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_proto_library(
     name = "vision_config",
     srcs = ["vision_config.proto"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/vision/image:camera_params",
     ],
@@ -31,6 +34,7 @@
     srcs = [
         "target_sender.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":target_finder",
         ":vision_config",
@@ -56,6 +60,7 @@
     srcs = [
         "target_receiver.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":target_finder",
@@ -73,6 +78,7 @@
     name = "target_finder",
     srcs = ["target_finder.cc"],
     hdrs = ["target_finder.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/vision/blob:threshold",
         "//aos/vision/blob:transpose",
@@ -84,6 +90,7 @@
 gtk_dependent_cc_binary(
     name = "debug_viewer",
     srcs = ["debug_viewer.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":target_finder",
         "//aos/vision/blob:move_scale",
diff --git a/y2018/BUILD b/y2018/BUILD
index cf3951e..7055f0a 100644
--- a/y2018/BUILD
+++ b/y2018/BUILD
@@ -12,6 +12,7 @@
         "//y2018/control_loops/drivetrain:drivetrain",
         "//y2018/control_loops/superstructure:superstructure",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_binary(
@@ -19,6 +20,7 @@
     srcs = [
         "joystick_reader.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":vision_proto",
         "//aos:init",
@@ -49,6 +51,7 @@
     hdrs = [
         "constants.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos/logging",
@@ -67,7 +70,7 @@
     srcs = [
         "wpilib_interface.cc",
     ],
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     deps = [
         ":status_light_fbs",
         "//aos:init",
@@ -111,6 +114,7 @@
         "status_light.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -125,6 +129,7 @@
         "//y2018/control_loops/superstructure:superstructure_status_fbs",
         "//y2018/vision:vision_fbs",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos/robot_state:config",
@@ -135,11 +140,13 @@
 cc_proto_library(
     name = "vision_proto",
     srcs = ["vision.proto"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/y2018/actors/BUILD b/y2018/actors/BUILD
index 7a95419..15cad33 100644
--- a/y2018/actors/BUILD
+++ b/y2018/actors/BUILD
@@ -6,6 +6,7 @@
     hdrs = [
         "autonomous_actor.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/actions:action_lib",
         "//aos/events:event_loop",
@@ -25,6 +26,7 @@
     srcs = [
         "autonomous_actor_main.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":autonomous_action_lib",
diff --git a/y2018/control_loops/BUILD b/y2018/control_loops/BUILD
index 57f2864..90a398e 100644
--- a/y2018/control_loops/BUILD
+++ b/y2018/control_loops/BUILD
@@ -1,6 +1,7 @@
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = ["//y2018:python_init"],
 )
diff --git a/y2018/control_loops/drivetrain/BUILD b/y2018/control_loops/drivetrain/BUILD
index 4d6a6a1..e9a75b8 100644
--- a/y2018/control_loops/drivetrain/BUILD
+++ b/y2018/control_loops/drivetrain/BUILD
@@ -7,6 +7,7 @@
         "kalman_drivetrain_motor_plant.cc",
     ],
     cmd = "$(location //y2018/control_loops/python:drivetrain) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2018/control_loops/python:drivetrain",
     ],
@@ -23,6 +24,7 @@
         "hybrid_velocity_drivetrain.cc",
     ],
     cmd = "$(location //y2018/control_loops/python:polydrivetrain) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2018/control_loops/python:polydrivetrain",
     ],
@@ -42,6 +44,7 @@
         "kalman_drivetrain_motor_plant.h",
         "polydrivetrain_dog_motor_plant.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//frc971/control_loops:hybrid_state_feedback_loop",
@@ -57,6 +60,7 @@
     hdrs = [
         "drivetrain_base.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":polydrivetrain_plants",
@@ -70,6 +74,7 @@
     srcs = [
         "drivetrain_main.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":drivetrain_base",
diff --git a/y2018/control_loops/python/BUILD b/y2018/control_loops/python/BUILD
index 7cea41b..1f29601 100644
--- a/y2018/control_loops/python/BUILD
+++ b/y2018/control_loops/python/BUILD
@@ -6,7 +6,7 @@
         "drivetrain.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -22,7 +22,7 @@
         "polydrivetrain.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -37,7 +37,7 @@
         "drivetrain.py",
         "polydrivetrain.py",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     visibility = ["//visibility:public"],
     deps = [
         ":python_init",
@@ -55,7 +55,7 @@
         "polydrivetrain_test.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":polydrivetrain_lib",
         ":python_init",
@@ -73,7 +73,7 @@
         "path_points.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -88,7 +88,7 @@
         "intake.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -103,6 +103,7 @@
     hdrs = [
         "dlqr.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "@slycot_repo//:slicot",
     ],
@@ -113,7 +114,7 @@
     srcs = [
         "arm_mpc.cc",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":arm_bounds",
         ":dlqr",
@@ -129,7 +130,7 @@
     srcs = [
         "3d_plot.cc",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":arm_bounds",
         "//third_party/matplotlib-cpp",
@@ -145,6 +146,7 @@
     hdrs = [
         "arm_bounds.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "@cgal_repo//:cgal",
         "@org_tuxfamily_eigen//:eigen",
@@ -156,7 +158,7 @@
     srcs = [
         "2d_plot.cc",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         "//third_party/matplotlib-cpp",
         "@com_github_gflags_gflags//:gflags",
@@ -169,10 +171,10 @@
         "graph_edit.py",
         "graph_generate.py",
     ],
-    python_version = "PY3",
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    python_version = "PY3",
     srcs_version = "PY3",
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//frc971/control_loops/python:basic_window",
@@ -187,9 +189,10 @@
         "graph_codegen.py",
         "graph_generate.py",
     ],
-    python_version = "PY2",
     legacy_create_init = False,
+    python_version = "PY2",
     srcs_version = "PY2",
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":python_init",
     ],
@@ -198,6 +201,7 @@
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = ["//y2018/control_loops:python_init"],
 )
@@ -207,7 +211,7 @@
     srcs = [
         "extended_lqr.py",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         "//external:python-gflags",
         "//external:python-glog",
@@ -221,7 +225,7 @@
         "arm_mpc.py",
     ],
     main = "arm_mpc.py",
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         "//external:python-gflags",
         "//external:python-glog",
diff --git a/y2018/control_loops/superstructure/BUILD b/y2018/control_loops/superstructure/BUILD
index db01298..d44807e 100644
--- a/y2018/control_loops/superstructure/BUILD
+++ b/y2018/control_loops/superstructure/BUILD
@@ -11,6 +11,7 @@
     includes = [
         "//frc971/control_loops:control_loops_fbs_includes",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -22,6 +23,7 @@
     includes = [
         "//frc971/control_loops:control_loops_fbs_includes",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -33,6 +35,7 @@
     includes = [
         "//frc971/control_loops:control_loops_fbs_includes",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -41,6 +44,7 @@
         "superstructure_output.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_library(
@@ -51,6 +55,7 @@
     hdrs = [
         "superstructure.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":superstructure_goal_fbs",
         ":superstructure_output_fbs",
@@ -76,6 +81,7 @@
     ],
     data = ["//y2018:config"],
     shard_count = 5,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":superstructure_goal_fbs",
         ":superstructure_lib",
@@ -97,6 +103,7 @@
     srcs = [
         "superstructure_main.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":superstructure_lib",
         "//aos:init",
@@ -111,6 +118,7 @@
     hdrs = [
         "debouncer.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_test(
@@ -118,6 +126,7 @@
     srcs = [
         "debouncer_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":debouncer",
         "//aos/testing:googletest",
diff --git a/y2018/control_loops/superstructure/arm/BUILD b/y2018/control_loops/superstructure/arm/BUILD
index bf3c306..d05c245 100644
--- a/y2018/control_loops/superstructure/arm/BUILD
+++ b/y2018/control_loops/superstructure/arm/BUILD
@@ -6,6 +6,7 @@
     hdrs = [
         "trajectory.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":dynamics",
@@ -21,6 +22,7 @@
     srcs = [
         "trajectory_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":demo_path",
         ":dynamics",
@@ -39,6 +41,7 @@
     hdrs = [
         "dynamics.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//frc971/control_loops:runge_kutta",
@@ -53,6 +56,7 @@
         "demo_path.cc",
     ],
     hdrs = ["demo_path.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":trajectory"],
 )
 
@@ -61,6 +65,7 @@
     srcs = [
         "dynamics_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":dynamics",
         "//aos/testing:googletest",
@@ -72,7 +77,7 @@
     srcs = [
         "trajectory_plot.cc",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":ekf",
         ":generated_graph",
@@ -91,6 +96,7 @@
     hdrs = [
         "ekf.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":dynamics",
@@ -103,11 +109,13 @@
     name = "graph",
     srcs = ["graph.cc"],
     hdrs = ["graph.h"],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_test(
     name = "graph_test",
     srcs = ["graph_test.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":graph",
         "//aos/testing:googletest",
@@ -122,6 +130,7 @@
     hdrs = [
         "arm.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":demo_path",
@@ -143,6 +152,7 @@
         "generated_graph.cc",
     ],
     cmd = "$(location //y2018/control_loops/python:graph_codegen) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2018/control_loops/python:graph_codegen",
     ],
@@ -157,6 +167,7 @@
     copts = [
         "-O1",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":graph",
diff --git a/y2018/control_loops/superstructure/intake/BUILD b/y2018/control_loops/superstructure/intake/BUILD
index dde7c63..c49b80b 100644
--- a/y2018/control_loops/superstructure/intake/BUILD
+++ b/y2018/control_loops/superstructure/intake/BUILD
@@ -7,6 +7,7 @@
         "intake_delayed_plant.cc",
     ],
     cmd = "$(location //y2018/control_loops/python:intake) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2018/control_loops/python:intake",
     ],
@@ -22,6 +23,7 @@
         "intake_delayed_plant.h",
         "intake_plant.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//frc971/control_loops:state_feedback_loop",
@@ -36,6 +38,7 @@
     hdrs = [
         "intake.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":intake_plants",
diff --git a/y2018/vision/BUILD b/y2018/vision/BUILD
index 7bcd402..470d0de 100644
--- a/y2018/vision/BUILD
+++ b/y2018/vision/BUILD
@@ -3,6 +3,7 @@
 cc_binary(
     name = "image_streamer",
     srcs = ["image_streamer.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/logging",
         "//aos/logging:implementations",
@@ -23,6 +24,7 @@
         "vision.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -31,6 +33,7 @@
     srcs = [
         "vision_status.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":vision_fbs",
diff --git a/y2018/vision/deploy.sh b/y2018/vision/deploy.sh
index d248f57..c77cddd 100755
--- a/y2018/vision/deploy.sh
+++ b/y2018/vision/deploy.sh
@@ -5,7 +5,7 @@
 JETSON="root@$1"
 
 # To build for the Jetson, use
-bazel build -c opt //y2018/vision:image_streamer --cpu=armhf-debian
+bazel build -c opt //y2018/vision:image_streamer --config=armhf-debian
 
 # Copy files to Jetson
 rsync -av --progress bazel-bin/y2018/vision/image_streamer y2018/vision/exposure_loop.sh "${JETSON}":.
diff --git a/y2019/BUILD b/y2019/BUILD
index ddc0a19..3f361a7 100644
--- a/y2019/BUILD
+++ b/y2019/BUILD
@@ -18,6 +18,7 @@
         "//y2019/actors:binaries",
         "//y2019/vision/server",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_library(
@@ -28,6 +29,7 @@
     hdrs = [
         "constants.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos/logging",
@@ -54,7 +56,7 @@
     ],
     # This library uses some deprecated parts of the SPI API.
     copts = ["-Wno-deprecated-declarations"],
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     deps = [
         ":camera_log_fbs",
         ":constants",
@@ -103,6 +105,7 @@
     hdrs = [
         "joystick_angle.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/input:drivetrain_input",
         "//frc971/zeroing:wrap",
@@ -114,6 +117,7 @@
     srcs = [
         "joystick_angle_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":joystick_angle",
         "//aos/testing:googletest",
@@ -125,6 +129,7 @@
     srcs = [
         ":joystick_reader.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":camera_log_fbs",
         ":vision_proto",
@@ -158,6 +163,7 @@
         "camera_log.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -167,6 +173,7 @@
         "status_light.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -183,6 +190,7 @@
         "//y2019/control_loops/superstructure:superstructure_status_fbs",
         ":camera_log_fbs",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos/robot_state:config",
@@ -195,11 +203,13 @@
 cc_proto_library(
     name = "vision_proto",
     srcs = ["vision.proto"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/y2019/actors/BUILD b/y2019/actors/BUILD
index 3aa2a22..4a66b55 100644
--- a/y2019/actors/BUILD
+++ b/y2019/actors/BUILD
@@ -24,6 +24,7 @@
         "auto_splines.h",
         "autonomous_actor.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/events:event_loop",
         "//aos/logging",
@@ -44,6 +45,7 @@
     srcs = [
         "autonomous_actor_main.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":autonomous_action_lib",
         "//aos:init",
diff --git a/y2019/control_loops/BUILD b/y2019/control_loops/BUILD
index ddfdf61..0c1940b 100644
--- a/y2019/control_loops/BUILD
+++ b/y2019/control_loops/BUILD
@@ -1,6 +1,7 @@
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = ["//y2019:python_init"],
 )
diff --git a/y2019/control_loops/drivetrain/BUILD b/y2019/control_loops/drivetrain/BUILD
index c500ce6..78c602e 100644
--- a/y2019/control_loops/drivetrain/BUILD
+++ b/y2019/control_loops/drivetrain/BUILD
@@ -11,6 +11,7 @@
         "kalman_drivetrain_motor_plant.cc",
     ],
     cmd = "$(location //y2019/control_loops/python:drivetrain) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2019/control_loops/python:drivetrain",
     ],
@@ -27,6 +28,7 @@
         "hybrid_velocity_drivetrain.cc",
     ],
     cmd = "$(location //y2019/control_loops/python:polydrivetrain) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2019/control_loops/python:polydrivetrain",
     ],
@@ -46,6 +48,7 @@
         "kalman_drivetrain_motor_plant.h",
         "polydrivetrain_dog_motor_plant.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//frc971/control_loops:hybrid_state_feedback_loop",
@@ -61,6 +64,7 @@
     hdrs = [
         "drivetrain_base.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":polydrivetrain_plants",
@@ -74,6 +78,7 @@
     srcs = [
         "drivetrain_main.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":drivetrain_base",
@@ -88,6 +93,7 @@
     name = "target_selector_fbs",
     srcs = ["target_selector.fbs"],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -97,12 +103,14 @@
         "camera.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
 cc_library(
     name = "localizer",
     hdrs = ["localizer.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//frc971/control_loops:pose",
         "//frc971/control_loops/drivetrain:camera",
@@ -114,6 +122,7 @@
     name = "target_selector",
     srcs = ["target_selector.cc"],
     hdrs = ["target_selector.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":target_selector_fbs",
         "//frc971/control_loops:pose",
@@ -128,6 +137,7 @@
     name = "target_selector_test",
     srcs = ["target_selector_test.cc"],
     data = ["//y2019:config"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":target_selector",
         "//aos/events:simulated_event_loop",
@@ -140,6 +150,7 @@
     name = "event_loop_localizer",
     srcs = ["event_loop_localizer.cc"],
     hdrs = ["event_loop_localizer.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":camera_fbs",
         ":localizer",
@@ -161,6 +172,7 @@
         }),
     linkstatic = True,
     shard_count = 8,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":localizer",
         ":drivetrain_base",
@@ -182,6 +194,7 @@
 aos_config(
     name = "simulation_config",
     src = "drivetrain_simulation_config.json",
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//frc971/control_loops/drivetrain:simulation_channels",
@@ -193,6 +206,7 @@
     name = "localized_drivetrain_test",
     srcs = ["localized_drivetrain_test.cc"],
     data = [":simulation_config"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":camera_fbs",
         ":drivetrain_base",
@@ -211,6 +225,7 @@
     name = "drivetrain_replay",
     srcs = ["drivetrain_replay.cc"],
     data = ["//y2019:config"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":drivetrain_base",
         ":event_loop_localizer",
diff --git a/y2019/control_loops/python/BUILD b/y2019/control_loops/python/BUILD
index 334bfd5..3d5e641 100644
--- a/y2019/control_loops/python/BUILD
+++ b/y2019/control_loops/python/BUILD
@@ -6,7 +6,7 @@
         "drivetrain.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -22,7 +22,7 @@
         "polydrivetrain.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -37,7 +37,7 @@
         "drivetrain.py",
         "polydrivetrain.py",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     visibility = ["//visibility:public"],
     deps = [
         ":python_init",
@@ -52,6 +52,7 @@
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = ["//y2019/control_loops:python_init"],
 )
@@ -62,7 +63,7 @@
         "elevator.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -78,7 +79,7 @@
         "wrist.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -94,7 +95,7 @@
         "intake.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -110,7 +111,7 @@
         "stilts.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
diff --git a/y2019/control_loops/superstructure/BUILD b/y2019/control_loops/superstructure/BUILD
index c352ba6..d89b1f3 100644
--- a/y2019/control_loops/superstructure/BUILD
+++ b/y2019/control_loops/superstructure/BUILD
@@ -12,6 +12,7 @@
         "//frc971/control_loops:control_loops_fbs_includes",
         "//frc971/control_loops:profiled_subsystem_fbs_includes",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -20,6 +21,7 @@
         "superstructure_output.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -32,6 +34,7 @@
         "//frc971/control_loops:control_loops_fbs_includes",
         "//frc971/control_loops:profiled_subsystem_fbs_includes",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -44,6 +47,7 @@
         "//frc971/control_loops:control_loops_fbs_includes",
         "//frc971/control_loops:profiled_subsystem_fbs_includes",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_library(
@@ -54,6 +58,7 @@
     hdrs = [
         "superstructure.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":collision_avoidance",
         ":superstructure_goal_fbs",
@@ -77,6 +82,7 @@
     data = [
         "//y2019:config",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":superstructure_goal_fbs",
         ":superstructure_lib",
@@ -101,6 +107,7 @@
     srcs = [
         "superstructure_main.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":superstructure_lib",
         "//aos:init",
@@ -116,6 +123,7 @@
     hdrs = [
         "collision_avoidance.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":superstructure_goal_fbs",
         ":superstructure_status_fbs",
@@ -134,6 +142,7 @@
     hdrs = [
         "vacuum.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":superstructure_goal_fbs",
         ":superstructure_output_fbs",
@@ -148,6 +157,7 @@
     srcs = [
         "collision_avoidance_tests.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":collision_avoidance",
         ":superstructure_goal_fbs",
diff --git a/y2019/control_loops/superstructure/elevator/BUILD b/y2019/control_loops/superstructure/elevator/BUILD
index f3d99fe..1084295 100644
--- a/y2019/control_loops/superstructure/elevator/BUILD
+++ b/y2019/control_loops/superstructure/elevator/BUILD
@@ -9,6 +9,7 @@
         "integral_elevator_plant.cc",
     ],
     cmd = "$(location //y2019/control_loops/python:elevator) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2019/control_loops/python:elevator",
     ],
@@ -24,6 +25,7 @@
         "elevator_plant.h",
         "integral_elevator_plant.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//frc971/control_loops:hybrid_state_feedback_loop",
diff --git a/y2019/control_loops/superstructure/intake/BUILD b/y2019/control_loops/superstructure/intake/BUILD
index 4f7f6b0..9d09510 100644
--- a/y2019/control_loops/superstructure/intake/BUILD
+++ b/y2019/control_loops/superstructure/intake/BUILD
@@ -9,6 +9,7 @@
         "integral_intake_plant.cc",
     ],
     cmd = "$(location //y2019/control_loops/python:intake) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2019/control_loops/python:intake",
     ],
@@ -24,6 +25,7 @@
         "intake_plant.h",
         "integral_intake_plant.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//frc971/control_loops:hybrid_state_feedback_loop",
diff --git a/y2019/control_loops/superstructure/stilts/BUILD b/y2019/control_loops/superstructure/stilts/BUILD
index a9c556e..346d88c 100644
--- a/y2019/control_loops/superstructure/stilts/BUILD
+++ b/y2019/control_loops/superstructure/stilts/BUILD
@@ -9,6 +9,7 @@
         "integral_stilts_plant.cc",
     ],
     cmd = "$(location //y2019/control_loops/python:stilts) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2019/control_loops/python:stilts",
     ],
@@ -24,6 +25,7 @@
         "integral_stilts_plant.h",
         "stilts_plant.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//frc971/control_loops:hybrid_state_feedback_loop",
diff --git a/y2019/control_loops/superstructure/wrist/BUILD b/y2019/control_loops/superstructure/wrist/BUILD
index e960b1a..8abfad5 100644
--- a/y2019/control_loops/superstructure/wrist/BUILD
+++ b/y2019/control_loops/superstructure/wrist/BUILD
@@ -9,6 +9,7 @@
         "integral_wrist_plant.cc",
     ],
     cmd = "$(location //y2019/control_loops/python:wrist) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2019/control_loops/python:wrist",
     ],
@@ -24,6 +25,7 @@
         "integral_wrist_plant.h",
         "wrist_plant.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//frc971/control_loops:hybrid_state_feedback_loop",
diff --git a/y2019/image_streamer/BUILD b/y2019/image_streamer/BUILD
index 4885da0..f394b91 100644
--- a/y2019/image_streamer/BUILD
+++ b/y2019/image_streamer/BUILD
@@ -3,6 +3,7 @@
 cc_binary(
     name = "image_streamer",
     srcs = ["image_streamer.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":flip_image",
         "//aos/logging",
@@ -28,6 +29,7 @@
         "-Wno-cast-qual",
         "-Wno-error=type-limits",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//third_party/cimg:CImg",
         "//third_party/libjpeg",
diff --git a/y2019/image_streamer/deploy.sh b/y2019/image_streamer/deploy.sh
index 584d09e..9cbf8ab 100755
--- a/y2019/image_streamer/deploy.sh
+++ b/y2019/image_streamer/deploy.sh
@@ -40,7 +40,7 @@
 echo -e "\n# Building image_streamer"
 (
 set -x
-bazel build -c opt //y2019/image_streamer:image_streamer --cpu=armhf-debian
+bazel build -c opt //y2019/image_streamer:image_streamer --config=armhf-debian
 )
 
 echo -e "\n# Copy files to ODROID"
diff --git a/y2019/jevois/BUILD b/y2019/jevois/BUILD
index f11c67c..d6d3dfc 100644
--- a/y2019/jevois/BUILD
+++ b/y2019/jevois/BUILD
@@ -1,4 +1,3 @@
-load("//tools:environments.bzl", "mcu_cpus")
 load("//motors:macros.bzl", "hex_from_elf")
 
 jevois_crc_args = [
@@ -47,7 +46,7 @@
             "$(location jevois_crc.c)",
         ]),
     ]),
-    compatible_with = mcu_cpus,
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//third_party/pycrc:pycrc_main",
     ],
@@ -61,7 +60,7 @@
     hdrs = [
         "jevois_crc.h",
     ],
-    compatible_with = mcu_cpus,
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//third_party/GSL",
     ],
@@ -81,19 +80,6 @@
 )
 
 cc_library(
-    name = "structures_mcu",
-    hdrs = [
-        "structures.h",
-    ],
-    restricted_to = mcu_cpus,
-    deps = [
-        "//aos/containers:sized_array",
-        "//aos/time:time_mcu",
-        "@org_tuxfamily_eigen//:eigen",
-    ],
-)
-
-cc_library(
     name = "spi",
     srcs = [
         "spi.cc",
@@ -105,27 +91,12 @@
     deps = [
         ":jevois_crc",
         ":structures",
-        "//aos/logging",
         "//aos/util:bitpacking",
         "//third_party/GSL",
-    ],
-)
-
-cc_library(
-    name = "spi_mcu",
-    srcs = [
-        "spi.cc",
-    ],
-    hdrs = [
-        "spi.h",
-    ],
-    restricted_to = mcu_cpus,
-    deps = [
-        ":jevois_crc",
-        ":structures_mcu",
-        "//aos/util:bitpacking",
-        "//third_party/GSL",
-    ],
+    ] + select({
+        "@platforms//os:linux": ["//aos/logging"],
+        "//conditions:default": [],
+    }),
 )
 
 cc_library(
@@ -142,29 +113,12 @@
         ":jevois_crc",
         ":structures",
         "//aos/containers:sized_array",
-        "//aos/logging",
         "//aos/util:bitpacking",
         "//third_party/GSL",
-    ],
-)
-
-cc_library(
-    name = "uart_mcu",
-    srcs = [
-        "uart.cc",
-    ],
-    hdrs = [
-        "uart.h",
-    ],
-    restricted_to = mcu_cpus,
-    deps = [
-        ":cobs_mcu",
-        ":jevois_crc",
-        ":structures_mcu",
-        "//aos/containers:sized_array",
-        "//aos/util:bitpacking",
-        "//third_party/GSL",
-    ],
+    ] + select({
+        "@platforms//os:linux": ["//aos/logging"],
+        "//conditions:default": [],
+    }),
 )
 
 cc_test(
@@ -172,6 +126,7 @@
     srcs = [
         "uart_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":uart",
         "//aos/testing:googletest",
@@ -183,6 +138,7 @@
     srcs = [
         "spi_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":spi",
         "//aos/testing:googletest",
@@ -199,22 +155,12 @@
     ],
 )
 
-cc_library(
-    name = "cobs_mcu",
-    hdrs = [
-        "cobs.h",
-    ],
-    restricted_to = mcu_cpus,
-    deps = [
-        "//third_party/GSL",
-    ],
-)
-
 cc_test(
     name = "cobs_test",
     srcs = [
         "cobs_test.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":cobs",
         "//aos/testing:googletest",
@@ -227,6 +173,7 @@
     name = "serial",
     srcs = ["serial.cc"],
     hdrs = ["serial.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos/logging",
@@ -238,12 +185,12 @@
     srcs = [
         "teensy.cc",
     ],
-    restricted_to = ["//tools:cortex-m4f"],
+    target_compatible_with = ["//tools/platforms/hardware:cortex_m4f"],
     deps = [
-        ":cobs_mcu",
-        ":spi_mcu",
-        ":uart_mcu",
-        "//aos/time:time_mcu",
+        ":cobs",
+        ":spi",
+        ":uart",
+        "//aos/time:time",
         "//motors:util",
         "//motors/core",
         "//motors/peripheral:configuration",
@@ -257,5 +204,5 @@
 
 hex_from_elf(
     name = "teensy",
-    restricted_to = ["//tools:cortex-m4f"],
+    target_compatible_with = ["//tools/platforms/hardware:cortex_m4f"],
 )
diff --git a/y2019/jevois/camera/BUILD b/y2019/jevois/camera/BUILD
index bf716a0..6bd2b99 100644
--- a/y2019/jevois/camera/BUILD
+++ b/y2019/jevois/camera/BUILD
@@ -4,6 +4,7 @@
     name = "reader",
     srcs = ["reader.cc"],
     hdrs = ["reader.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/time",
         "//aos/vision/image:camera_params",
@@ -17,6 +18,7 @@
     name = "image_stream",
     srcs = ["image_stream.cc"],
     hdrs = ["image_stream.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":reader",
         "//aos/logging",
diff --git a/y2019/jevois/deploy_teensy.sh b/y2019/jevois/deploy_teensy.sh
index 50d0571..87ea153 100755
--- a/y2019/jevois/deploy_teensy.sh
+++ b/y2019/jevois/deploy_teensy.sh
@@ -2,4 +2,4 @@
 
 cd "$(dirname "${BASH_SOURCE[0]}")"
 
-bazel build --cpu=cortex-m4f -c opt //y2019/jevois:teensy.hex -s && bazel run //motors/teensy_loader_cli -- --mcu=mk64fx512 -s $(readlink -f ../../bazel-bin/y2019/jevois/teensy.hex)
+bazel build --config=cortex-m4f -c opt //y2019/jevois:teensy.hex -s && bazel run //motors/teensy_loader_cli -- --mcu=mk64fx512 -s $(readlink -f ../../bazel-bin/y2019/jevois/teensy.hex)
diff --git a/y2019/vision/BUILD b/y2019/vision/BUILD
index 22b973a..e005e70 100644
--- a/y2019/vision/BUILD
+++ b/y2019/vision/BUILD
@@ -1,13 +1,12 @@
-load("//tools/build_rules:gtk_dependent.bzl", "gtk_dependent_cc_binary", "gtk_dependent_cc_library")
-load("@com_google_protobuf//:protobuf.bzl", "cc_proto_library")
-load("//tools:environments.bzl", "mcu_cpus")
+load("//tools:platforms.bzl", "platforms")
+load("//tools/build_rules:gtk_dependent.bzl", "gtk_dependent_cc_binary")
 
 package(default_visibility = ["//visibility:public"])
 
-VISION_TARGETS = [
-    "//tools:k8",
-    "//tools:armhf-debian",
-]
+VISION_TARGETS = platforms.any_of([
+    "@platforms//cpu:x86_64",
+    "//tools/platforms/hardware:raspberry_pi",
+])
 
 cc_library(
     name = "constants",
@@ -16,13 +15,14 @@
         "constants_formatting.cc",
     ],
     hdrs = ["constants.h"],
-    compatible_with = mcu_cpus,
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
 cc_binary(
     name = "constants_formatting",
     srcs = ["constants_formatting_main.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [":constants"],
 )
 
@@ -30,6 +30,7 @@
     name = "generate_constants",
     outs = ["validate_constants.cc"],
     cmd = "$(location :constants_formatting) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [":constants_formatting"],
 )
 
@@ -37,6 +38,7 @@
     name = "image_writer",
     srcs = ["image_writer.cc"],
     hdrs = ["image_writer.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/vision/image:image_types",
         "@com_github_google_glog//:glog",
@@ -54,6 +56,7 @@
         ":constants.cc",
         ":validate_constants.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_library(
@@ -66,7 +69,7 @@
         "target_finder.h",
         "target_types.h",
     ],
-    restricted_to = VISION_TARGETS,
+    target_compatible_with = VISION_TARGETS,
     deps = [
         ":constants",
         "//aos/util:math",
@@ -84,7 +87,7 @@
 gtk_dependent_cc_binary(
     name = "debug_viewer",
     srcs = ["debug_viewer.cc"],
-    restricted_to = VISION_TARGETS,
+    target_compatible_with = VISION_TARGETS,
     deps = [
         ":target_finder",
         "//aos/vision/blob:move_scale",
@@ -99,7 +102,7 @@
 cc_binary(
     name = "target_sender",
     srcs = ["target_sender.cc"],
-    restricted_to = VISION_TARGETS,
+    target_compatible_with = VISION_TARGETS,
     deps = [
         ":image_writer",
         ":target_finder",
@@ -121,7 +124,7 @@
 cc_binary(
     name = "serial_waiter",
     srcs = ["serial_waiter.cc"],
-    restricted_to = VISION_TARGETS,
+    target_compatible_with = VISION_TARGETS,
     deps = [
         "//aos/time",
         "//y2019/jevois:serial",
@@ -131,6 +134,7 @@
 cc_binary(
     name = "debug_serial",
     srcs = ["debug_serial.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/logging",
         "//aos/logging:implementations",
@@ -145,7 +149,7 @@
     srcs = [
         "global_calibration.cc",
     ],
-    restricted_to = VISION_TARGETS,
+    target_compatible_with = VISION_TARGETS,
     deps = [
         ":target_finder",
         "//aos/logging",
diff --git a/y2019/vision/server/BUILD b/y2019/vision/server/BUILD
index 3d63e09..c20357f 100644
--- a/y2019/vision/server/BUILD
+++ b/y2019/vision/server/BUILD
@@ -9,6 +9,7 @@
     srcs = [
         "demo.ts",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 gen_embedded(
@@ -17,6 +18,7 @@
         include = ["www_defaults/**/*"],
         exclude = ["www/**/*"],
     ),
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 aos_downloader_dir(
@@ -26,12 +28,14 @@
         "//y2019/vision/server/www:visualizer_bundle",
     ],
     dir = "www",
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
 cc_proto_library(
     name = "server_data_proto",
     srcs = ["server_data.proto"],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_binary(
@@ -43,6 +47,7 @@
         "//y2019/vision/server/www:files",
         "//y2019/vision/server/www:visualizer_bundle",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":gen_embedded",
diff --git a/y2019/vision/server/www/BUILD b/y2019/vision/server/www/BUILD
index 7631d5e..62c1f13 100644
--- a/y2019/vision/server/www/BUILD
+++ b/y2019/vision/server/www/BUILD
@@ -15,11 +15,13 @@
     srcs = glob([
         "*.ts",
     ]) + ["camera_constants.ts"],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_binary(
     name = "generate_camera",
     srcs = ["generate_camera.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = ["//y2019:constants"],
 )
 
@@ -27,6 +29,7 @@
     name = "gen_cam_ts",
     outs = ["camera_constants.ts"],
     cmd = "$(location :generate_camera) $@",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [":generate_camera"],
 )
 
@@ -34,6 +37,7 @@
     name = "visualizer_bundle",
     enable_code_splitting = False,
     entry_point = "main.ts",
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":visualizer",
     ],
diff --git a/y2019/vision/tools/deploy.sh b/y2019/vision/tools/deploy.sh
index 2538239..c3bf9b9 100755
--- a/y2019/vision/tools/deploy.sh
+++ b/y2019/vision/tools/deploy.sh
@@ -15,7 +15,7 @@
 fi
 
 echo "Building executables"
-readonly BAZEL_OPTIONS="-c opt --cpu=armhf-debian"
+readonly BAZEL_OPTIONS="-c opt --config=armhf-debian"
 readonly BAZEL_BIN="$(bazel info ${BAZEL_OPTIONS} bazel-bin)"
 readonly TARGET_DIR=/media/$USER/JEVOIS
 
diff --git a/y2020/BUILD b/y2020/BUILD
index 59642fe..e54c168 100644
--- a/y2020/BUILD
+++ b/y2020/BUILD
@@ -21,6 +21,7 @@
         "//y2020/control_loops/drivetrain:drivetrain",
         "//y2020/control_loops/superstructure:superstructure",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 robot_downloader(
@@ -34,13 +35,13 @@
     dirs = [
         "//y2020/www:www_files",
     ],
-    restricted_to = ["//tools:armhf-debian"],
     start_binaries = [
         "//aos/network:message_bridge_client",
         "//aos/network:message_bridge_server",
         "//aos/network:web_proxy_main",
         "//y2020/vision:camera_reader",
     ],
+    target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
     target_type = "pi",
 )
 
@@ -52,6 +53,7 @@
     hdrs = [
         "constants.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos/logging",
@@ -75,7 +77,7 @@
     srcs = [
         "wpilib_interface.cc",
     ],
-    restricted_to = ["//tools:roborio"],
+    target_compatible_with = ["//tools/platforms/hardware:roborio"],
     deps = [
         ":constants",
         "//aos:init",
@@ -117,6 +119,7 @@
     srcs = [
         ":joystick_reader.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":setpoint_fbs",
         "//aos:init",
@@ -146,6 +149,7 @@
         "//y2020/vision/sift:sift_training_fbs",
         "//y2020/vision:vision_fbs",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":config_laptop",
@@ -170,6 +174,7 @@
             "//y2020/vision:vision_fbs",
             "//aos/events/logging:logger_fbs",
         ],
+        target_compatible_with = ["@platforms//os:linux"],
         visibility = ["//visibility:public"],
         deps = [
             "//aos/events:config",
@@ -197,6 +202,7 @@
         "//y2020/vision:vision_fbs",
         "//aos/events/logging:logger_fbs",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//aos/events:config",
@@ -220,6 +226,7 @@
         "//y2020/control_loops/superstructure:superstructure_position_fbs",
         "//y2020/control_loops/superstructure:superstructure_status_fbs",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/events:config",
         "//aos/robot_state:config",
@@ -232,6 +239,7 @@
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -245,6 +253,7 @@
         "//y2020/www:field_main_bundle.min.js",
         "//y2020/www:files",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
@@ -255,11 +264,13 @@
         "setpoint.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_binary(
     name = "setpoint_setter",
     srcs = ["setpoint_setter.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":setpoint_fbs",
         "//aos:init",
@@ -272,6 +283,7 @@
         name = "y2020_pi" + str(num) + ".json",
         src = "y2020_pi_template.json",
         parameters = {"NUM": str(num)},
+        target_compatible_with = ["@platforms//os:linux"],
     )
     for num in range(1, 5)
 ]
diff --git a/y2020/actors/BUILD b/y2020/actors/BUILD
index b294a51..fee0196 100644
--- a/y2020/actors/BUILD
+++ b/y2020/actors/BUILD
@@ -24,6 +24,7 @@
         "auto_splines.h",
         "autonomous_actor.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/events:event_loop",
         "//aos/logging",
@@ -46,6 +47,7 @@
     srcs = [
         "autonomous_actor_main.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":autonomous_action_lib",
         "//aos:init",
diff --git a/y2020/control_loops/BUILD b/y2020/control_loops/BUILD
index c0aa1ee..75ca8eb 100644
--- a/y2020/control_loops/BUILD
+++ b/y2020/control_loops/BUILD
@@ -1,6 +1,7 @@
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = ["//y2020:python_init"],
 )
diff --git a/y2020/control_loops/drivetrain/BUILD b/y2020/control_loops/drivetrain/BUILD
index 7e2ba18..490b1e7 100644
--- a/y2020/control_loops/drivetrain/BUILD
+++ b/y2020/control_loops/drivetrain/BUILD
@@ -11,6 +11,7 @@
         "kalman_drivetrain_motor_plant.cc",
     ],
     cmd = "$(location //y2020/control_loops/python:drivetrain) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2020/control_loops/python:drivetrain",
     ],
@@ -27,6 +28,7 @@
         "hybrid_velocity_drivetrain.cc",
     ],
     cmd = "$(location //y2020/control_loops/python:polydrivetrain) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2020/control_loops/python:polydrivetrain",
     ],
@@ -46,6 +48,7 @@
         "kalman_drivetrain_motor_plant.h",
         "polydrivetrain_dog_motor_plant.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//frc971/control_loops:hybrid_state_feedback_loop",
@@ -57,6 +60,7 @@
     name = "localizer",
     srcs = ["localizer.cc"],
     hdrs = ["localizer.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/containers:ring_buffer",
         "//aos/network:message_bridge_server_fbs",
@@ -77,6 +81,7 @@
     hdrs = [
         "drivetrain_base.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":polydrivetrain_plants",
@@ -90,6 +95,7 @@
     srcs = [
         "drivetrain_main.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":drivetrain_base",
@@ -103,6 +109,7 @@
 aos_config(
     name = "simulation_config",
     src = "drivetrain_simulation_config.json",
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//frc971/control_loops/drivetrain:simulation_channels",
@@ -113,6 +120,7 @@
 aos_config(
     name = "replay_config",
     src = "drivetrain_replay_config.json",
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//y2020:config",
@@ -123,6 +131,7 @@
     name = "localizer_test",
     srcs = ["localizer_test.cc"],
     data = [":simulation_config"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":drivetrain_base",
         ":localizer",
@@ -143,6 +152,7 @@
         ":replay_config",
         "@drivetrain_replay//file:spinning_wheels_while_still.bfbs",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":drivetrain_base",
         "//aos:configuration",
@@ -161,6 +171,7 @@
     name = "drivetrain_replay",
     srcs = ["drivetrain_replay.cc"],
     data = ["//y2020:config"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":drivetrain_base",
         ":localizer",
diff --git a/y2020/control_loops/python/BUILD b/y2020/control_loops/python/BUILD
index e218571..34d49cb 100644
--- a/y2020/control_loops/python/BUILD
+++ b/y2020/control_loops/python/BUILD
@@ -6,7 +6,7 @@
         "drivetrain.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -22,7 +22,7 @@
         "polydrivetrain.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -37,7 +37,7 @@
         "drivetrain.py",
         "polydrivetrain.py",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     visibility = ["//visibility:public"],
     deps = [
         ":python_init",
@@ -55,7 +55,7 @@
         "hood.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -71,7 +71,7 @@
         "intake.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -87,7 +87,7 @@
         "turret.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -103,7 +103,7 @@
         "control_panel.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":python_init",
         "//external:python-gflags",
@@ -118,7 +118,7 @@
     srcs = [
         "flywheel.py",
     ],
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         "//frc971/control_loops/python:controls",
         "@matplotlib_repo//:matplotlib2.7",
@@ -131,7 +131,7 @@
         "accelerator.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":flywheel",
         ":python_init",
@@ -146,7 +146,7 @@
         "finisher.py",
     ],
     legacy_create_init = False,
-    restricted_to = ["//tools:k8"],
+    target_compatible_with = ["@platforms//cpu:x86_64"],
     deps = [
         ":flywheel",
         ":python_init",
@@ -158,6 +158,7 @@
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = ["//y2020/control_loops:python_init"],
 )
diff --git a/y2020/control_loops/superstructure/BUILD b/y2020/control_loops/superstructure/BUILD
index e97fb12..d659920 100644
--- a/y2020/control_loops/superstructure/BUILD
+++ b/y2020/control_loops/superstructure/BUILD
@@ -12,6 +12,7 @@
         "//frc971/control_loops:control_loops_fbs_includes",
         "//frc971/control_loops:profiled_subsystem_fbs_includes",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -20,6 +21,7 @@
         "superstructure_output.fbs",
     ],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -32,6 +34,7 @@
         "//frc971/control_loops:control_loops_fbs_includes",
         "//frc971/control_loops:profiled_subsystem_fbs_includes",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 flatbuffer_cc_library(
@@ -44,6 +47,7 @@
         "//frc971/control_loops:control_loops_fbs_includes",
         "//frc971/control_loops:profiled_subsystem_fbs_includes",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
 )
 
 cc_library(
@@ -54,6 +58,7 @@
     hdrs = [
         "superstructure.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":climber",
         ":superstructure_goal_fbs",
@@ -75,6 +80,7 @@
     srcs = [
         "superstructure_main.cc",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":superstructure_lib",
         "//aos:init",
@@ -90,6 +96,7 @@
     data = [
         "//y2020:config",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":superstructure_goal_fbs",
         ":superstructure_lib",
@@ -119,6 +126,7 @@
     hdrs = [
         "climber.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":superstructure_goal_fbs",
         ":superstructure_output_fbs",
diff --git a/y2020/control_loops/superstructure/accelerator/BUILD b/y2020/control_loops/superstructure/accelerator/BUILD
index 30fca08..c2a6717 100644
--- a/y2020/control_loops/superstructure/accelerator/BUILD
+++ b/y2020/control_loops/superstructure/accelerator/BUILD
@@ -1,7 +1,5 @@
 package(default_visibility = ["//visibility:public"])
 
-load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
-
 genrule(
     name = "genrule_accelerator",
     outs = [
@@ -11,6 +9,7 @@
         "integral_accelerator_plant.cc",
     ],
     cmd = "$(location //y2020/control_loops/python:accelerator) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2020/control_loops/python:accelerator",
     ],
@@ -26,6 +25,7 @@
         "accelerator_plant.h",
         "integral_accelerator_plant.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//frc971/control_loops:hybrid_state_feedback_loop",
diff --git a/y2020/control_loops/superstructure/control_panel/BUILD b/y2020/control_loops/superstructure/control_panel/BUILD
index 75619ca..9f46998 100644
--- a/y2020/control_loops/superstructure/control_panel/BUILD
+++ b/y2020/control_loops/superstructure/control_panel/BUILD
@@ -9,6 +9,7 @@
         "integral_control_panel_plant.cc",
     ],
     cmd = "$(location //y2020/control_loops/python:control_panel) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2020/control_loops/python:control_panel",
     ],
@@ -24,6 +25,7 @@
         "control_panel_plant.h",
         "integral_control_panel_plant.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//frc971/control_loops:hybrid_state_feedback_loop",
diff --git a/y2020/control_loops/superstructure/finisher/BUILD b/y2020/control_loops/superstructure/finisher/BUILD
index 2009886..7a628c8 100644
--- a/y2020/control_loops/superstructure/finisher/BUILD
+++ b/y2020/control_loops/superstructure/finisher/BUILD
@@ -1,7 +1,5 @@
 package(default_visibility = ["//visibility:public"])
 
-load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
-
 genrule(
     name = "genrule_finisher",
     outs = [
@@ -11,6 +9,7 @@
         "integral_finisher_plant.cc",
     ],
     cmd = "$(location //y2020/control_loops/python:finisher) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2020/control_loops/python:finisher",
     ],
@@ -26,6 +25,7 @@
         "finisher_plant.h",
         "integral_finisher_plant.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//frc971/control_loops:hybrid_state_feedback_loop",
diff --git a/y2020/control_loops/superstructure/hood/BUILD b/y2020/control_loops/superstructure/hood/BUILD
index 6c1a60b..d0e5953 100644
--- a/y2020/control_loops/superstructure/hood/BUILD
+++ b/y2020/control_loops/superstructure/hood/BUILD
@@ -9,6 +9,7 @@
         "integral_hood_plant.cc",
     ],
     cmd = "$(location //y2020/control_loops/python:hood) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2020/control_loops/python:hood",
     ],
@@ -24,6 +25,7 @@
         "hood_plant.h",
         "integral_hood_plant.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//frc971/control_loops:hybrid_state_feedback_loop",
diff --git a/y2020/control_loops/superstructure/intake/BUILD b/y2020/control_loops/superstructure/intake/BUILD
index 2133204..5bb5d7f 100644
--- a/y2020/control_loops/superstructure/intake/BUILD
+++ b/y2020/control_loops/superstructure/intake/BUILD
@@ -9,6 +9,7 @@
         "integral_intake_plant.cc",
     ],
     cmd = "$(location //y2020/control_loops/python:intake) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2020/control_loops/python:intake",
     ],
@@ -24,6 +25,7 @@
         "intake_plant.h",
         "integral_intake_plant.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//frc971/control_loops:hybrid_state_feedback_loop",
diff --git a/y2020/control_loops/superstructure/shooter/BUILD b/y2020/control_loops/superstructure/shooter/BUILD
index fe8a29a..0b65037 100644
--- a/y2020/control_loops/superstructure/shooter/BUILD
+++ b/y2020/control_loops/superstructure/shooter/BUILD
@@ -1,9 +1,8 @@
 package(default_visibility = ["//visibility:public"])
 
-load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
-
 cc_library(
     name = "shooter_plants",
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//frc971/control_loops:state_feedback_loop",
     ],
@@ -17,6 +16,7 @@
     hdrs = [
         "shooter.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":flywheel_controller",
         "//aos/controls:control_loop",
@@ -36,6 +36,7 @@
     hdrs = [
         "flywheel_controller.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos/controls:control_loop",
         "//frc971/control_loops:profiled_subsystem",
diff --git a/y2020/control_loops/superstructure/turret/BUILD b/y2020/control_loops/superstructure/turret/BUILD
index 010c6fd..3761868 100644
--- a/y2020/control_loops/superstructure/turret/BUILD
+++ b/y2020/control_loops/superstructure/turret/BUILD
@@ -9,6 +9,7 @@
         "integral_turret_plant.cc",
     ],
     cmd = "$(location //y2020/control_loops/python:turret) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         "//y2020/control_loops/python:turret",
     ],
@@ -24,6 +25,7 @@
         "integral_turret_plant.h",
         "turret_plant.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         "//frc971/control_loops:hybrid_state_feedback_loop",
@@ -35,6 +37,7 @@
     name = "aiming",
     srcs = ["aiming.cc"],
     hdrs = ["aiming.h"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos:flatbuffers",
         "//frc971/control_loops:control_loops_fbs",
@@ -50,6 +53,7 @@
 cc_test(
     name = "aiming_test",
     srcs = ["aiming_test.cc"],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":aiming",
         "//aos/testing:googletest",
diff --git a/y2020/vision/BUILD b/y2020/vision/BUILD
index aaad085..a58ed8c 100644
--- a/y2020/vision/BUILD
+++ b/y2020/vision/BUILD
@@ -5,6 +5,7 @@
     name = "vision_fbs",
     srcs = ["vision.fbs"],
     gen_reflections = 1,
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//y2020:__subpackages__"],
 )
 
@@ -16,6 +17,7 @@
     hdrs = [
         "v4l2_reader.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//y2020:__subpackages__"],
     deps = [
         ":vision_fbs",
@@ -34,10 +36,7 @@
     data = [
         "//y2020:config",
     ],
-    restricted_to = [
-        "//tools:k8",
-        "//tools:armhf-debian",
-    ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//y2020:__subpackages__"],
     deps = [
         ":v4l2_reader",
@@ -57,6 +56,7 @@
 flatbuffer_ts_library(
     name = "vision_ts_fbs",
     srcs = ["vision.fbs"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//y2020:__subpackages__"],
 )
 
@@ -68,10 +68,7 @@
     data = [
         "//y2020:config",
     ],
-    restricted_to = [
-        "//tools:k8",
-        "//tools:armhf-debian",
-    ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//y2020:__subpackages__"],
     deps = [
         ":vision_fbs",
@@ -90,10 +87,7 @@
     data = [
         "//y2020:config",
     ],
-    restricted_to = [
-        "//tools:k8",
-        "//tools:armhf-debian",
-    ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//y2020:__subpackages__"],
     deps = [
         ":vision_fbs",
@@ -117,10 +111,7 @@
     data = [
         "//y2020:config",
     ],
-    restricted_to = [
-        "//tools:k8",
-        "//tools:armhf-debian",
-    ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//y2020:__subpackages__"],
     deps = [
         ":vision_fbs",
diff --git a/y2020/vision/sift/BUILD b/y2020/vision/sift/BUILD
index 158aa94..4a0dcfb 100644
--- a/y2020/vision/sift/BUILD
+++ b/y2020/vision/sift/BUILD
@@ -6,10 +6,7 @@
     srcs = [
         "fast_gaussian_generator.cc",
     ],
-    restricted_to = [
-        "//tools:k8",
-        "//tools:armhf-debian",
-    ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//third_party:halide",
         "//third_party:halide_gengen",
@@ -25,18 +22,15 @@
     ],
     data = [
         ":fast_gaussian_generator",
-        # TODO(Brian): Replace this with something more fine-grained from the
-        # configuration fragment or something.
-        "//tools/cpp:toolchain",
         "@amd64_debian_sysroot//:sysroot_files",
     ],
-    python_version = "PY3",
-    main = "fast_gaussian_runner.py",
-    restricted_to = [
-        "//tools:k8",
-        "//tools:armhf-debian",
+    toolchains = [
+        "@bazel_tools//tools/cpp:current_cc_toolchain",
     ],
+    main = "fast_gaussian_runner.py",
+    python_version = "PY3",
     srcs_version = "PY2AND3",
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "@bazel_tools//tools/python/runfiles",
     ],
@@ -121,10 +115,7 @@
     hdrs = [
         "sift971.h",
     ],
-    restricted_to = [
-        "//tools:k8",
-        "//tools:armhf-debian",
-    ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":fast_gaussian",
@@ -141,10 +132,7 @@
     hdrs = [
         "fast_gaussian.h",
     ],
-    restricted_to = [
-        "//tools:k8",
-        "//tools:armhf-debian",
-    ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":fast_gaussian_all",
         "//third_party:halide_runtime",
@@ -158,10 +146,7 @@
     srcs = [
         "fast_gaussian_test.cc",
     ],
-    restricted_to = [
-        "//tools:k8",
-        "//tools:armhf-debian",
-    ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":fast_gaussian",
         "//aos/testing:googletest",
@@ -174,10 +159,7 @@
     srcs = [
         "testing_sift.cc",
     ],
-    restricted_to = [
-        "//tools:k8",
-        "//tools:armhf-debian",
-    ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":fast_gaussian",
         "//aos:init",
@@ -207,6 +189,7 @@
         "TrainingImage",
         "TrainingData",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -214,12 +197,14 @@
     name = "sift_fbs",
     srcs = ["sift.fbs"],
     gen_reflections = True,
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
 flatbuffer_ts_library(
     name = "sift_ts_fbs",
     srcs = ["sift.fbs"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//y2020:__subpackages__"],
 )
 
@@ -228,6 +213,7 @@
     srcs = ["sift_training.fbs"],
     gen_reflections = True,
     includes = [":sift_fbs_includes"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -236,6 +222,7 @@
     srcs = ["demo_sift_training.py"],
     python_version = "PY3",
     srcs_version = "PY2AND3",
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":sift_fbs_python",
         "@opencv_contrib_nonfree_amd64//:python_opencv",
@@ -255,6 +242,7 @@
         "$(location images/demo/FRC-Image4-cleaned.png)",
         "$(location demo_sift.h)",
     ]),
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         ":demo_sift_training",
     ],
@@ -265,5 +253,6 @@
     hdrs = [
         "demo_sift.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
diff --git a/y2020/vision/sift/fast_gaussian.bzl b/y2020/vision/sift/fast_gaussian.bzl
index 0905423..5eaa4bf 100644
--- a/y2020/vision/sift/fast_gaussian.bzl
+++ b/y2020/vision/sift/fast_gaussian.bzl
@@ -1,3 +1,6 @@
+load("//tools:platforms.bzl", "platforms")
+load("//tools/build_rules:select.bzl", "cpu_select")
+
 def fast_gaussian(sigmas, sizes):
     files = []
     for _, sigma_name, _ in sigmas:
@@ -28,17 +31,22 @@
             ":fast_gaussian_runner",
         ],
         cmd = " ".join([
-            "$(location fast_gaussian_runner)",
+            "$(location :fast_gaussian_runner)",
             "'" + params.to_json() + "'",
-            # TODO(Brian): This should be RULEDIR once we have support for that.
-            "$(@D)",
-            "$(TARGET_CPU)",
-        ]),
+            "$(RULEDIR)",
+        ]) + " " + cpu_select({
+            "amd64": "k8",
+            "roborio": "roborio",
+            "armhf": "armhf-debian",
+            "cortex-m": "cortex-m",
+        }),
         outs = headers + objects + htmls,
-        restricted_to = [
-            "//tools:k8",
-            "//tools:armhf-debian",
-        ],
+        # The tool doesn't support anything other than k8 and armhf-debian
+        # right now.
+        target_compatible_with = platforms.any_of([
+            "@platforms//cpu:x86_64",
+            "//tools/platforms/hardware:raspberry_pi",
+        ]),
     )
 
     native.cc_library(
@@ -48,8 +56,4 @@
         deps = [
             "//third_party:halide_runtime",
         ],
-        restricted_to = [
-            "//tools:k8",
-            "//tools:armhf-debian",
-        ],
     )
diff --git a/y2020/vision/tools/python_code/BUILD b/y2020/vision/tools/python_code/BUILD
index 9b4eb08..4ff3397 100644
--- a/y2020/vision/tools/python_code/BUILD
+++ b/y2020/vision/tools/python_code/BUILD
@@ -1,4 +1,5 @@
 load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library", "flatbuffer_py_library")
+load("//tools:platforms.bzl", "platforms")
 
 py_binary(
     name = "load_sift_training",
@@ -17,6 +18,7 @@
     ]),
     python_version = "PY3",
     srcs_version = "PY2AND3",
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//external:python-glog",
         "//y2020/vision/sift:sift_fbs_python",
@@ -34,6 +36,7 @@
         "$(location :load_sift_training)",
         "$(location sift_training_data.h)",
     ]),
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         ":load_sift_training",
     ],
@@ -44,6 +47,7 @@
     hdrs = [
         "sift_training_data.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -63,9 +67,10 @@
     data = glob(["calib_files/*.json"]) + glob([
         "test_images/*.png",
     ]),
-    python_version = "PY3",
     main = "load_sift_training.py",
+    python_version = "PY3",
     srcs_version = "PY2AND3",
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":load_sift_training",
         "//external:python-glog",
@@ -84,6 +89,7 @@
         "$(location :load_sift_training_test)",
         "$(location sift_training_data_test.h) test",
     ]),
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         ":load_sift_training_test",
     ],
@@ -94,6 +100,7 @@
     hdrs = [
         "sift_training_data_test.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -102,10 +109,7 @@
     srcs = [
         "camera_param_test.cc",
     ],
-    restricted_to = [
-        "//tools:k8",
-        "//tools:armhf-debian",
-    ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":sift_training_data_test",
         "//aos/testing:googletest",
diff --git a/y2020/www/BUILD b/y2020/www/BUILD
index 60fb704..bbad63b 100644
--- a/y2020/www/BUILD
+++ b/y2020/www/BUILD
@@ -8,6 +8,7 @@
         "camera_main.ts",
         "image_handler.ts",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//y2020:__subpackages__"],
     deps = [
         "//aos:configuration_ts_fbs",
@@ -26,6 +27,7 @@
         "field_handler.ts",
         "field_main.ts",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//aos:configuration_ts_fbs",
         "//aos/network:connect_ts_fbs",
@@ -40,6 +42,7 @@
     name = "camera_main_bundle",
     enable_code_splitting = False,
     entry_point = "camera_main.ts",
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//y2020:__subpackages__"],
     deps = [
         "camera_main",
@@ -50,6 +53,7 @@
     name = "field_main_bundle",
     enable_code_splitting = False,
     entry_point = "field_main.ts",
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//y2020:__subpackages__"],
     deps = [
         "field_main",
@@ -73,5 +77,6 @@
         ":files",
     ],
     dir = "www",
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )