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

Commit dd0d5a3d authored by David Anderson's avatar David Anderson Committed by android-build-merger
Browse files

Merge "fastboot: Resize logical partitions when using the flash command." am: 3eb5ba75

am: 9cfdd87f

Change-Id: I67d3b6481466242bd872680a399a3db6253fd11b
parents 7e3f2291 9cfdd87f
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -1092,12 +1092,20 @@ static void do_for_partitions(const std::string& part, const std::string& slot,
    }
}

static bool is_logical(const std::string& partition) {
    std::string value;
    return fb->GetVar("is-logical:" + partition, &value) == fastboot::SUCCESS && value == "yes";
}

static void do_flash(const char* pname, const char* fname) {
    struct fastboot_buffer buf;

    if (!load_buf(fname, &buf)) {
        die("cannot load '%s': %s", fname, strerror(errno));
    }
    if (is_logical(pname)) {
        fb->ResizePartition(pname, std::to_string(buf.image_size));
    }
    flash_buf(pname, &buf);
}

@@ -1140,11 +1148,6 @@ static bool if_partition_exists(const std::string& partition, const std::string&
    return fb->GetVar("partition-size:" + partition_name, &partition_size) == fastboot::SUCCESS;
}

static bool is_logical(const std::string& partition) {
    std::string value;
    return fb->GetVar("is-logical:" + partition, &value) == fastboot::SUCCESS && value == "yes";
}

static void reboot_to_userspace_fastboot() {
    fb->RebootTo("fastboot");