summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2016-02-24 01:23:58 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-03-02 23:08:51 +0000
commitbb1c719250cecc8725147cbdd999a9a44a11b549 (patch)
tree87c69fe8fe2c254d87dbf09b47fba74b9c8a8928 /meta
parent5c5c13d77783e96b9acbbe460bf7060722f436cb (diff)
downloadpoky-bb1c719250cecc8725147cbdd999a9a44a11b549.tar.gz
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>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/boot-directdisk.bbclass8
-rw-r--r--meta/classes/bootimg.bbclass1
-rw-r--r--meta/classes/image-live.bbclass16
-rw-r--r--meta/classes/image-vm.bbclass15
-rw-r--r--meta/classes/syslinux.bbclass23
5 files changed, 38 insertions, 25 deletions
diff --git a/meta/classes/boot-directdisk.bbclass b/meta/classes/boot-directdisk.bbclass
index 89007e315b..fcdef26fd8 100644
--- a/meta/classes/boot-directdisk.bbclass
+++ b/meta/classes/boot-directdisk.bbclass
@@ -53,14 +53,13 @@ def pcbios_class(d):
53PCBIOS = "${@pcbios(d)}" 53PCBIOS = "${@pcbios(d)}"
54PCBIOS_CLASS = "${@pcbios_class(d)}" 54PCBIOS_CLASS = "${@pcbios_class(d)}"
55 55
56# Get the build_syslinux_cfg() function from the syslinux class
56inherit ${PCBIOS_CLASS} 57inherit ${PCBIOS_CLASS}
57inherit ${EFI_CLASS} 58inherit ${EFI_CLASS}
58 59
59# Get the build_syslinux_cfg() function from the syslinux class
60
61DISK_SIGNATURE ?= "${DISK_SIGNATURE_GENERATED}" 60DISK_SIGNATURE ?= "${DISK_SIGNATURE_GENERATED}"
62SYSLINUX_ROOT ?= "root=/dev/sda2" 61SYSLINUX_ROOT_VM ?= "root=/dev/sda2"
63SYSLINUX_TIMEOUT ?= "10" 62SYSLINUX_CFG_VM ?= "${S}/syslinux_hdd.cfg"
64 63
65boot_direct_populate() { 64boot_direct_populate() {
66 dest=$1 65 dest=$1
@@ -162,6 +161,7 @@ build_boot_dd() {
162python do_bootdirectdisk() { 161python do_bootdirectdisk() {
163 validate_disk_signature(d) 162 validate_disk_signature(d)
164 if d.getVar("PCBIOS", True) == "1": 163 if d.getVar("PCBIOS", True) == "1":
164 syslinux_set_vars(d, 'VM')
165 bb.build.exec_func('build_syslinux_cfg', d) 165 bb.build.exec_func('build_syslinux_cfg', d)
166 if d.getVar("EFI", True) == "1": 166 if d.getVar("EFI", True) == "1":
167 bb.build.exec_func('build_efi_cfg', d) 167 bb.build.exec_func('build_efi_cfg', d)
diff --git a/meta/classes/bootimg.bbclass b/meta/classes/bootimg.bbclass
index b174266131..7946839ce0 100644
--- a/meta/classes/bootimg.bbclass
+++ b/meta/classes/bootimg.bbclass
@@ -281,6 +281,7 @@ build_hddimg() {
281 281
282python do_bootimg() { 282python do_bootimg() {
283 if d.getVar("PCBIOS", True) == "1": 283 if d.getVar("PCBIOS", True) == "1":
284 syslinux_set_vars(d, 'LIVE')
284 bb.build.exec_func('build_syslinux_cfg', d) 285 bb.build.exec_func('build_syslinux_cfg', d)
285 if d.getVar("EFI", True) == "1": 286 if d.getVar("EFI", True) == "1":
286 bb.build.exec_func('build_efi_cfg', d) 287 bb.build.exec_func('build_efi_cfg', d)
diff --git a/meta/classes/image-live.bbclass b/meta/classes/image-live.bbclass
index badf40de54..b8f21cb7a5 100644
--- a/meta/classes/image-live.bbclass
+++ b/meta/classes/image-live.bbclass
@@ -1,10 +1,10 @@
1 1
2INITRD_IMAGE ?= "core-image-minimal-initramfs" 2INITRD_IMAGE_LIVE ?= "core-image-minimal-initramfs"
3INITRD ?= "${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE}-${MACHINE}.cpio.gz" 3INITRD_LIVE ?= "${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE_LIVE}-${MACHINE}.cpio.gz"
4SYSLINUX_ROOT ?= "root=/dev/ram0" 4SYSLINUX_ROOT_LIVE ?= "root=/dev/ram0"
5SYSLINUX_TIMEOUT ?= "50" 5SYSLINUX_LABELS_LIVE ?= "boot install"
6SYSLINUX_LABELS ?= "boot install" 6LABELS_LIVE ?= "${SYSLINUX_LABELS_LIVE}"
7LABELS_append = " ${SYSLINUX_LABELS} " 7SYSLINUX_CFG_LIVE ?= "${S}/syslinux_live.cfg"
8 8
9ROOTFS ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.ext4" 9ROOTFS ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.ext4"
10 10
@@ -19,9 +19,9 @@ IMAGE_TYPES_MASKED += "live hddimg iso"
19 19
20python() { 20python() {
21 image_b = d.getVar('IMAGE_BASENAME', True) 21 image_b = d.getVar('IMAGE_BASENAME', True)
22 initrd_i = d.getVar('INITRD_IMAGE', True) 22 initrd_i = d.getVar('INITRD_IMAGE_LIVE', True)
23 if image_b == initrd_i: 23 if image_b == initrd_i:
24 bb.error('INITRD_IMAGE %s cannot use image live, hddimg or iso.' % initrd_i) 24 bb.error('INITRD_IMAGE_LIVE %s cannot use image live, hddimg or iso.' % initrd_i)
25 bb.fatal('Check IMAGE_FSTYPES and INITRAMFS_FSTYPES settings.') 25 bb.fatal('Check IMAGE_FSTYPES and INITRAMFS_FSTYPES settings.')
26 else: 26 else:
27 d.appendVarFlag('do_bootimg', 'depends', ' %s:do_image_complete' % initrd_i) 27 d.appendVarFlag('do_bootimg', 'depends', ' %s:do_image_complete' % initrd_i)
diff --git a/meta/classes/image-vm.bbclass b/meta/classes/image-vm.bbclass
index 6f3a55b263..17e87a5a87 100644
--- a/meta/classes/image-vm.bbclass
+++ b/meta/classes/image-vm.bbclass
@@ -1,18 +1,17 @@
1 1
2SYSLINUX_PROMPT ?= "0" 2SYSLINUX_LABELS_VM ?= "boot"
3SYSLINUX_LABELS = "boot" 3LABELS_VM ?= "${SYSLINUX_LABELS_VM}"
4LABELS_append = " ${SYSLINUX_LABELS} "
5 4
6# Using an initramfs is optional. Enable it by setting INITRD_IMAGE. 5# Using an initramfs is optional. Enable it by setting INITRD_IMAGE_VM.
7INITRD_IMAGE ?= "" 6INITRD_IMAGE_VM ?= ""
8INITRD ?= "${@'${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE}-${MACHINE}.cpio.gz' if '${INITRD_IMAGE}' else ''}" 7INITRD_VM ?= "${@'${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE_VM}-${MACHINE}.cpio.gz' if '${INITRD_IMAGE_VM}' else ''}"
9do_bootdirectdisk[depends] += "${@'${INITRD_IMAGE}:do_image_complete' if '${INITRD_IMAGE}' else ''}" 8do_bootdirectdisk[depends] += "${@'${INITRD_IMAGE_VM}:do_image_complete' if '${INITRD_IMAGE_VM}' else ''}"
10 9
11# need to define the dependency and the ROOTFS for directdisk 10# need to define the dependency and the ROOTFS for directdisk
12do_bootdirectdisk[depends] += "${PN}:do_image_ext4" 11do_bootdirectdisk[depends] += "${PN}:do_image_ext4"
13ROOTFS ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.ext4" 12ROOTFS ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.ext4"
14 13
15# creating VM images relies on having a hddimg so ensure we inherit it here. 14# creating VM images relies on having a hdddirect so ensure we inherit it here.
16inherit boot-directdisk 15inherit boot-directdisk
17 16
18IMAGE_TYPEDEP_vmdk = "ext4" 17IMAGE_TYPEDEP_vmdk = "ext4"
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 @@
20do_bootimg[depends] += "${MLPREFIX}syslinux:do_populate_sysroot \ 20do_bootimg[depends] += "${MLPREFIX}syslinux:do_populate_sysroot \
21 syslinux-native:do_populate_sysroot" 21 syslinux-native:do_populate_sysroot"
22 22
23SYSLINUXCFG = "${S}/syslinux.cfg"
24
25ISOLINUXDIR = "/isolinux" 23ISOLINUXDIR = "/isolinux"
26SYSLINUXDIR = "/" 24SYSLINUXDIR = "/"
27# The kernel has an internal default console, which you can override with 25# The kernel has an internal default console, which you can override with
@@ -29,6 +27,9 @@ SYSLINUXDIR = "/"
29SYSLINUX_DEFAULT_CONSOLE ?= "" 27SYSLINUX_DEFAULT_CONSOLE ?= ""
30SYSLINUX_SERIAL ?= "0 115200" 28SYSLINUX_SERIAL ?= "0 115200"
31SYSLINUX_SERIAL_TTY ?= "console=ttyS0,115200" 29SYSLINUX_SERIAL_TTY ?= "console=ttyS0,115200"
30SYSLINUX_PROMPT ?= "0"
31SYSLINUX_TIMEOUT ?= "50"
32AUTO_SYSLINUXMENU ?= "1"
32ISO_BOOTIMG = "isolinux/isolinux.bin" 33ISO_BOOTIMG = "isolinux/isolinux.bin"
33ISO_BOOTCAT = "isolinux/boot.cat" 34ISO_BOOTCAT = "isolinux/boot.cat"
34MKISOFS_OPTIONS = "-no-emul-boot -boot-load-size 4 -boot-info-table" 35MKISOFS_OPTIONS = "-no-emul-boot -boot-load-size 4 -boot-info-table"
@@ -37,6 +38,18 @@ APPEND_prepend = " ${SYSLINUX_ROOT} "
37# Need UUID utility code. 38# Need UUID utility code.
38inherit fs-uuid 39inherit fs-uuid
39 40
41# Some of the vars for vm and live image are conflicted, this function
42# is used for fixing the problem.
43def syslinux_set_vars(d, suffix):
44 vars = ['SYSLINUX_ROOT', 'SYSLINUX_CFG', 'LABELS', 'INITRD']
45 for var in vars:
46 var_with_suffix = var + '_' + suffix
47 if d.getVar(var, True):
48 bb.warn('Found potential conflicted var %s, please use %s rather than %s' % \
49 (var, var_with_suffix, var))
50 elif d.getVar(var_with_suffix, True):
51 d.setVar(var, d.getVar(var_with_suffix, True))
52
40syslinux_populate() { 53syslinux_populate() {
41 DEST=$1 54 DEST=$1
42 BOOTDIR=$2 55 BOOTDIR=$2
@@ -45,7 +58,7 @@ syslinux_populate() {
45 install -d ${DEST}${BOOTDIR} 58 install -d ${DEST}${BOOTDIR}
46 59
47 # Install the config files 60 # Install the config files
48 install -m 0644 ${SYSLINUXCFG} ${DEST}${BOOTDIR}/${CFGNAME} 61 install -m 0644 ${SYSLINUX_CFG} ${DEST}${BOOTDIR}/${CFGNAME}
49 if [ "${AUTO_SYSLINUXMENU}" = 1 ] ; then 62 if [ "${AUTO_SYSLINUXMENU}" = 1 ] ; then
50 install -m 0644 ${STAGING_DATADIR}/syslinux/vesamenu.c32 ${DEST}${BOOTDIR}/vesamenu.c32 63 install -m 0644 ${STAGING_DATADIR}/syslinux/vesamenu.c32 ${DEST}${BOOTDIR}/vesamenu.c32
51 install -m 0444 ${STAGING_DATADIR}/syslinux/libcom32.c32 ${DEST}${BOOTDIR}/libcom32.c32 64 install -m 0444 ${STAGING_DATADIR}/syslinux/libcom32.c32 ${DEST}${BOOTDIR}/libcom32.c32
@@ -96,9 +109,9 @@ python build_syslinux_cfg () {
96 bb.debug(1, "No labels, nothing to do") 109 bb.debug(1, "No labels, nothing to do")
97 return 110 return
98 111
99 cfile = d.getVar('SYSLINUXCFG', True) 112 cfile = d.getVar('SYSLINUX_CFG', True)
100 if not cfile: 113 if not cfile:
101 raise bb.build.FuncFailed('Unable to read SYSLINUXCFG') 114 raise bb.build.FuncFailed('Unable to read SYSLINUX_CFG')
102 115
103 try: 116 try:
104 cfgfile = file(cfile, 'w') 117 cfgfile = file(cfile, 'w')