[U-Boot] [PATCH] pxe: automatically add console= to bootargs when not specified in append
Stephen Warren
swarren at wwwdotorg.org
Fri Aug 1 21:01:10 CEST 2014
On 08/01/2014 01:46 AM, Hans de Goede wrote:
> From: Dennis Gilmore <dennis at ausil.us>
>
> if there is a console variable in the u-boot environment and not one on
> the append line from syslinux config add what is in the environment to
> the bootargs.
>
> This is necessary to allow distros to have a single extlinux/extlinux.conf
> file which will work on multiple boards, even if these boards have different
> consoles (e.g. ttyS0 vs ttyAMA0).
> diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
I know you rejected this afterwards, but since I read the patch before
the reply, a couple of comments for anyone who finds this code in the
archived and wants to copy it:
> + char console[30] = "";
> - if (label->append)
> + if (label->append) {
> len += strlen(label->append);
> + /* If no console in append and $console is set, use it */
> + if (!strstr(label->append, "console=") && getenv("console")) {
This would get a false positive match for the text fooconsole= in the
existing command-line. It might be better to strtok() (or similar) the
existing value, so it can guarantee to match only options that start
with console= not that contain console=.
> + sprintf(console, " console=%s", getenv("console"));
This should check for buffer overflows, e.g. use snprintf().
More information about the U-Boot
mailing list