LpUtil


LpUtil is a Win32 utility for modifying Android logical partitions (i.e. super).

Usage: lputil [flags] super [file | range] /x extract /r replace /m modify /s slot index /p partition name /e extent index Modify uses 2000-6000 (range) or 2000+4000 (start, count)

Note that sparse files are not handled specially and will simply be outputted in their sparse form.

Modify only changes the limits of an extent and does not move any data. When resizing extents you will first have to extract the data, modify the extent, then replace the data.

Hints

To become familiar with this utility do not use the full super partition. It's easier to just start with a 1 MB chunk at the start of the super partition. That has all the tables and metadata that you need to play around with. The other GBs of a super partition are just the data.

Currently the backup slots must be written manually. That means when you modify slot 0 you must modify slot 2 or 3 depending on how many slots you have.

Always double check after modifications that everything is clean. The backup slots will only be listed tersely in a single line if they agree with the main slots.

# dd if=/dev/block/by-name/super of=/sdcard/soup count=2048

Examples

Show information:

C:\>lputil super.img ====== Slot 0 ====== 03000 Header v10.2 03100 P0 system_a (readonly) E0 G1 03134 P1 system_ext_a (readonly) E1 G1 03168 P2 product_a (readonly) E2 G1 0319c P3 vendor_a (readonly) E3 G1 031d0 E0 2048 - 4392712 (4390664) D0 031e8 E1 4392712 - 4978120 (585408) D0 03200 E2 4978120 - 5775576 (797456) D0 03218 E3 5775576 - 6873168 (1097592) D0 03230 G0 default () 03260 G1 qti_dynamic_partitions_a () 03290 D0 super ...

Extract a logical partition:

C:\>lputil /x super.img /s0 /psystem_a sys.img

Replace a logical partition (must be the exact same size):

C:\>lputil /r super.img /s0 /psystem_a sys.img

Extract an extent:

C:\>lputil /x super.img /s0 /e0 sys.img

Modify an extent (don't forget the backup slot):

C:\>lputil /m super.img /s0 /e3 5775576-6873168 C:\>lputil /m super.img /s3 /e3 5775576-6873168

Modify multiple extents:

C:\>lputil /m super.img /s0 /e0 2048-4392712 4392712-4978120 4978120-5775576 5775576-6873168

Modify multiple contiguous extents using size shorthand (retains original 2048 start):

C:\>lputil /m super.img /s0 /e0 +4390664 +585408 +797456 +1097592

Modify multiple contiguous extents using upper limit shorthand:

C:\>lputil /m super.img /s0 /e0 -4392712 -4978120 -5775576 -6873168

Modify multiple contiguous extents using size in sectors of file shorthand (retains size of E1, E2):

C:\>lputil /m super.img /s0 /e0 +size(system.img) + + +size(vendor.img)

Download the executable.