From 0ec326eb3ccfc4868eac5af679ccd093553bf4df Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Fri, 13 Apr 2012 09:29:52 -0400 Subject: [PATCH] mkefiboot: Copy Mac bootloader, rather than linking it The Mac firmware needs special-casing for hardlinked bootloaders, and it's kind of awkward to handle that in python. Just copy them for now instead. --- src/pylorax/imgutils.py | 2 ++ src/sbin/mkefiboot | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pylorax/imgutils.py b/src/pylorax/imgutils.py index fa842349..2b760d31 100644 --- a/src/pylorax/imgutils.py +++ b/src/pylorax/imgutils.py @@ -147,6 +147,8 @@ def estimate_size(rootdir, graft={}, fstype=None, blocksize=4096, overhead=128): getsize = lambda f: os.lstat(f).st_size if fstype == "btrfs": overhead = 64*1024 # don't worry, it's all sparse + if fstype == "hfsplus": + overhead = 200 # hack to deal with two bootloader copies if fstype in ("vfat", "msdos"): blocksize = 2048 getsize = lambda f: os.stat(f).st_size # no symlinks, count as copies diff --git a/src/sbin/mkefiboot b/src/sbin/mkefiboot index fd276638..e8eaf98a 100755 --- a/src/sbin/mkefiboot +++ b/src/sbin/mkefiboot @@ -70,8 +70,8 @@ def macmunge(imgfile, product): ''' % (product,)) - os.link(loader, os.path.join(sysdir,'boot.efi')) - os.link(config, os.path.join(sysdir,'boot.conf')) + shutil.copy(loader, os.path.join(sysdir,'boot.efi')) + shutil.copy(config, os.path.join(sysdir,'boot.conf')) # format data properly (big-endian UInt32) nodedata = struct.pack(">i", blessnode) dirdata = struct.pack(">i", dirnode)