From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Warren Date: Fri, 01 Aug 2014 13:01:10 -0600 Subject: [U-Boot] [PATCH] pxe: automatically add console= to bootargs when not specified in append In-Reply-To: <1406879180-12278-1-git-send-email-hdegoede@redhat.com> References: <1406879180-12278-1-git-send-email-hdegoede@redhat.com> Message-ID: <53DBE3F6.6060300@wwwdotorg.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 08/01/2014 01:46 AM, Hans de Goede wrote: > From: Dennis Gilmore > > 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().