syslinux.bbclass: make vm and live can be built together

* The vm image(hdddirect, vmdk, qcow2, vdi) and live image (hddimg, iso)
  couldn't be built together because the following vars settings are
  conflicted:
  - SYSLINUX_ROOT (/dev/sda2 vs /dev/ram0)
  - LABELS (boot vs boot install)
  - INITRD (None vs live install)
  - SYSLINUX_CFG (see above)
  Introduce new vars (SYSLINUX_ROOT_VM/_LIVE, the samilar to others) to
  make them can work together, now we can build all of them together:

  IMAGE_FSTYPES += "live iso hddimg hdddirect vmdk qcow2 vdi"

* Use SYSLINUX_CFG rather than SYSLINUXCFG to keep align with others
  SYSLINUX vars.

* The SYSLINUX_TIMEOUT had been set, but it didn't work since
  AUTO_SYSLINUXMENU wasn't set, this would cause confusions, so also set
  AUTO_SYSLINUXMENU.

* Move SYSLINUX_PROMPT and SYSLINUX_TIMEOUT to syslinux.bbclass rather
  than in separate classes since they are the same.

* Set SYSLINUX_TIMEOUT to 50 to have a unique timeout for syslinux.

[YOCTO #9161]

(From OE-Core rev: e38c94d6bf83ed3ca7f046d9503e81b927487bf2)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Robert Yang
2016-02-24 01:23:58 -08:00
committed by Richard Purdie
parent 5c5c13d777
commit bb1c719250
5 changed files with 38 additions and 25 deletions

View File

@@ -20,8 +20,6 @@
do_bootimg[depends] += "${MLPREFIX}syslinux:do_populate_sysroot \
syslinux-native:do_populate_sysroot"
SYSLINUXCFG = "${S}/syslinux.cfg"
ISOLINUXDIR = "/isolinux"
SYSLINUXDIR = "/"
# The kernel has an internal default console, which you can override with
@@ -29,6 +27,9 @@ SYSLINUXDIR = "/"
SYSLINUX_DEFAULT_CONSOLE ?= ""
SYSLINUX_SERIAL ?= "0 115200"
SYSLINUX_SERIAL_TTY ?= "console=ttyS0,115200"
SYSLINUX_PROMPT ?= "0"
SYSLINUX_TIMEOUT ?= "50"
AUTO_SYSLINUXMENU ?= "1"
ISO_BOOTIMG = "isolinux/isolinux.bin"
ISO_BOOTCAT = "isolinux/boot.cat"
MKISOFS_OPTIONS = "-no-emul-boot -boot-load-size 4 -boot-info-table"
@@ -37,6 +38,18 @@ APPEND_prepend = " ${SYSLINUX_ROOT} "
# Need UUID utility code.
inherit fs-uuid
# Some of the vars for vm and live image are conflicted, this function
# is used for fixing the problem.
def syslinux_set_vars(d, suffix):
vars = ['SYSLINUX_ROOT', 'SYSLINUX_CFG', 'LABELS', 'INITRD']
for var in vars:
var_with_suffix = var + '_' + suffix
if d.getVar(var, True):
bb.warn('Found potential conflicted var %s, please use %s rather than %s' % \
(var, var_with_suffix, var))
elif d.getVar(var_with_suffix, True):
d.setVar(var, d.getVar(var_with_suffix, True))
syslinux_populate() {
DEST=$1
BOOTDIR=$2
@@ -45,7 +58,7 @@ syslinux_populate() {
install -d ${DEST}${BOOTDIR}
# Install the config files
install -m 0644 ${SYSLINUXCFG} ${DEST}${BOOTDIR}/${CFGNAME}
install -m 0644 ${SYSLINUX_CFG} ${DEST}${BOOTDIR}/${CFGNAME}
if [ "${AUTO_SYSLINUXMENU}" = 1 ] ; then
install -m 0644 ${STAGING_DATADIR}/syslinux/vesamenu.c32 ${DEST}${BOOTDIR}/vesamenu.c32
install -m 0444 ${STAGING_DATADIR}/syslinux/libcom32.c32 ${DEST}${BOOTDIR}/libcom32.c32
@@ -96,9 +109,9 @@ python build_syslinux_cfg () {
bb.debug(1, "No labels, nothing to do")
return
cfile = d.getVar('SYSLINUXCFG', True)
cfile = d.getVar('SYSLINUX_CFG', True)
if not cfile:
raise bb.build.FuncFailed('Unable to read SYSLINUXCFG')
raise bb.build.FuncFailed('Unable to read SYSLINUX_CFG')
try:
cfgfile = file(cfile, 'w')