From 9d92c9d0a797b19662968b250919d075317d7379 Mon Sep 17 00:00:00 2001 From: Tom Fitzhenry Date: Fri, 19 Jun 2020 17:57:04 +1000 Subject: [PATCH] iso-image: add 'serial console' boot entry Prior to this commit, installation over serial console would requiring manually having to modify the kernel modeline, as described in https://github.com/NixOS/nixpkgs/issues/58198 . This is unnecessarily fiddly, so this commit adds a syslinux boot entry that has serial enabled. GRUB already has a serial console entry: https://github.com/NixOS/nixpkgs/blob/2c07a0800a76be01a3c255f39e21877a9a389f84/nixos/modules/installer/cd-dvd/iso-image.nix#L311-L317 Why 115200 bps? This is already used in other places, e.g. https://github.com/NixOS/nixpkgs/pull/58196 I tested this change by building the image, booting the image, and observing the boot process over serial: $ cd nixos/ $ nix-build -A config.system.build.isoImage -I nixos-config=modules/installer/cd-dvd/installation-cd-minimal.nix default.nix $ sudo cp /nix/store/arcl702c3z8xlndlvnfplq9yhixjvs9k-nixos-20.09pre-git-x86_64-linux.iso/iso/nixos-20.09pre-git-x86_64-linux.iso /dev/sdb $ picocom -b 115200 /dev/ttyUSB0 --- nixos/modules/installer/cd-dvd/iso-image.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nixos/modules/installer/cd-dvd/iso-image.nix b/nixos/modules/installer/cd-dvd/iso-image.nix index 405fbfa10db..43d20a556f8 100644 --- a/nixos/modules/installer/cd-dvd/iso-image.nix +++ b/nixos/modules/installer/cd-dvd/iso-image.nix @@ -143,6 +143,13 @@ let LINUX /boot/${config.system.boot.loader.kernelFile} APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} loglevel=7 INITRD /boot/${config.system.boot.loader.initrdFile} + + # A variant to boot with a serial console enabled + LABEL boot-serial + MENU LABEL NixOS ${config.system.nixos.label}${config.isoImage.appendToMenuLabel} (serial console=ttyS0,115200n8) + LINUX /boot/${config.system.boot.loader.kernelFile} + APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} console=ttyS0,115200n8 + INITRD /boot/${config.system.boot.loader.initrdFile} ''; isolinuxMemtest86Entry = ''