at 24.11-pre 1.7 kB view raw
1# This module adds Memtest86+ to the GRUB boot menu. 2{ config, lib, pkgs, ... }: 3 4with lib; 5 6let 7 memtest86 = pkgs.memtest86plus; 8 cfg = config.boot.loader.grub.memtest86; 9in 10 11{ 12 options = { 13 14 boot.loader.grub.memtest86 = { 15 16 enable = mkOption { 17 default = false; 18 type = types.bool; 19 description = '' 20 Make Memtest86+, a memory testing program, available from the GRUB 21 boot menu. 22 ''; 23 }; 24 25 params = mkOption { 26 default = []; 27 example = [ "console=ttyS0,115200" ]; 28 type = types.listOf types.str; 29 description = '' 30 Parameters added to the Memtest86+ command line. As of memtest86+ 5.01 31 the following list of (apparently undocumented) parameters are 32 accepted: 33 34 - `console=...`, set up a serial console. 35 Examples: 36 `console=ttyS0`, 37 `console=ttyS0,9600` or 38 `console=ttyS0,115200n8`. 39 40 - `btrace`, enable boot trace. 41 42 - `maxcpus=N`, limit number of CPUs. 43 44 - `onepass`, run one pass and exit if there 45 are no errors. 46 47 - `tstlist=...`, list of tests to run. 48 Example: `0,1,2`. 49 50 - `cpumask=...`, set a CPU mask, to select CPUs 51 to use for testing. 52 53 This list of command line options was obtained by reading the 54 Memtest86+ source code. 55 ''; 56 }; 57 58 }; 59 }; 60 61 config = mkIf cfg.enable { 62 boot.loader.grub.extraEntries = '' 63 menuentry "Memtest86+" { 64 linux @bootRoot@/memtest.bin ${toString cfg.params} 65 } 66 ''; 67 boot.loader.grub.extraFiles."memtest.bin" = "${memtest86}/memtest.bin"; 68 }; 69}