generic-poky/scripts/lib/wic/utils/syslinux.py
Adrian Freihofer 4255b32738 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>
2015-05-03 11:43:49 +01:00

59 lines
2.4 KiB
Python

# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; version 2 of the License
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc., 59
# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# AUTHOR
# Adrian Freihofer <adrian.freihofer (at] neratec.com>
import re
from wic import msger
def serial_console_form_kargs(kernel_args):
"""
Create SERIAL... line from kernel parameters
syslinux needs a line SERIAL port [baudrate [flowcontrol]]
in the syslinux.cfg file. The config line is generated based
on kernel boot parameters. The the parameters of the first
ttyS console are considered for syslinux config.
@param kernel_args kernel command line
@return line for syslinux config file e.g. "SERIAL 0 115200"
"""
syslinux_conf = ""
for param in kernel_args.split():
param_match = re.match("console=ttyS([0-9]+),?([0-9]*)([noe]?)([0-9]?)(r?)", param)
if param_match:
syslinux_conf += "SERIAL " + param_match.group(1)
# baudrate
if param_match.group(2):
syslinux_conf += " " + param_match.group(2)
# parity
if param_match.group(3) and param_match.group(3) != 'n':
msger.warning("syslinux does not support parity for console. {} is ignored."
.format(param_match.group(3)))
# number of bits
if param_match.group(4) and param_match.group(4) != '8':
msger.warning("syslinux supports 8 bit console configuration only. {} is ignored."
.format(param_match.group(4)))
# flow control
if param_match.group(5) and param_match.group(5) != '':
msger.warning("syslinux console flowcontrol configuration. {} is ignored."
.format(param_match.group(5)))
break
return syslinux_conf