Spawn mulitple ttys when system boots

This commit is contained in:
wyt8 2026-02-10 17:32:24 +00:00
parent e2ffdf1c46
commit fa1fb6f8ae
5 changed files with 31 additions and 2 deletions

View File

@ -21,7 +21,7 @@ kcmd_args = [
"PATH=/bin:/benchmark", "PATH=/bin:/benchmark",
"init=/usr/bin/busybox", "init=/usr/bin/busybox",
] ]
init_args = ["sh", "-l"] init_args = ["/init"]
initramfs = "test/initramfs/build/initramfs.cpio.gz" initramfs = "test/initramfs/build/initramfs.cpio.gz"
# Special options for testing # Special options for testing

View File

@ -22,7 +22,14 @@
shell = "${pkgs.bash}/bin/bash"; shell = "${pkgs.bash}/bin/bash";
hashedPassword = null; hashedPassword = null;
}; };
systemd.targets.getty.wants = [ "autovt@hvc0.service" ]; systemd.targets.getty.wants = [
"autovt@hvc0.service"
"getty@tty2.service"
"getty@tty3.service"
"getty@tty4.service"
"getty@tty5.service"
"getty@tty6.service"
];
systemd.extraConfig = '' systemd.extraConfig = ''
LogLevel=crit LogLevel=crit

View File

@ -37,6 +37,9 @@ in stdenvNoCC.mkDerivation {
cp -r ${etc}/* $out/etc/ cp -r ${etc}/* $out/etc/
cp ${./../src/init} $out/init
chmod +x $out/init
cp ${resolv_conf}/resolv.conf $out/etc/ cp ${resolv_conf}/resolv.conf $out/etc/
${lib.optionalString (apps != null) '' ${lib.optionalString (apps != null) ''

View File

@ -0,0 +1,15 @@
hvc0::respawn:/bin/sh
tty1::askfirst:/bin/cttyhack /bin/sh
tty2::askfirst:/bin/cttyhack /bin/sh
tty3::askfirst:/bin/cttyhack /bin/sh
tty4::askfirst:/bin/cttyhack /bin/sh
tty5::askfirst:/bin/cttyhack /bin/sh
tty6::askfirst:/bin/cttyhack /bin/sh
# Stuff to do when restarting the init process
::restart:/bin/init
# Stuff to do before rebooting
::ctrlaltdel:/bin/reboot
::shutdown:/bin/umount -a -r
::shutdown:/bin/swapoff -a

4
test/initramfs/src/init Normal file
View File

@ -0,0 +1,4 @@
#!/bin/sh
# Start the init process
exec /bin/init