avatar
mikhailnov has added c9c4e962a9
Initial support of F2FS (no resize support for now)
view file @ c9c4e962a9
... ... --- a/perl-install/bootloader.pm
... ... +++ b/perl-install/bootloader.pm
... ... @@ -1964,7 +1964,8 @@ sub action {
1964 1964
1965 1965
sub install {
1966 1966
    my ($bootloader, $all_hds) = @_;
1967
1967
    
1968
    # this is for cases when installing the bootloader to a partition, not the root of the disk
1968 1969
    if (my $part = fs::get::device2part($bootloader->{boot}, [ fs::get::fstab($all_hds) ])) {
1969 1970
	die N("You can not install the bootloader on a %s partition\n", $part->{fs_type})
1970 1971
	  if member($part->{fs_type}, qw(btrfs xfs));
view file @ c9c4e962a9
... ... --- a/perl-install/diskdrake/interactive.pm
... ... +++ b/perl-install/diskdrake/interactive.pm
... ... @@ -423,6 +423,7 @@ sub Hd_info {
423 423
424 424
sub is_LVM_resizable {
425 425
    my ($part) = @_;
426
    # TODO: add f2fs resizing
426 427
    member($part->{fs_type}, qw(btrfs ext3 ext4 reiserfs xfs));
427 428
}
428 429
sub part_possible_actions {
view file @ c9c4e962a9
... ... --- a/perl-install/fs/format.pm
... ... +++ b/perl-install/fs/format.pm
... ... @@ -25,6 +25,7 @@ my %cmds = (
25 25
   'ntfs-3g' => [ 'ntfsprogs', 'mkntfs', '--fast' ],
26 26
    btrfs    => [ 'btrfs-progs', 'mkfs.btrfs', '-f' ],
27 27
    nilfs2   => [ 'nilfs-utils', 'mkfs.nilfs2' ],
28
    f2fs     => [ 'f2fs-tools', 'mkfs.f2fs', '-f' ],
28 29
);
29 30
30 31
my %LABELs = ( #- option, length, handled_by_mount
... ... @@ -42,6 +43,8 @@ my %LABELs = ( #- option, length, handled_by_mount
43 43
   'ntfs-3g' => [ '-L', 128, 0 ],
44 44
    btrfs    => [ '-L', 256, 1 ],
45 45
    nilfs2   => [ '-L', 16, 1],
46
    # https://github.com/torvalds/linux/blob/master/Documentation/filesystems/f2fs.txt#L348
47
    f2fs     => [ '-L', 512, 1],
46 48
);
47 49
48 50
my %edit_LABEL = ( # package, command, option
... ... @@ -61,6 +64,8 @@ my %edit_LABEL = ( # package, command, option
64 64
   'ntfs-3g' => [ 'ntfsprogs', 'ntfslabel' ],
65 65
    btrfs => [ 'btrfs-progs', 'btrfs', 'filesystem', 'label' ],
66 66
    nilfs2 => [ 'nilfs-utils', 'nilfs-tune', '-L' ],
67
    # fsfs-tools seem to be unable to change the label of existing f2fs partition
68
    # https://gparted.org/features.php
67 69
);
68 70
69 71
# Preserve UUID on fs where we couldn't enforce it while formatting
... ... @@ -131,6 +136,9 @@ sub write_label {
136 136
    }
137 137
138 138
    my $dev = $part->{real_device} || $part->{device};
139
    if ($part->{fs_type} eq 'f2fs') {
140
      die N("f2fs-tools don't support changing labels of existing partitions.");
141
    }
139 142
    my ($_pkg, $cmd, @first_options) = @{$edit_LABEL{$part->{fs_type}} || die N("I do not know how to set label on %s with type %s", $part->{device}, $part->{fs_type})};
140 143
    my @args;
141 144
    if ($cmd eq 'mlabel') {
view file @ c9c4e962a9
... ... --- a/perl-install/fs/mount.pm
... ... +++ b/perl-install/fs/mount.pm
... ... @@ -35,7 +35,7 @@ sub mount {
35 35
    $fs or log::l("not mounting $dev partition"), return;
36 36
37 37
    {
38
	my @fs_modules = qw(btrfs ext3 ext4 hfs jfs nilfs2 nfs ntfs romfs reiserfs ufs xfs vfat);
38
	my @fs_modules = qw(btrfs ext3 ext4 hfs jfs nilfs2 nfs ntfs romfs reiserfs ufs xfs vfat f2fs);
39 39
# for kernel 3.5 and upper
40 40
	my @types = (qw(ext2 proc sysfs iso9660 devpts auto ntfs-3g), @fs_modules);
41 41
#	my @types = (qw(ext2 proc sysfs usbfs usbdevfs iso9660 devpts auto ntfs-3g), @fs_modules);
view file @ c9c4e962a9
... ... --- a/perl-install/fs/type.pm
... ... +++ b/perl-install/fs/type.pm
... ... @@ -21,6 +21,7 @@ my (%type_name2pt_type, %type_name2fs_type, %fs_type2pt_type, %pt_type2fs_type,
21 21
	important => [
22 22
  0x82 => 'swap',     'Linux swap',
23 23
  0x83 => 'btrfs',    'Journalised FS: Btrfs',
24
  0x83 => 'f2fs',     'FS for flash memory: F2FS',
24 25
  0x83 => 'ext2',     'Linux native (ext2)',
25 26
  0x83 => 'ext3',     'Journalised FS: ext3',
26 27
  0x83 => 'ext4',     'Journalised FS: ext4',
... ... @@ -314,7 +315,7 @@ sub type_subpart_from_magic {
315 315
316 316
sub defaultFS() { 'ext4' }
317 317
318
sub true_local_fs_types() { qw(btrfs ext3 ext2 ext4 reiserfs xfs jfs) }
318
sub true_local_fs_types() { qw(ext4 ext3 ext2 btrfs f2fs reiserfs xfs jfs) }
319 319
320 320
sub isEmpty { !$_[0]{fs_type} && $_[0]{pt_type} == 0 }
321 321
sub isEfi { $_[0]{pt_type} == 0xef }
view file @ c9c4e962a9
... ... --- a/perl-install/fsedit.pm
... ... +++ b/perl-install/fsedit.pm
... ... @@ -526,6 +526,9 @@ Please be sure to add a separate /boot partition");
526 526
The bootloader is not able to handle this when the volume spans physical volumes.
527 527
You should create a separate /boot partition first") if $mntpoint eq "/" && isLVM($part) && lvm::lv_nb_pvs($part) != 1 && !fs::get::has_mntpoint("/boot", $all_hds);
528 528
529
    cdie N("GRUB < 2.03 does not support booting from F2FS, please make a separate /boot partition with another filesystem, e.g. ext4.")
530
      if ($mntpoint eq "/" && ($part->{fs_type} eq 'f2fs') && !fs::get::has_mntpoint("/boot", $all_hds));
531
    
529 532
    die N("Mount point %s must be a physical partition", $mntpoint)
530 533
      if $mntpoint eq '/boot/efi' && isSpecial($part);
531 534
... ... @@ -535,10 +538,9 @@ You should create a separate /boot partition first") if $mntpoint eq "/" && isLV
538 538
      if member($mntpoint, qw(/bin /dev /etc /lib /sbin /mnt /media));
539 539
    die N("You need a true filesystem (ext2/3/4, reiserfs, xfs, or jfs) for this mount point\n")
540 540
      if !isTrueLocalFS($part) && $mntpoint eq '/';
541
    die N("You need a true filesystem (ext2/3/4, reiserfs, xfs, or jfs) for this mount point\n")
542
      if $part->{fs_type} eq 'btrfs' && $mntpoint eq '/boot';
543
    die N("You need a true filesystem (ext2/3/4, reiserfs, xfs, or jfs) for this mount point\n")
544
      if $part->{fs_type} eq 'btrfs' && $mntpoint eq '/boot';
541
    die N("GRUB < 2.03 does not support F2FS\n")
542
      # TODO: GRUB >= 2.03 will support F2FS
543
      if $part->{fs_type} eq 'f2fs' && $mntpoint eq '/boot';
545 544
    die N("You need a true filesystem (ext2/3/4, reiserfs, xfs, or jfs) for this mount point\n")
546 545
      if !isTrueFS($part) && member($mntpoint, '/home', fs::type::directories_needed_to_boot());
547 546
    die N("You cannot use an encrypted filesystem for mount point %s", $mntpoint)
view file @ c9c4e962a9
... ... --- a/perl-install/modules.pm
... ... +++ b/perl-install/modules.pm
... ... @@ -112,7 +112,10 @@ sub load_with_options {
112 112
    my @l = map {
113 113
	if_(member($_, 'plip', @parallel_zip_modules), 'parport_pc'),
114 114
	if_($_ eq 'vfat', 'nls_cp437', 'nls_iso8859_1'),
115
	# TODO: what if we run not on x86 hardware?
116
	# Is this code really needed on modern kernels and dracut?
115 117
	if_($_ eq 'btrfs', 'crc32c', 'crc32c-intel'),
118
	if_($_ eq 'f2fs', 'crc32c', 'crc32c-intel'),
116 119
	dependencies_closure(cond_mapping_24_26($_));
117 120
    } @$l;
118 121

Comments