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/01/19 00:26:11 UTC
[3/3] incubator-mynewt-larva git commit: Use image version parsing
routine from libs/imgmgr in bin2img project.
Use image version parsing routine from libs/imgmgr in bin2img project.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/commit/ccc970cd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/tree/ccc970cd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/diff/ccc970cd
Branch: refs/heads/master
Commit: ccc970cd7d9d6d9823a8f528e92ea3a1d521eb65
Parents: a519dac
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Mon Jan 18 15:25:15 2016 -0800
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Mon Jan 18 15:25:15 2016 -0800
----------------------------------------------------------------------
fs/fs/egg.yml | 5 +++-
libs/imgmgr/egg.yml | 4 ++-
libs/newtmgr/egg.yml | 1 -
libs/os/egg.yml | 4 +--
libs/shell/egg.yml | 3 +-
project/bin2img/bin2img.yml | 1 +
project/bin2img/src/bin2img.c | 56 ++------------------------------------
7 files changed, 14 insertions(+), 60 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/ccc970cd/fs/fs/egg.yml
----------------------------------------------------------------------
diff --git a/fs/fs/egg.yml b/fs/fs/egg.yml
index 8f1d729..31a6a46 100644
--- a/fs/fs/egg.yml
+++ b/fs/fs/egg.yml
@@ -1,5 +1,8 @@
egg.name: fs/fs
egg.deps.SHELL:
- libs/shell
- - libs/console/full
+egg.reqs.SHELL:
+ - console
egg.cflags.SHELL: -DSHELL_PRESENT
+egg.identities:
+ - FS
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/ccc970cd/libs/imgmgr/egg.yml
----------------------------------------------------------------------
diff --git a/libs/imgmgr/egg.yml b/libs/imgmgr/egg.yml
index 59f9b39..ca438ff 100644
--- a/libs/imgmgr/egg.yml
+++ b/libs/imgmgr/egg.yml
@@ -1,6 +1,8 @@
egg.name: libs/imgmgr
egg.vers: 0.1
egg.deps:
- - fs/fs
- libs/newtmgr
- libs/bootutil
+egg.deps.FS:
+ - fs/fs
+egg.cflags.FS: -DFS_PRESENT
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/ccc970cd/libs/newtmgr/egg.yml
----------------------------------------------------------------------
diff --git a/libs/newtmgr/egg.yml b/libs/newtmgr/egg.yml
index 8f5e6b2..110a01f 100644
--- a/libs/newtmgr/egg.yml
+++ b/libs/newtmgr/egg.yml
@@ -5,5 +5,4 @@ egg.deps:
- libs/json
- libs/util
- libs/testutil
-egg.deps.SHELL:
- libs/shell
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/ccc970cd/libs/os/egg.yml
----------------------------------------------------------------------
diff --git a/libs/os/egg.yml b/libs/os/egg.yml
index 08c4413..09a04a7 100644
--- a/libs/os/egg.yml
+++ b/libs/os/egg.yml
@@ -6,9 +6,9 @@ egg.req_caps:
- console
egg.deps.SHELL:
- - libs/console/full
- libs/shell
egg.cflags.SHELL: -DSHELL_PRESENT
-
+egg.reqs.SHELL:
+ - console
# Satisfy capability dependencies for the self-contained test executable.
egg.deps.selftest: libs/console/stub
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/ccc970cd/libs/shell/egg.yml
----------------------------------------------------------------------
diff --git a/libs/shell/egg.yml b/libs/shell/egg.yml
index e064e6e..6d953bf 100644
--- a/libs/shell/egg.yml
+++ b/libs/shell/egg.yml
@@ -1,8 +1,9 @@
egg.name: libs/shell
egg.vers: 0.1
egg.deps:
- - libs/console/full
- libs/os
- libs/util
+egg.reqs:
+ - console
egg.identities:
- SHELL
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/ccc970cd/project/bin2img/bin2img.yml
----------------------------------------------------------------------
diff --git a/project/bin2img/bin2img.yml b/project/bin2img/bin2img.yml
index 7a99887..acb4b3e 100644
--- a/project/bin2img/bin2img.yml
+++ b/project/bin2img/bin2img.yml
@@ -1,4 +1,5 @@
project.name: bin2img
project.eggs:
- libs/bootutil
+ - libs/imgmgr
- libs/console/stub
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/ccc970cd/project/bin2img/src/bin2img.c
----------------------------------------------------------------------
diff --git a/project/bin2img/src/bin2img.c b/project/bin2img/src/bin2img.c
index ff8a139..d8bd021 100644
--- a/project/bin2img/src/bin2img.c
+++ b/project/bin2img/src/bin2img.c
@@ -22,6 +22,7 @@
#include <errno.h>
#include <sys/stat.h>
#include "bootutil/image.h"
+#include "imgmgr/imgmgr.h"
#include "crc32.h"
#if !defined(__BYTE_ORDER__) || (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
@@ -37,59 +38,6 @@ print_usage(FILE *stream)
}
static int
-parse_ver(struct image_version *out_ver, char *s)
-{
- unsigned long ul;
- char *tok;
- char *ep;
-
- tok = strtok(s, ".");
- if (tok == NULL) {
- return -1;
- }
-
- ul = strtoul(tok, &ep, 16);
- if (tok[0] == '\0' || ep[0] != '\0' || ul > UINT8_MAX) {
- return -1;
- }
- out_ver->iv_major = ul;
-
- tok = strtok(NULL, ".");
- if (tok == NULL) {
- return -1;
- }
-
- ul = strtoul(tok, &ep, 16);
- if (tok[0] == '\0' || ep[0] != '\0' || ul > UINT8_MAX) {
- return -1;
- }
- out_ver->iv_minor = ul;
-
- tok = strtok(NULL, ".");
- if (tok == NULL) {
- return -1;
- }
-
- ul = strtoul(tok, &ep, 16);
- if (tok[0] == '\0' || ep[0] != '\0' || ul > UINT16_MAX) {
- return -1;
- }
- out_ver->iv_revision = ul;
-
- tok = strtok(NULL, ".");
- if (tok == NULL) {
- return -1;
- }
- ul = strtoul(tok, &ep, 16);
- if (tok[0] == '\0' || ep[0] != '\0' || ul > UINT32_MAX) {
- return -1;
- }
- out_ver->iv_build_num = ul;
-
- return 0;
-}
-
-static int
is_image_file(const char *filename)
{
FILE *fp;
@@ -149,7 +97,7 @@ main(int argc, char **argv)
return 1;
}
- rc = parse_ver(&hdr.ih_ver, argv[3]);
+ rc = imgr_ver_parse(argv[3], &hdr.ih_ver);
if (rc != 0) {
print_usage(stderr);
return 1;