kernel: make tty count for 8250 configurable
authorFlorian Eckert <[email protected]>
Tue, 7 Mar 2023 11:02:26 +0000 (12:02 +0100)
committerHauke Mehrtens <[email protected]>
Sun, 13 Jul 2025 15:32:00 +0000 (17:32 +0200)
The number of serial interfaces for the chip 8250 can be configured at
build time. This is currently not configurable and is always set to 16
interfaces. This is too little for some small embedded devices and too much
for others (x86_64). Therefore, this commit creates the possibility to set
this at compile time.

Signed-off-by: Florian Eckert <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/19217
Signed-off-by: Hauke Mehrtens <[email protected]>
package/kernel/linux/modules/other.mk

index 53b1043a53d49675473696d29e7a6d37cee5c8fe..42c7ab06e878eec33d57adfe47440ff88e84ace2 100644 (file)
@@ -566,8 +566,6 @@ define KernelPackage/serial-8250
   DEPENDS:=@!TARGET_uml
   KCONFIG:= CONFIG_SERIAL_8250 \
        CONFIG_SERIAL_8250_PCI \
-       CONFIG_SERIAL_8250_NR_UARTS=16 \
-       CONFIG_SERIAL_8250_RUNTIME_UARTS=16 \
        CONFIG_SERIAL_8250_EXTENDED=y \
        CONFIG_SERIAL_8250_MANY_PORTS=y \
        CONFIG_SERIAL_8250_SHARE_IRQ=y \
@@ -585,6 +583,31 @@ define KernelPackage/serial-8250/description
  Kernel module for 8250 UART based serial ports
 endef
 
+define KernelPackage/serial-8250/config
+menu "Configuration"
+       depends on PACKAGE_kmod-serial-8250
+
+config KERNEL_SERIAL_8250_NR_UARTS
+       int "Maximum number of 8250/16550 serial ports"
+       default "16"
+       help
+         Set this to the number of serial ports you want the driver
+         to support.  This includes any ports discovered via ACPI or
+         PCI enumeration and any ports that may be added at run-time
+         via hot-plug, or any ISA multi-port serial cards.
+
+config KERNEL_SERIAL_8250_RUNTIME_UARTS
+       int "Number of 8250/16550 serial ports to register at runtime"
+       range 0 KERNEL_SERIAL_8250_NR_UARTS
+       default "16"
+       help
+         Set this to the maximum number of serial ports you want
+         the kernel to register at boot time.  This can be overridden
+         with the module parameter "nr_uarts", or boot-time parameter
+         8250.nr_uarts
+endmenu
+endef
+
 $(eval $(call KernelPackage,serial-8250))