lkml.org 
[lkml]   [1998]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patches in this message
/
Date
From
Subject[PATCH] modify console_loglevel from commandline
These little patches (against 2.0.35 and 2.1.128, but should apply 
cleanly towards later) allow changing the default console_loglevel with
kernel parameters. These should be simple enough to include in the
current 2.0 and 2.1 trees without disturbing anything.

Two new parameters are added, "quiet" which sets console_loglevel to 1,
and "loglevel=integer" which sets the console_loglevel to some integer
from 1 to 10. This lets me quiet down the boot process of my
distribution (as to not scare anyone) without having to patch the kernel,
and additionally allows me to change it from LILO without including
another entire kernel image.

--
Robert Minichino
Chief Engineer
Denarius Enterprises, Inc.
http://www.denarius.com/
--- ../linux-2.0.35/init/main.c Thu Jul 23 14:00:33 1998
+++ init/main.c Wed Dec 9 00:35:39 1998
@@ -258,6 +258,15 @@
return(cur);
}

+int atoi(const char *num) {
+ int result = 0;
+
+ while ( (*num >= '0') && (*num <= '9') )
+ result = result * 10 + *(num++) - '0';
+
+ return result;
+}
+
static void profile_setup(char *str, int *ints)
{
if (ints[0] > 0)
@@ -741,6 +750,19 @@
}
if (!strcmp(line,"debug")) {
console_loglevel = 10;
+ continue;
+ }
+ if (!strcmp(line,"quiet")) {
+ console_loglevel = 1;
+ continue;
+ }
+ if (!strncmp(line,"loglevel=",9)) {
+ if ( atoi(line+9) > 0 )
+ console_loglevel = atoi(line+9);
+ if ( console_loglevel < 0 )
+ console_loglevel = 0;
+ else if ( console_loglevel > 10 )
+ console_loglevel = 10;
continue;
}
if (!strncmp(line,"init=",5)) {--- ../linux-pristine/init/main.c Wed Dec 9 00:42:27 1998
+++ init/main.c Wed Dec 9 00:48:12 1998
@@ -379,6 +379,15 @@
return(cur);
}

+int atoi(const char *num) {
+ int result = 0;
+
+ while ( (*num >= '0') && (*num <= '9') )
+ result = result * 10 + *(num++) - '0';
+
+ return result;
+}
+
static void __init profile_setup(char *str, int *ints)
{
if (ints[0] > 0)
@@ -1012,6 +1021,19 @@
}
if (!strcmp(line,"debug")) {
console_loglevel = 10;
+ continue;
+ }
+ if (!strcmp(line,"quiet")) {
+ console_loglevel = 1;
+ continue;
+ }
+ if (!strncmp(line,"loglevel=",9)) {
+ if ( atoi(line+9) > 0 )
+ console_loglevel = atoi(line+9);
+ if ( console_loglevel < 0 )
+ console_loglevel = 0;
+ else if ( console_loglevel > 10 )
+ console_loglevel = 10;
continue;
}
if (!strncmp(line,"init=",5)) {
\
 
 \ /
  Last update: 2005-03-22 13:46    [W:2.977 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site