[PATCH] vt: Add enable module parameter

From: Jocelyn Falempe

Date: Mon Jan 26 2026 - 04:26:44 EST


This allows to build the kernel with CONFIG_VT enabled, and choose
on the kernel command line to enable it or not.
Add vt.enable=1 to force enable, or vt.enable=0 to force disable.

Signed-off-by: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
---
drivers/tty/Kconfig | 13 +++++++++++++
drivers/tty/vt/vt.c | 5 +++++
2 files changed, 18 insertions(+)

diff --git a/drivers/tty/Kconfig b/drivers/tty/Kconfig
index 149f3d53b7608..2b94c2710687a 100644
--- a/drivers/tty/Kconfig
+++ b/drivers/tty/Kconfig
@@ -41,6 +41,19 @@ config VT
If unsure, say Y, or else you won't be able to do much with your new
shiny Linux system :-)

+config VT_ENABLE
+ depends on VT
+ default y
+ bool "enable VT terminal" if EXPERT
+ help
+ This allows to build the kernel with CONFIG_VT, and choose on the
+ kernel command line to enable it or not. If set to y, VT will be
+ enabled by default, but can be disabled with vt.enable=0 on the kernel
+ command line. Otherwise, use vt.enable=1 to enable VT.
+ This should help to transition to VT-less system.
+
+ If unsure, say Y.
+
config CONSOLE_TRANSLATIONS
depends on VT
default y
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 59b4b5e126ba1..d83613d98f594 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -164,6 +164,8 @@ EXPORT_SYMBOL(global_cursor_default);

static int cur_default = CUR_UNDERLINE;
module_param(cur_default, int, S_IRUGO | S_IWUSR);
+static bool vt_enable = IS_ENABLED(CONFIG_VT_ENABLE) ? true : false;
+module_param_named(enable, vt_enable, bool, S_IRUGO | S_IWUSR);

/*
* ignore_poke: don't unblank the screen when things are typed. This is
@@ -3852,6 +3854,9 @@ ATTRIBUTE_GROUPS(vt_dev);

int __init vty_init(const struct file_operations *console_fops)
{
+ if (!vt_enable)
+ return 0;
+
cdev_init(&vc0_cdev, console_fops);
if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) ||
register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0)

base-commit: 24d479d26b25bce5faea3ddd9fa8f3a6c3129ea7
--
2.52.0