summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/utils/syslinux.py
diff options
context:
space:
mode:
authorAdrian Freihofer <adrian.freihofer@gmail.com>2015-04-27 15:00:23 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-05-03 11:43:49 +0100
commit4255b32738b6b3c01603ad19899c5e453da38ddb (patch)
treee5dded0079ea760ef1adf04e8ff200b51264b2b2 /scripts/lib/wic/utils/syslinux.py
parentfd254d007f0986b3e14ef2e2d23a1666271e0e04 (diff)
downloadpoky-4255b32738b6b3c01603ad19899c5e453da38ddb.tar.gz
wic: Add plugin for single partition disk
The wic plugin creates a disk image containig one ext2/3/4 partition. No additional boot partition is required. Syslinux is installed into the image. The target device is a legacy BIOS PC. Purpose of this plugin: Other avaliable plugins create a fat partition for /boot and an ext partition for rootfs. Current linux-yocto kernel packages are not compatible with this disk layout. The boot partition is not mounted by default, hence the kernel is installed into rootfs and not into boot partition. A kernel update ends up in a bricked device. The old kernel which is still in boot likely does not even boot with updated kernel modules from /. Even if the boot partition is mounted during the kernel update the update will fail. The kernel package installs a symbolic link which is not supported by the fat partition. Creating just one ext partition for boot and rootfs solves all issues related to package based kernel updates on the device. The plugin depends on syslinux-nomtools a user space installer for syslinux on ext filesystems. Thanks to Robert Yang who implemented syslinux-nomtools and supported the implementation of this plugin. (From OE-Core rev: 4a7bd79b5100a496c9b1597b57d6dc18ba2b9c83) Signed-off-by: Adrian Freihofer <adrian.freihofer@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic/utils/syslinux.py')
-rw-r--r--scripts/lib/wic/utils/syslinux.py58
1 files changed, 58 insertions, 0 deletions
diff --git a/scripts/lib/wic/utils/syslinux.py b/scripts/lib/wic/utils/syslinux.py
new file mode 100644
index 0000000000..aace2863c1
--- /dev/null
+++ b/scripts/lib/wic/utils/syslinux.py
@@ -0,0 +1,58 @@
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