Skip to content

Commit

Permalink
binfin: add url0 and url1 to set repo URLs in image.
Browse files Browse the repository at this point in the history
  • Loading branch information
cire831 committed Jan 2, 2021
1 parent ded08ed commit a9fc517
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 63 deletions.
19 changes: 10 additions & 9 deletions doc/10_Image_Management
Original file line number Diff line number Diff line change
Expand Up @@ -150,18 +150,19 @@ o hw_ver. A two byte, Model and Revision that identifies the h/w this
- Additional fields can be added in a TLV based additional storage area.
The area is statically allocated and variable length fields are carved
out of it. Total size including TLV headers must fit in the statically
allocated size.
allocated size. (image_info.h:IMAGE_INFO_PLUS_SIZE)

o image_desc. An ID_MAX (44) byte string that contains an arbitrary
descriptor of what this image is.
o image_desc. Arbitrary descriptor of what this image is.

o repo0_desc. An ID_MAX (44) byte string that describes the tip of the
main tree. The main tree is currently gh:tp-freeforall/prod(tp-master).
null terminated.
o repo0_desc. Describes the tip of the main tree. The main tree is
currently gh:tp-freeforall/prod(tp-master). null terminated.

o repo1_desc. An ID_MAX (44) byte string that describes the tip of the
aux tree. This is the main MamMark tree and is currently
gh:MamMark/mm(master). null terminated.
o url0_desc. Where to find the main system repository.

o repo1_desc. Descriptor for the tip of the aux tree. This is the main
MamMark tree and is currently gh:MamMark/mm(master). null terminated.

o url1_desc. Where to find the MamMark system repository.

o stamp_date: a 30 byte null terminated string which is the build data
when this image was built.
Expand Down
14 changes: 9 additions & 5 deletions include/image_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ enum {
IIP_TLV_END = 0,
IIP_TLV_DESC = 1,
IIP_TLV_REPO0 = 2,
IIP_TLV_REPO0URL = 3,
IIP_TLV_URL0 = 3,
IIP_TLV_REPO1 = 4,
IIP_TLV_REPO1URL = 5,
IIP_TLV_URL1 = 5,
IIP_TLV_STAMP = 6,
};

Expand Down Expand Up @@ -131,21 +131,25 @@ typedef struct {
* o image_chk
* o image_desc
* o repo0_desc
* o url0_desc
* o repo1_desc
* o url1_desc
* o stamp_date
*
* image_desc is a general string (null terminated) that can be used to
* indicate what this image is, released, development, etc. It is an
* arbitrary string provided to binfin and placed into image_desc.
*
* url{0,1} are descriptor strings identifying the URLs of the repositories.
*
* repo{0,1} are descriptor strings that identify the code repositories
* used to build this image.
*
* each descriptor is generated using:
*
* git describe --all --long --dirty
*
* sha information is abbreviated to 7 digits (default). This should work
* SHA information is abbreviated to 7 digits (default). This should work
* for both the MamMark as well as the Prod/tinyos-main repositories. There
* is enough additional information to enable finding where on the tree this
* code base was built from.
Expand All @@ -168,8 +172,8 @@ typedef struct {
* To verify the image_chk, first it must be copied out (saved), zeroed,
* and the checksum computed then compared against the saved value.
*
* image_desc, repo_desc{0,1}, and stamp_date must be filled in prior to
* computing the value of image_chk.
* TLVs in the info_plus area: image_desc, repo_desc{0,1}, url{0,1}, and
* stamp_date must be filled in prior to computing the value of image_chk.
*/

#endif /* __IMAGE_INFO_H__ */
33 changes: 2 additions & 31 deletions tools/utils/binfin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,12 @@ BINFIN

Ricky Li Fo Sjoe <[email protected]>
copyright (c) 2018 Ricky Li Fo Sjoe
copyright (c) 2020 Eric B. Decker

*License*: [GPL3](https://opensource.org/licenses/GPL-3.0)

binfin - Update the generated main.exe file to update the Meta Tag information
binfin will look for the associated BIN file and apply the same update
to the image Meta Tag in that file.

Usage: binfin [ -h ] [ -i ]
[ -I <Img Desc.> ] [ -R <Repo0 Desc.> ] [ -r <Repo1 Desc.> ]
[ -t <timestamp> ] <filename>

<filename> the name of an EXE, with ELF, which needs to have it's
image_info META updated. Binfin will look for the BIN file and update that
if it exists.

-h
Help show this usage information

-I
Image Description string

-R
Repo0 Description string

-r
Repo1 Description string

-t
Timestamp string (30 chars max)

-i
Execute BinInfo on the file to read and display META info
in the file.





See binfin.py for usage.
3 changes: 2 additions & 1 deletion tools/utils/binfin/binfin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
@author: R. Li Fo Sjoe
"""

__version__ = '1.0.0'
__version__ = '1.1.0'

# 1.1.0 url0 and url1 for repo urls
# 1.0.0 release
# 0.1.4 rework core binfin to deal with plus tlvs as reworked.
# rework options, add -c (clear), -d (desc), --version,
Expand Down
27 changes: 23 additions & 4 deletions tools/utils/binfin/binfin/binfin.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#
# Usage: binfin [-h] [-D] [-V] [-w] [-c] [-i] [--version <maj>.<min>.<build>]
# [ -d <Img Desc.> ] [ --repo0 <Repo0 Desc.> ] [ --repo1 <Repo1 Desc.> ]
# [ --url0 <url0 desc.> ] [ --url1 <url1 desc.> ]
# [ -t <timestamp> ] [ -H <HW Ver.>] [ -M <Model> ] <elf/exe filename>
#
# <filename> the name of an elf exectable.
Expand Down Expand Up @@ -57,13 +58,19 @@
# set software version to <maj>.<minor>,<build> above.
#
# -d, --desc
# Image Description (44 chars. max)
# Image Description
#
# --repo0
# Repo0 Description string (44 chars max)
# Repo0 Description string
#
# --url0
# Repo0 URL string
#
# --repo1
# Repo1 Description string (44 chars max)
# Repo1 Description string
#
# --url1
# Repo1 URL string
#
# -t
# Timestamp string (30 chars max)
Expand Down Expand Up @@ -192,14 +199,20 @@ def binfin_args():
parser.add_argument('--repo0',
help = 'Repo 0 Descriptor')

parser.add_argument('--url0',
help = 'Repo 0 URL Descriptor')

parser.add_argument('--repo1',
help = 'Repo 1 Descriptor')

parser.add_argument('--url1',
help = 'Repo 1 URL Descriptor')

parser.add_argument('-t', '--timestamp',
help = 'image build time')

parser.add_argument('elf_file',
help = 'ELF(.exe) executable')
help = 'ELF(.exe) executable or binary')

return parser.parse_args()

Expand Down Expand Up @@ -295,9 +308,15 @@ def processMeta(argv):
if args.repo0:
tlv_success = process_TLV('repo0', args.repo0)

if args.url0:
tlv_success = process_TLV('url0', args.url0)

if args.repo1:
tlv_success = process_TLV('repo1', args.repo1)

if args.url1:
tlv_success = process_TLV('url1', args.url1)

if args.timestamp:
tlv_success = process_TLV('stamp', args.timestamp)

Expand Down
10 changes: 5 additions & 5 deletions tools/utils/tagcore/tagcore/core_emitters.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

from __future__ import print_function

__version__ = '0.4.8.dev5'
__version__ = '0.4.8.dev6'

from ctypes import c_int32
from binascii import hexlify
Expand Down Expand Up @@ -275,9 +275,9 @@ def emit_version(level, offset, buf, obj):
tlv_block = ii['plus']
desc = tlv_block.get_tlv(IIP_TLV_DESC)
repo0 = tlv_block.get_tlv(IIP_TLV_REPO0)
repo0url = tlv_block.get_tlv(IIP_TLV_REPO0URL)
url0 = tlv_block.get_tlv(IIP_TLV_URL0)
repo1 = tlv_block.get_tlv(IIP_TLV_REPO1)
repo1url = tlv_block.get_tlv(IIP_TLV_REPO1URL)
url1 = tlv_block.get_tlv(IIP_TLV_URL1)
stamp = tlv_block.get_tlv(IIP_TLV_STAMP)

print_hourly(rtctime)
Expand All @@ -292,9 +292,9 @@ def emit_version(level, offset, buf, obj):
print()
print(ver2a.format(desc))
print(ver2b.format(repo0))
print(ver2b0.format(repo0url))
print(ver2b0.format(url0))
print(ver2c.format(repo1))
print(ver2c0.format(repo1url))
print(ver2c0.format(url1))
print(ver2d.format(stamp,
ii['basic']['im_start'].val,
ii['basic']['im_len'].val,
Expand Down
16 changes: 8 additions & 8 deletions tools/utils/tagcore/tagcore/imageinfo_defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
'IIP_TLV_END',
'IIP_TLV_DESC',
'IIP_TLV_REPO0',
'IIP_TLV_REPO0URL',
'IIP_TLV_URL0',
'IIP_TLV_REPO1',
'IIP_TLV_REPO1URL',
'IIP_TLV_URL1',
'IIP_TLV_STAMP',
]

Expand All @@ -48,26 +48,26 @@
IIP_TLV_END = 0
IIP_TLV_DESC = 1
IIP_TLV_REPO0 = 2
IIP_TLV_REPO0URL = 3
IIP_TLV_URL0 = 3
IIP_TLV_REPO1 = 4
IIP_TLV_REPO1URL = 5
IIP_TLV_URL1 = 5
IIP_TLV_STAMP = 6

iip_tlv = {
'end' : 0,
'desc' : 1,
'repo0' : 2,
'repo0Url' : 3,
'url0' : 3,
'repo1' : 4,
'repo1Url' : 5,
'url1' : 5,
'stamp' : 6,

0 : 'end',
1 : 'desc',
2 : 'repo0',
3 : 'repo0Url',
3 : 'url0',
4 : 'repo1',
5 : 'repo1Url',
5 : 'url1',
6 : 'stamp',
}

Expand Down

0 comments on commit a9fc517

Please sign in to comment.