From a37389d5745767bc81e4b7f92ed1a863ad6eed98 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 db344e0d..e74fd0e6 100644 --- a/src/pylorax/imgutils.py +++ b/src/pylorax/imgutils.py @@ -146,6 +146,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)