install: add --filesystem to handle ext4 or f2fs (MR 2011)
Co-Authored-By: Oliver Smith <ollieparanoid@postmarketos.org>
This commit is contained in:
parent
958ecc6c72
commit
807d7019f8
|
@ -420,6 +420,7 @@ deviceinfo_attributes = [
|
||||||
"sd_embed_firmware_step_size",
|
"sd_embed_firmware_step_size",
|
||||||
"partition_blacklist",
|
"partition_blacklist",
|
||||||
"boot_part_start",
|
"boot_part_start",
|
||||||
|
"root_filesystem",
|
||||||
|
|
||||||
# weston
|
# weston
|
||||||
"weston_pixman_type",
|
"weston_pixman_type",
|
||||||
|
|
|
@ -251,6 +251,9 @@ def install(args):
|
||||||
if args.rsync:
|
if args.rsync:
|
||||||
raise ValueError("--on-device-installer cannot be combined with"
|
raise ValueError("--on-device-installer cannot be combined with"
|
||||||
" --rsync")
|
" --rsync")
|
||||||
|
if args.filesystem:
|
||||||
|
raise ValueError("--on-device-installer cannot be combined with"
|
||||||
|
" --filesystem")
|
||||||
else:
|
else:
|
||||||
if args.ondev_cp:
|
if args.ondev_cp:
|
||||||
raise ValueError("--cp can only be combined with --ondev")
|
raise ValueError("--cp can only be combined with --ondev")
|
||||||
|
@ -279,7 +282,10 @@ def install(args):
|
||||||
if flasher.get("split", False):
|
if flasher.get("split", False):
|
||||||
args.split = True
|
args.split = True
|
||||||
|
|
||||||
# Warning for android recovery zip with FDE
|
# Android recovery zip related
|
||||||
|
if args.android_recovery_zip and args.filesystem:
|
||||||
|
raise ValueError("--android-recovery-zip cannot be combined with"
|
||||||
|
" --filesystem (patches welcome)")
|
||||||
if args.android_recovery_zip and args.full_disk_encryption:
|
if args.android_recovery_zip and args.full_disk_encryption:
|
||||||
logging.info("WARNING: --fde is rarely used in combination with"
|
logging.info("WARNING: --fde is rarely used in combination with"
|
||||||
" --android-recovery-zip. If this does not work, consider"
|
" --android-recovery-zip. If this does not work, consider"
|
||||||
|
|
|
@ -75,21 +75,28 @@ def format_and_mount_root(args, device, root_label, sdcard):
|
||||||
"""
|
"""
|
||||||
# Format
|
# Format
|
||||||
if not args.rsync:
|
if not args.rsync:
|
||||||
# Some downstream kernels don't support metadata_csum (#1364).
|
filesystem = (args.filesystem or args.deviceinfo["root_filesystem"] or
|
||||||
# When changing the options of mkfs.ext4, also change them in the
|
"ext4")
|
||||||
# recovery zip code (see 'grep -r mkfs\.ext4')!
|
|
||||||
mkfs_ext4_args = ["mkfs.ext4", "-O", "^metadata_csum", "-F",
|
|
||||||
"-q", "-L", root_label]
|
|
||||||
|
|
||||||
# When we don't know the file system size before hand like
|
if filesystem == "ext4":
|
||||||
# with non-block devices, we need to explicitely set a number of
|
# Some downstream kernels don't support metadata_csum (#1364).
|
||||||
# inodes. See #1717 and #1845 for details
|
# When changing the options of mkfs.ext4, also change them in the
|
||||||
if not sdcard:
|
# recovery zip code (see 'grep -r mkfs\.ext4')!
|
||||||
mkfs_ext4_args = mkfs_ext4_args + ["-N", "100000"]
|
mkfs_root_args = ["mkfs.ext4", "-O", "^metadata_csum", "-F",
|
||||||
|
"-q", "-L", 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 sdcard:
|
||||||
|
mkfs_root_args = mkfs_root_args + ["-N", "100000"]
|
||||||
|
elif filesystem == "f2fs":
|
||||||
|
mkfs_root_args = ["mkfs.f2fs", "-f", "-l", root_label]
|
||||||
|
else:
|
||||||
|
raise RuntimeError(f"Don't know how to format {filesystem}!")
|
||||||
|
|
||||||
install_fsprogs(args, "ext4")
|
install_fsprogs(args, filesystem)
|
||||||
logging.info("(native) format " + device)
|
logging.info(f"(native) format {device} (root, {filesystem})")
|
||||||
pmb.chroot.root(args, mkfs_ext4_args + [device])
|
pmb.chroot.root(args, mkfs_root_args + [device])
|
||||||
|
|
||||||
# Mount
|
# Mount
|
||||||
mountpoint = "/mnt/install"
|
mountpoint = "/mnt/install"
|
||||||
|
|
|
@ -155,6 +155,11 @@ def arguments_install(subparser):
|
||||||
" 'pmbootstrap install' run or by providing it"
|
" 'pmbootstrap install' run or by providing it"
|
||||||
" as CHROOT_DEST with --cp", action="store_true")
|
" as CHROOT_DEST with --cp", action="store_true")
|
||||||
|
|
||||||
|
# Other
|
||||||
|
group = ret.add_argument_group("other optional arguments")
|
||||||
|
group.add_argument("--filesystem", help="root filesystem type",
|
||||||
|
choices=["ext4", "f2fs"])
|
||||||
|
|
||||||
|
|
||||||
def arguments_export(subparser):
|
def arguments_export(subparser):
|
||||||
ret = subparser.add_parser("export", help="create convenience symlinks"
|
ret = subparser.add_parser("export", help="create convenience symlinks"
|
||||||
|
|
Loading…
Reference in New Issue