Fix geometry (ESP overlapped secondary GPT)
This commit is contained in:
parent
37f90009be
commit
9c45629ec2
@ -97,7 +97,9 @@ def create_partitions(dev, *, efi=False):
|
||||
device = parted.Device(str(dev))
|
||||
if efi:
|
||||
ptype = 'gpt'
|
||||
extra_space = esp_sec = parted.sizeToSectors(ESP_SIZE, "MiB", device.sectorSize)
|
||||
esp_sec = parted.sizeToSectors(ESP_SIZE, "MiB", device.sectorSize)
|
||||
end_pad = parted.sizeToSectors(1, "MiB", device.sectorSize) # leave space for secondary part table at the end
|
||||
extra_space = esp_sec + end_pad
|
||||
else:
|
||||
ptype = 'msdos'
|
||||
extra_space = 0
|
||||
@ -117,7 +119,7 @@ def create_partitions(dev, *, efi=False):
|
||||
partition.setFlag(parted.PARTITION_BOOT)
|
||||
|
||||
if efi: # create ESP
|
||||
geometry = parted.Geometry(device=device, start=device.getLength() - esp_sec,
|
||||
geometry = parted.Geometry(device=device, start=device.getLength() - esp_sec - end_pad,
|
||||
length=esp_sec)
|
||||
filesystem = parted.FileSystem(type='fat32', geometry=geometry)
|
||||
partition = parted.Partition(disk=disk, type=parted.PARTITION_NORMAL,
|
||||
@ -155,6 +157,7 @@ def copy_boot_files(dir):
|
||||
shutil.copy(Path(__file__).parent / 'BCD', ci_lookup(boot_dir, 'BCD', creating=True))
|
||||
|
||||
|
||||
|
||||
def setup_part(part, wim, image_name, *, unattend=None, postproc=None, postproc_only=False):
|
||||
if not postproc_only:
|
||||
format_part(part)
|
||||
|
Loading…
Reference in New Issue
Block a user