diff options
Diffstat (limited to 'meta/classes/bootimg.bbclass')
-rw-r--r-- | meta/classes/bootimg.bbclass | 49 |
1 files changed, 40 insertions, 9 deletions
diff --git a/meta/classes/bootimg.bbclass b/meta/classes/bootimg.bbclass index ce95801bff..0d06351127 100644 --- a/meta/classes/bootimg.bbclass +++ b/meta/classes/bootimg.bbclass | |||
@@ -38,7 +38,24 @@ BOOTIMG_EXTRA_SPACE ?= "512" | |||
38 | EFI = ${@base_contains("MACHINE_FEATURES", "efi", "1", "0", d)} | 38 | EFI = ${@base_contains("MACHINE_FEATURES", "efi", "1", "0", d)} |
39 | EFI_CLASS = ${@base_contains("MACHINE_FEATURES", "efi", "grub-efi", "dummy", d)} | 39 | EFI_CLASS = ${@base_contains("MACHINE_FEATURES", "efi", "grub-efi", "dummy", d)} |
40 | 40 | ||
41 | inherit syslinux | 41 | # Include legacy boot if MACHINE_FEATURES includes "pcbios" or if it does not |
42 | # contain "efi". This way legacy is supported by default if neither is | ||
43 | # specified, maintaining the original behavior. | ||
44 | def pcbios(d): | ||
45 | pcbios = base_contains("MACHINE_FEATURES", "pcbios", "1", "0", d) | ||
46 | if pcbios == "0": | ||
47 | pcbios = base_contains("MACHINE_FEATURES", "efi", "0", "1", d) | ||
48 | return pcbios | ||
49 | |||
50 | def pcbios_class(d): | ||
51 | if d.getVar("PCBIOS", True) == "1": | ||
52 | return "syslinux" | ||
53 | return "dummy" | ||
54 | |||
55 | PCBIOS = ${@pcbios(d)} | ||
56 | PCBIOS_CLASS = ${@pcbios_class(d)} | ||
57 | |||
58 | inherit ${PCBIOS_CLASS} | ||
42 | inherit ${EFI_CLASS} | 59 | inherit ${EFI_CLASS} |
43 | 60 | ||
44 | 61 | ||
@@ -51,15 +68,24 @@ build_iso() { | |||
51 | 68 | ||
52 | install -d ${ISODIR} | 69 | install -d ${ISODIR} |
53 | 70 | ||
54 | syslinux_iso_populate | 71 | if [ "${PCBIOS}" = "1" ]; then |
72 | syslinux_iso_populate | ||
73 | fi | ||
55 | if [ "${EFI}" = "1" ]; then | 74 | if [ "${EFI}" = "1" ]; then |
56 | grubefi_iso_populate | 75 | grubefi_iso_populate |
57 | fi | 76 | fi |
58 | 77 | ||
59 | mkisofs -V ${BOOTIMG_VOLUME_ID} \ | 78 | if [ "${PCBIOS}" = "1" ]; then |
60 | -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso \ | 79 | mkisofs -V ${BOOTIMG_VOLUME_ID} \ |
61 | -b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} -r \ | 80 | -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso \ |
62 | ${MKISOFS_OPTIONS} ${ISODIR} | 81 | -b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} -r \ |
82 | ${MKISOFS_OPTIONS} ${ISODIR} | ||
83 | else | ||
84 | bbnote "EFI-only ISO images are untested, please provide feedback." | ||
85 | mkisofs -V ${BOOTIMG_VOLUME_ID} \ | ||
86 | -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso \ | ||
87 | -r ${ISODIR} | ||
88 | fi | ||
63 | 89 | ||
64 | cd ${DEPLOY_DIR_IMAGE} | 90 | cd ${DEPLOY_DIR_IMAGE} |
65 | rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.iso | 91 | rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.iso |
@@ -70,7 +96,9 @@ build_hddimg() { | |||
70 | # Create an HDD image | 96 | # Create an HDD image |
71 | if [ "${NOHDD}" != "1" ] ; then | 97 | if [ "${NOHDD}" != "1" ] ; then |
72 | install -d ${HDDDIR} | 98 | install -d ${HDDDIR} |
73 | syslinux_hddimg_populate | 99 | if [ "${PCBIOS}" = "1" ]; then |
100 | syslinux_hddimg_populate | ||
101 | fi | ||
74 | if [ "${EFI}" = "1" ]; then | 102 | if [ "${EFI}" = "1" ]; then |
75 | grubefi_hddimg_populate | 103 | grubefi_hddimg_populate |
76 | fi | 104 | fi |
@@ -82,7 +110,9 @@ build_hddimg() { | |||
82 | mkdosfs -n ${BOOTIMG_VOLUME_ID} -d ${HDDDIR} \ | 110 | mkdosfs -n ${BOOTIMG_VOLUME_ID} -d ${HDDDIR} \ |
83 | -C ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg $SIZE | 111 | -C ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg $SIZE |
84 | 112 | ||
85 | syslinux_hddimg_install | 113 | if [ "${PCBIOS}" = "1" ]; then |
114 | syslinux_hddimg_install | ||
115 | fi | ||
86 | 116 | ||
87 | chmod 644 ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg | 117 | chmod 644 ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg |
88 | 118 | ||
@@ -93,7 +123,8 @@ build_hddimg() { | |||
93 | } | 123 | } |
94 | 124 | ||
95 | python do_bootimg() { | 125 | python do_bootimg() { |
96 | bb.build.exec_func('build_syslinux_cfg', d) | 126 | if d.getVar("PCBIOS", True) == "1": |
127 | bb.build.exec_func('build_syslinux_cfg', d) | ||
97 | if d.getVar("EFI", True) == "1": | 128 | if d.getVar("EFI", True) == "1": |
98 | bb.build.exec_func('build_grub_cfg', d) | 129 | bb.build.exec_func('build_grub_cfg', d) |
99 | bb.build.exec_func('build_hddimg', d) | 130 | bb.build.exec_func('build_hddimg', d) |