On 2019-01-20 03:02 +0000, Ben Hutchings wrote: > /proc/consoles shows everything on the global console_drivers list. > Every time a console is added to the list the kernel logs a message > with the format "%sconsole [%s%d] enabled\n". So these should match, > except that (1) it is also possible to unregister consoles, and reopen- > consoles doesn't account for that (2) the kernel log might have rolled > over so that reopen-console-linux doesn't see the messages. > > > Does it include any/all listed explicitly on the kernel command line? > > It's a bit more complicated than that. The kernel has a table of up to > 8 "preferred" console devices, which can be specified on the kernel > command, or through Device Tree or platform code, or by a hypervisor. > The device specified last (which usually means the last console= > argument on the command line) is the most preferred. > > If some preferred devices are specified, then console_drivers will > include all the console devices that are preferred *and* have been > found to exist, and the most preferred (if it exists) will be first. > > Otherwise, the kernel seems to enable the first console device found to > exist.
> Reading /proc/consoles is exactly what you should do. Checking this on a booted thunderx machine (with no explicit kernel cmdline options) it lists ttyAMA0 If I boot with explicit console=tty0 console=ttyAMA0 on the kernel cmdline then they both appear in /proc/consoles, AMA0 last If I boot with explicit console=tty0 on the kernel cmdline then they both appear in /proc/consoles, AMA0 still last So /proc/consoles does indeed correspond to the set of enabled consoles listed by dmesg, however the last-listed on the cmdline is not necessarily the last in the list. Perhaps this is influenced by the device EFI specifies as the default console? What it doesn't do (which I was hoping for) is automagically note that there is a display attached (that could be used as a console) unless you tell it to look. Anyone know what would it take to make tty0 appear as a valid console on a thunderx machine without having to explicitly list it on the kernel command line? This is what we'd ideally like to happen. I've modified reopen-console-linux to use /proc/console and run D-I on all found. I'll test that on tue when back at suitable machine, and post here when it shows signs of working. Wookey -- Principal hats: Linaro, Debian, Wookware, ARM http://wookware.org/
signature.asc
Description: PGP signature