Add boot image checksums to image header.
This adds an early validity check, so that we do not need to
load an image extension and oat file before we can discard
them as out-of-date based on the checksums from oat header.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing --interp-ac
Bug: 119800099
Change-Id: I951e8429f8dde73f3fc41c36dffe5a657a0db62b
diff --git a/runtime/image.cc b/runtime/image.cc
index 08b81c1..06ba946 100644
--- a/runtime/image.cc
+++ b/runtime/image.cc
@@ -29,7 +29,7 @@
namespace art {
const uint8_t ImageHeader::kImageMagic[] = { 'a', 'r', 't', '\n' };
-const uint8_t ImageHeader::kImageVersion[] = { '0', '7', '9', '\0' }; // FP16ToHalf intrinsic
+const uint8_t ImageHeader::kImageVersion[] = { '0', '8', '0', '\0' }; // Chained checksums.
ImageHeader::ImageHeader(uint32_t image_reservation_size,
uint32_t component_count,
@@ -44,6 +44,8 @@
uint32_t oat_file_end,
uint32_t boot_image_begin,
uint32_t boot_image_size,
+ uint32_t boot_image_component_count,
+ uint32_t boot_image_checksum,
uint32_t pointer_size)
: image_reservation_size_(image_reservation_size),
component_count_(component_count),
@@ -57,6 +59,8 @@
oat_file_end_(oat_file_end),
boot_image_begin_(boot_image_begin),
boot_image_size_(boot_image_size),
+ boot_image_component_count_(boot_image_component_count),
+ boot_image_checksum_(boot_image_checksum),
image_roots_(image_roots),
pointer_size_(pointer_size) {
CHECK_EQ(image_begin, RoundUp(image_begin, kPageSize));