diff options
author | Samuel Dionne-Riel <samuel@dionne-riel.com> | 2021-04-20 01:34:15 -0400 |
---|---|---|
committer | Samuel Dionne-Riel <samuel@dionne-riel.com> | 2021-05-01 19:53:13 -0400 |
commit | 189507a35d4fd5c88e1172aee0a410229e60ba86 (patch) | |
tree | cf1cf73382fc581a69372f90f4a90d779cd21d3d /nixos/modules/installer/cd-dvd/iso-image.nix | |
parent | 20d0824b150492d4b484954c64aad9f24656c130 (diff) | |
download | nixpkgs-189507a35d4fd5c88e1172aee0a410229e60ba86.tar nixpkgs-189507a35d4fd5c88e1172aee0a410229e60ba86.tar.gz nixpkgs-189507a35d4fd5c88e1172aee0a410229e60ba86.tar.bz2 nixpkgs-189507a35d4fd5c88e1172aee0a410229e60ba86.tar.lz nixpkgs-189507a35d4fd5c88e1172aee0a410229e60ba86.tar.xz nixpkgs-189507a35d4fd5c88e1172aee0a410229e60ba86.tar.zst nixpkgs-189507a35d4fd5c88e1172aee0a410229e60ba86.zip |
iso-image: Make graphical output work properly on AArch64
The serial output (but it's named console, not serial actually) causes issues on U-Boot's EFI, at the very least. This is inspired by OpenSUSE's approach: * https://build.opensuse.org/package/view_file/Base:System/grub2/grub2-SUSE-Add-the-t-hotkey.patch Where they add a hidden menu entry, which can be used to force the console output. The `echo` will be visible on the serial terminal (grub "console"), while the graphical interface is shown. Note that input in the serial terminal (grub "console") will continue controlling the graphical interface. Useful if you have an SBC connectedinto an HDMI monitor, but no keyboard connected to it.
Diffstat (limited to 'nixos/modules/installer/cd-dvd/iso-image.nix')
-rw-r--r-- | nixos/modules/installer/cd-dvd/iso-image.nix | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/nixos/modules/installer/cd-dvd/iso-image.nix b/nixos/modules/installer/cd-dvd/iso-image.nix index e73bb883df5..b876e83e237 100644 --- a/nixos/modules/installer/cd-dvd/iso-image.nix +++ b/nixos/modules/installer/cd-dvd/iso-image.nix @@ -187,6 +187,9 @@ let # Fonts can be loaded? # (This font is assumed to always be provided as a fallback by NixOS) if loadfont /EFI/boot/unicode.pf2; then + set with_fonts=true + fi + if [ "\$textmode" != "true" -a "\$with_fonts" == "true" ]; then # Use graphical term, it can be either with background image or a theme. # input is "console", while output is "gfxterm". # This enables "serial" input and output only when possible. @@ -264,6 +267,8 @@ let cat <<EOF > $out/EFI/boot/grub.cfg + set with_fonts=false + set textmode=false # If you want to use serial for "terminal_*" commands, you need to set one up: # Example manual configuration: # → serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1 @@ -273,8 +278,28 @@ let export with_serial clear set timeout=10 + + # This message will only be viewable when "gfxterm" is not used. + echo "" + echo "Loading graphical boot menu..." + echo "" + echo "Press 't' to use the text boot menu on this console..." + echo "" + ${grubMenuCfg} + hiddenentry 'Text mode' --hotkey 't' { + loadfont /EFI/boot/unicode.pf2 + set textmode=true + terminal_output gfxterm console + } + hiddenentry 'GUI mode' --hotkey 'g' { + $(find ${config.isoImage.grubTheme} -iname '*.pf2' -printf "loadfont /EFI/boot/grub-theme/%P\n") + set textmode=false + terminal_output gfxterm + } + + # If the parameter iso_path is set, append the findiso parameter to the kernel # line. We need this to allow the nixos iso to be booted from grub directly. if [ \''${iso_path} ] ; then |