Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support header_version up to version 2 #7

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Commits on Aug 18, 2022

  1. Fix allocation size when extracting second stage

    This needs to be ssize, not ksize.
    alexlarsson committed Aug 18, 2022
    Configuration menu
    Copy the full SHA
    8b5acb9 View commit details
    Browse the repository at this point in the history
  2. create: fix random ENOENT error when looking for block device

    When creating a new image, if the stat fails with ENOENT we need to
    not check if it is a block device, we now do that randomly if the
    `S_ISBLK(st.st_mode)` check happens to pas with uninitialized `st`.
    alexlarsson committed Aug 18, 2022
    Configuration menu
    Copy the full SHA
    dca107d View commit details
    Browse the repository at this point in the history
  3. extract_second(): Fix offset

    We need to skip the ramdisk as well to get to the second part.
    alexlarsson committed Aug 18, 2022
    Configuration menu
    Copy the full SHA
    198f1d3 View commit details
    Browse the repository at this point in the history
  4. Fix output of second stage size in info

    It was using the ramdisk size
    alexlarsson committed Aug 18, 2022
    Configuration menu
    Copy the full SHA
    f58c45c View commit details
    Browse the repository at this point in the history
  5. Add some helper for reading and writing image parts

    This means less duplicated code, especially when we later
    add support for more parts.
    alexlarsson committed Aug 18, 2022
    Configuration menu
    Copy the full SHA
    e654023 View commit details
    Browse the repository at this point in the history
  6. Import bootimg.h with v2 support

    This imports bootimh.h from upstream commit
    e55998a0f2b61b685d5eb4a486ca3a0c680b1a2f, which has added v2 support.
    
    (File is: https://android.googlesource.com/platform/system/tools/mkbootimg/+/e55998a0f2b61b685d5eb4a486ca3a0c680b1a2f/include/bootimg/bootimg.h)
    
    The upstream version was C++, so the struct derivation like:
    
      struct boot_img_hdr_v1 : public boot_img_hdr_v0 {
        uint32_t recovery_dtbo_size;
        ...
    
    Was changed to:
    
      struct boot_img_hdr_v1 {
        struct boot_img_hdr_v0 v0;
        uint32_t recovery_dtbo_size;
        ...
    
    To make this work in C.
    alexlarsson committed Aug 18, 2022
    Configuration menu
    Copy the full SHA
    b911faf View commit details
    Browse the repository at this point in the history
  7. Support header_version 1 and 2

    This adds support for the "recovery dtbo" and "dtb" parts in the header.
    
    Whenever we add a feature from the later versions we update the header
    version, but we never go backwards with versions. New headers start as
    version 1, so will only become 1 or 2 as needed.
    
    We also display some new information from v0 headers that were not shown
    before (os version, header version), as well as the new data in the v1
    and v2 headers.
    alexlarsson committed Aug 18, 2022
    Configuration menu
    Copy the full SHA
    af692c7 View commit details
    Browse the repository at this point in the history
  8. Add some tests

    This builds and inspects some images in various ways and checks
    that we get the right results.
    alexlarsson committed Aug 18, 2022
    Configuration menu
    Copy the full SHA
    ec0bd0c View commit details
    Browse the repository at this point in the history