diff options
| author | Robert Yang <liezhi.yang@windriver.com> | 2016-02-24 01:23:58 -0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-03-02 23:08:51 +0000 |
| commit | bb1c719250cecc8725147cbdd999a9a44a11b549 (patch) | |
| tree | 87c69fe8fe2c254d87dbf09b47fba74b9c8a8928 | |
| parent | 5c5c13d77783e96b9acbbe460bf7060722f436cb (diff) | |
| download | poky-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>
| -rw-r--r-- | meta/classes/boot-directdisk.bbclass | 8 | ||||
| -rw-r--r-- | meta/classes/bootimg.bbclass | 1 | ||||
| -rw-r--r-- | meta/classes/image-live.bbclass | 16 | ||||
| -rw-r--r-- | meta/classes/image-vm.bbclass | 15 | ||||
| -rw-r--r-- | meta/classes/syslinux.bbclass | 23 |
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): | |||
| 53 | PCBIOS = "${@pcbios(d)}" | 53 | PCBIOS = "${@pcbios(d)}" |
| 54 | PCBIOS_CLASS = "${@pcbios_class(d)}" | 54 | PCBIOS_CLASS = "${@pcbios_class(d)}" |
| 55 | 55 | ||
| 56 | # Get the build_syslinux_cfg() function from the syslinux class | ||
| 56 | inherit ${PCBIOS_CLASS} | 57 | inherit ${PCBIOS_CLASS} |
| 57 | inherit ${EFI_CLASS} | 58 | inherit ${EFI_CLASS} |
| 58 | 59 | ||
| 59 | # Get the build_syslinux_cfg() function from the syslinux class | ||
| 60 | |||
| 61 | DISK_SIGNATURE ?= "${DISK_SIGNATURE_GENERATED}" | 60 | DISK_SIGNATURE ?= "${DISK_SIGNATURE_GENERATED}" |
| 62 | SYSLINUX_ROOT ?= "root=/dev/sda2" | 61 | SYSLINUX_ROOT_VM ?= "root=/dev/sda2" |
| 63 | SYSLINUX_TIMEOUT ?= "10" | 62 | SYSLINUX_CFG_VM ?= "${S}/syslinux_hdd.cfg" |
| 64 | 63 | ||
| 65 | boot_direct_populate() { | 64 | boot_direct_populate() { |
| 66 | dest=$1 | 65 | dest=$1 |
| @@ -162,6 +161,7 @@ build_boot_dd() { | |||
| 162 | python do_bootdirectdisk() { | 161 | python 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 | ||
| 282 | python do_bootimg() { | 282 | python 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 | ||
| 2 | INITRD_IMAGE ?= "core-image-minimal-initramfs" | 2 | INITRD_IMAGE_LIVE ?= "core-image-minimal-initramfs" |
| 3 | INITRD ?= "${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE}-${MACHINE}.cpio.gz" | 3 | INITRD_LIVE ?= "${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE_LIVE}-${MACHINE}.cpio.gz" |
| 4 | SYSLINUX_ROOT ?= "root=/dev/ram0" | 4 | SYSLINUX_ROOT_LIVE ?= "root=/dev/ram0" |
| 5 | SYSLINUX_TIMEOUT ?= "50" | 5 | SYSLINUX_LABELS_LIVE ?= "boot install" |
| 6 | SYSLINUX_LABELS ?= "boot install" | 6 | LABELS_LIVE ?= "${SYSLINUX_LABELS_LIVE}" |
| 7 | LABELS_append = " ${SYSLINUX_LABELS} " | 7 | SYSLINUX_CFG_LIVE ?= "${S}/syslinux_live.cfg" |
| 8 | 8 | ||
| 9 | ROOTFS ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.ext4" | 9 | ROOTFS ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.ext4" |
| 10 | 10 | ||
| @@ -19,9 +19,9 @@ IMAGE_TYPES_MASKED += "live hddimg iso" | |||
| 19 | 19 | ||
| 20 | python() { | 20 | python() { |
| 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 | ||
| 2 | SYSLINUX_PROMPT ?= "0" | 2 | SYSLINUX_LABELS_VM ?= "boot" |
| 3 | SYSLINUX_LABELS = "boot" | 3 | LABELS_VM ?= "${SYSLINUX_LABELS_VM}" |
| 4 | LABELS_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. |
| 7 | INITRD_IMAGE ?= "" | 6 | INITRD_IMAGE_VM ?= "" |
| 8 | INITRD ?= "${@'${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE}-${MACHINE}.cpio.gz' if '${INITRD_IMAGE}' else ''}" | 7 | INITRD_VM ?= "${@'${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE_VM}-${MACHINE}.cpio.gz' if '${INITRD_IMAGE_VM}' else ''}" |
| 9 | do_bootdirectdisk[depends] += "${@'${INITRD_IMAGE}:do_image_complete' if '${INITRD_IMAGE}' else ''}" | 8 | do_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 |
| 12 | do_bootdirectdisk[depends] += "${PN}:do_image_ext4" | 11 | do_bootdirectdisk[depends] += "${PN}:do_image_ext4" |
| 13 | ROOTFS ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.ext4" | 12 | ROOTFS ?= "${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. |
| 16 | inherit boot-directdisk | 15 | inherit boot-directdisk |
| 17 | 16 | ||
| 18 | IMAGE_TYPEDEP_vmdk = "ext4" | 17 | IMAGE_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 @@ | |||
| 20 | do_bootimg[depends] += "${MLPREFIX}syslinux:do_populate_sysroot \ | 20 | do_bootimg[depends] += "${MLPREFIX}syslinux:do_populate_sysroot \ |
| 21 | syslinux-native:do_populate_sysroot" | 21 | syslinux-native:do_populate_sysroot" |
| 22 | 22 | ||
| 23 | SYSLINUXCFG = "${S}/syslinux.cfg" | ||
| 24 | |||
| 25 | ISOLINUXDIR = "/isolinux" | 23 | ISOLINUXDIR = "/isolinux" |
| 26 | SYSLINUXDIR = "/" | 24 | SYSLINUXDIR = "/" |
| 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 = "/" | |||
| 29 | SYSLINUX_DEFAULT_CONSOLE ?= "" | 27 | SYSLINUX_DEFAULT_CONSOLE ?= "" |
| 30 | SYSLINUX_SERIAL ?= "0 115200" | 28 | SYSLINUX_SERIAL ?= "0 115200" |
| 31 | SYSLINUX_SERIAL_TTY ?= "console=ttyS0,115200" | 29 | SYSLINUX_SERIAL_TTY ?= "console=ttyS0,115200" |
| 30 | SYSLINUX_PROMPT ?= "0" | ||
| 31 | SYSLINUX_TIMEOUT ?= "50" | ||
| 32 | AUTO_SYSLINUXMENU ?= "1" | ||
| 32 | ISO_BOOTIMG = "isolinux/isolinux.bin" | 33 | ISO_BOOTIMG = "isolinux/isolinux.bin" |
| 33 | ISO_BOOTCAT = "isolinux/boot.cat" | 34 | ISO_BOOTCAT = "isolinux/boot.cat" |
| 34 | MKISOFS_OPTIONS = "-no-emul-boot -boot-load-size 4 -boot-info-table" | 35 | MKISOFS_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. |
| 38 | inherit fs-uuid | 39 | inherit 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. | ||
| 43 | def 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 | |||
| 40 | syslinux_populate() { | 53 | syslinux_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') |
