Currently resign-android-image does not rebuild filesystem images, but rather modifies the ext4 filesystem using a combination of tools.
This was done because the goal was to modify the upstream OTA/image as little as possible, but involves a lot of hackery due to the use of the ext4 shared_blocks feature, requires a lot of code including a verbose calculation of how much to enlarge the filesystem accounting for ext4 details and produces images that are larger than necessary and contain wasted space.
I think it may be better to support completely rebuilding the filesystem images, probably by completing the --rebuild option and recreating enough of target_files.zip so that sign_target_files_apk actually succeeds in building the images, and making that the default.
This would also remove the need to run the script as root as long as /tmp has enough space.
Currently resign-android-image does not rebuild filesystem images, but rather modifies the ext4 filesystem using a combination of tools.
This was done because the goal was to modify the upstream OTA/image as little as possible, but involves a lot of hackery due to the use of the ext4 shared_blocks feature, requires a lot of code including a verbose calculation of how much to enlarge the filesystem accounting for ext4 details and produces images that are larger than necessary and contain wasted space.
I think it may be better to support completely rebuilding the filesystem images, probably by completing the --rebuild option and recreating enough of target_files.zip so that sign_target_files_apk actually succeeds in building the images, and making that the default.
This would also remove the need to run the script as root as long as /tmp has enough space.