Skip to content

Commit

Permalink
Add --enable-kernel-quiet to configure, delayed quiet after initial b…
Browse files Browse the repository at this point in the history
…oot.

... with the additional twist that the kernel command line option
'quiet' also gets to play.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
  • Loading branch information
troglobit committed Jun 7, 2015
1 parent f8d6081 commit 6d3972c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
8 changes: 5 additions & 3 deletions conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ void parse_kernel_cmdline(void)

if (strstr(line, "finit_debug") || strstr(line, "--debug"))
debug = 1;

#ifdef KERNEL_QUIET
if (!debug && strstr(line, "quiet"))
verbose = 0;

quiet = 1;
else
quiet = 0;
#endif
fclose(fp);
}
}
Expand Down
12 changes: 12 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ defaults()
embedded=${embedded:=0}
inetd=${inetd:=1}
verbose=${verbose:=1}
kernel_quiet=${kernel_quiet:=1}
static=${static:=0}
disable_plugins=${disable_plugins:=0}
}
Expand Down Expand Up @@ -65,6 +66,11 @@ fi
else
echo "Quiet Finit : NO, verbose output (default)"
fi
if [ $kernel_quiet -eq 1 ]; then
echo "Kernel Quiet : YES, silent after inital boot (default)"
else
echo "Kernel Quiet : NO"
fi
if [ $static -ne 0 ]; then
echo "Static Finit : YES"
fi
Expand Down Expand Up @@ -105,6 +111,7 @@ usage()
echo " --enable-embedded Enable embedded defaults, BusBox getty, mdev etc."
echo " --enable-debug Enable debug flags, '-O0, -g'"
echo " --enable-quiet Quiet mode, reduce screen output to absolute minimum."
echo " --enable-kernel-quiet Like quiet, but after boot, using kernel cmdline quiet."
echo " --enable-static Link statically. This disables a few features."
echo " --disable-inetd Disable inetd support if not needed."
echo " --disable-plugins Disable plugins"
Expand Down Expand Up @@ -182,6 +189,10 @@ while [ "$*" != "" ]; do
verbose=0
;;

enable-kernel-quiet)
kernel_quiet=1
;;

enable-static)
static=1
;;
Expand Down Expand Up @@ -275,6 +286,7 @@ if [ x"$heading" != x"" ]; then
fi

echo "#define VERBOSE_MODE $verbose" >> config.h
echo "#define KERNEL_QUIET $kernel_quiet" >> config.h
echo "#define FINIT_FIFO \"$fifo\"" >> config.h
echo "#define FINIT_CONF \"$config\"" >> config.h
echo "#define FINIT_RCSD \"$rcsd\"" >> config.h
Expand Down
5 changes: 5 additions & 0 deletions finit.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "inetd.h"

int debug = 0;
int quiet = KERNEL_QUIET; /* Delayed disable of verbose mode. */
int verbose = VERBOSE_MODE;
int runlevel = 0; /* Bootstrap */
int cfglevel = RUNLEVEL; /* Fallback if no configured runlevel */
Expand Down Expand Up @@ -185,6 +186,10 @@ int main(int argc, char* argv[])
/* Start TTYs */
tty_runlevel(runlevel);

/* Disable verbose mode, if selected */
if (quiet)
verbose = 0;

/*
* Enter main loop to monior /dev/initctl and services
*/
Expand Down
1 change: 1 addition & 0 deletions finit.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ struct init_request {
};

extern int debug;
extern int quiet;
extern int verbose;
extern int runlevel;
extern int cfglevel;
Expand Down

0 comments on commit 6d3972c

Please sign in to comment.