You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2016/04/15 00:08:47 UTC

[2/2] incubator-mynewt-core git commit: bootutil; was not taking trailing TLVs into account when figuring out how many sectors to copy.

bootutil; was not taking trailing TLVs into account when figuring out
how many sectors to copy.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/ed1401a7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/ed1401a7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/ed1401a7

Branch: refs/heads/develop
Commit: ed1401a7f9d496b4ef8c6cd2e09dffa58841a971
Parents: e9b477f
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Thu Apr 14 15:06:41 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Thu Apr 14 15:06:41 2016 -0700

----------------------------------------------------------------------
 libs/bootutil/src/loader.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/ed1401a7/libs/bootutil/src/loader.c
----------------------------------------------------------------------
diff --git a/libs/bootutil/src/loader.c b/libs/bootutil/src/loader.c
index 32a7189..130264c 100644
--- a/libs/bootutil/src/loader.c
+++ b/libs/bootutil/src/loader.c
@@ -563,24 +563,25 @@ boot_build_status(void)
 {
     uint8_t flash_id;
     uint32_t address;
+    uint32_t len;
 
     memset(boot_status_entries, 0xff,
            boot_req->br_num_image_areas * sizeof *boot_status_entries);
 
     if (boot_img_hdrs[0].ih_magic == IMAGE_MAGIC) {
-        boot_status.bs_img1_length = boot_img_hdrs[0].ih_img_size;
+        len = boot_img_hdrs[0].ih_img_size + boot_img_hdrs[0].ih_tlv_size;
+        boot_status.bs_img1_length = len;
         boot_slot_addr(0, &flash_id, &address);
-        boot_build_status_one(0, flash_id, address,
-                              boot_img_hdrs[0].ih_img_size);
+        boot_build_status_one(0, flash_id, address, len);
     } else {
         boot_status.bs_img1_length = 0;
     }
 
     if (boot_img_hdrs[1].ih_magic == IMAGE_MAGIC) {
-        boot_status.bs_img2_length = boot_img_hdrs[1].ih_img_size;
+        len = boot_img_hdrs[1].ih_img_size + boot_img_hdrs[1].ih_tlv_size;
+        boot_status.bs_img2_length = len;
         boot_slot_addr(1, &flash_id, &address);
-        boot_build_status_one(1, flash_id, address,
-                              boot_img_hdrs[1].ih_img_size);
+        boot_build_status_one(1, flash_id, address, len);
     } else {
         boot_status.bs_img2_length = 0;
     }