From f60c9ff1f9f1f161d9aba021827792d0df3d2ba7 Mon Sep 17 00:00:00 2001 From: Sergii Shchelkanov Date: Tue, 8 Feb 2022 19:13:58 +0200 Subject: MTCAP3 - bootlogd patch - no init scripts messages in console - fix --- .../bootlogd-support-more-console-names.patch | 66 ++++++++++++++++++++++ recipes-core/sysvinit/sysvinit_2.96.bbappend | 10 ++++ 2 files changed, 76 insertions(+) create mode 100644 recipes-core/sysvinit/sysvinit/bootlogd-support-more-console-names.patch create mode 100644 recipes-core/sysvinit/sysvinit_2.96.bbappend diff --git a/recipes-core/sysvinit/sysvinit/bootlogd-support-more-console-names.patch b/recipes-core/sysvinit/sysvinit/bootlogd-support-more-console-names.patch new file mode 100644 index 0000000..2286750 --- /dev/null +++ b/recipes-core/sysvinit/sysvinit/bootlogd-support-more-console-names.patch @@ -0,0 +1,66 @@ +From 8a085ea9b7f2d8e59cbf17e9c04b155fddab4dd9 Mon Sep 17 00:00:00 2001 +From: Jesse Smith +Date: Tue, 3 Aug 2021 18:21:16 -0300 +Subject: Applied patch from Matthias Schiffer which allows bootlogd to read + from a wider range of consoles. The console name is already passed in from + the kernel command line using "console=". We no longer filter out names as + strictly but do now check to confirm the "console=" device points to a valid + TTY. + +--- + src/bootlogd.c | 25 ++++++++++++++++++++++++- + 1 file changed, 24 insertions(+), 1 deletion(-) + +diff --git a/src/bootlogd.c b/src/bootlogd.c +index 787db87..78e4c81 100644 +--- a/src/bootlogd.c ++++ b/src/bootlogd.c +@@ -212,6 +212,22 @@ int findpty(int *master, int *slave, char *name) + + return 0; + } ++ ++static int istty(const char *dev) ++{ ++ int fd, ret; ++ ++ fd = open(dev, O_RDONLY|O_NONBLOCK); ++ if (fd < 0) ++ return 0; ++ ++ ret = isatty(fd); ++ ++ close(fd); ++ ++ return ret; ++} ++ + /* + * See if a console taken from the kernel command line maps + * to a character device we know about, and if we can open it. +@@ -228,7 +244,7 @@ int isconsole(char *s, char *res, int rlen) + l = strlen(c->cmdline); + if (sl <= l) continue; + p = s + l; +- if (strncmp(s, c->cmdline, l) != 0 || !isdigit(*p)) ++ if (strncmp(s, c->cmdline, l) != 0) + continue; + for (i = 0; i < 2; i++) { + snprintf(res, rlen, i ? c->dev1 : c->dev2, p); +@@ -239,6 +255,13 @@ int isconsole(char *s, char *res, int rlen) + } + } + } ++ ++ /* Fallback: accept any TTY device */ ++ snprintf(res, rlen, "/dev/%s", s); ++ if ((q = strchr(res, ',')) != NULL) *q = 0; ++ if (istty(res)) ++ return 1; ++ + return 0; + } + +-- +cgit v1.1 + diff --git a/recipes-core/sysvinit/sysvinit_2.96.bbappend b/recipes-core/sysvinit/sysvinit_2.96.bbappend new file mode 100644 index 0000000..1f30887 --- /dev/null +++ b/recipes-core/sysvinit/sysvinit_2.96.bbappend @@ -0,0 +1,10 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" + +# Backport from sysvinit 3.00. Remove bbappend when updating the main recipe to +# 3.00 or newer. + +PR = "r0" + +SRC_URI_append = " \ + file://bootlogd-support-more-console-names.patch \ +" -- cgit v1.2.3