2013-10-02 11:29:07 +01:00
|
|
|
# This module adds Memtest86+ to the GRUB boot menu.
|
2012-04-02 18:19:21 +01:00
|
|
|
|
2014-04-14 15:26:48 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
2012-04-02 18:19:21 +01:00
|
|
|
|
2014-04-14 15:26:48 +01:00
|
|
|
with lib;
|
2013-10-02 11:29:07 +01:00
|
|
|
|
2012-04-02 18:19:21 +01:00
|
|
|
let
|
2013-01-09 21:44:50 +00:00
|
|
|
memtest86 = pkgs.memtest86plus;
|
2014-01-21 16:25:49 +00:00
|
|
|
cfg = config.boot.loader.grub.memtest86;
|
2012-04-02 18:19:21 +01:00
|
|
|
in
|
2013-10-02 11:29:07 +01:00
|
|
|
|
2012-04-02 18:19:21 +01:00
|
|
|
{
|
|
|
|
options = {
|
2013-10-02 11:29:07 +01:00
|
|
|
|
2014-01-21 16:25:49 +00:00
|
|
|
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:
|
2014-02-09 12:43:12 +00:00
|
|
|
|
|
|
|
<itemizedlist>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para><literal>console=...</literal>, set up a serial console.
|
|
|
|
Examples:
|
|
|
|
<literal>console=ttyS0</literal>,
|
|
|
|
<literal>console=ttyS0,9600</literal> or
|
|
|
|
<literal>console=ttyS0,115200n8</literal>.</para>
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para><literal>btrace</literal>, enable boot trace.</para>
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para><literal>maxcpus=N</literal>, limit number of CPUs.</para>
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para><literal>onepass</literal>, run one pass and exit if there
|
|
|
|
are no errors.</para>
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para><literal>tstlist=...</literal>, list of tests to run.
|
|
|
|
Example: <literal>0,1,2</literal>.</para>
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para><literal>cpumask=...</literal>, set a CPU mask, to select CPUs
|
|
|
|
to use for testing.</para>
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
</itemizedlist>
|
|
|
|
|
|
|
|
This list of command line options was obtained by reading the
|
|
|
|
Memtest86+ source code.
|
2014-01-21 16:25:49 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2012-04-02 18:19:21 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2014-01-21 16:25:49 +00:00
|
|
|
config = mkIf cfg.enable {
|
2013-10-02 11:29:07 +01:00
|
|
|
|
2013-10-28 00:14:16 +00:00
|
|
|
boot.loader.grub.extraEntries =
|
2013-10-02 11:29:07 +01:00
|
|
|
if config.boot.loader.grub.version == 2 then
|
|
|
|
''
|
|
|
|
menuentry "Memtest86+" {
|
2014-02-18 16:05:19 +00:00
|
|
|
linux16 @bootRoot@/memtest.bin ${toString cfg.params}
|
2013-10-02 11:29:07 +01:00
|
|
|
}
|
|
|
|
''
|
2012-04-10 23:20:20 +01:00
|
|
|
else
|
2013-10-28 00:14:16 +00:00
|
|
|
throw "Memtest86+ is not supported with GRUB 1.";
|
2013-10-02 11:29:07 +01:00
|
|
|
|
|
|
|
boot.loader.grub.extraFiles."memtest.bin" = "${memtest86}/memtest.bin";
|
|
|
|
|
2012-04-02 18:19:21 +01:00
|
|
|
};
|
|
|
|
}
|