phhusson / boot-diverter

Something that acts as a GSI but does... uh stuff
112 stars 8 forks source link

Use loop mount instead of dm-linear for the sdcard image #2

Closed PeterCxy closed 3 years ago

PeterCxy commented 3 years ago

This allows the use of fallocate instead of dd on sdcard partitions formatted with ext4, which is way more efficient. In addition, this PR also fixes FBE on my devices due to incorrect SELinux labels.

However, before merging this, please test if this works on sdcard partitions formatted with FAT32 / exFAT, as I am not sure what C library your busybox binary is compiled against. The C library dictates whether posix_fallocate falls back to the dd behavior or not depending on the underlying filesystem. If it does not fall back, then we will need to implement our own fallback using dd.

PeterCxy commented 3 years ago

Ok I added an automatic fallback if fallocate failed. Still, please test to confirm it works before merging this.

PeterCxy commented 3 years ago

Closing this because I'm preparing to PR the minui branch here instead. Merging this patch itself doesn't really make a lot of sense since the minui branch is a much larger refactor.