[G2 Android Development] blastagator:
WARNING: Changing Partition type

WILL

wipe ALL data,

including

INTERNAL SD!

WARNING: This is NOT for noobs!

[MENTION=2376110]dorimanx[/MENTION] - How to make your kernel auto-mount /data /system and /cache partitions as either ext4 or f2fs :D

Major thanks to [MENTION=4577448]Khaon[/MENTION], who posted the inspiration / info on how to do this. I adapted from his post!

WARNING: Systems with encrypted /data will not work! I'm sure this could be adapted to add support for that, but I haven't done that yet, since I don't use it.

Mount /system and /data:

I'm not 100% this will work, but it should!

First, comment out the mounting in fstab.g2 [busybox scripts will be used to mount these]

#/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 barrier=1,noauto_da_alloc wait,check
#/dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 nosuid,nodev,barrier=1,noatime,noauto_da_alloc,errors=continue wait,check,encryptable=/dev/block/platform/msm_sdcc.1/by-name/encrypt

Second, create a file in the root of the ramdisk, data_system.sh

#!/sbin/busybox sh

wait /dev/block/platform/msm_sdcc.1/by-name/system
SYSTEM=`/sbin/busybox blkid /dev/block/mmcblk0p34 | /sbin/busybox grep "f2fs"`

if [ "${SYSTEM}" != "" ]; then
/sbin/busybox mount -t f2fs /dev/block/platform/msm_sdcc.1/by-name/system /system -o ro;
else
/sbin/busybox mount -t ext4 /dev/block/platform/msm_sdcc.1/by-name/system /system -o ro,barrier=1,noauto_da_alloc;
fi;

wait /dev/block/platform/msm_sdcc.1/by-name/userdata
DATA=`/sbin/busybox blkid /dev/block/mmcblk0p38 | /sbin/busybox grep "f2fs"`

if [ "${DATA}" != "" ]; then
/sbin/busybox mount -t f2fs /dev/block/platform/msm_sdcc.1/by-name/userdata /data -o noatime,nosuid,nodev,discard,nodiratime,inline_xattr,inline_data,flush_merge,errors=recover;
else
/sbin/busybox mount -t ext4 /dev/block/platform/msm_sdcc.1/by-name/userdata /data -o noatime,nosuid,nodev,barrier=1,noauto_da_alloc,errors=continue;
fi;

Third, Edit init.g2.rc to run the script:

on fs
mount_all fstab.g2

chmod 0777 /data_system.sh
exec /data_system.sh

# LGE_UPDATE_START

(I added the two middle lines.)

/system and /data should now both auto-mount as ext4 or f2fs. Any ROM compatible with your kernel should boot without any special mods using this script. I'm not fully versed in converting a rom to install to /system as f2fs, but it should be possible.

WARNING: Systems with encrypted /data will not work! I'm sure this could be adapted to add support for that, but I haven't done that yet, since I don't use it.

Mount /cache:

This definitely works!

First, edit init.target.rc

on fs
# Keeping following partitions outside fstab file. As user may not have
# these partition flashed on the device. Failure to mount any partition in fstab file
# results in failure to launch late-start class.

# wait /dev/block/platform/msm_sdcc.1/by-name/cache
# mount ext4 /dev/block/platform/msm_sdcc.1/by-name/cache /cache nosuid nodev noatime barrier=1 noauto_da_alloc errors=continue
chmod 0777 /cache.sh
exec /cache.sh

(Comment out the 2 old lines used to mount /cache and add 2 new ones)

Second, create cache.sh, in the root of the ramdisk

#!/sbin/busybox sh

wait /dev/block/platform/msm_sdcc.1/by-name/cache
CACHE=`/sbin/busybox blkid /dev/block/mmcblk0p35 | /sbin/busybox grep "f2fs"`

if [ "${CACHE}" != "" ]; then
/sbin/busybox mount -t f2fs /dev/block/platform/msm_sdcc.1/by-name/cache /cache -o noatime,nosuid,nodev,discard,nodiratime,inline_xattr,inline_data,flush_merge,errors=recover;
else
/sbin/busybox mount -t ext4 /dev/block/platform/msm_sdcc.1/by-name/cache /cache -o noatime,nosuid,nodev,barrier=1,noauto_da_alloc,errors=continue;
fi;

/cache should now auto mount correctly as well :)

I have tested these modifications on 8.4 of your kernel and my phone boots properly!