pmbootstrap install: support size_reserve (MR 1946)

Create an empty partition between boot and root. This will be used by
the on-device installer, as explained in detail here:
https://wiki.postmarketos.org/wiki/On-device_installer
This commit is contained in:
Oliver Smith 2020-06-06 19:05:11 +02:00 committed by Bart Ribbers
parent 5fbc95c3c2
commit a97ec615ad
No known key found for this signature in database
GPG key ID: 699D16185DAFAE61
5 changed files with 57 additions and 26 deletions

View file

@ -23,9 +23,11 @@ def format_and_mount_boot(args):
pmb.chroot.root(args, ["mount", device, mountpoint])
def format_and_mount_root(args):
def format_and_mount_root(args, device):
"""
:param device: root partition on install block device (e.g. /dev/installp2)
"""
mountpoint = "/dev/mapper/pm_crypt"
device = "/dev/installp2"
if args.full_disk_encryption:
logging.info("(native) format " + device + " (root, luks), mount to " +
mountpoint)
@ -41,12 +43,13 @@ def format_and_mount_root(args):
raise RuntimeError("Failed to open cryptdevice!")
def format_and_mount_pm_crypt(args):
def format_and_mount_pm_crypt(args, device):
"""
:param device: root partition on install block device (e.g. /dev/installp2)
"""
# Block device
if args.full_disk_encryption:
device = "/dev/mapper/pm_crypt"
else:
device = "/dev/installp2"
# Format
if not args.rsync:
@ -72,7 +75,11 @@ def format_and_mount_pm_crypt(args):
pmb.chroot.root(args, ["mount", device, mountpoint])
def format(args):
format_and_mount_root(args)
format_and_mount_pm_crypt(args)
def format(args, size_reserve):
"""
:param size_reserve: empty partition between root and boot in MiB (pma#463)
"""
root_dev = "/dev/installp3" if size_reserve else "/dev/installp2"
format_and_mount_root(args, root_dev)
format_and_mount_pm_crypt(args, root_dev)
format_and_mount_boot(args)