From 359505490d02cf0ba5df03e298e15ed05b133e1b Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Sat, 28 Dec 2013 16:56:21 -0800 Subject: [PATCH] fix(disk_util): Install syslinux as part of filesystem formatting. This means scripts later don't need to deal with the ESP block device directly, they can just copy the config files into place. --- build_library/disk_util | 14 ++++++++++++++ build_library/legacy_disk_layout.json | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/build_library/disk_util b/build_library/disk_util index 6ea07fa57d..f1b4514324 100755 --- a/build_library/disk_util +++ b/build_library/disk_util @@ -8,6 +8,7 @@ import json import os import subprocess import sys +import tempfile import uuid # First sector we can use. @@ -283,6 +284,19 @@ def FormatFat(part, device): vfat_blocks], stdout_null=True) + if 'syslinux' in part.get('features', []): + # The syslinux directory must exist before installing ldlinux.sys to it. + vfat_mount = tempfile.mkdtemp() + Sudo(['mount', '-t', 'vfat', device, vfat_mount]) + try: + Sudo(['mkdir', os.path.join(vfat_mount, 'syslinux')]) + finally: + Sudo(['umount', vfat_mount]) + os.rmdir(vfat_mount) + + Sudo(['syslinux', '-d', '/syslinux', device]) + print "Installed SYSLINUX to %s" % part['label'] + def Format(options): """Writes the given partition table and initialize fresh filesystems. diff --git a/build_library/legacy_disk_layout.json b/build_library/legacy_disk_layout.json index dbe1628d9b..31248796dd 100644 --- a/build_library/legacy_disk_layout.json +++ b/build_library/legacy_disk_layout.json @@ -12,7 +12,8 @@ "type":"efi", "blocks":"262144", "fs_type":"vfat", - "mount":"/boot/efi" + "mount":"/boot/efi", + "features": ["syslinux"] }, "2":{ "label":"BOOT-B",