如何在 Yocto Linux 中禁用虚拟终端

How to disable a Virtual Terminal in Yocto Linux

有人知道如何禁用linux中的虚拟终端吗?我在 i.MX6 处理器上使用 Yocto,Morty 版本。尽管我们的基础发行版是 Yocto,但不幸的是,我们已经偏离了使用食谱构建它的方式,因此与 Yocto 相比,这更像是一个直接的 linux 问题……

详细说明我的问题:它适用于具有 HDMI 端口的嵌入式设备 - 当我将终端连接到 HDMI 端口时,它会显示 Linux Penguin 徽标、getty 服务和600 秒后消失。我只想将 hdmi 端口用作输出,输出上不显示任何内容,我希望它一直保持打开状态。

我发现 hdmi 端口映射到 /dev/tty1 – 当我键入:echo “asdfasdf” > /dev/tty1 我看到字符输出到显示器。

这里有一些我尝试过但无济于事的东西——如果我能弄清楚如何将它禁用为虚拟终端,那么很多都不需要了……

• 我找到了禁用 getty 服务的方法,但光标仍然闪烁。我什至不想显示光标

• 我试图通过禁用内核配置参数中的徽标来禁用企鹅的显示 - 我注释掉了带有徽标的任何内容:

CONFIG_LOGO=y
CONFIG_LOGO_LINUX_MONO=y
CONFIG_LOGO_LINUX_VGA16=y
CONFIG_LOGO_LINUX_CLUT224=y

无济于事。徽标仍然显示 : 。

• 它在 600 秒后空白是控制台空白 – 我可以在文件中看到它设置为 600:/sys/module/kernel/parameters/consoleblank。当我发出命令时: echo -e '\033[9;0]'>/dev/tty1 它将控制台消隐设置为 0 并唤醒终端。能够唤醒控制台是有限的成功,但我想完全禁用虚拟终端......

• 我尝试注释掉配置文件中定义的任何虚拟终端,但都无济于事:

CONFIG_VT=y
CONFIG_VT_CONSOLE=y
CONFIG_VT_CONSOLE_SLEEP=y
CONFIG_HW_CONSOLE=y
CONFIG_VT_HW_CONSOLE_BINDING=y

我读过的所有内容都表明 /dev/tty1 是一个虚拟终端或控制台。根据我对 VT 选项的了解,禁用 CONFIG_VT 应该可以做到:

VT — Virtual terminal Say yes here to get support for terminal devices with display and keyboard devices. These are called "virtual" because you can run several virtual terminals (also called virtual consoles) on one physical terminal. You need at least one virtual terminal device in order to make use of your keyboard and monitor. Therefore, only people configuring an embedded system would want to say no here in order to save some memory; the only way to log into such a system is then via a serial or network connection. Virtual terminals are useful because, for example, one virtual terminal can display system messages and warnings, another one can be used for a text-mode user session, and a third could run an X session, all in parallel. Switching between virtual terminals is done with certain key combinations, usually Alt-function key. If you are unsure, say yes, or else you won't be able to do much with your Linux system.

但由于某种原因它什么也没做!

• 我找到了这个话题; https://askubuntu.com/questions/357039/how-do-i-disable-virtual-consoles-tty1-6 等,但 none 有很大帮助,因为我的发行版没有此线程或我找到的任何其他解决方案中提供的任何目录。例如,我没有 /etc/events.d,也没有 /etc/default/console-setup 文件,也没有 /etc/init 目录……我想这是因为我的发行版使用 systemd 和解决方案可能是基于 SysV 的初始化?

如果我能弄清楚如何禁用该端口作为终端,则不需要禁用徽标或控制台消隐……

那么有没有人有指点或我可以尝试的事情?我是相对较新的人(10 年后回归——我在 10 年前使用 DNX v2.6,似乎我所知道的关于 init 的一切都已经过时了哈哈)到 linux 所以我确信我错过了很多......

谢谢, - 查克

我想我找到了问题的答案。这实际上是此处记录的帧缓冲区控制台:Documentation/fb/fbcon.txt。来自文档:

The framebuffer console (fbcon), as its name implies, is a text console running on top of the framebuffer device. It has the functionality of any standard text console driver, such as the VGA console, with the added features that can be attributed to the graphical nature of the framebuffer.

注释掉该行

CONFIG_FRAMEBUFFER_CONSOLE=y

在位于/arch/arm/configs的配置文件中将禁用它。

文档的这一部分还向您展示了如何在运行时禁用它:

So, how do we unbind fbcon from the console? Part of the answer is in Documentation/console/console.txt. To summarize:

Echo a value to the bind file that represents the framebuffer console driver. So assuming vtcon1 represents fbcon, then:

echo 1 > sys/class/vtconsole/vtcon1/bind - attach framebuffer console to console layer echo 0 > sys/class/vtconsole/vtcon1/bind - detach framebuffer console from console layer

当我发出 echo 0 命令时,光标停止闪烁,当我发出 echo 1 命令时又开始闪烁。

我认为还有另一种方法可以通过将 USE_VT="0" 放入 OpenEmbedded 机器配置文件来修改 Yocto 构建环境。 "USE_VT" 变量由 sysvinit-inittab 配方引用。这个答案是从 Yocto Linux 邮件列表中给我的——但我还没有测试过它,因为我们已经从 Yocto 中分离出来了……