summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2017-02-01 12:29:32 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-02-02 17:37:45 +0000
commitf1957bf59e538fb3762be31706671481c53ed6b6 (patch)
tree6786d9094231fec6a7f295e8b0c0269f0fcaf01d /scripts
parent653aaea3ccd4b671a6753bc9aecceb08f9eb0e41 (diff)
downloadpoky-f1957bf59e538fb3762be31706671481c53ed6b6.tar.gz
wic: remove syslinux.py
This module contains singe function serial_console_form_kargs, which is used only by rootfs_pcbios_ext plugin. Moved it there and removed syslinux module to make it easy to find and mainain plugin code. [YOCTO #10619] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py38
-rw-r--r--scripts/lib/wic/utils/syslinux.py58
2 files changed, 37 insertions, 59 deletions
diff --git a/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py b/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py
index 1032019a5f..bd6fd6cec7 100644
--- a/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py
+++ b/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py
@@ -19,13 +19,49 @@
19# 19#
20 20
21import os 21import os
22import re
23
22from wic import msger 24from wic import msger
23from wic.utils import syslinux
24from wic.utils import runner 25from wic.utils import runner
25from wic.utils.misc import get_bitbake_var, exec_cmd, exec_native_cmd 26from wic.utils.misc import get_bitbake_var, exec_cmd, exec_native_cmd
26from wic.utils.errors import ImageError 27from wic.utils.errors import ImageError
27from wic.pluginbase import SourcePlugin 28from wic.pluginbase import SourcePlugin
28 29
30def serial_console_form_kargs(kernel_args):
31 """
32 Create SERIAL... line from kernel parameters
33
34 syslinux needs a line SERIAL port [baudrate [flowcontrol]]
35 in the syslinux.cfg file. The config line is generated based
36 on kernel boot parameters. The the parameters of the first
37 ttyS console are considered for syslinux config.
38 @param kernel_args kernel command line
39 @return line for syslinux config file e.g. "SERIAL 0 115200"
40 """
41 syslinux_conf = ""
42 for param in kernel_args.split():
43 param_match = re.match("console=ttyS([0-9]+),?([0-9]*)([noe]?)([0-9]?)(r?)", param)
44 if param_match:
45 syslinux_conf += "SERIAL " + param_match.group(1)
46 # baudrate
47 if param_match.group(2):
48 syslinux_conf += " " + param_match.group(2)
49 # parity
50 if param_match.group(3) and param_match.group(3) != 'n':
51 msger.warning("syslinux does not support parity for console. {} is ignored."
52 .format(param_match.group(3)))
53 # number of bits
54 if param_match.group(4) and param_match.group(4) != '8':
55 msger.warning("syslinux supports 8 bit console configuration only. {} is ignored."
56 .format(param_match.group(4)))
57 # flow control
58 if param_match.group(5) and param_match.group(5) != '':
59 msger.warning("syslinux console flowcontrol configuration. {} is ignored."
60 .format(param_match.group(5)))
61 break
62
63 return syslinux_conf
64
29 65
30# pylint: disable=no-init 66# pylint: disable=no-init
31class RootfsPlugin(SourcePlugin): 67class RootfsPlugin(SourcePlugin):
diff --git a/scripts/lib/wic/utils/syslinux.py b/scripts/lib/wic/utils/syslinux.py
deleted file mode 100644
index aace2863c1..0000000000
--- a/scripts/lib/wic/utils/syslinux.py
+++ /dev/null
@@ -1,58 +0,0 @@
1# ex:ts=4:sw=4:sts=4:et
2# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
3#
4# This program is free software; you can redistribute it and/or modify it
5# under the terms of the GNU General Public License as published by the Free
6# Software Foundation; version 2 of the License
7#
8# This program is distributed in the hope that it will be useful, but
9# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11# for more details.
12#
13# You should have received a copy of the GNU General Public License along
14# with this program; if not, write to the Free Software Foundation, Inc., 59
15# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16#
17# AUTHOR
18# Adrian Freihofer <adrian.freihofer (at] neratec.com>
19
20
21import re
22from wic import msger
23
24
25def serial_console_form_kargs(kernel_args):
26 """
27 Create SERIAL... line from kernel parameters
28
29 syslinux needs a line SERIAL port [baudrate [flowcontrol]]
30 in the syslinux.cfg file. The config line is generated based
31 on kernel boot parameters. The the parameters of the first
32 ttyS console are considered for syslinux config.
33 @param kernel_args kernel command line
34 @return line for syslinux config file e.g. "SERIAL 0 115200"
35 """
36 syslinux_conf = ""
37 for param in kernel_args.split():
38 param_match = re.match("console=ttyS([0-9]+),?([0-9]*)([noe]?)([0-9]?)(r?)", param)
39 if param_match:
40 syslinux_conf += "SERIAL " + param_match.group(1)
41 # baudrate
42 if param_match.group(2):
43 syslinux_conf += " " + param_match.group(2)
44 # parity
45 if param_match.group(3) and param_match.group(3) != 'n':
46 msger.warning("syslinux does not support parity for console. {} is ignored."
47 .format(param_match.group(3)))
48 # number of bits
49 if param_match.group(4) and param_match.group(4) != '8':
50 msger.warning("syslinux supports 8 bit console configuration only. {} is ignored."
51 .format(param_match.group(4)))
52 # flow control
53 if param_match.group(5) and param_match.group(5) != '':
54 msger.warning("syslinux console flowcontrol configuration. {} is ignored."
55 .format(param_match.group(5)))
56 break
57
58 return syslinux_conf