install/partition: allow specifying a different boot partition start (!1856)

This adds a new deviceinfo parameter, 'boot_part_start' which accepts an
int and indicates the number of sectors from the start of the drive to
place the boot partition.

The librem5 devkit (and actual phone) u-boot has grown beyond the 2048
sector space previously before the boot partition, so this is necessary in
order to boot pmos on this device.
This commit is contained in:
Clayton Craft 2020-01-11 19:24:37 -08:00 committed by clayton craft
parent 1fa61aad37
commit 9f1dd64fa1
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
2 changed files with 5 additions and 2 deletions

View File

@ -340,7 +340,8 @@ def embed_firmware(args):
"{}".format("/usr/share/" + binary))
# Insure that embedding the firmware will not overrun the
# first partition
max_size = (2048 * 512) - (offset * step)
boot_part_start = args.deviceinfo["boot_part_start"] or "2048"
max_size = (int(boot_part_start) * 512) - (offset * step)
binary_size = os.path.getsize(binary_path)
if binary_size > max_size:
raise RuntimeError("The firmware is too big to embed in the "

View File

@ -74,9 +74,11 @@ def partition(args, size_boot):
# sometimes "fails to inform the kernel". In case it really failed with
# partitioning, the follow-up mounting/formatting will not work, so it
# will stop there (see #463).
boot_part_start = args.deviceinfo["boot_part_start"] or "2048"
commands = [
["mktable", "msdos"],
["mkpart", "primary", filesystem, "2048s", mb_boot],
["mkpart", "primary", filesystem, boot_part_start + 's', mb_boot],
["mkpart", "primary", mb_boot, "100%"],
["set", "1", "boot", "on"]
]