From 516b86434a4585032f8d1fb5734c204ab567ebe5 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Fri, 31 Mar 2023 11:46:28 -0700 Subject: [PATCH] kgpe: allow to configure recovery nvram values On amd64 platforms, booting ownerboot with the recovery jumper installed will wipe the battery-backed nvram (aka "cmos" aka "rtc nvram") and overwrite it with known-safe values taken from the coreboot source code (`src/mainboard/asus/kgpe-d16/cmos.default`). You should always do this when flashing a motherboard with ownerboot for the first time. This commit allows the user to customize the set of known-safe values which are written when the recovery jumper is installed. To do so, copy `src/mainboard/asus/kgpe-d16/cmos.default` out of coreboot, edit to suit your tastes, and then override `cmos-defaults` with the path to your customized `cmos.default` file. --- src/platform/kgpe/default.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/platform/kgpe/default.nix b/src/platform/kgpe/default.nix index faa1b31..415c1de 100644 --- a/src/platform/kgpe/default.nix +++ b/src/platform/kgpe/default.nix @@ -33,6 +33,16 @@ # insecure configurations? (63xx without microcode) microcode-blob = null; + # This contains the default values written into the + # battery-backed nvram when you boot with the recovery jumper + # installed (which is something you should do the first time you + # boot with ownerboot/coreboot). If you want to customize these + # values, copy `src/mainboard/asus/kgpe-d16/cmos.default` out of + # coreboot and edit to suit your tastes. + # + # TODO: use a NixOS-style structuredConfig for this. + cmos-default = null; + coreboot = final.lib.makeOverridable (prev.coreboot.override { iasl = final.iasl_20180531; payload = "${final.kernel}/bzImage"; @@ -52,6 +62,8 @@ 3rdparty/blobs/cpu/amd/family_15h/microcode_amd_fam15h.bin mkdir -p 3rdparty/blobs/cpu/amd/family_10h-family_14h/ touch 3rdparty/blobs/cpu/amd/family_10h-family_14h/microcode_amd.bin + '' + final.lib.optionalString (final.cmos-default != null) '' + cp ${final.cmos-default} src/mainboard/asus/kgpe-d16/cmos.default ''; postInstall = (a.postInstall or "") + '' cp src/mainboard/asus/kgpe-d16/cmos.layout $out/