• Sam Protsenko's avatar
    image: android: Add functions for handling dtb field · c3bfad82
    Sam Protsenko authored
    Android Boot Image v2 adds "DTB" payload (and corresponding field in the
    image header). Provide functions for its handling:
      - android_image_get_dtb_by_index(): Obtain DTB blob from "DTB" part of
        boot image, by blob's index
      - android_image_print_dtb_contents(): Iterate over all DTB blobs in
        "DTB" part of boot image and print those blobs info
    "DTB" payload might be in one of the following formats:
      1. concatenated DTB blobs
      2. Android DTBO format
    The latter requires "android-image-dt.c" functionality, so this commit
    selects that file for building for CONFIG_ANDROID_BOOT_IMAGE option.
    Right now this new functionality isn't used, but it can be used further.
    As it's required to apply some specific dtbo blob(s) from "dtbo"
    partition, we can't automate this process inside of "bootm" command. But
    we can do next:
      - come up with some new command like "abootimg" to extract dtb blob
        from boot image (using functions from this patch)
      - extract desired dtbo blobs from "dtbo" partition using "adtimg"
      - merge dtbo blobs into dtb blob using "fdt apply" command
      - pass resulting dtb blob into bootm command in order to boot the
        Android kernel with Android ramdisk from boot image
    Signed-off-by: default avatarSam Protsenko <joe.skb7@gmail.com>
    Signed-off-by: Lokesh Vutla's avatarLokesh Vutla <lokeshvutla@ti.com>