1## Combine images
2
3### Usage
4``python mk_combined_img.py [--input <filename> --output <filename>]``
5The defaults of `--input` and `--output` are:
6* `./image_config` for `--input`
7* `$OUT/combined.img` for `--output`
8
9### Prerequisite
10The script will try to get environment variables ``$ANDROID_HOST_OUT`` and ``$OUT``
11If you have built android these variables should exist and in place.
12Make sure simg2img and sgdisk are in ``$ANDROID_HOST_OUT``, if not, do following:
13
14``$ cd $ANDROID_BUILD_TOP``
15
16``$ m simg2img``
17
18``$ m sgdisk``
19
20### Functionality
21* Combine multiple images into one image with multiple partitions
22* Sparse image detection
23
24### The format of input config file
25Each line with the order of ``</path/to/image>`` ``<partition label>`` ``<partition number>``
26
27
28``<partition number>`` should be within range of ``[1, number of lines]``
29and cannot be repeated.
30
31### Config file example
32```
33$OUT/sparse_system.img      system      1
34$OUT/encryptionkey.img      encrypt     4
35$OUT/vendor.img             vendor      5
36$OUT/sparse_userdata.img    userdata    3
37$OUT/cache.img              cache       2
38```
39
40### TODO
41* Output in sparse format
42* Detect images that already have partitions in them.
43* Auto genereate config file
44
45