From bb1c719250cecc8725147cbdd999a9a44a11b549 Mon Sep 17 00:00:00 2001 From: Robert Yang Date: Wed, 24 Feb 2016 01:23:58 -0800 Subject: 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 Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- meta/classes/syslinux.bbclass | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'meta/classes/syslinux.bbclass') diff --git a/meta/classes/syslinux.bbclass b/meta/classes/syslinux.bbclass index 44ef9a9176..1b644b2561 100644 --- a/meta/classes/syslinux.bbclass +++ b/meta/classes/syslinux.bbclass @@ -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') -- cgit v1.2.3-54-g00ecf