You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.4 KiB
62 lines
1.4 KiB
4 years ago
|
{ config, lib, pkgs, ... }:
|
||
|
|
||
|
with lib;
|
||
|
|
||
|
let
|
||
|
cfg = config.seabios;
|
||
4 years ago
|
payloadName =
|
||
|
if cfg.asSecondaryPayload then "img/seabios" else "fallback/payload";
|
||
4 years ago
|
|
||
|
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);
|
||
4 years ago
|
default = { };
|
||
4 years ago
|
};
|
||
|
};
|
||
|
|
||
|
config = mkIf cfg.enable {
|
||
|
seabios.seabiosConfig = {
|
||
|
CONFIG_COREBOOT = "y";
|
||
|
} // (lib.optionalAttrs cfg.withVgaBios {
|
||
|
CONFIG_VGA_COREBOOT = "y";
|
||
|
CONFIG_BUILD_VGABIOS = "y";
|
||
|
});
|
||
|
|
||
|
corenix.extraFiles = let
|
||
4 years ago
|
package =
|
||
|
pkgs.coreboot-payload-seabios.override { inherit (cfg) seabiosConfig; };
|
||
4 years ago
|
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
|
||
|
'';
|
||
|
};
|
||
|
}
|