Copy files on efs/efs_backup/modem_userdata/persist partitions to /data in 16kb mode

There are 4 partitions that are flashed at the factory and use F2FS fs with
4kb block size:

- /dev/block/by-name/efs
- /dev/block/by-name/efs_backup
- /dev/block/by-name/modem_userdata
- /dev/block/by-name/persist

These partitions can NOT be mounted by 16kb kernels because F2FS
expects BLOCK_SIZE == PAGE_SIZE.

In order to access the files in these partitions by 16kb kernels,
the dump.f2fs tool is used.

This change will perform these steps at boot time ONLY for 16kb mode. For
every partition (efs/efs_backup/modem_userdata/persist):

1. Use dump.f2fs to copy the content of the partition
to /data/vendor/copied/<partition name>.img.
2. If the copy was succesfull, rename /data/vendor/copied/<partition name>.img
to /data/vendor/copied/<partition name>
3. fsync the content of the directory /data/vendor/copied/<partition name>.

After the content of the partitions is in /data/vendor/copied,
bind-mount the partitions to the directory /mnt/vendor. See conf/fstab.efs.from_data.

Note: This change ONLY applies to 16kb kernels. This change does not modify
the original partitions.

Bug: 347015136
Bug: 362368691
Test: $ source build/envsetup.sh
      $ lunch [zumapro]-trunk_staging-userdebug
      $ m
      $ ./vendor/google/tools/flashall -w
Flag: EXEMPT bugfix
Change-Id: Idf46a2a3a4f0b2e91ee4a0322a0c469e055684c8
This commit is contained in:
Juan Yescas 2024-08-17 12:22:14 -07:00
parent 49a4d989ad
commit 60dc676409
6 changed files with 95 additions and 1 deletions

24
conf/init.efs.16k.rc Normal file
View file

@ -0,0 +1,24 @@
service copy_efs_files_to_data /vendor/bin/copy_efs_files_to_data
user root
group root radio system audio media graphics camera
stdio_to_kmsg
oneshot
disabled
on post-fs-data
mkdir /data/vendor/copied 0775 radio system
restorecon_recursive /data/vendor/copied
exec_start copy_efs_files_to_data
mount_all /vendor/etc/fstab.efs.from_data
restorecon_recursive /mnt/vendor/persist
restorecon_recursive /data/vendor/ss
setprop ro.vendor.persist.status mounted
on late-fs
# for modem related functions
restorecon_recursive /mnt/vendor/efs
chown radio system /mnt/vendor/efs
restorecon_recursive /mnt/vendor/efs_backup
chown radio system /mnt/vendor/efs_backup
restorecon_recursive /mnt/vendor/modem_userdata
chown radio system /mnt/vendor/modem_userdata