diff options
Diffstat (limited to 'fastboot/fastboot.cpp')
-rw-r--r-- | fastboot/fastboot.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp index ab429df50..af8c50223 100644 --- a/fastboot/fastboot.cpp +++ b/fastboot/fastboot.cpp @@ -1025,7 +1025,7 @@ static uint64_t get_partition_size(const std::string& partition) { return partition_size; } -static void copy_boot_avb_footer(const std::string& partition, struct fastboot_buffer* buf) { +static void copy_avb_footer(const std::string& partition, struct fastboot_buffer* buf) { if (buf->sz < AVB_FOOTER_SIZE) { return; } @@ -1040,9 +1040,9 @@ static void copy_boot_avb_footer(const std::string& partition, struct fastboot_b // In this case, partition_size will be zero. if (partition_size < buf->sz) { fprintf(stderr, - "Warning: skip copying boot image avb footer" - " (boot partition size: %" PRId64 ", boot image size: %" PRId64 ").\n", - partition_size, buf->sz); + "Warning: skip copying %s image avb footer" + " (%s partition size: %" PRId64 ", %s image size: %" PRId64 ").\n", + partition.c_str(), partition.c_str(), partition_size, partition.c_str(), buf->sz); return; } @@ -1050,7 +1050,7 @@ static void copy_boot_avb_footer(const std::string& partition, struct fastboot_b // Because buf->fd will still be used afterwards. std::string data; if (!android::base::ReadFdToString(buf->fd, &data)) { - die("Failed reading from boot"); + die("Failed reading from %s", partition.c_str()); } uint64_t footer_offset = buf->sz - AVB_FOOTER_SIZE; @@ -1059,13 +1059,14 @@ static void copy_boot_avb_footer(const std::string& partition, struct fastboot_b return; } - unique_fd fd(make_temporary_fd("boot rewriting")); + const std::string tmp_fd_template = partition + " rewriting"; + unique_fd fd(make_temporary_fd(tmp_fd_template.c_str())); if (!android::base::WriteStringToFd(data, fd)) { - die("Failed writing to modified boot"); + die("Failed writing to modified %s", partition.c_str()); } lseek(fd.get(), partition_size - AVB_FOOTER_SIZE, SEEK_SET); if (!android::base::WriteStringToFd(data.substr(footer_offset), fd)) { - die("Failed copying AVB footer in boot"); + die("Failed copying AVB footer in %s", partition.c_str()); } buf->fd = std::move(fd); buf->sz = partition_size; @@ -1078,7 +1079,7 @@ static void flash_buf(const std::string& partition, struct fastboot_buffer *buf) 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); + copy_avb_footer(partition, buf); } // Rewrite vbmeta if that's what we're flashing and modification has been requested. |