nixos/limine: add resolution option for Linux boot entries
Add boot.loader.limine.resolution option to control the framebuffer resolution that Limine sets via GOP before booting Linux. This affects early boot graphics drivers like simpledrm and efifb. This is distinct from style.interface.resolution which only controls the Limine bootloader's own menu interface - the new option sets the per-entry "resolution:" directive in limine.conf which calls gop->SetMode() to change the actual framebuffer resolution before handing off to the kernel. Example usage: boot.loader.limine.resolution = "3840x1600x32"; This enables users to get native resolution early boot graphics instead of being limited to whatever GOP mode the UEFI firmware provides by default (often 1024x768).
This commit is contained in:
@@ -291,6 +291,12 @@ def config_entry(levels: int, bootspec: BootSpec, label: str, time: str) -> str:
|
||||
entry += f'comment: {bootspec.label}, built on {time}\n'
|
||||
entry += 'kernel_path: ' + get_kernel_uri(bootspec.kernel) + '\n'
|
||||
entry += 'cmdline: ' + ' '.join(['init=' + bootspec.init] + bootspec.kernelParams).strip() + '\n'
|
||||
|
||||
# Set framebuffer resolution for Linux boot entries if configured
|
||||
resolution = config('resolution')
|
||||
if resolution is not None:
|
||||
entry += f'resolution: {resolution}\n'
|
||||
|
||||
if bootspec.initrd:
|
||||
entry += f'module_path: ' + get_kernel_uri(bootspec.initrd) + '\n'
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ let
|
||||
force = cfg.force;
|
||||
enrollConfig = cfg.enrollConfig;
|
||||
style = cfg.style;
|
||||
resolution = cfg.resolution;
|
||||
maxGenerations = if cfg.maxGenerations == null then 0 else cfg.maxGenerations;
|
||||
hostArchitecture = pkgs.stdenv.hostPlatform.parsed.cpu;
|
||||
timeout = if config.boot.loader.timeout != null then config.boot.loader.timeout else 10;
|
||||
@@ -98,6 +99,27 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
resolution = lib.mkOption {
|
||||
default = null;
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
example = "1920x1080x32";
|
||||
description = ''
|
||||
The framebuffer resolution to set when booting Linux entries.
|
||||
This controls the GOP mode that Limine sets before handing off to the kernel,
|
||||
which affects early boot graphics (e.g., simpledrm, efifb).
|
||||
|
||||
Format: `<width>x<height>` or `<width>x<height>x<bpp>`.
|
||||
If bpp is omitted, defaults to 32.
|
||||
|
||||
Note: Refresh rate is not supported because the UEFI GOP protocol only
|
||||
defines framebuffer dimensions and pixel format, not display timing.
|
||||
Refresh rate is determined later by the GPU driver based on EDID.
|
||||
|
||||
This is distinct from {option}`boot.loader.limine.style.interface.resolution`
|
||||
which only affects the Limine bootloader's own menu interface.
|
||||
'';
|
||||
};
|
||||
|
||||
additionalFiles = lib.mkOption {
|
||||
default = { };
|
||||
type = lib.types.attrsOf lib.types.path;
|
||||
|
||||
Reference in New Issue
Block a user