Patchwork [v3,7/9] syslinux.bbclass: Fix hard coding of console=tty*

login
register
mail settings
Submitter Jason Wessel
Date Sept. 17, 2013, 1:32 p.m.
Message ID <1379424738-16798-8-git-send-email-jason.wessel@windriver.com>
Download mbox | patch
Permalink /patch/58267/
State Accepted
Commit 4a0ff9c74dcf41847c23f30616e95f18309e59c1
Headers show

Comments

Jason Wessel - Sept. 17, 2013, 1:32 p.m.
The SYSLINUX_SERIAL variable was hard coded and occasionally needs to
be different for the kernel argument vs the syslinux argument.

In the auto-generated boot mode console=tty0 was hard coded, and this
is not needed at all, and causes problems in some cases if a end user
wanted to change the console=... via the kernel boot argument APPEND
mechanism.  The default can be forced with SYSLINUX_DEFAULT_CONSOLE
for systems that need a special specification to enable the frame
buffer instead of a serial port.

[YOCTO #3944]

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
---
 meta/classes/syslinux.bbclass |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
Darren Hart - Sept. 17, 2013, 10:28 p.m.
On Tue, 2013-09-17 at 08:32 -0500, Jason Wessel wrote:
> The SYSLINUX_SERIAL variable was hard coded and occasionally needs to
> be different for the kernel argument vs the syslinux argument.
> 
> In the auto-generated boot mode console=tty0 was hard coded, and this
> is not needed at all, and causes problems in some cases if a end user
> wanted to change the console=... via the kernel boot argument APPEND
> mechanism.  The default can be forced with SYSLINUX_DEFAULT_CONSOLE
> for systems that need a special specification to enable the frame
> buffer instead of a serial port.
> 
> [YOCTO #3944]
> 
> Signed-off-by: Jason Wessel <jason.wessel@windriver.com>

The two new variables need to be documented in the glossary, Scott R on
Cc.

One question below, not blocking this though.

Reviewed-by: Darren Hart <dvhart@linux.intel.com>

> ---
>  meta/classes/syslinux.bbclass |   14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/meta/classes/syslinux.bbclass b/meta/classes/syslinux.bbclass
> index 223e4dc..91b9731 100644
> --- a/meta/classes/syslinux.bbclass
> +++ b/meta/classes/syslinux.bbclass
> @@ -12,7 +12,9 @@
>  # ${APPEND} - an override list of append strings for each label
>  # ${SYSLINUX_OPTS} - additional options to add to the syslinux file ';' delimited
>  # ${SYSLINUX_SPLASH} - A background for the vga boot menu if using the boot menu
> +# ${SYSLINUX_DEFAULT_CONSOLE} - set to "console=ttyX" to change kernel boot default console
>  # ${SYSLINUX_SERIAL} - Set an alternate serial port or turn off serial with empty string
> +# ${SYSLINUX_SERIAL_TTY} - Set alternate console=tty... kernel boot argument
>  
>  do_bootimg[depends] += "syslinux:do_populate_sysroot \
>                          syslinux-native:do_populate_sysroot"
> @@ -21,7 +23,11 @@ SYSLINUXCFG  = "${S}/syslinux.cfg"
>  
>  ISOLINUXDIR = "/isolinux"
>  SYSLINUXDIR = "/"
> +# The kernel has an internal default console, which you can override with
> +# a console=...some_tty...
> +SYSLINUX_DEFAULT_CONSOLE ?= ""
>  SYSLINUX_SERIAL ?= "0 115200"
> +SYSLINUX_SERIAL_TTY ?= "ttyS0,115200"
>  ISO_BOOTIMG = "isolinux/isolinux.bin"
>  ISO_BOOTCAT = "isolinux/boot.cat"
>  MKISOFS_OPTIONS = "-no-emul-boot -boot-load-size 4 -boot-info-table"
> @@ -102,6 +108,8 @@ python build_syslinux_cfg () {
>              cfgfile.write('%s\n' % opt)
>  
>      cfgfile.write('ALLOWOPTIONS 1\n');
> +    syslinux_default_console = d.getVar('SYSLINUX_DEFAULT_CONSOLE', True)
> +    syslinux_serial_tty = d.getVar('SYSLINUX_SERIAL_TTY', True)
>      syslinux_serial = d.getVar('SYSLINUX_SERIAL', True)
>      if syslinux_serial:
>          cfgfile.write('SERIAL %s\n' % syslinux_serial)
> @@ -144,10 +152,10 @@ python build_syslinux_cfg () {
>          localdata.setVar('OVERRIDES', label + ':' + overrides)
>          bb.data.update_data(localdata)
>      
> -        btypes = [ [ "", "console=tty0" ] ]
> +        btypes = [ [ "", syslinux_default_console ] ]
>          if menu and syslinux_serial:
> -            btypes = [ [ "Graphics console ", " console=tty0" ],
> -                [ "Serial console ",  " console=ttyS0,115200" ] ]
> +            btypes = [ [ "Graphics console ", syslinux_default_console  ],
> +                [ "Serial console ", syslinux_serial_tty ] ]
>  
>          for btype in btypes:
>              cfgfile.write('LABEL %s%s\nKERNEL /vmlinuz\n' % (btype[0], label))

Is no space between the to string "%s%s" correct?

Patch

diff --git a/meta/classes/syslinux.bbclass b/meta/classes/syslinux.bbclass
index 223e4dc..91b9731 100644
--- a/meta/classes/syslinux.bbclass
+++ b/meta/classes/syslinux.bbclass
@@ -12,7 +12,9 @@ 
 # ${APPEND} - an override list of append strings for each label
 # ${SYSLINUX_OPTS} - additional options to add to the syslinux file ';' delimited
 # ${SYSLINUX_SPLASH} - A background for the vga boot menu if using the boot menu
+# ${SYSLINUX_DEFAULT_CONSOLE} - set to "console=ttyX" to change kernel boot default console
 # ${SYSLINUX_SERIAL} - Set an alternate serial port or turn off serial with empty string
+# ${SYSLINUX_SERIAL_TTY} - Set alternate console=tty... kernel boot argument
 
 do_bootimg[depends] += "syslinux:do_populate_sysroot \
                         syslinux-native:do_populate_sysroot"
@@ -21,7 +23,11 @@  SYSLINUXCFG  = "${S}/syslinux.cfg"
 
 ISOLINUXDIR = "/isolinux"
 SYSLINUXDIR = "/"
+# The kernel has an internal default console, which you can override with
+# a console=...some_tty...
+SYSLINUX_DEFAULT_CONSOLE ?= ""
 SYSLINUX_SERIAL ?= "0 115200"
+SYSLINUX_SERIAL_TTY ?= "ttyS0,115200"
 ISO_BOOTIMG = "isolinux/isolinux.bin"
 ISO_BOOTCAT = "isolinux/boot.cat"
 MKISOFS_OPTIONS = "-no-emul-boot -boot-load-size 4 -boot-info-table"
@@ -102,6 +108,8 @@  python build_syslinux_cfg () {
             cfgfile.write('%s\n' % opt)
 
     cfgfile.write('ALLOWOPTIONS 1\n');
+    syslinux_default_console = d.getVar('SYSLINUX_DEFAULT_CONSOLE', True)
+    syslinux_serial_tty = d.getVar('SYSLINUX_SERIAL_TTY', True)
     syslinux_serial = d.getVar('SYSLINUX_SERIAL', True)
     if syslinux_serial:
         cfgfile.write('SERIAL %s\n' % syslinux_serial)
@@ -144,10 +152,10 @@  python build_syslinux_cfg () {
         localdata.setVar('OVERRIDES', label + ':' + overrides)
         bb.data.update_data(localdata)
     
-        btypes = [ [ "", "console=tty0" ] ]
+        btypes = [ [ "", syslinux_default_console ] ]
         if menu and syslinux_serial:
-            btypes = [ [ "Graphics console ", " console=tty0" ],
-                [ "Serial console ",  " console=ttyS0,115200" ] ]
+            btypes = [ [ "Graphics console ", syslinux_default_console  ],
+                [ "Serial console ", syslinux_serial_tty ] ]
 
         for btype in btypes:
             cfgfile.write('LABEL %s%s\nKERNEL /vmlinuz\n' % (btype[0], label))