What does check_for_consoles do?

fykcee1 at gmail.com fykcee1 at gmail.com
Thu Apr 21 19:07:37 PDT 2011


Hi,

2011/4/22 Ray Strode <halfline at gmail.com>:
> Hey,
>
> On Thu, Apr 21, 2011 at 3:38 AM, fykcee1 at gmail.com <fykcee1 at gmail.com> wrote:
>> Thanks for the reply.
>> I guess we should filter out 'vt' in check_for_consoles, since a 'vt'
>> isn't a serial console. I've made a patch for it, seems working fine.
> So reading through this patch, it seems to do a few things:
>
> 1)
> +      if (strncmp (console_string, "/dev/", strlen ("/dev/")) == 0)
> +        console_string += strlen ("/dev/");
> Chop off the /dev/ prefix before adding the console to the hash table.
>
> This is fine and a useful change by itself because say
>
> console=/dev/ttyS0 console=ttyS0
>
> on the kernel command line should be coalesced into one entry and they
> aren't right now.
>
> 2) Prevent e.g. console=tty0 from forcing details.  Sounds fine.
All 'tty0-tty63 + tty' will hence use default tty -- they will not be
added to 'consoles' hash table.
If 'consoles' hash table is empty, add_default_displays_and_keyboard()
will be called and it adds default tty as text display and other pixel
displays, am I right?

The other thing is how to decide 'state->kernel_console_tty', the
patch changes the original logic -- now, the first 'console=xxx' in
/proc/cmdline wins.
If the first 'console=xxx' is 'console=tty' or 'console=tty0',
state->kernel_console_tty will be set to default tty.

> 3) Switching to stack allocated memory instead of heap allocated
> memory.  I don't really
> care either way about this.
This just for code cleanup, hence doesn't need to care about free.

> 4) Prevent the default_tty from getting a text display associated with
> it.  This will break the "text" plugin I think. Or am I missing
> something in my read through?
Hmm, I am not sure I understand this?
I tested the patch with kernel cmdline "console=tty1" and default tty
"tty7", "text" plugin works fine.
For this patch, default tty will associate with a text display in
add_default_displays_and_keyboard(), and only if something like
"console=ttyS1" appears, default tty will not be used, am I right?

BTW, If more than one "console=..." are present,
add_display_and_keyboard_for_console() will be called for each of
them, which will set state->terminal and state->keyboard. This seems
may cause memory leak, e.g.
state->keyboard holds the only reference of
"ply_keyboard_new_for_terminal()", but state->keyboard will be
overwritten by a later possible assignment.



-- 
Regards,
- cee1


More information about the plymouth mailing list