summaryrefslogtreecommitdiffstats
path: root/meta/classes/bootimg.bbclass
diff options
context:
space:
mode:
authorDarren Hart <dvhart@linux.intel.com>2011-11-23 23:35:43 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-11-30 22:18:08 +0000
commit77d5a0c4c47d18d7a477fa79dcf982a001201801 (patch)
tree3d99af0a35d2b1b514ad3e1db6d95f47ba77cce0 /meta/classes/bootimg.bbclass
parenteb4aa3483b1129a7137983ed54596030a5ccba2b (diff)
downloadpoky-77d5a0c4c47d18d7a477fa79dcf982a001201801.tar.gz
bootimg: Allow for EFI-only boot images
Condition building PCBIOS legacy images on MACHINE_FEATURES containing "pcbios" or not containing "efi". This ensures existing BSPs will continue to get the old PCBIOS legacy-only images. New BSPs can add "efi", "pcbios", or both. The images created likewise support one or the other or both. EFI-only ISO images are untested. (From OE-Core rev: be3fc8c07e84c654f55c5d09934dfbdc7ff7e2b6) Signed-off-by: Darren Hart <dvhart@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/bootimg.bbclass')
-rw-r--r--meta/classes/bootimg.bbclass49
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"
38EFI = ${@base_contains("MACHINE_FEATURES", "efi", "1", "0", d)} 38EFI = ${@base_contains("MACHINE_FEATURES", "efi", "1", "0", d)}
39EFI_CLASS = ${@base_contains("MACHINE_FEATURES", "efi", "grub-efi", "dummy", d)} 39EFI_CLASS = ${@base_contains("MACHINE_FEATURES", "efi", "grub-efi", "dummy", d)}
40 40
41inherit 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.
44def 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
50def pcbios_class(d):
51 if d.getVar("PCBIOS", True) == "1":
52 return "syslinux"
53 return "dummy"
54
55PCBIOS = ${@pcbios(d)}
56PCBIOS_CLASS = ${@pcbios_class(d)}
57
58inherit ${PCBIOS_CLASS}
42inherit ${EFI_CLASS} 59inherit ${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
95python do_bootimg() { 125python 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)