Explorar o código

systemd-serialgetty: Switch to TERM=linux

Long ago in commit 473ff65c2f69de4ece3204fadfae7c5cb992149a
(serial-getty service: Add xterm as default TERM), the xterm
became the default for the serial port terminal.

Using the version of vim.tiny in oe-core master with the
serial port connected in xterm version 322 (which is one
of the most widely deployed versions at the current time)
causes artifacts and missed characters.

The example sequence is the following:
  * Start vim
  * Press "i" to enter input mode
  * Type "123"
  * Press Escape to enter command mode
  * Press "a" to enter append mode
  * Type "456"

At this point if you are using xterm less than version 535 you will
see on your screen "12456" instead of "123456".

Changing the TERM variable to "linux" will still allow you to have all
the same functionality with colorization, ansi character escapes
etc..., but will avoid the extra xterm specific escape sequence that
only exists in the most recent versions of xterm.

This patch allows the end user to set the serial terminal type to
something other than the new default of "linux" by changing the
SERIAL_TERM variable in local.conf.  For example:
    SERIAL_TERM = "xterm"

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Jason Wessel %!s(int64=3) %!d(string=hai) anos
pai
achega
84e7e68c22

+ 2 - 0
meta/recipes-core/systemd/systemd-serialgetty.bb

@@ -6,6 +6,7 @@ LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=80
 PR = "r5"
 
 SERIAL_CONSOLES ?= "115200;ttyS0"
+SERIAL_TERM ?= "linux"
 
 SRC_URI = "file://serial-getty@.service"
 
@@ -22,6 +23,7 @@ do_install() {
 		install -d ${D}${sysconfdir}/systemd/system/getty.target.wants/
 		install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_unitdir}/system/
 		sed -i -e "s/\@BAUDRATE\@/$default_baudrate/g" ${D}${systemd_unitdir}/system/serial-getty@.service
+		sed -i -e "s/\@TERM\@/${SERIAL_TERM}/g" ${D}${systemd_unitdir}/system/serial-getty@.service
 
 		tmp="${SERIAL_CONSOLES}"
 		for entry in $tmp ; do

+ 1 - 1
meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service

@@ -29,7 +29,7 @@ Conflicts=rescue.service
 Before=rescue.service
 
 [Service]
-Environment="TERM=xterm"
+Environment="TERM=@TERM@"
 ExecStart=-/sbin/agetty -8 -L %I @BAUDRATE@ $TERM
 Type=idle
 Restart=always