<commit_before># layout of boot.img

### 1. header part

              item                        size in bytes             position
    +----------------------------------------------------------+    --> 0
    |<MAGIC HEADER>                  |     8                   |
    |--------------------------------+-------------------------|    --> 8
    |<kernel length>                 |     4                   |
    |--------------------------------+-------------------------|    --> 12
    |<kernel offset>                 |     4                   |
    |--------------------------------+-------------------------|    --> 16 (0x10)
    |<ramdisk length>                |     4                   |
    |--------------------------------+-------------------------|    --> 20
    |<ramdisk offset>                |     4                   |
    |--------------------------------+-------------------------|    --> 24
    |<second bootloader length>      |     4                   |
    |--------------------------------+-------------------------|    --> 28
    |<second bootloader offset>      |     4                   |
    |--------------------------------+-------------------------|    --> 32 (0x20)
    |<tags offset>                   |     4                   |
    |--------------------------------+-------------------------|    --> 36
    |<page size>                     |     4                   |
    |--------------------------------+-------------------------|    --> 40
    |<header version>                |     4                   |
    |--------------------------------+-------------------------|    --> 44
    |<os version& os patch level>    |     4                   |
    |--------------------------------+-------------------------|    --> 48 (0x30)
    |<board name>                    |     16                  |
    |--------------------------------+-------------------------|    --> 64 (0x40)
    |<cmdline part 1>                |     512                 |
    |--------------------------------+-------------------------|    --> 576 (0x240)
    |<hash digest>                   |     32                  |
    |--------------------------------+-------------------------|    --> 608 (0x260)
    |<cmdline part 2>                |     1024                |
    |--------------------------------+-------------------------|    --> 1632 (0x660)
    |<dtbo length>                   |     4                   |
    |--------------------------------+-------------------------|    --> 1636
    |<dtbo offset>                   |     8                   |
    |--------------------------------+-------------------------|    --> 1644
    |<header size>                   |     4                   |
    |--------------------------------+-------------------------|    --> 1648 (0x670)
    |<padding>                       | min(n * page_zie - 1648)|
    +----------------------------------------------------------+    --> pagesize

### 2. data part

    +----------------------------------------------------------+    --> pagesize
    |<kernel>                        |   kernel length         |
    |--------------------------------+-------------------------|
    |<padding>                       |  min(n * page_zie - len)|
    +----------------------------------------------------------+

    +--------------------------------+-------------------------+
    |<ramdisk>                       |   ramdisk length        |
    |--------------------------------+-------------------------|
    |<padding>                       |  min(n * page_zie - len)|
    +----------------------------------------------------------+

    +--------------------------------+-------------------------+
    |<second bootloader>             | second bootloader length|
    |--------------------------------+-------------------------|
    |<padding>                       |  min(n * page_zie - len)|
    +----------------------------------------------------------+

    +--------------------------------+-------------------------+
    |<recovery dtbo>                 | recovery dtbo length    |
    |--------------------------------+-------------------------|
    |<padding>                       |  min(n * page_zie - len)|
    +----------------------------------------------------------+

### 3. signature part

#### 3.1 Boot Image Signature (VBoot 1.0)

    +--------------------------------+-------------------------+
    |<signature>                     | signature length        |
    |--------------------------------+-------------------------|
    |<padding>                       | defined by boot_signer  |
    +----------------------------------------------------------+

#### 3.2 AVB Footer (VBoot 2.0)

    +--------------------------------+-------------------------+
    |<signature>                     | signature length        |
    |--------------------------------+-------------------------|
    | ...                            | ...                     |
    |<padding>                       | defined by avbtool,     |
    |<padding>                       | it will pad to requested|
    |<padding>                       | image size              |
    | ...                            | ...                     |
    +----------------------------------------------------------+<commit_msg>update AVB signature layout in README.expert.md<commit_after># layout of boot.img

### 1. header part

              item                        size in bytes             position
    +----------------------------------------------------------+    --> 0
    |<MAGIC HEADER>                  |     8                   |
    |--------------------------------+-------------------------|    --> 8
    |<kernel length>                 |     4                   |
    |--------------------------------+-------------------------|    --> 12
    |<kernel offset>                 |     4                   |
    |--------------------------------+-------------------------|    --> 16 (0x10)
    |<ramdisk length>                |     4                   |
    |--------------------------------+-------------------------|    --> 20
    |<ramdisk offset>                |     4                   |
    |--------------------------------+-------------------------|    --> 24
    |<second bootloader length>      |     4                   |
    |--------------------------------+-------------------------|    --> 28
    |<second bootloader offset>      |     4                   |
    |--------------------------------+-------------------------|    --> 32 (0x20)
    |<tags offset>                   |     4                   |
    |--------------------------------+-------------------------|    --> 36
    |<page size>                     |     4                   |
    |--------------------------------+-------------------------|    --> 40
    |<header version>                |     4                   |
    |--------------------------------+-------------------------|    --> 44
    |<os version& os patch level>    |     4                   |
    |--------------------------------+-------------------------|    --> 48 (0x30)
    |<board name>                    |     16                  |
    |--------------------------------+-------------------------|    --> 64 (0x40)
    |<cmdline part 1>                |     512                 |
    |--------------------------------+-------------------------|    --> 576 (0x240)
    |<hash digest>                   |     32                  |
    |--------------------------------+-------------------------|    --> 608 (0x260)
    |<cmdline part 2>                |     1024                |
    |--------------------------------+-------------------------|    --> 1632 (0x660)
    |<dtbo length>                   |     4                   |
    |--------------------------------+-------------------------|    --> 1636
    |<dtbo offset>                   |     8                   |
    |--------------------------------+-------------------------|    --> 1644
    |<header size>                   |     4                   |
    |--------------------------------+-------------------------|    --> 1648 (0x670)
    |<padding>                       | min(n * page_zie - 1648)|
    +----------------------------------------------------------+    --> pagesize

### 2. data part

    +----------------------------------------------------------+    --> pagesize
    |<kernel>                        |   kernel length         |
    |--------------------------------+-------------------------|
    |<padding>                       |  min(n * page_zie - len)|
    +----------------------------------------------------------+

    +--------------------------------+-------------------------+
    |<ramdisk>                       |   ramdisk length        |
    |--------------------------------+-------------------------|
    |<padding>                       |  min(n * page_zie - len)|
    +----------------------------------------------------------+

    +--------------------------------+-------------------------+
    |<second bootloader>             | second bootloader length|
    |--------------------------------+-------------------------|
    |<padding>                       |  min(n * page_zie - len)|
    +----------------------------------------------------------+

    +--------------------------------+-------------------------+
    |<recovery dtbo>                 | recovery dtbo length    |
    |--------------------------------+-------------------------|
    |<padding>                       |  min(n * page_zie - len)|
    +----------------------------------------------------------+    --> end of data part

### 3. signature part

#### 3.1 Boot Image Signature (VBoot 1.0)

    +--------------------------------+-------------------------+    --> end of data part
    |<signature>                     | signature length        |
    |--------------------------------+-------------------------|
    |<padding>                       | defined by boot_signer  |
    +--------------------------------+-------------------------+

#### 3.2 AVB Footer (VBoot 2.0)

              item                        size in bytes             position
    +--------------------------------+-------------------------+    --> end of data part (say locaton A)
    | VBMeta Header                  | total 256               |
    |                                |                         |
    |   - Header Magic "AVB0"        |     4                   |
    |   - avb_version Major          |     4                   |
    |   - avb_version Minor          |     4                   |
    |   - authentication blob size   |     8                   |
    |   - auxiliary blob size        |     8                   |
    |   - algorithm type             |     4                   |
    |   - hash offset                |     8                   |
    |   - hash size                  |     8                   |
    |   - signature offset           |     8                   |
    |   - signature size             |     8                   |
    |   - pub key offset             |     8                   |
    |   - pub key size               |     8                   |
    |   - pub key metadata offset    |     8                   |
    |   - pub key metadata size      |     8                   |
    |   - descriptors offset         |     8                   |
    |   - descriptors size           |     8                   |
    |   - rollback index             |     8                   |
    |   - flags                      |     4                   |
    |   - RESERVED                   |     4                   |
    |   - release string             |     47                  |
    |   - NULL                       |     1                   |
    |   - RESERVED                   |     80                  |
    |--------------------------------+-------------------------+    --> (location A) + 256
    | Authentication Blob            |                         |
    |   - Hash of Header & Aux Blob  | alg.hash_num_bytes      |
    |   - Signature of Hash          | alg.signature_num_bytes |
    |   - Padding                    | align by 64             |
    +--------------------------------+-------------------------+
    | Auxiliary Blob                 |                         |
    |   - descriptors                |                         |
    |   - pub key                    |                         |
    |   - pub key meta data          |                         |
    |   - padding                    | align by 64             |
    +--------------------------------+-------------------------+
    | Padding                        | align by block_size     |
    +--------------------------------+-------------------------+    --> (location A) + (block_size * n)

    +--------------------------------+-------------------------+
    |                                |                         |
    |                                |                         |
    | DONOT CARE CHUNK               |                         |
    |                                |                         |
    |                                |                         |
    +--------------------------------+-------------------------+

    +--------------------------------+-------------------------+    --> partition_size - block_size
    | Padding                        | block_size - 64         |
    +--------------------------------+-------------------------+    --> partition_size - 64
    | AVB Footer                     | total 64                |
    |                                |                         |
    |   - Footer Magic "AVBf"        |     4                   |
    |   - Footer Major Version       |     4                   |
    |   - Footer Minor Version       |     4                   |
    |   - original image size        |     8                   |
    |   - VBMeta offset              |     8                   |
    |   - VBMeta size                |     8                   |
    |   - Padding                    |     28                  |
    +--------------------------------+-------------------------+    --> partition_size
{'fraction_non_alphanumeric': 0.4086301562719977, 'fraction_numerical': 0.01978037448965226, 'mean_word_length': 0.30903897539850733, 'pattern_counts': {'":': 0, '<': 65, '<?xml version=': 0, '>': 115, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 92, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7413128', 'n_tokens_mistral': 2880, 'n_tokens_neox': 2376, 'n_words': 519}