1# Microdroid Payload 2 3Payload disk is a composite disk image referencing host APEXes and an APK so that microdroid 4mounts/activates APK/APEXes and executes a binary within the APK. 5 6Payload disk is created by [VirtualizationService](../../virtualizationservice) Service when 7starting a VM. 8 9## Partitions 10 11Payload disk has 1 + N(number of APEX/APK payloads) partitions. 12 13The first partition is a "payload-metadata" partition which describes other partitions. 14And APEXes and an APK are following as separate partitions. 15 16For now, the order of partitions are important. 17 18* partition 1: Metadata partition 19* partition 2 ~ n: APEX payloads 20* partition n+1, n+2: APK payload and its idsig 21 22It's subject to change in the future, though. 23 24### Metadata partition 25 26Metadata partition provides description of the other partitions and the location for VM payload 27configuration. 28 29The partition is a protobuf message prefixed with the size of the message. 30 31| offset | size | description | 32| ------ | ---- | ---------------------------------------------------- | 33| 0 | 4 | Header. unsigned int32: body length(L) in big endian | 34| 4 | L | Body. A protobuf message. [schema](metadata.proto) | 35 36### Payload partitions 37 38Each payload partition presents APEX or APK passed from the host. 39 40The size of a payload partition must be a multiple of 4096 bytes. 41 42# `mk_payload` 43 44`mk_payload` is a small utility to create a payload disk image. It is used by ARCVM. 45 46``` 47$ cat payload_config.json 48{ 49 "apexes": [ 50 { 51 "name": "com.my.hello", 52 "path": "hello.apex", 53 } 54 ], 55 "apk": { 56 "name": "com.my.world", 57 "path": "/path/to/world.apk", 58 "idsigPath": "/path/to/world.apk.idsig", 59 } 60} 61$ m mk_payload 62$ mk_payload payload_config.json payload.img 63$ ls 64payload.img 65payload-footer.img 66payload-header.img 67payload-metadata.img 68payload-filler-0.img 69payload-filler-1.img 70... 71``` 72