summaryrefslogtreecommitdiffstats
path: root/meta/classes/live-vm-common.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/live-vm-common.bbclass')
-rw-r--r--meta/classes/live-vm-common.bbclass50
1 files changed, 43 insertions, 7 deletions
diff --git a/meta/classes/live-vm-common.bbclass b/meta/classes/live-vm-common.bbclass
index c751385e7d..74e7074a53 100644
--- a/meta/classes/live-vm-common.bbclass
+++ b/meta/classes/live-vm-common.bbclass
@@ -4,17 +4,19 @@ def set_live_vm_vars(d, suffix):
vars = ['GRUB_CFG', 'SYSLINUX_CFG', 'ROOT', 'LABELS', 'INITRD']
for var in vars:
var_with_suffix = var + '_' + suffix
- if d.getVar(var, True):
+ if d.getVar(var):
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))
+ elif d.getVar(var_with_suffix):
+ d.setVar(var, d.getVar(var_with_suffix))
EFI = "${@bb.utils.contains("MACHINE_FEATURES", "efi", "1", "0", d)}"
EFI_PROVIDER ?= "grub-efi"
EFI_CLASS = "${@bb.utils.contains("MACHINE_FEATURES", "efi", "${EFI_PROVIDER}", "", d)}"
+MKDOSFS_EXTRAOPTS ??= "-S 512"
+
# Include legacy boot if MACHINE_FEATURES includes "pcbios" or if it does not
# contain "efi". This way legacy is supported by default if neither is
# specified, maintaining the original behavior.
@@ -25,20 +27,54 @@ def pcbios(d):
return pcbios
PCBIOS = "${@pcbios(d)}"
-PCBIOS_CLASS = "${@['','syslinux'][d.getVar('PCBIOS', True) == '1']}"
+PCBIOS_CLASS = "${@['','syslinux'][d.getVar('PCBIOS') == '1']}"
+
+# efi_populate_common DEST BOOTLOADER
+efi_populate_common() {
+ # DEST must be the root of the image so that EFIDIR is not
+ # nested under a top level directory.
+ DEST=$1
+
+ install -d ${DEST}${EFIDIR}
+
+ install -m 0644 ${DEPLOY_DIR_IMAGE}/$2-${EFI_BOOT_IMAGE} ${DEST}${EFIDIR}/${EFI_BOOT_IMAGE}
+ EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
+ printf 'fs0:%s\%s\n' "$EFIPATH" "${EFI_BOOT_IMAGE}" >${DEST}/startup.nsh
+}
+
+efi_iso_populate() {
+ iso_dir=$1
+ efi_populate $iso_dir
+ # Build a EFI directory to create efi.img
+ mkdir -p ${EFIIMGDIR}/${EFIDIR}
+ cp $iso_dir/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR}
+ cp $iso_dir/${KERNEL_IMAGETYPE} ${EFIIMGDIR}
+
+ EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
+ printf 'fs0:%s\%s\n' "$EFIPATH" "${EFI_BOOT_IMAGE}" >${EFIIMGDIR}/startup.nsh
+
+ if [ -f "$iso_dir/initrd" ] ; then
+ cp $iso_dir/initrd ${EFIIMGDIR}
+ fi
+}
+
+efi_hddimg_populate() {
+ efi_populate $1
+}
inherit ${EFI_CLASS}
inherit ${PCBIOS_CLASS}
-KERNEL_IMAGETYPE ??= "bzImage"
-
populate_kernel() {
dest=$1
install -d $dest
# Install bzImage, initrd, and rootfs.img in DEST for all loaders to use.
+ bbnote "Trying to install ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} as $dest/${KERNEL_IMAGETYPE}"
if [ -e ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} ]; then
- install -m 0644 ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} $dest/vmlinuz
+ install -m 0644 ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} $dest/${KERNEL_IMAGETYPE}
+ else
+ bbwarn "${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} doesn't exist"
fi
# initrd is made of concatenation of multiple filesystem images