Skip to contentSkip to conversation

Fixes two warnings when boot with qemuppc64

PATCH New Kevin Hao 1 participant 4 messages Apr 7, 2021

lore
Share & tools
lore

Kevin Hao

author
#0 lore raw

cover Fixes two warnings when boot with qemuppc64

Fixes two following warnings:
depmod: can't change directory to 'lib/modules/5.10.25-yocto-standard': No such file or directory
INIT: Id "hvc0" respawning too fast: disabled for 5 minutes

Kevin Hao (3):
modutils-initscripts: Bail out when no module is installed sysvinit-inittab/start_getty: Check /sys for the tty device existence Revert "inittab: Add getty launch on hvc0 for qemuppc64"

 .../busybox/busybox-inittab_1.33.0.bb         |  3 --
 .../sysvinit/sysvinit-inittab/start_getty     | 44 ++-----------------
 .../sysvinit/sysvinit-inittab_2.88dsf.bb      |  4 --
 .../modutils-initscripts/files/modutils.sh    |  1 +
 4 files changed, 4 insertions(+), 48 deletions(-)
Signature · 1 line
2.30.2
author
#1 lore raw

PATCH 1/3 modutils-initscripts: Bail out when no module is installed

Fix the following warning when boot with a core-image-minimal rootfs:
depmod: can't change directory to 'lib/modules/5.10.25-yocto-standard': No such file or directory

---
 meta/recipes-kernel/modutils-initscripts/files/modutils.sh | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-kernel/modutils-initscripts/files/modutils.sh +1 -0
index 28fe6f92d77f..67e1dcd9907e 100755
@@ -13,6 +13,7 @@
 
 LOAD_MODULE=modprobe
 [ -f /proc/modules ] || exit 0
+[ -d /lib/modules/`uname -r` ] || exit 0
 
 # Test if modules.dep exists and has a size greater than zero
 if [ ! -s /lib/modules/`uname -r`/modules.dep ]; then
Signature · 1 line
2.30.2
author
#2 lore raw

PATCH 2/3 sysvinit-inittab/start_getty: Check /sys for the tty device existence

In reply to Kevin Hao

The hvc tty driver doesn't populate a file like /proc/tty/driver/serial, so the current implementation of start_getty doesn't work for the hvc console. By checking the /sys/class/tty/ for the tty device existence, it should support more console types and also make the codes more simple.

---
 .../sysvinit/sysvinit-inittab/start_getty     | 44 ++-----------------
 1 file changed, 3 insertions(+), 41 deletions(-)
meta/recipes-core/sysvinit/sysvinit-inittab/start_getty +3 -41
index dfa799adac2e..699a1ead1a40 100644
@@ -1,17 +1,4 @@
 #!/bin/sh
-###############################################################################
-# This script is used to automatically set up the serial console(s) on startup.
-# The variable SERIAL_CONSOLES can be set in meta/conf/machine/*.conf.
-# Script enhancement has been done based on Bug YOCTO #10844.
-# Most of the information is retrieved from /proc virtual filesystem containing
-# all the runtime system information (eg. system memory, device mount, etc).
-###############################################################################
-
-# Get active serial filename.
-active_serial=$(grep "serial" /proc/tty/drivers | cut -d/ -f1 | sed "s/ *$//")
-
-# Rephrase input parameter from ttyS target index (ttyS1, ttyS2, ttyAMA0, etc).
-runtime_tty=$(echo $2 | grep -oh '[0-9]\+')
 
 # busybox' getty does this itself, util-linux' agetty needs extra help
 getty="/sbin/getty"
@@ -25,31 +12,6 @@ case $(readlink -f "${getty}") in
         ;;
 esac
 
-# Backup $IFS.
-DEFAULT_IFS=$IFS
-# Customize Internal Field Separator.
-IFS="$(printf '\n\t')"
-
-for line in $active_serial; do
-	# Check we have the file containing current active serial target index.
-	if [ -e "/proc/tty/driver/$line" ]
-        then
-		# Remove all unknown entries and discard the first line (desc).
-		activetty=$(grep -v "unknown" "/proc/tty/driver/$line" \
-			    | tail -n +2 | grep -oh "^\s*\S*[0-9]\+")
-		for active in $activetty; do
-			# If indexes do match then enable the serial console.
-			if [ $active -eq $runtime_tty ]
-			then
-				if [ -c /dev/$2 ]
-				then
-				    ${setsid:-} ${getty} -L $1 $2 $3
-				fi
-				break
-			fi
-		done
-	fi
-done
-
-# Restore $IFS.
-IFS=$DEFAULT_IFS
+if [ -e /sys/class/tty/$2 -a -c /dev/$2 ]; then
+	${setsid:-} ${getty} -L $1 $2 $3
+fi
Signature · 1 line
2.30.2
author
#3 lore raw

PATCH 3/3 Revert "inittab: Add getty launch on hvc0 for qemuppc64"

In reply to Kevin Hao

This reverts commit ed69ef20167da0986bc9363d1a91e62001995af4.

The console entry has already been added into /etc/inittab based on the SERIAL_CONSOLES. So drop this redundant entry.

---
 meta/recipes-core/busybox/busybox-inittab_1.33.0.bb    | 3 ---
 meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb | 4 ----
 2 files changed, 7 deletions(-)
meta/recipes-core/busybox/busybox-inittab_1.33.0.bb +0 -3
index 0021e45511d7..3804f4f7b2d0 100644
@@ -44,9 +44,6 @@ EOF
 	fi
 
 }
-do_install_append_qemuppc64 () {
-            echo "9:12345:respawn:${base_sbindir}/getty 38400 hvc0" >> ${D}${sysconfdir}/inittab
-}
 
 pkg_postinst_${PN} () {
 # run this on host and on target
meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb +0 -4
index 0af116f35cbd..d95d1a63f5c4 100644
@@ -53,10 +53,6 @@ EOF
     fi
 }
 
-do_install_append_qemuppc64 () {
-            echo "9:12345:respawn:${base_sbindir}/getty 38400 hvc0" >> ${D}${sysconfdir}/inittab
-}
-
 pkg_postinst_${PN} () {
 # run this on host and on target
 if [ "${SERIAL_CONSOLES_CHECK}" = "" ]; then
Signature · 1 line
2.30.2