public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [PATCH v3 1/3] qemuriscv: check serial consoles w.r.t. /proc/consoles
@ 2020-12-14  6:01 Khem Raj
  2020-12-14  6:01 ` [PATCH v3 2/3] busybox-inittab: Implement SYSVINIT_ENABLED_GETTYS and USE_VT Khem Raj
  2020-12-14  6:01 ` [PATCH v3 3/3] systemd: Fix reallocarray check Khem Raj
  0 siblings, 2 replies; 3+ messages in thread
From: Khem Raj @ 2020-12-14  6:01 UTC (permalink / raw)
  To: openembedded-core; +Cc: Khem Raj

qemuriscv enables hvc0 along with ttyS0, however its not enabled in
/proc/consoles, getty tries to enable it in inittab and erroring out

Fixes below message with sysvinit

INIT: Id "hvc0" respawning too fast: disabled for 5 minutes

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/conf/machine/include/riscv/qemuriscv.inc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta/conf/machine/include/riscv/qemuriscv.inc b/meta/conf/machine/include/riscv/qemuriscv.inc
index 0e88c91aa6..47d7e9b174 100644
--- a/meta/conf/machine/include/riscv/qemuriscv.inc
+++ b/meta/conf/machine/include/riscv/qemuriscv.inc
@@ -10,6 +10,7 @@ KERNEL_IMAGETYPES += "uImage"
 KEEPUIMAGE = "no"
 
 SERIAL_CONSOLES ?= "115200;ttyS0 115200;hvc0"
+SERIAL_CONSOLES_CHECK = "${SERIAL_CONSOLES}"
 
 IMAGE_FSTYPES += "ext4 wic.qcow2"
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v3 2/3] busybox-inittab: Implement SYSVINIT_ENABLED_GETTYS and USE_VT
  2020-12-14  6:01 [PATCH v3 1/3] qemuriscv: check serial consoles w.r.t. /proc/consoles Khem Raj
@ 2020-12-14  6:01 ` Khem Raj
  2020-12-14  6:01 ` [PATCH v3 3/3] systemd: Fix reallocarray check Khem Raj
  1 sibling, 0 replies; 3+ messages in thread
From: Khem Raj @ 2020-12-14  6:01 UTC (permalink / raw)
  To: openembedded-core; +Cc: Khem Raj

This ensures that busybox init can generate matching tty's in inittab as
system defines, secondly resepcts USE_VT for creating virtual ttys

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../busybox/busybox-inittab_1.32.0.bb         | 50 +++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/meta/recipes-core/busybox/busybox-inittab_1.32.0.bb b/meta/recipes-core/busybox/busybox-inittab_1.32.0.bb
index 61fb8cbad1..8d0f419f4d 100644
--- a/meta/recipes-core/busybox/busybox-inittab_1.32.0.bb
+++ b/meta/recipes-core/busybox/busybox-inittab_1.32.0.bb
@@ -23,6 +23,53 @@ do_install() {
 		id=`echo ${i} | sed -e 's/^.*;//' -e 's/;.*//'`
 		echo "$id::respawn:${base_sbindir}/getty ${j}" >> ${D}${sysconfdir}/inittab
 	done
+	if [ "${USE_VT}" = "1" ]; then
+		cat <<EOF >>${D}${sysconfdir}/inittab
+# ${base_sbindir}/getty invocations for the runlevels.
+#
+# The "id" field MUST be the same as the last
+# characters of the device (after "tty").
+#
+# Format:
+#  <id>:<runlevels>:<action>:<process>
+#
+
+EOF
+
+		for n in ${SYSVINIT_ENABLED_GETTYS}
+		do
+			echo "tty$n:12345:respawn:${base_sbindir}/getty 38400 tty$n" >> ${D}${sysconfdir}/inittab
+		done
+		echo "" >> ${D}${sysconfdir}/inittab
+	fi
+
+}
+
+pkg_postinst_${PN} () {
+# run this on host and on target
+if [ "${SERIAL_CONSOLES_CHECK}" = "" ]; then
+       exit 0
+fi
+}
+
+pkg_postinst_ontarget_${PN} () {
+# run this on the target
+if [ -e /proc/consoles ]; then
+        tmp="${SERIAL_CONSOLES_CHECK}"
+        for i in $tmp
+        do
+                j=`echo ${i} | sed -e s/^.*\;//g -e s/\:.*//g`
+                k=`echo ${i} | sed s/^.*\://g`
+                if [ -z "`grep ${j} /proc/consoles`" ]; then
+                        if [ -z "${k}" ] || [ -z "`grep ${k} /proc/consoles`" ] || [ ! -e /dev/${j} ]; then
+                                sed -i -e /^.*${j}\ /d -e /^.*${j}$/d /etc/inittab
+                        fi
+                fi
+        done
+        kill -HUP 1
+else
+        exit 1
+fi
 }
 
 # SERIAL_CONSOLES is generally defined by the MACHINE .conf.
@@ -33,3 +80,6 @@ FILES_${PN} = "${sysconfdir}/inittab"
 CONFFILES_${PN} = "${sysconfdir}/inittab"
 
 RCONFLICTS_${PN} = "sysvinit-inittab"
+
+USE_VT ?= "1"
+SYSVINIT_ENABLED_GETTYS ?= "1"
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v3 3/3] systemd: Fix reallocarray check
  2020-12-14  6:01 [PATCH v3 1/3] qemuriscv: check serial consoles w.r.t. /proc/consoles Khem Raj
  2020-12-14  6:01 ` [PATCH v3 2/3] busybox-inittab: Implement SYSVINIT_ENABLED_GETTYS and USE_VT Khem Raj
@ 2020-12-14  6:01 ` Khem Raj
  1 sibling, 0 replies; 3+ messages in thread
From: Khem Raj @ 2020-12-14  6:01 UTC (permalink / raw)
  To: openembedded-core; +Cc: Khem Raj

Musl brought this latent issue to fore

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../0001-meson-Fix-reallocarray-check.patch   | 30 +++++++++++++++++++
 meta/recipes-core/systemd/systemd_246.6.bb    |  1 +
 2 files changed, 31 insertions(+)
 create mode 100644 meta/recipes-core/systemd/systemd/0001-meson-Fix-reallocarray-check.patch

diff --git a/meta/recipes-core/systemd/systemd/0001-meson-Fix-reallocarray-check.patch b/meta/recipes-core/systemd/systemd/0001-meson-Fix-reallocarray-check.patch
new file mode 100644
index 0000000000..1229dd6e17
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-meson-Fix-reallocarray-check.patch
@@ -0,0 +1,30 @@
+From 1ebf1a1df17afd8b89f84b1928a89069035bf20b Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 12 Dec 2020 16:15:57 -0800
+Subject: [PATCH] meson: Fix reallocarray check
+
+reallocarray() is defined in stdlib.h, so that would be right header to
+check for its presense.
+
+Upstream-Status: Submitted [https://github.com/systemd/systemd/pull/17951]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index d205f846c7..e0a3c53529 100644
+--- a/meson.build
++++ b/meson.build
+@@ -517,7 +517,7 @@ foreach ident : [
+                                  #include <sys/stat.h>
+                                  #include <unistd.h>'''],
+         ['explicit_bzero' ,   '''#include <string.h>'''],
+-        ['reallocarray',      '''#include <malloc.h>'''],
++        ['reallocarray',      '''#include <stdlib.h>'''],
+         ['set_mempolicy',     '''#include <stdlib.h>
+                                  #include <unistd.h>'''],
+         ['get_mempolicy',     '''#include <stdlib.h>
+-- 
+2.29.2
+
diff --git a/meta/recipes-core/systemd/systemd_246.6.bb b/meta/recipes-core/systemd/systemd_246.6.bb
index d9e7b1a00c..b89eff6be2 100644
--- a/meta/recipes-core/systemd/systemd_246.6.bb
+++ b/meta/recipes-core/systemd/systemd_246.6.bb
@@ -24,6 +24,7 @@ SRC_URI += "file://touchscreen.rules \
            file://0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch \
            file://selinux-hook-handling-to-enumerate-nexthop.patch \
            file://0001-logind-Restore-chvt-as-non-root-user-without-polkit.patch \
+           file://0001-meson-Fix-reallocarray-check.patch \
            "
 
 # patches needed by musl
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-14  6:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-14  6:01 [PATCH v3 1/3] qemuriscv: check serial consoles w.r.t. /proc/consoles Khem Raj
2020-12-14  6:01 ` [PATCH v3 2/3] busybox-inittab: Implement SYSVINIT_ENABLED_GETTYS and USE_VT Khem Raj
2020-12-14  6:01 ` [PATCH v3 3/3] systemd: Fix reallocarray check Khem Raj

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox