WHEW. booting now all fixed for all implementations. can probably get that iPXE image smaller, though.

This commit is contained in:
2016-12-23 16:40:38 -05:00
parent e1e464d5c5
commit 764ba2f8d0
10 changed files with 124 additions and 909 deletions

View File

@@ -136,14 +136,20 @@ def genUEFI(build, bdisk):
fname = 'bootx64.efi'
else:
fname = f
if not os.path.isfile(prepdir + '/EFI/boot/' + fname):
shutil.copy2('{0}/root.x86_64/usr/share/efitools/efi/{1}'.format(chrootdir, f),
'{0}/EFI/boot/{1}'.format(prepdir, fname))
with open('{0}/root.x86_64/usr/share/efitools/efi/{1}'.format(
chrootdir,
f),
'rb') as r:
with open('{0}/EFI/boot/{1}'.format(prepdir, fname), 'wb') as file:
file.write(r.read())
# And we also need the systemd efi bootloader.
if os.path.isfile(prepdir + '/EFI/boot/loader.efi'):
os.remove(prepdir + '/EFI/boot/loader.efi')
shutil.copy2(chrootdir + '/root.x86_64/usr/lib/systemd/boot/efi/systemd-bootx64.efi',
prepdir + '/EFI/boot/loader.efi')
with open('{0}/root.x86_64/usr/lib/systemd/boot/efi/systemd-bootx64.efi'.format(
chrootdir),
'rb') as r:
with open('{0}/EFI/boot/loader.efi'.format(prepdir), 'wb') as file:
file.write(r.read())
# And the accompanying configs for the systemd efi bootloader, too.
tpl_loader = jinja2.FileSystemLoader(templates_dir)
env = jinja2.Environment(loader = tpl_loader)
@@ -166,9 +172,9 @@ def genUEFI(build, bdisk):
f.write(tpl_out)
# And we need to get filesizes (in bytes) for everything we need to include in the ESP.
# This is more important than it looks.
#sizetotal = 33553920 # The spec'd EFI binary size (32MB). It's okay to go over this though (and we do)
sizetotal = 33553920 # The spec'd EFI binary size (32MB). It's okay to go over this though (and we do)
# because xorriso sees it as a filesystem image and adjusts the ISO automagically.
sizetotal = 2097152 # we start with 2MB and add to it for wiggle room
#sizetotal = 2097152 # we start with 2MB and add to it for wiggle room
sizefiles = ['/boot/' + bdisk['uxname'] + '.64.img',
'/boot/' + bdisk['uxname'] + '.64.kern',
'/EFI/boot/bootx64.efi',
@@ -235,10 +241,8 @@ def genUEFI(build, bdisk):
if os.path.isfile(z):
os.remove(z)
shutil.copy(y, z)
#shutil.copy2('{0}/root.{1}/boot/vmlinuz-linux-{2}'.format(chrootdir, 'x86_64', bdisk['name']),
shutil.copy2('{0}/root.{1}/boot/vmlinuz-linux'.format(chrootdir, 'x86_64'),
'{0}/EFI/{1}/{2}.efi'.format(mountpt, bdisk['name'], bdisk['uxname']))
#shutil.copy2('{0}/root.{1}/boot/initramfs-linux-{2}.img'.format(chrootdir, 'x86_64', bdisk['name']),
shutil.copy2('{0}/root.{1}/boot/initramfs-linux.img'.format(chrootdir, 'x86_64'),
'{0}/EFI/{1}/{2}.img'.format(mountpt, bdisk['name'], bdisk['uxname']))
# TODO: support both arch's as EFI bootable instead? Maybe? requires more research. very rare.

View File

@@ -133,8 +133,8 @@ def genISO(conf):
os.makedirs(os.path.dirname(efiboot_img), exist_ok = True) # FAT32 embedded EFI dir
os.makedirs('{0}/EFI/boot'.format(bootdir), exist_ok = True) # EFI bootloader binary dir
# Inner dir (miniboot.img file)
sizetotal = 2097152 # 2MB wiggle room. increase this if we add IA64.
#sizetotal = 34603008 # 33MB wiggle room. increase this if we add IA64.
#sizetotal = 2097152 # 2MB wiggle room. increase this if we add IA64.
sizetotal = 34603008 # 33MB wiggle room. increase this if we add IA64.
sizetotal += os.path.getsize(innerefi64)
sizefiles = ['HashTool', 'PreLoader']
for f in sizefiles:
@@ -161,7 +161,7 @@ def genISO(conf):
cmd = ['/bin/mount', efiboot_img, mountpt]
subprocess.call(cmd)
os.makedirs(mountpt + '/EFI/boot', exist_ok = True) # "Inner" (EFI image)
os.makedirs('{0}/EFI/{1}'.format(mountpt, bdisk['name']), exist_ok = True) # "Inner" (EFI image)
#os.makedirs('{0}/EFI/{1}'.format(mountpt, bdisk['name']), exist_ok = True) # "Inner" (EFI image)
os.makedirs('{0}/boot'.format(bootdir), exist_ok = True) # kernel(s)
os.makedirs('{0}/loader/entries'.format(bootdir), exist_ok = True) # EFI
for d in (mountpt, bootdir):
@@ -171,19 +171,24 @@ def genISO(conf):
fname = 'bootx64.efi'
else:
fname = f
if not os.path.isfile('{0}/EFI/boot/{1}'.format(mountpt, fname)):
shutil.copy2('{0}/root.x86_64/usr/share/efitools/efi/{1}'.format(chrootdir, f),
'{0}/EFI/boot/{1}'.format(mountpt, fname))
if not os.path.isfile('{0}/EFI/boot/{1}'.format(bootdir, f)):
shutil.copy2('{0}/root.x86_64/usr/share/efitools/efi/{1}'.format(chrootdir, f),
'{0}/EFI/boot/{1}'.format(bootdir, fname))
# And the systemd efi bootloader.
if not os.path.isfile('{0}/EFI/boot/loader.efi'.format(mountpt)):
shutil.copy2('{0}/root.x86_64/usr/lib/systemd/boot/efi/systemd-bootx64.efi'.format(chrootdir),
'{0}/EFI/boot/loader.efi'.format(mountpt))
if not os.path.isfile('{0}/EFI/boot/loader.efi'.format(bootdir)):
shutil.copy2('{0}/root.x86_64/usr/lib/systemd/boot/efi/systemd-bootx64.efi'.format(chrootdir),
'{0}/EFI/boot/loader.efi'.format(bootdir))
with open('{0}/root.x86_64/usr/share/efitools/efi/{1}'.format(
chrootdir,f),
'rb') as r:
with open('{0}/EFI/boot/{1}'.format(mountpt, fname), 'wb') as file:
file.write(r.read())
with open('{0}/root.x86_64/usr/share/efitools/efi/{1}'.format(
chrootdir, f),
'rb') as r:
with open('{0}/EFI/boot/{1}'.format(bootdir, fname), 'wb+') as file:
file.write(r.read())
# And the systemd efi bootloader.
with open('{0}/root.x86_64/usr/lib/systemd/boot/efi/systemd-bootx64.efi'.format(
chrootdir),
'rb') as r:
with open('{0}/EFI/boot/loader.efi'.format(mountpt), 'wb+') as f:
f.write(r.read())
# And loader entries.
os.makedirs('{0}/loader/entries'.format(mountpt, exist_ok = True))
for t in ('loader', 'base'):
@@ -202,7 +207,7 @@ def genISO(conf):
# Outer dir
outerdir = True
os.makedirs('{0}/isolinux'.format(bootdir), exist_ok = True) # BIOS
# and we create the loader entries (outer)
# Loader entries (outer)
for t in ('loader','base'):
if t == 'base':
name = bdisk['uxname']