1# Dynamic Partition Tools 2 3## lpmake 4 5lpmake is a command-line tool for generating a "super" partition image. It can currently generate two types of images: 6* Sparse images, for traditional fastboot. 7* Metadata-only images, for the lpflash utility. 8 9The following command-line arguments are required: 10 11* `-d,--device-size` - The size of the "super" partition on the device. It must match exactly, and it must be evenly divisible by the sector size (512 bytes). 12* `-m,--metadata-size` - The maximum size that partition metadata may consume. A partition entry uses 64 bytes and an extent entry uses 16 bytes. The minimum size is 512 bytes. 13* `-s,--metadata-slots` - The number of slots available for storing metadata. This should match the number of update slots on the device, 2 for A/B devices and 1 for non-A/B. 14* `-p,--partition=DATA` - Add a partition to the metadata. At least one partition must be defined. The format for the data string is `<name>:<GUID>:<attributes>:<size>`. The attributes must be either `none` or `readonly`. The size will be rounded up to the nearest aligned block (see below). 15* `-o,--output=FILE` - The output file for writing the image. 16 17Optional arguments: 18 19* `--alignment=N` - By default, lpmake will align partitions to 1MiB boundaries. However, an alternate alignment can be specified if desired. This is useful for devices with a minimum I/O request size where mis-aligned partition boundaries could be a performance issue. 20* `--alignment-offset=N` - In some cases, the "super" partition is misaligned within its parent block device. This offset can be used to correct for that. 21* `--sparse` - If set, the output image will be in sparse format for flashing with fastboot. Otherwise, by default, the image will be a minimal format usable with lpdump and lpflash. 22* `-b,--block-size=N` - When writing a sparse image, the device may require a specific block size. That block size can be specified here. The alignment must be a multiple of the block size. By default the block size is 4096. 23* `-i,--image=[NAME=FILE]` - When writing a sparse image, include the contents of FILE as the data for the partition named NAME. The file can be a normal file or a sparse image, but the destination size must be less than or equal to the partition size. This option is only available when creating sparse images. 24 25Example usage. This specifies a 10GB super partition for an A/B device, with a single 64MiB "cache" partition. 26 27``` 28lpmake --device-size 10240000000 \ 29 --metadata-size 65536 \ 30 --metadata-slots 2 \ 31 -o /tmp/super.img \ 32 -p "cache:2da85788-f0e1-4fda-9ee7-e5177eab184b:none:67108864" \ 33 -i "cache=out/target/hikey960/cache.img" 34``` 35 36## lpdump 37 38lpdump displays pretty-printed partition metadata. It accepts a single argument, which can be: 39 40* A path to a non-sparse image from lpmake. 41* A path to a filesystem image or block device. 42 43It also accepts an optional argument `-s,--slot=N` which can dump a specific metadata slot (the default is 0). 44 45Usage: `lpdump [-s,--slot=N] PATH` 46 47## lpflash 48 49lpflash writes a non-sparse image from lpmake to a block device. It is intended to be run on the device itself. 50 51Usage: `lpflash /dev/block/sdX /path/to/image/file` 52