tftp: introduce an alternative command line for TFTP #8

Merged
rlahfa merged 17 commits from strong-tftp into main 2024-09-01 17:48:54 +02:00
4 changed files with 25 additions and 1 deletions
Showing only changes of commit 4689bb9bb1 - Show all commits

View file

@ -14,5 +14,8 @@
boot.commandLine = [ boot.commandLine = [
"console=ttyS0,115200" # true of all mips we've yet encountered "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
];
}; };
} }

View file

@ -111,6 +111,12 @@ in {
++ lib.optional (config.rootOptions != null) "rootflags=${config.rootOptions}" ++ lib.optional (config.rootOptions != null) "rootflags=${config.rootOptions}"
++ lib.optional (config.hardware.alternativeRootDevice != null) "altroot=${config.hardware.alternativeRootDevice}"; ++ 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 : system.callService = path : parameters :
let let
typeChecked = caller: type: value: typeChecked = caller: type: value:

View file

@ -28,6 +28,14 @@ in {
type = types.bool; type = types.bool;
default = false; 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 = { options.system.outputs = {
tftpboot = mkOption { tftpboot = mkOption {
@ -105,7 +113,7 @@ in {
zimage = "bootz"; zimage = "bootz";
}; in choices.${cfg.kernelFormat}; }; in choices.${cfg.kernelFormat};
cmdline = concatStringsSep " " config.boot.commandLine; cmdline = concatStringsSep " " config.boot.tftp.commandLine;
objcopy = "${pkgs.stdenv.cc.bintools.targetPrefix}objcopy"; objcopy = "${pkgs.stdenv.cc.bintools.targetPrefix}objcopy";
stripAndZip = '' stripAndZip = ''
${objcopy} -O binary -R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id -S vmlinux.elf vmlinux.bin ${objcopy} -O binary -R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id -S vmlinux.elf vmlinux.bin

View file

@ -29,6 +29,13 @@ in
}; };
boot.initramfs.enable = true; 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 = system.outputs.rootfs =
let let
inherit (pkgs.pkgsBuildBuild) runCommand; inherit (pkgs.pkgsBuildBuild) runCommand;