[PATCH] mkefiboot: Add support for disk label files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The Apple boot picker provides drive names by reading small icon files
off the filesystem. Add support for including them.
---
 share/efi.tmpl     |    3 ++-
 src/sbin/mkefiboot |   14 +++++++++++---
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/share/efi.tmpl b/share/efi.tmpl
index dd55af7..add28ee 100644
--- a/share/efi.tmpl
+++ b/share/efi.tmpl
@@ -2,6 +2,7 @@
 <%
 EFIBOOTDIR="EFI/BOOT"
 APPLE_EFI_ICON=inroot+"/usr/share/pixmaps/bootloader/fedora.icns"
+APPLE_EFI_DISKNAME=inroot+"/usr/share/pixmaps/bootloader/fedora-media.vol"
 %>
 
 mkdir ${EFIBOOTDIR}
@@ -19,7 +20,7 @@ ${make_efiboot("images/macboot.img", imgtype="apple")}
     eficonf = "%s/BOOT%s.conf" % (EFIBOOTDIR, efiarch)
     args = "--label=ANACONDA"
     if disk: args += " --disk"
-    if imgtype == "apple": args += ' --apple --icon=%s --product="%s %s"' % (APPLE_EFI_ICON, product.name, product.version)
+    if imgtype == "apple": args += ' --apple --icon=%s --diskname=%s --product="%s %s"' % (APPLE_EFI_ICON, APPLE_EFI_DISKNAME, product.name, product.version)
     %>
     %if include_kernel:
         copy ${KERNELDIR}/vmlinuz ${EFIBOOTDIR}
diff --git a/src/sbin/mkefiboot b/src/sbin/mkefiboot
index e8eaf98..d546b0e 100755
--- a/src/sbin/mkefiboot
+++ b/src/sbin/mkefiboot
@@ -27,11 +27,14 @@ def mkefiboot(bootdir, outfile, label):
     '''Make an EFI boot image with the contents of bootdir in EFI/BOOT'''
     mkdosimg(None, outfile, label=label, graft={'EFI/BOOT':bootdir})
 
-def mkmacboot(bootdir, outfile, label, icon=None, product='Generic'):
+def mkmacboot(bootdir, outfile, label, icon=None, product='Generic',
+              diskname=None):
     '''Make an EFI boot image for Apple's EFI implementation'''
     graft = {'EFI/BOOT':bootdir}
-    if icon:
+    if icon and os.path.exists(icon):
         graft['.VolumeIcon.icns'] = icon
+    if diskname and os.path.exists(diskname):
+        graft['EFI/BOOT/.disk_label'] = diskname
     mkhfsimg(None, outfile, label=label, graft=graft)
     macmunge(outfile, product)
 
@@ -112,6 +115,8 @@ if __name__ == '__main__':
         help="filesystem label to use (default: %(default)s)")
     parser.add_argument("-i", "--icon", metavar="ICONFILE",
         help="icon file to include (for Apple EFI image)")
+    parser.add_argument("-n", "--diskname", metavar="DISKNAME",
+        help="disk name image to include (for Apple EFI image)")
     parser.add_argument("-p", "--product", metavar="PRODUCT",
         help="product name to use (for Apple EFI image)")
     parser.add_argument("bootdir", metavar="EFIBOOTDIR",
@@ -126,9 +131,12 @@ if __name__ == '__main__':
         parser.error("need root permissions")
     if opt.icon and not opt.imgtype == "apple":
         print "Warning: --icon is only useful for Apple EFI images"
+    if opt.diskname and not opt.imgtype == "apple":
+        print "Warning: --diskname is only useful for Apple EFI images"
     # do the thing!
     if opt.imgtype == "apple":
-        mkmacboot(opt.bootdir, opt.outfile, opt.label, opt.icon, opt.product)
+        mkmacboot(opt.bootdir, opt.outfile, opt.label, opt.icon, opt.product,
+                  opt.diskname)
     else:
         mkefiboot(opt.bootdir, opt.outfile, opt.label)
     if opt.disk:
-- 
1.7.10

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux