install_system_image: add sdcard argument (MR 1946)

The on-device installer will run install_system_image once with
sdcard=None and the second time with sdcard=args.sdcard.
This commit is contained in:
Oliver Smith 2020-06-09 15:43:25 +02:00 committed by Bart Ribbers
parent 718839364b
commit 8fb69f9c46
No known key found for this signature in database
GPG key ID: 699D16185DAFAE61
4 changed files with 40 additions and 31 deletions

View file

@ -43,10 +43,11 @@ def format_and_mount_root(args, device):
raise RuntimeError("Failed to open cryptdevice!")
def format_and_mount_pm_crypt(args, device, root_label):
def format_and_mount_pm_crypt(args, device, root_label, sdcard):
"""
:param device: root partition on install block device (e.g. /dev/installp2)
:param root_label: label of the root partition (e.g. "pmOS_root")
:param sdcard: path to sdcard device (e.g. /dev/mmcblk0) or None
"""
# Block device
if args.full_disk_encryption:
@ -64,7 +65,7 @@ def format_and_mount_pm_crypt(args, device, root_label):
# When we don't know the file system size before hand like
# with non-block devices, we need to explicitely set a number of
# inodes. See #1717 and #1845 for details
if not args.sdcard:
if not sdcard:
mkfs_ext4_args = mkfs_ext4_args + ["-N", "100000"]
pmb.chroot.root(args, mkfs_ext4_args + [device])
@ -76,12 +77,13 @@ def format_and_mount_pm_crypt(args, device, root_label):
pmb.chroot.root(args, ["mount", device, mountpoint])
def format(args, size_reserve, root_label):
def format(args, size_reserve, root_label, sdcard):
"""
:param size_reserve: empty partition between root and boot in MiB (pma#463)
:param root_label: label of the root partition (e.g. "pmOS_root")
:param sdcard: path to sdcard device (e.g. /dev/mmcblk0) or None
"""
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, root_label)
format_and_mount_pm_crypt(args, root_dev, root_label, sdcard)
format_and_mount_boot(args)