You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/10/11 23:19:10 UTC
incubator-mynewt-core git commit: imgmgr - Fix "image boot" reporting
issue
Repository: incubator-mynewt-core
Updated Branches:
refs/heads/develop 2056cc633 -> 2fda2349c
imgmgr - Fix "image boot" reporting issue
For split images, "image boot" should report slot 0 for test image and
main image; slot 1 for active image. This behavior was changed in a
previous commit.
This fix is temporary; the image boot read command will go away soon.
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/2fda2349
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/2fda2349
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/2fda2349
Branch: refs/heads/develop
Commit: 2fda2349c3159690911b89e4f96fb8edfa405a24
Parents: 2056cc6
Author: Christopher Collins <cc...@apache.org>
Authored: Tue Oct 11 16:17:49 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Tue Oct 11 16:17:49 2016 -0700
----------------------------------------------------------------------
mgmt/imgmgr/src/imgmgr_boot.c | 37 +++++++++++++++++++++++++++----------
1 file changed, 27 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/2fda2349/mgmt/imgmgr/src/imgmgr_boot.c
----------------------------------------------------------------------
diff --git a/mgmt/imgmgr/src/imgmgr_boot.c b/mgmt/imgmgr/src/imgmgr_boot.c
index b89ce87..34f4471 100644
--- a/mgmt/imgmgr/src/imgmgr_boot.c
+++ b/mgmt/imgmgr/src/imgmgr_boot.c
@@ -53,31 +53,48 @@ imgr_boot2_read(struct mgmt_jbuf *njb)
struct image_version ver;
struct json_value jv;
uint8_t hash[IMGMGR_HASH_LEN];
- int slot;
+ int test_slot;
+ int main_slot;
+ int active_slot;
enc = &njb->mjb_enc;
json_encode_object_start(enc);
- rc = boot_vect_read_test(&slot);
- if (!rc) {
- rc = imgr_read_info(slot, &ver, hash, NULL);
+ test_slot = -1;
+ main_slot = -1;
+ active_slot = -1;
+
+ /* Temporary hack to preserve old behavior. */
+ if (boot_split_app_active_get()) {
+ test_slot = 0;
+ main_slot = 0;
+ active_slot = 1;
+ } else {
+ boot_vect_read_test(&test_slot);
+ boot_vect_read_main(&main_slot);
+ active_slot = boot_current_slot;
+ }
+
+ if (test_slot != -1) {
+ rc = imgr_read_info(test_slot, &ver, hash, NULL);
if (rc >= 0) {
imgr_hash_jsonstr(enc, "test", hash);
}
}
- rc = boot_vect_read_main(&slot);
- if (!rc) {
- rc = imgr_read_info(slot, &ver, hash, NULL);
+ if (main_slot != -1) {
+ rc = imgr_read_info(main_slot, &ver, hash, NULL);
if (rc >= 0) {
imgr_hash_jsonstr(enc, "main", hash);
}
}
- rc = imgr_read_info(boot_current_slot, &ver, hash, NULL);
- if (!rc) {
- imgr_hash_jsonstr(enc, "active", hash);
+ if (active_slot != -1) {
+ rc = imgr_read_info(active_slot, &ver, hash, NULL);
+ if (rc >= 0) {
+ imgr_hash_jsonstr(enc, "active", hash);
+ }
}
JSON_VALUE_INT(&jv, MGMT_ERR_EOK);