rules: Limit the number of device units generated for serial ttys
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 10 Jun 2024 10:59:58 +0000 (12:59 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 18 Jun 2024 18:41:01 +0000 (20:41 +0200)
As per the suggestion in https://github.com/systemd/systemd/issues/33242.

This reduces the number of /dev/ttySXX device units generated in
mkosi from 32 to 4.

(cherry picked from commit dc38f9addd04c34d1fd743efc407bdebb3573d05)

rules.d/99-systemd.rules.in

index ad0c7e2fb5e45fd4af7c39d5ce85edb8a6dc6c06..8ba6f177f845d506469058b7ac07a500963d9fa5 100644 (file)
@@ -10,6 +10,8 @@
 ACTION=="remove", GOTO="systemd_end"
 
 SUBSYSTEM=="tty", KERNEL=="tty[a-zA-Z]*|hvc*|xvc*|hvsi*|ttysclp*|sclp_line*|3270/tty[0-9]*", TAG+="systemd"
+# Exclude 8250 serial ports with a zero IO port, as they are not usable until "setserial /dev/ttySxxx port …" is invoked.
+SUBSYSTEM=="tty", KERNEL=="ttyS*", DRIVERS=="serial8250", ATTR{port}=="0x0", ENV{SYSTEMD_READY}="0"
 KERNEL=="vport*", TAG+="systemd"
 
 SUBSYSTEM=="ptp", TAG+="systemd"