[PATCH] pungi: Add support for generating EFI-bootable USB images

Matthew Garrett mjg59 at srcf.ucam.org
Thu Aug 25 13:29:07 UTC 2011


Right now our hybrid images aren't bootable via EFI when written 
directly to a USB stick. This patch adds the necessary argument to the 
isohybrid call, and in addition will perform appropriate setup to make 
the image bootable on older EFI Macs if the tree has a macboot image. 
This requires syslinux 4.02-5 or later.

diff --git a/src/pypungi/__init__.py b/src/pypungi/__init__.py
index e183b9c..ac2f7f0 100644
--- a/src/pypungi/__init__.py
+++ b/src/pypungi/__init__.py
@@ -1002,6 +1002,9 @@ class Pungi(pypungi.PungiBase):
         efibootargs = ['-eltorito-alt-boot', '-e', 'images/efiboot.img',
                        '-no-emul-boot']
 
+        macbootargs = ['-eltorito-alt-boot', '-e', 'images/macboot.img',
+                       '-no-emul-boot']
+
         ia64bootargs = ['-b', 'images/boot.img', '-no-emul-boot']
 
         ppcbootargs = ['-part', '-hfs', '-r', '-l', '-sysid', 'PPC', '-no-desktop', '-allow-multidot', '-chrp-boot']
@@ -1016,6 +1019,8 @@ class Pungi(pypungi.PungiBase):
 
         sparcbootargs = ['-G', '/boot/isofs.b', '-B', '...', '-s', '/boot/silo.conf', '-sparc-label', '"sparc"']
 
+        isohybrid = ['/usr/bin/isohybrid']
+
         # Check the size of the tree
         # This size checking method may be bunk, accepting patches...
         if not self.config.get('pungi', 'arch') == 'source':
@@ -1044,6 +1049,10 @@ class Pungi(pypungi.PungiBase):
             extraargs.extend(x86bootargs)
             if self.config.get('pungi', 'arch') == 'x86_64':
                 extraargs.extend(efibootargs)
+                isohybrid.append('-u')
+                if os.path.exists(os.path.join(self.topdir, 'images', 'macboot.img')):
+                    extraargs.extend(macbootargs)
+                    isohybrid.append('-m')
         elif self.config.get('pungi', 'arch') == 'ia64':
             extraargs.extend(ia64bootargs)
         elif self.config.get('pungi', 'arch') == 'ppc':
@@ -1061,7 +1070,9 @@ class Pungi(pypungi.PungiBase):
                 self.config.get('pungi', 'version'), self.config.get('pungi', 'arch')))
 
         extraargs.extend(['-o', isofile])
-        
+
+        isohybrid.append(isofile)
+
         if not self.config.get('pungi', 'arch') == 'source':
             extraargs.append(self.topdir)
         else:
@@ -1072,7 +1083,7 @@ class Pungi(pypungi.PungiBase):
 
         # Run isohybrid on the iso
         if os.path.exists("/usr/bin/isohybrid"):
-            subprocess.call(["/usr/bin/isohybrid", isofile])
+            pypungi.util._doRunCommand(isohybrid, self.logger)
 
         # implant md5 for mediacheck on all but source arches
         if not self.config.get('pungi', 'arch') == 'source':


-- 
Matthew Garrett | mjg59 at srcf.ucam.org


More information about the buildsys mailing list