m/node: build microcode payloads
This adds a builder for loadable microcode payloads for the Linux
kernel and microcode for Intel and AMD CPUs. It also adds a rule
generating a microcode payload for Metropolis at
//metropolis/node:ucode but does not integrate it yet.
Change-Id: I00145e4c983d9ff3e81881e92cbecc3e09392665
Reviewed-on: https://review.monogon.dev/c/monogon/+/546
Reviewed-by: Sergiusz Bazanski <serge@monogon.tech>
diff --git a/third_party/intel_ucode/BUILD b/third_party/intel_ucode/BUILD
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/third_party/intel_ucode/BUILD
diff --git a/third_party/intel_ucode/external.bzl b/third_party/intel_ucode/external.bzl
new file mode 100644
index 0000000..4e68775
--- /dev/null
+++ b/third_party/intel_ucode/external.bzl
@@ -0,0 +1,18 @@
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+def intel_ucode_external(name, version):
+ sums = {
+ "20220207": "532527bd17f3ea6664452b536699818a3bf896e4ace689a43a73624711b7c921",
+ }
+ all_content = """
+# Anything other than family 6 is not interesting to us
+filegroup(name = "fam6h", srcs = glob(["intel-ucode/06-*"]), visibility = ["//visibility:public"])
+ """
+
+ http_archive(
+ name = name,
+ build_file_content = all_content,
+ sha256 = sums[version],
+ strip_prefix = "Intel-Linux-Processor-Microcode-Data-Files-microcode-" + version,
+ urls = ["https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/archive/refs/tags/microcode-%s.tar.gz" % version],
+ )
diff --git a/third_party/linux-firmware/external.bzl b/third_party/linux-firmware/external.bzl
index f9a2acd..ddd7de3 100644
--- a/third_party/linux-firmware/external.bzl
+++ b/third_party/linux-firmware/external.bzl
@@ -4,7 +4,10 @@
sums = {
"20211216": "c0f735dd232c22d41ce4d23a050a8d6efe3b6b8cbf9d0a636af5f9df66a619a3",
}
- all_content = """filegroup(name = "all_files", srcs = glob(["**"]), visibility = ["//visibility:public"])"""
+ all_content = """
+filegroup(name = "all_files", srcs = glob(["**"]), visibility = ["//visibility:public"])
+filegroup(name = "amd_ucode", srcs = glob(["amd-ucode/*.bin"]), visibility = ["//visibility:public"])
+ """
http_archive(
name = name,