imgcreate/live.py | 58 ++++++++++++++++++++++++++++++--------------
tools/edit-livecd | 4 +--
tools/livecd-iso-to-disk.sh | 2 -
3 files changed, 43 insertions(+), 21 deletions(-)
New commits:
commit eab4dcca46a17cd31c74c558665a5d7b9d328f4a
Author: Matthew Garrett <mjg(a)redhat.com>
Date: Wed Feb 29 14:57:58 2012 -0500
Change EFI/boot to EFI/BOOT
Fix this up for consistency with other build tools
diff --git a/imgcreate/live.py b/imgcreate/live.py
index 685a306..adcf34f 100755
--- a/imgcreate/live.py
+++ b/imgcreate/live.py
@@ -231,9 +231,9 @@ class LiveImageCreatorBase(LoopImageCreator):
"""Generate EFI boot images."""
if not os.path.exists(self._instroot + "/boot/efi/EFI/redhat/grub.efi"):
return False
- subprocess.call(["mkefiboot", isodir + "/EFI/boot",
+ subprocess.call(["mkefiboot", isodir + "/EFI/BOOT",
isodir + "/isolinux/efiboot.img"])
- subprocess.call(["mkefiboot", "-a", isodir + "/EFI/boot",
+ subprocess.call(["mkefiboot", "-a", isodir + "/EFI/BOOT",
isodir + "/isolinux/macboot.img"])
def _create_bootconfig(self):
@@ -690,19 +690,19 @@ menu end
if not os.path.exists(self._instroot + "/boot/efi/EFI/redhat/grub.efi"):
return False
shutil.copy(self._instroot + "/boot/efi/EFI/redhat/grub.efi",
- isodir + "/EFI/boot/grub.efi")
+ isodir + "/EFI/BOOT/grub.efi")
# Should exist, but if it doesn't we should fail
if os.path.exists(self._instroot + "/boot/grub/splash.xpm.gz"):
shutil.copy(self._instroot + "/boot/grub/splash.xpm.gz",
- isodir + "/EFI/boot/splash.xpm.gz")
+ isodir + "/EFI/BOOT/splash.xpm.gz")
return True
def __get_basic_efi_config(self, **args):
return """
default=0
-splashimage=/EFI/boot/splash.xpm.gz
+splashimage=/EFI/BOOT/splash.xpm.gz
timeout %(timeout)d
hiddenmenu
@@ -715,8 +715,8 @@ hiddenmenu
args["rootlabel"] = "CDLABEL=%(fslabel)s" % args
return """title %(long)s
findiso
- kernel /EFI/boot/vmlinuz%(index)s root=%(rootlabel)s rootfstype=%(isofstype)s %(liveargs)s %(extra)s
- initrd /EFI/boot/initrd%(index)s.img
+ kernel /EFI/BOOT/vmlinuz%(index)s root=%(rootlabel)s rootfstype=%(isofstype)s %(liveargs)s %(extra)s
+ initrd /EFI/BOOT/initrd%(index)s.img
""" %args
def __get_efi_image_stanzas(self, isodir, name):
@@ -729,7 +729,7 @@ hiddenmenu
for index in range(0, 9):
# we don't support xen kernels
- if os.path.exists("%s/EFI/boot/xen%d.gz" %(isodir, index)):
+ if os.path.exists("%s/EFI/BOOT/xen%d.gz" %(isodir, index)):
continue
cfg += self.__get_efi_image_stanza(fslabel = self.fslabel,
isofstype = "auto",
@@ -749,7 +749,7 @@ hiddenmenu
def _configure_efi_bootloader(self, isodir):
"""Set up the configuration for an EFI bootloader"""
- makedirs(isodir + "/EFI/boot")
+ makedirs(isodir + "/EFI/BOOT")
if not self.__copy_efi_files(isodir):
shutil.rmtree(isodir + "/EFI")
@@ -757,27 +757,27 @@ hiddenmenu
for f in os.listdir(isodir + "/isolinux"):
os.link("%s/isolinux/%s" %(isodir, f),
- "%s/EFI/boot/%s" %(isodir, f))
+ "%s/EFI/BOOT/%s" %(isodir, f))
cfg = self.__get_basic_efi_config(name = self.name,
timeout = self._timeout)
cfg += self.__get_efi_image_stanzas(isodir, self.name)
- cfgf = open(isodir + "/EFI/boot/grub.conf", "w")
+ cfgf = open(isodir + "/EFI/BOOT/grub.conf", "w")
cfgf.write(cfg)
cfgf.close()
# first gen mactel machines get the bootloader name wrong apparently
if rpmUtils.arch.getBaseArch() == "i386":
- os.link(isodir + "/EFI/boot/grub.efi", isodir + "/EFI/boot/boot.efi")
- os.link(isodir + "/EFI/boot/grub.conf", isodir + "/EFI/boot/boot.conf")
+ os.link(isodir + "/EFI/BOOT/grub.efi", isodir + "/EFI/BOOT/BOOT.efi")
+ os.link(isodir + "/EFI/BOOT/grub.conf", isodir + "/EFI/BOOT/BOOT.conf")
# for most things, we want them named boot$efiarch
efiarch = {"i386": "ia32", "x86_64": "x64"}
efiname = efiarch[rpmUtils.arch.getBaseArch()]
- os.rename(isodir + "/EFI/boot/grub.efi", isodir + "/EFI/boot/boot%s.efi" %(efiname,))
- os.link(isodir + "/EFI/boot/grub.conf", isodir + "/EFI/boot/boot%s.conf" %(efiname,))
+ os.rename(isodir + "/EFI/BOOT/grub.efi", isodir + "/EFI/BOOT/BOOT%s.efi" %(efiname,))
+ os.link(isodir + "/EFI/BOOT/grub.conf", isodir + "/EFI/BOOT/BOOT%s.conf" %(efiname,))
def _configure_bootloader(self, isodir):
diff --git a/tools/edit-livecd b/tools/edit-livecd
index 0df2fa8..948064b 100755
--- a/tools/edit-livecd
+++ b/tools/edit-livecd
@@ -640,9 +640,9 @@ def get_fsvalue(filesystem, tag):
def rebuild_iso_symlinks(isodir):
# remove duplicate files and rebuild symlinks to reduce iso size
- efi_vmlinuz = "%s/EFI/boot/vmlinuz0" % isodir
+ efi_vmlinuz = "%s/EFI/BOOT/vmlinuz0" % isodir
isolinux_vmlinuz = "%s/isolinux/vmlinuz0" % isodir
- efi_initrd = "%s/EFI/boot/initrd0.img" % isodir
+ efi_initrd = "%s/EFI/BOOT/initrd0.img" % isodir
isolinux_initrd = "%s/isolinux/initrd0.img" % isodir
if os.path.exists(efi_vmlinuz):
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index 3ae88a2..db57067 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -1397,7 +1397,7 @@ if [ -z "$multi" ]; then
echo "Installing boot loader"
if [ -n "$efi" ]; then
# replace the ia32 hack
- if [ -f "$TGTMNT$EFI_BOOT/boot.conf" ]; then
+ if [ -f "$TGTMNT$EFI_BOOT/BOOT.conf" ]; then
cp -f $TGTMNT$EFI_BOOT/BOOTia32.conf $TGTMNT$EFI_BOOT/BOOT.conf
fi
fi
commit 135df7dd03a354d456c993dfd3ca0455ab5b8987
Author: Matthew Garrett <mjg(a)redhat.com>
Date: Wed Feb 29 14:57:57 2012 -0500
Add support for generating EFI-bootable hybrid images
This patch adds support for generating efiboot and macboot images, passing
them to the ISO generation and then performing the appropriate isohybrid
call.
diff --git a/imgcreate/live.py b/imgcreate/live.py
index 7eefbc3..685a306 100755
--- a/imgcreate/live.py
+++ b/imgcreate/live.py
@@ -227,9 +227,19 @@ class LiveImageCreatorBase(LoopImageCreator):
self.__isodir = self._mkdtemp("iso-")
return self.__isodir
+ def _generate_efiboot(self, isodir):
+ """Generate EFI boot images."""
+ if not os.path.exists(self._instroot + "/boot/efi/EFI/redhat/grub.efi"):
+ return False
+ subprocess.call(["mkefiboot", isodir + "/EFI/boot",
+ isodir + "/isolinux/efiboot.img"])
+ subprocess.call(["mkefiboot", "-a", isodir + "/EFI/boot",
+ isodir + "/isolinux/macboot.img"])
+
def _create_bootconfig(self):
"""Configure the image so that it's bootable."""
self._configure_bootloader(self.__ensure_isodir())
+ self._generate_efiboot(self.__ensure_isodir())
def _get_post_scripts_env(self, in_chroot):
env = LoopImageCreator._get_post_scripts_env(self, in_chroot)
@@ -305,7 +315,10 @@ class LiveImageCreatorBase(LoopImageCreator):
raise CreatorError("ISO creation failed!")
if os.path.exists("/usr/bin/isohybrid"):
- subprocess.call(["/usr/bin/isohybrid", iso])
+ if os.path.exists(isodir + "/isolinux/efiboot.img"):
+ subprocess.call(["/usr/bin/isohybrid", "-u", "-m", iso])
+ else:
+ subprocess.call(["/usr/bin/isohybrid", iso])
self.__implant_md5sum(iso)
@@ -358,10 +371,18 @@ class LiveImageCreatorBase(LoopImageCreator):
class x86LiveImageCreator(LiveImageCreatorBase):
"""ImageCreator for x86 machines"""
def _get_mkisofs_options(self, isodir):
- return [ "-b", "isolinux/isolinux.bin",
- "-c", "isolinux/boot.cat",
- "-no-emul-boot", "-boot-info-table",
- "-boot-load-size", "4" ]
+ options = [ "-b", "isolinux/isolinux.bin",
+ "-c", "isolinux/boot.cat",
+ "-no-emul-boot", "-boot-info-table",
+ "-boot-load-size", "4" ]
+ if os.path.exists(isodir + "/isolinux/efiboot.img"):
+ options.extend([ "-eltorito-alt-boot",
+ "-e", "isolinux/efiboot.img",
+ "-no-emul-boot",
+ "-eltorito-alt-boot",
+ "-e", "isolinux/macboot.img",
+ "-no-emul-boot"])
+ return options
def _get_required_packages(self):
return ["syslinux"] + LiveImageCreatorBase._get_required_packages(self)
@@ -693,6 +714,7 @@ hiddenmenu
else:
args["rootlabel"] = "CDLABEL=%(fslabel)s" % args
return """title %(long)s
+ findiso
kernel /EFI/boot/vmlinuz%(index)s root=%(rootlabel)s rootfstype=%(isofstype)s %(liveargs)s %(extra)s
initrd /EFI/boot/initrd%(index)s.img
""" %args