diff options
author | 2021-03-19 20:09:36 +0100 | |
---|---|---|
committer | 2021-03-20 01:12:35 +0100 | |
commit | d5f7d79bab1563c301e0722ede0d75549297a031 (patch) | |
tree | 4fb4ecb72fc0c5bb29763084ccf51e85ec221ee4 /defaults | |
parent | linuxrc: Fix QUIET mode (diff) | |
download | genkernel-d5f7d79bab1563c301e0722ede0d75549297a031.tar.gz genkernel-d5f7d79bab1563c301e0722ede0d75549297a031.tar.bz2 genkernel-d5f7d79bab1563c301e0722ede0d75549297a031.zip |
linuxrc: Refactor handling of console log level
Closes: https://github.com/gentoo/genkernel/pull/24
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'defaults')
-rw-r--r-- | defaults/initrd.defaults | 1 | ||||
-rw-r--r-- | defaults/initrd.scripts | 18 | ||||
-rw-r--r-- | defaults/linuxrc | 18 |
3 files changed, 12 insertions, 25 deletions
diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index 18e13825..88495391 100644 --- a/defaults/initrd.defaults +++ b/defaults/initrd.defaults @@ -70,6 +70,7 @@ VERIFY=0 IP='dhcp' GK_BOOTFONT_DISABLED=0 +GK_CONSOLE_LOGLEVEL=3 GK_DEBUGMODE_STATEFILE="/tmp/debug.enabled" GK_EMERGENCY_ACTION="halt -f" GK_HW_LOAD_ALL_MODULES=0 diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index ea66d9bd..d68875ba 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -2502,24 +2502,6 @@ sdelay() { fi } -quiet_kmsg() { - # if QUIET is set make the kernel less chatty - if [ -n "${QUIET}" ] - then - echo '0' > /proc/sys/kernel/printk \ - && log_msg "COMMAND: 'echo \"0\" > /proc/sys/kernel/printk'" - fi -} - -verbose_kmsg() { - # if QUIET is set make the kernel less chatty - if [ -n "${QUIET}" ] - then - echo '6' > /proc/sys/kernel/printk \ - && log_msg "COMMAND: 'echo \"6\" > /proc/sys/kernel/printk'" - fi -} - cdupdate() { if [ "${CDROOT}" = '1' ] then diff --git a/defaults/linuxrc b/defaults/linuxrc index 1861f238..dc34439a 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -42,9 +42,6 @@ then chmod 0750 /run/initramfs fi -# Prevent superfluous printks from being printed to the console -echo 1 > /proc/sys/kernel/printk - if [ ! -s /etc/ld.so.cache ] then # Looks like we were unable to run ldconfig during initramfs generation @@ -54,6 +51,7 @@ fi # Set up symlinks run busybox --install -s +console_loglevel="$(cut -b1 /proc/sys/kernel/printk 2>/dev/null || echo 7)" gk_ver="$(cat /etc/build_id)" gk_build_date="$(cat /etc/build_date)" kernel_ver="$(uname -r)" @@ -467,6 +465,9 @@ do esac done +# Prevent superfluous printks from being printed to the console +echo ${GK_CONSOLE_LOGLEVEL} > /proc/sys/kernel/printk + good_msg "${gk_ver} (${gk_build_date}). Linux kernel ${kernel_ver}" if [ "${GK_BOOTFONT_DISABLED}" = '0' -a -e /lib/console/font ] @@ -480,8 +481,6 @@ then fi fi -quiet_kmsg - if [ "${CDROOT}" = '0' ] then if [ -z "${REAL_ROOT}" -a "${FAKE_ROOT}" != "/dev/ram0" ] @@ -1305,8 +1304,6 @@ then CHROOT="${CHROOT}/${SUBDIR}" fi -verbose_kmsg - if [ "${aufs}" = '1' ] then aufs_union_memory=${CHROOT}/.unions/memory @@ -1384,6 +1381,13 @@ do fi done +if [[ "${console_loglevel}" != "${GK_CONSOLE_LOGLEVEL}" ]] +then + good_msg "Restoring console log level (${console_loglevel}) ..." + echo ${console_loglevel} > /proc/sys/kernel/printk \ + && log_msg "COMMAND: 'echo \"${console_loglevel}\" > /proc/sys/kernel/printk'" +fi + good_msg "Switching to real root: switch_root ${CHROOT} ${init} ${init_opts}" exec switch_root "${CHROOT}" "${init}" ${init_opts} |