Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nixos/modules/installer/cd-dvd/installation-cd-base.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ with pkgs.lib;
isoImage.makeEfiBootable = true;

# Add Memtest86+ to the CD.
boot.loader.grub.memtest86 = true;
boot.loader.grub.memtest86.enable = true;

# Get a console as soon as the initrd loads fbcon on EFI boot
boot.initrd.kernelModules = [ "fbcon" ];
Expand Down
41 changes: 32 additions & 9 deletions nixos/modules/system/boot/loader/grub/memtest.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,51 @@ with pkgs.lib;

let
memtest86 = pkgs.memtest86plus;
cfg = config.boot.loader.grub.memtest86;
params = concatStringsSep " " cfg.params;
in

{
options = {

boot.loader.grub.memtest86 = mkOption {
default = false;
type = types.bool;
description = ''
Make Memtest86+, a memory testing program, available from the
GRUB boot menu.
'';
boot.loader.grub.memtest86 = {

enable = mkOption {
default = false;
type = types.bool;
description = ''
Make Memtest86+, a memory testing program, available from the
GRUB boot menu.
'';
};

params = mkOption {
default = [];
example = [ "console=ttyS0,115200" ];
type = types.listOf types.str;
description = ''
Parameters added to the Memtest86+ command line. As of memtest86+ 5.01
the following list of (apparently undocumented) parameters are
accepted:
console=... -- set up a serial console.
btrace -- enable boot trace.
maxcpus=... -- limit number of CPUs.
onepass -- run one pass and exit if there are no errors.
tstlist=... -- list of tests to run.
cpumask=... -- set a CPU mask, to select CPUs to use for testing.
'';
};

};
};

config = mkIf config.boot.loader.grub.memtest86 {
config = mkIf cfg.enable {

boot.loader.grub.extraEntries =
if config.boot.loader.grub.version == 2 then
''
menuentry "Memtest86+" {
linux16 @bootRoot@/memtest.bin
linux16 @bootRoot@/memtest.bin ${params}
}
''
else
Expand Down