Refactor 3e8d63c: use consoles from /sys/class/tty/console/active

As documented in the kernel docs and systemd[1], the default system
console is the first listed in /sys/class/tty/console/active, which
is the reverse order of console= given on the kernel cmdline.

Some distros don't have console= on their default command line in
their bootloader, e.g. Alpine Linux, some multiple, e.g Buildroot.
Instead of relying on the value given at configure time we probe
sysfs and open all (at most three) consoles listed.  This way we
at least get the default console for our progress output.

- drop old --with-console from configure script
- drop /proc/cmdline fishing in favor of sysfs
- replace CONSOLE from configure with new console()

[1]: http://0pointer.de/blog/projects/serial-console.html

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2021-02-08 20:09:49 +01:00
1 parent 3fb700c17d
commit 82664396d6
6 files changed
+58 -19

No files matched your search

+5
View File
@@ -386,6 +386,11 @@ int main(int argc, char *argv[])
*/
conf_parse_cmdline(argc, argv);
/*
* Figure out system console(s)
*/
console_init();
/*
* Initalize event context.
*/