diff mbox

Set boot consoles to be used by the bootloader

Message ID 1457479802-8517-1-git-send-email-sam@mendozajonas.com
State Rejected
Headers show

Commit Message

Sam Mendoza-Jonas March 8, 2016, 11:30 p.m. UTC
If nothing is specified on the kernel command line the boot console will
only be displayed on hvc0 by default.
Specify both tty0 and hvc0 so that the boot console can also be seen on
the VGA device if it is available.

Signed-off-by: Sam Mendoza-Jonas <sam@mendozajonas.com>
---
Technically this could also be done by patching it to be the default
in the kernel (ie. a patch in op-build) but this seems to be a cleaner
way of setting it for any bootloader we may have.
Tested on a Habanero and Tuleta machine, although I don't have a monitor
attached to any Tuletas at the moment.

 include/config.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Joel Stanley March 9, 2016, 12:20 a.m. UTC | #1
On Wed, Mar 9, 2016 at 10:00 AM, Sam Mendoza-Jonas <sam@mendozajonas.com> wrote:
> If nothing is specified on the kernel command line the boot console will
> only be displayed on hvc0 by default.
> Specify both tty0 and hvc0 so that the boot console can also be seen on
> the VGA device if it is available.

> Technically this could also be done by patching it to be the default
> in the kernel (ie. a patch in op-build) but this seems to be a cleaner
> way of setting it for any bootloader we may have.
> Tested on a Habanero and Tuleta machine, although I don't have a monitor
> attached to any Tuletas at the moment.

Where/how does hvc0 added as an output before this change?

It would be cool if the kernel had a console=all option.

Cheers,

Joel
Sam Mendoza-Jonas March 9, 2016, 12:45 a.m. UTC | #2
On Wed, Mar 09, 2016 at 10:50:56AM +1030, Joel Stanley wrote:
> On Wed, Mar 9, 2016 at 10:00 AM, Sam Mendoza-Jonas <sam@mendozajonas.com> wrote:
> > If nothing is specified on the kernel command line the boot console will
> > only be displayed on hvc0 by default.
> > Specify both tty0 and hvc0 so that the boot console can also be seen on
> > the VGA device if it is available.
> 
> > Technically this could also be done by patching it to be the default
> > in the kernel (ie. a patch in op-build) but this seems to be a cleaner
> > way of setting it for any bootloader we may have.
> > Tested on a Habanero and Tuleta machine, although I don't have a monitor
> > attached to any Tuletas at the moment.
> 
> Where/how does hvc0 added as an output before this change?

AFAIK the kernel will choose the first available device by default,
which has been hvc0 on everything I've seen so far.

> 
> It would be cool if the kernel had a console=all option.

Absolutely, I spent some time reading around to see if it was valid but
I couldn't find a mention of it, and digging into kernel/printk/printk.c
seems to say it isn't a thing either.

> 
> Cheers,
> 
> Joel
Stewart Smith March 30, 2016, 11:35 p.m. UTC | #3
Sam Mendoza-Jonas <sam@mendozajonas.com> writes:
> If nothing is specified on the kernel command line the boot console will
> only be displayed on hvc0 by default.
> Specify both tty0 and hvc0 so that the boot console can also be seen on
> the VGA device if it is available.
>
> Signed-off-by: Sam Mendoza-Jonas <sam@mendozajonas.com>
> ---
> Technically this could also be done by patching it to be the default
> in the kernel (ie. a patch in op-build) but this seems to be a cleaner
> way of setting it for any bootloader we may have.
> Tested on a Habanero and Tuleta machine, although I don't have a monitor
> attached to any Tuletas at the moment.

So... I've been thinking about this for a bit, and my mind returned to
it sometime this morning in a haze of cold+flu meds - and I've started
to think that this may not be the best way to achieve this...

While this probably works on existing configurations okay, my concern is
if people start doing crazy things like adding in serial ports or hvc
consoles and the like....

Should we instead have some kind of notation in the device tree that
then Linux can listen to? I've been digging into the /chosen/stdout
property, but that only gets us one console, which isn't exactly what we
want....

so it kind of seems like we want a new binding, maybe
/chosen/console-path that's a list of devices that firmware hints that a
console should be run on? That way we could avoid something that ends up
being like "console=all" on a command line, and possibly starting
consoles in the wrong place...

thoughts?
Sam Mendoza-Jonas March 30, 2016, 11:50 p.m. UTC | #4
On Thu, Mar 31, 2016 at 10:35:39AM +1100, Stewart Smith wrote:
> Sam Mendoza-Jonas <sam@mendozajonas.com> writes:
> > If nothing is specified on the kernel command line the boot console will
> > only be displayed on hvc0 by default.
> > Specify both tty0 and hvc0 so that the boot console can also be seen on
> > the VGA device if it is available.
> >
> > Signed-off-by: Sam Mendoza-Jonas <sam@mendozajonas.com>
> > ---
> > Technically this could also be done by patching it to be the default
> > in the kernel (ie. a patch in op-build) but this seems to be a cleaner
> > way of setting it for any bootloader we may have.
> > Tested on a Habanero and Tuleta machine, although I don't have a monitor
> > attached to any Tuletas at the moment.
> 
> So... I've been thinking about this for a bit, and my mind returned to
> it sometime this morning in a haze of cold+flu meds - and I've started
> to think that this may not be the best way to achieve this...
> 
> While this probably works on existing configurations okay, my concern is
> if people start doing crazy things like adding in serial ports or hvc
> consoles and the like....
> 
> Should we instead have some kind of notation in the device tree that
> then Linux can listen to? I've been digging into the /chosen/stdout
> property, but that only gets us one console, which isn't exactly what we
> want....
> 
> so it kind of seems like we want a new binding, maybe
> /chosen/console-path that's a list of devices that firmware hints that a
> console should be run on? That way we could avoid something that ends up
> being like "console=all" on a command line, and possibly starting
> consoles in the wrong place...
> 
> thoughts?

Actually over coffee this morning Mikey pointed out the CONFIG_CMDLINE
kernel option, which appears to work just as well. That means we can
target specific platforms in op-build rather than an always-on config.
I'm going to send an op-build PR at some point this morning, and we
should drop this patch :)

The /chosen/console-path sounds like an interesting idea too, maybe
something to think about once we start seeing crazy new platforms
popping up.

Cheers,
Sam

> 
> -- 
> Stewart Smith
> OPAL Architect, IBM.
>
diff mbox

Patch

diff --git a/include/config.h b/include/config.h
index 2524570..9feb10e 100644
--- a/include/config.h
+++ b/include/config.h
@@ -89,7 +89,7 @@ 
 /* Configure this to provide some additional kernel command line
  * arguments to the bootloader
  */
-//#define KERNEL_COMMAND_LINE	"debug"
+#define KERNEL_COMMAND_LINE "console=tty0 console=hvc0"
 
 #endif /* __CONFIG_H */