summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Wessel <jason.wessel@windriver.com>2013-09-17 13:32:14 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-09-30 22:11:56 +0100
commit24ffda4701371f6a2e88c10e5a20cf3a5bedbc15 (patch)
tree808bf57174ca0dc4c2b632cbb01c494bd26b57bc
parent197f1fe1cc453b60367d50471f15a7580633e763 (diff)
downloadpoky-24ffda4701371f6a2e88c10e5a20cf3a5bedbc15.tar.gz
bootimage.bbclass, grub-efi.bbclass: Improve EFI & PCBIOS+EFI ISO support
Using the latest mkisofs it is possible to generate 3 different types of ISO images, which can be used in various scenarios. 1) PCBIOS Only ISO - This option remains unchanged by this commit - Uses syslinux menus - Can be directly copied with dd to a USB device - Can be burned to optical media 2) EFI Only ISO - Uses grub 2 menus - Can be burned to optical media - If you want to use this image on a USB device extra steps must be taken in order to format the USB device with fat32, and copy an EFI loader which will in turn load the iso image 3) PCBIOS / EFI ISO - This is a hybrid image ISO that will work for case 1 or 2 as above with the same restrictions and boot menu types depending on what type of firmware is installed on the hardware or depending on if EFI or "Legacy Boot" is enabled on some UEFI firmwares. The syslinux.bbclass is now always required because that is where the isohybrid dependencies come from as well as the configuration data for the isohybrid. The isohybrid is the secret sauce which allows the ISO to work as optical media or as a disk image on USB or a HDD/SSD. [YOCTO #4100] (From OE-Core rev: a4baf911ab9d306ce5200e7d794ed6a9ccb25f30) Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/bootimg.bbclass35
-rw-r--r--meta/classes/grub-efi.bbclass8
2 files changed, 31 insertions, 12 deletions
diff --git a/meta/classes/bootimg.bbclass b/meta/classes/bootimg.bbclass
index bd211fbdc3..fdd4ea9561 100644
--- a/meta/classes/bootimg.bbclass
+++ b/meta/classes/bootimg.bbclass
@@ -32,6 +32,7 @@ EXCLUDE_FROM_WORLD = "1"
32 32
33HDDDIR = "${S}/hddimg" 33HDDDIR = "${S}/hddimg"
34ISODIR = "${S}/iso" 34ISODIR = "${S}/iso"
35EFIIMGDIR = "${S}/efi_img"
35 36
36BOOTIMG_VOLUME_ID ?= "boot" 37BOOTIMG_VOLUME_ID ?= "boot"
37BOOTIMG_EXTRA_SPACE ?= "512" 38BOOTIMG_EXTRA_SPACE ?= "512"
@@ -48,15 +49,10 @@ def pcbios(d):
48 pcbios = base_contains("MACHINE_FEATURES", "efi", "0", "1", d) 49 pcbios = base_contains("MACHINE_FEATURES", "efi", "0", "1", d)
49 return pcbios 50 return pcbios
50 51
51def pcbios_class(d):
52 if d.getVar("PCBIOS", True) == "1":
53 return "syslinux"
54 return ""
55
56PCBIOS = "${@pcbios(d)}" 52PCBIOS = "${@pcbios(d)}"
57PCBIOS_CLASS = "${@pcbios_class(d)}"
58 53
59inherit ${PCBIOS_CLASS} 54# The syslinux is required for the isohybrid command and boot catalog
55inherit syslinux
60inherit ${EFI_CLASS} 56inherit ${EFI_CLASS}
61 57
62populate() { 58populate() {
@@ -90,21 +86,36 @@ build_iso() {
90 fi 86 fi
91 if [ "${EFI}" = "1" ]; then 87 if [ "${EFI}" = "1" ]; then
92 grubefi_iso_populate 88 grubefi_iso_populate
89 build_fat_img ${EFIIMGDIR} ${ISODIR}/efi.img
93 fi 90 fi
94 91
95 if [ "${PCBIOS}" = "1" ]; then 92 # EFI only
93 if [ "${PCBIOS}" != "1" ] && [ "${EFI}" = "1" ] ; then
94 # Work around bug in isohybrid where it requires isolinux.bin
95 # In the boot catalog, even though it is not used
96 mkdir -p ${ISODIR}/${ISOLINUXDIR}
97 install -m 0644 ${STAGING_DATADIR}/syslinux/isolinux.bin ${ISODIR}${ISOLINUXDIR}
98 fi
99
100 if [ "${PCBIOS}" = "1" ] && [ "${EFI}" != "1" ] ; then
101 # PCBIOS only media
96 mkisofs -V ${BOOTIMG_VOLUME_ID} \ 102 mkisofs -V ${BOOTIMG_VOLUME_ID} \
97 -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso \ 103 -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso \
98 -b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} -r \ 104 -b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} -r \
99 ${MKISOFS_OPTIONS} ${ISODIR} 105 ${MKISOFS_OPTIONS} ${ISODIR}
100 else 106 else
101 bbnote "EFI-only ISO images are untested, please provide feedback." 107 # EFI only OR EFI+PCBIOS
102 mkisofs -V ${BOOTIMG_VOLUME_ID} \ 108 mkisofs -A ${BOOTIMG_VOLUME_ID} -V ${BOOTIMG_VOLUME_ID} \
103 -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso \ 109 -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso \
104 -r ${ISODIR} 110 -b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} \
111 -r ${MKISOFS_OPTIONS} \
112 -eltorito-alt-boot -eltorito-platform efi \
113 -b efi.img -no-emul-boot \
114 ${ISODIR}
115 isohybrid_args="-u"
105 fi 116 fi
106 117
107 isohybrid ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso 118 isohybrid $isohybrid_args ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso
108 119
109 cd ${DEPLOY_DIR_IMAGE} 120 cd ${DEPLOY_DIR_IMAGE}
110 rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.iso 121 rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.iso
diff --git a/meta/classes/grub-efi.bbclass b/meta/classes/grub-efi.bbclass
index c6f5d4e246..c21babb293 100644
--- a/meta/classes/grub-efi.bbclass
+++ b/meta/classes/grub-efi.bbclass
@@ -41,6 +41,14 @@ grubefi_populate() {
41 41
42grubefi_iso_populate() { 42grubefi_iso_populate() {
43 grubefi_populate ${ISODIR} 43 grubefi_populate ${ISODIR}
44 # Build a EFI directory to create efi.img
45 mkdir -p ${EFIIMGDIR}/${EFIDIR}
46 cp ${ISODIR}/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR}
47 cp ${ISODIR}/vmlinuz ${EFIIMGDIR}
48 echo "EFI\\BOOT\\${GRUB_IMAGE}" > ${EFIIMGDIR}/startup.nsh
49 if [ -f "${ISODIR}/initrd" ] ; then
50 cp ${ISODIR}/initrd ${EFIIMGDIR}
51 fi
44} 52}
45 53
46grubefi_hddimg_populate() { 54grubefi_hddimg_populate() {