blob: d48e36387442aa5d81235e568e0555ee1ebed053 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.seabios;
payloadName = if cfg.asSecondaryPayload then
"img/seabios"
else
"fallback/payload";
in {
options.seabios = {
enable = mkEnableOption "seabios coreboot primary payload";
withVgaBios = mkOption {
type = types.bool;
default = true;
};
asSecondaryPayload = mkOption {
type = types.bool;
default = false;
};
ps2Timeout = mkOption {
type = types.int;
default = 0;
};
seabiosConfig = mkOption {
type = types.attrsOf (types.nullOr types.str);
default = {};
};
};
config = mkIf cfg.enable {
seabios.seabiosConfig = {
CONFIG_COREBOOT = "y";
} // (lib.optionalAttrs cfg.withVgaBios {
CONFIG_VGA_COREBOOT = "y";
CONFIG_BUILD_VGABIOS = "y";
});
corenix.extraFiles = let
package = pkgs.coreboot-payload-seabios.override {
inherit (cfg) seabiosConfig;
};
in {
${payloadName} = {
type = "payload";
src = "${package}/bios.bin.elf";
};
} // (optionalAttrs cfg.withVgaBios {
"vgaroms/seavgabios.bin".src = "${package}/vgabios.bin";
});
corenix.installCommands = optionalString (cfg.ps2Timeout != 0) ''
cbfstool $out/coreboot.rom add-int \
-i ${toString cfg.ps2Timeout} \
-n etc/ps2-keyboard-spinup
'';
};
}
|