Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH V3 0/3] use single variable to set baud rate
@ 2014-12-10  5:43 Chong Lu
  2014-12-10  5:43 ` [PATCH V3 1/3] console.bbclass: add class which can be used to set serial console and " Chong Lu
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Chong Lu @ 2014-12-10  5:43 UTC (permalink / raw)
  To: openembedded-core

Change since V2:
don't change SERIAL_CONSOLE default value and add console.bbclass to get
port, tty and baud rate from SERIAL_CONSOLE.

The following changes since commit ec6377bcf52d105cd23ac6bbbeddd38fee9337e4:

  bitbake: bitbake-user-manual-metadata.xml: Updated do_package_write example (2014-12-09 22:25:36 +0000)

are available in the git repository at:

  git://git.pokylinux.org/poky-contrib chonglu/baudrate
  http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=chonglu/baudrate

Chong Lu (3):
  console.bbclass: add class which can be used to set serial console and
    baud rate
  syslinux.bbclass: use single variable to set baud rate
  grub-efi.bbclass: use single variable to set baud rate

 meta/classes/console.bbclass  | 23 +++++++++++++++++++++++
 meta/classes/grub-efi.bbclass |  5 +++--
 meta/classes/syslinux.bbclass |  5 +++--
 3 files changed, 29 insertions(+), 4 deletions(-)
 create mode 100644 meta/classes/console.bbclass

-- 
1.9.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH V3 1/3] console.bbclass: add class which can be used to set serial console and baud rate
  2014-12-10  5:43 [PATCH V3 0/3] use single variable to set baud rate Chong Lu
@ 2014-12-10  5:43 ` Chong Lu
  2014-12-10  5:43 ` [PATCH V3 2/3] syslinux.bbclass: use single variable to set " Chong Lu
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Chong Lu @ 2014-12-10  5:43 UTC (permalink / raw)
  To: openembedded-core

Use a single method set serial console and baud rate by SERIAL_CONSOLE variable.
Defind three function, we can get port, tty and baud rate of the console. they can
be used by syslinux, grub, qemu and so on.

[YOCTO #6331]

Signed-off-by: Chong Lu <Chong.Lu@windriver.com>
---
 meta/classes/console.bbclass | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 meta/classes/console.bbclass

diff --git a/meta/classes/console.bbclass b/meta/classes/console.bbclass
new file mode 100644
index 0000000..b01ffef
--- /dev/null
+++ b/meta/classes/console.bbclass
@@ -0,0 +1,23 @@
+def console_tty(d):
+    serial_console = d.getVar('SERIAL_CONSOLE', True).split()
+    if serial_console:
+        tty = d.getVar('SERIAL_CONSOLE', True).split()[1]
+    else:
+        tty = "ttyS0"
+    return tty
+
+def console_baudrate(d):
+    serial_console = d.getVar('SERIAL_CONSOLE', True).split()
+    if serial_console:
+        baudrate = d.getVar('SERIAL_CONSOLE', True).split()[0]
+    else:
+        baudrate = "115200"
+    return baudrate
+
+def console_port(d):
+    serial_console = d.getVar('SERIAL_CONSOLE', True).split()
+    if serial_console:
+        port = filter(str.isdigit, d.getVar('SERIAL_CONSOLE', True).split()[1])
+    else:
+        port = "0"
+    return port
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH V3 2/3] syslinux.bbclass: use single variable to set baud rate
  2014-12-10  5:43 [PATCH V3 0/3] use single variable to set baud rate Chong Lu
  2014-12-10  5:43 ` [PATCH V3 1/3] console.bbclass: add class which can be used to set serial console and " Chong Lu
@ 2014-12-10  5:43 ` Chong Lu
  2014-12-10  5:43 ` [PATCH V3 3/3] grub-efi.bbclass: " Chong Lu
  2014-12-19  8:17 ` [PATCH V3 0/3] " Chong Lu
  3 siblings, 0 replies; 5+ messages in thread
From: Chong Lu @ 2014-12-10  5:43 UTC (permalink / raw)
  To: openembedded-core

Use SERIAL_CONSOLE to set baud rate in syslinux.cfg file.

[YOCTO #6331]

Signed-off-by: Chong Lu <Chong.Lu@windriver.com>
---
 meta/classes/syslinux.bbclass | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/meta/classes/syslinux.bbclass b/meta/classes/syslinux.bbclass
index d6498d9..8629bb1 100644
--- a/meta/classes/syslinux.bbclass
+++ b/meta/classes/syslinux.bbclass
@@ -26,9 +26,10 @@ ISOLINUXDIR = "/isolinux"
 SYSLINUXDIR = "/"
 # The kernel has an internal default console, which you can override with
 # a console=...some_tty...
+inherit console
 SYSLINUX_DEFAULT_CONSOLE ?= ""
-SYSLINUX_SERIAL ?= "0 115200"
-SYSLINUX_SERIAL_TTY ?= "console=ttyS0,115200"
+SYSLINUX_SERIAL ?= "${@console_port(d)} ${@console_baudrate(d)}"
+SYSLINUX_SERIAL_TTY ?= "console=${@console_tty(d)},${@console_baudrate(d)}"
 ISO_BOOTIMG = "isolinux/isolinux.bin"
 ISO_BOOTCAT = "isolinux/boot.cat"
 MKISOFS_OPTIONS = "-no-emul-boot -boot-load-size 4 -boot-info-table"
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH V3 3/3] grub-efi.bbclass: use single variable to set baud rate
  2014-12-10  5:43 [PATCH V3 0/3] use single variable to set baud rate Chong Lu
  2014-12-10  5:43 ` [PATCH V3 1/3] console.bbclass: add class which can be used to set serial console and " Chong Lu
  2014-12-10  5:43 ` [PATCH V3 2/3] syslinux.bbclass: use single variable to set " Chong Lu
@ 2014-12-10  5:43 ` Chong Lu
  2014-12-19  8:17 ` [PATCH V3 0/3] " Chong Lu
  3 siblings, 0 replies; 5+ messages in thread
From: Chong Lu @ 2014-12-10  5:43 UTC (permalink / raw)
  To: openembedded-core

Use SERIAL_CONSOLE to set baud rate in grub.cfg file.

[YOCTO #6331]

Signed-off-by: Chong Lu <Chong.Lu@windriver.com>
---
 meta/classes/grub-efi.bbclass | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/meta/classes/grub-efi.bbclass b/meta/classes/grub-efi.bbclass
index 47bd35e..18ae261 100644
--- a/meta/classes/grub-efi.bbclass
+++ b/meta/classes/grub-efi.bbclass
@@ -18,11 +18,12 @@
 do_bootimg[depends] += "${MLPREFIX}grub-efi:do_deploy"
 do_bootdirectdisk[depends] += "${MLPREFIX}grub-efi:do_deploy"
 
-GRUB_SERIAL ?= "console=ttyS0,115200"
+inherit console
+GRUB_SERIAL ?= "console=${@console_tty(d)},${@console_baudrate(d)}"
 GRUBCFG = "${S}/grub.cfg"
 GRUB_TIMEOUT ?= "10"
 #FIXME: build this from the machine config
-GRUB_OPTS ?= "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1"
+GRUB_OPTS ?= "serial --unit=${@console_port(d)} --speed=${@console_baudrate(d)} --word=8 --parity=no --stop=1"
 
 EFIDIR = "/EFI/BOOT"
 
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH V3 0/3] use single variable to set baud rate
  2014-12-10  5:43 [PATCH V3 0/3] use single variable to set baud rate Chong Lu
                   ` (2 preceding siblings ...)
  2014-12-10  5:43 ` [PATCH V3 3/3] grub-efi.bbclass: " Chong Lu
@ 2014-12-19  8:17 ` Chong Lu
  3 siblings, 0 replies; 5+ messages in thread
From: Chong Lu @ 2014-12-19  8:17 UTC (permalink / raw)
  To: openembedded-core

ping

On 12/10/2014 01:43 PM, Chong Lu wrote:
> Change since V2:
> don't change SERIAL_CONSOLE default value and add console.bbclass to get
> port, tty and baud rate from SERIAL_CONSOLE.
>
> The following changes since commit ec6377bcf52d105cd23ac6bbbeddd38fee9337e4:
>
>    bitbake: bitbake-user-manual-metadata.xml: Updated do_package_write example (2014-12-09 22:25:36 +0000)
>
> are available in the git repository at:
>
>    git://git.pokylinux.org/poky-contrib chonglu/baudrate
>    http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=chonglu/baudrate
>
> Chong Lu (3):
>    console.bbclass: add class which can be used to set serial console and
>      baud rate
>    syslinux.bbclass: use single variable to set baud rate
>    grub-efi.bbclass: use single variable to set baud rate
>
>   meta/classes/console.bbclass  | 23 +++++++++++++++++++++++
>   meta/classes/grub-efi.bbclass |  5 +++--
>   meta/classes/syslinux.bbclass |  5 +++--
>   3 files changed, 29 insertions(+), 4 deletions(-)
>   create mode 100644 meta/classes/console.bbclass
>



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-12-19  8:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-10  5:43 [PATCH V3 0/3] use single variable to set baud rate Chong Lu
2014-12-10  5:43 ` [PATCH V3 1/3] console.bbclass: add class which can be used to set serial console and " Chong Lu
2014-12-10  5:43 ` [PATCH V3 2/3] syslinux.bbclass: use single variable to set " Chong Lu
2014-12-10  5:43 ` [PATCH V3 3/3] grub-efi.bbclass: " Chong Lu
2014-12-19  8:17 ` [PATCH V3 0/3] " Chong Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox