From 4df59e77b2ddce25c525c1c36759821d379946b0 Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Wed, 2 May 2012 13:09:20 -0400 Subject: [PATCH] mkefiboot: Add support for disk label files 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 dd55af7f..add28ee3 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 e8eaf98a..d546b0e0 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: