Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1af1202f authored by Devin Moore's avatar Devin Moore
Browse files

fastboot: copy AVB footer from init_boot.img to end of partition

Similar to GKI boot.img, init_boot.img is released as a specific size
and should be able to be flashed into partitions that have different
sizes. So the AVB footer is moved from the end of the init_boot.img to
the end of the partition in the case that the partition is larger than
the image.

Bug: 203698939
Test: m
Change-Id: Ib5a63a7bf1b4be4eba4941972750f12e3edb3a17
parent dd1eb873
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -172,7 +172,8 @@ int Flash(FastbootDevice* device, const std::string& partition_name) {
        return -EOVERFLOW;
    } else if (data.size() < block_device_size &&
               (partition_name == "boot" || partition_name == "boot_a" ||
                partition_name == "boot_b")) {
                partition_name == "boot_b" || partition_name == "init_boot" ||
                partition_name == "init_boot_a" || partition_name == "init_boot_b")) {
        CopyAVBFooter(&data, block_device_size);
    }
    if (android::base::GetProperty("ro.system.build.type", "") != "user") {
+2 −1
Original line number Diff line number Diff line
@@ -1076,7 +1076,8 @@ static void flash_buf(const std::string& partition, struct fastboot_buffer *buf)
{
    sparse_file** s;

    if (partition == "boot" || partition == "boot_a" || partition == "boot_b") {
    if (partition == "boot" || partition == "boot_a" || partition == "boot_b" ||
        partition == "init_boot" || partition == "init_boot_a" || partition == "init_boot_b") {
        copy_boot_avb_footer(partition, buf);
    }