diff --git a/modules/arch/mips.nix b/modules/arch/mips.nix index 155c147..359bb71 100644 --- a/modules/arch/mips.nix +++ b/modules/arch/mips.nix @@ -14,5 +14,8 @@ boot.commandLine = [ "console=ttyS0,115200" # true of all mips we've yet encountered ]; + boot.tftp.commandLine = [ + "console=ttyS0,115200" # true of all mips we've yet encountered + ]; }; } diff --git a/modules/base.nix b/modules/base.nix index 1c8b67c..4c179ec 100644 --- a/modules/base.nix +++ b/modules/base.nix @@ -111,6 +111,12 @@ in { ++ lib.optional (config.rootOptions != null) "rootflags=${config.rootOptions}" ++ lib.optional (config.hardware.alternativeRootDevice != null) "altroot=${config.hardware.alternativeRootDevice}"; + boot.tftp.commandLine = [ + "panic=10 oops=panic init=/bin/init loglevel=8" + "fw_devlink=off" + "rootfstype=${config.rootfsType}" + ]; + system.callService = path : parameters : let typeChecked = caller: type: value: diff --git a/modules/outputs/tftpboot.nix b/modules/outputs/tftpboot.nix index 94d5ef4..6d5bad9 100644 --- a/modules/outputs/tftpboot.nix +++ b/modules/outputs/tftpboot.nix @@ -28,6 +28,14 @@ in { type = types.bool; default = false; }; + commandLine = mkOption { + type = types.listOf types.str; + default = config.boot.commandLine; + description = '' + TFTP-specific command line. + Defaults to the classical one if unset. + ''; + }; }; options.system.outputs = { tftpboot = mkOption { @@ -105,7 +113,7 @@ in { zimage = "bootz"; }; in choices.${cfg.kernelFormat}; - cmdline = concatStringsSep " " config.boot.commandLine; + cmdline = concatStringsSep " " config.boot.tftp.commandLine; objcopy = "${pkgs.stdenv.cc.bintools.targetPrefix}objcopy"; stripAndZip = '' ${objcopy} -O binary -R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id -S vmlinux.elf vmlinux.bin diff --git a/modules/outputs/ubivolume.nix b/modules/outputs/ubivolume.nix index 45aa889..1b9decc 100644 --- a/modules/outputs/ubivolume.nix +++ b/modules/outputs/ubivolume.nix @@ -29,6 +29,13 @@ in }; boot.initramfs.enable = true; + # In TFTP, the device named "rootfs" is the UBI device. + # We tell the kernel to load it. + # This avoids interference from the other UBI volumes. + boot.tftp.commandLine = [ + "ubi.mtd=rootfs" + ]; + system.outputs.rootfs = let inherit (pkgs.pkgsBuildBuild) runCommand;