[OE-core] [PATCH v2] Introduce new SERIAL_CONSOLES to add multiple consoles for your MACHINE

Phil Blundell philb at gnu.org
Fri Nov 4 21:34:59 UTC 2011


On Fri, 2011-11-04 at 16:25 -0500, Matthew McClintock wrote:
> v2: handle case where SERIAL_CONSOLES is not defined
> 
>  .../sysvinit/sysvinit-inittab_2.88dsf.bb           |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb b/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
> index ba60c74..adab262 100644
> --- a/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
> +++ b/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
> @@ -25,6 +25,18 @@ do_install() {
>      if [ ! -z "${SERIAL_CONSOLE}" ]; then
>          echo "S:2345:respawn:${base_sbindir}/getty ${SERIAL_CONSOLE}" >> ${D}${sysconfdir}/inittab
>      fi
> +
> +    idx=0
> +    tmp="${SERIAL_CONSOLES}"
> +    if [ "x" != "x$tmp" ]; then
> +	for i in $tmp
> +	do
> +	    j=`echo ${i} | sed s/\;/\ /g`
> +	    echo "${idx}:2345:respawn:${base_sbindir}/getty ${j}" >> ${D}${sysconfdir}/inittab
> +	    idx=`expr $idx + 1`
> +	done
> +    fi
> +

Did you test that this actually solves the problem?  It looks to me as
though it will still do the wrong thing if the variable is not defined
at all (as opposed to being defined to the empty string).  The added
"if" statement doesn't actually achieve much since, if $tmp is the empty
string, the for-loop wouldn't have executed anyway and there is no need
for an extra guard.

Also, for what it's worth, the "x$tmp" idiom is unnecessary if you're
going to quote the strings.

p.






More information about the Openembedded-core mailing list