Hi all, bootloader now expects images to have SHA TLV at the end of the image, and will not boot the image without that. That’s hash is to check the integrity of the image.
Later I’ll add another TLV which signs the hash, and this mechanism will mean signed images. That mechanism will be optional. Anyway, the side-effect of the checked-in change is that you’ll need to use newt to add image headers to built images. Previously work-flow was: ‘newt target build <my_target>’ ‘newt target download <my_target>’ The 2nd step would invoke bin2img automatically to add image header (if your BSP had bootloader) and assign version number 11.22.3333 to it. Now you should do: ‘newt target label <my_target> <my_version>’ ‘newt target download <my_target>` Here the step 1 builds the target, and adds image header AND adds the hash TLV. Also assigns version <my_version> to the image. The 2nd step then takes the image created during step 1, and downloads it to target board. I *think* the old boot loaders would still work with the new images, but I do recommend replacing the bootloader on your board as well. Oh yeah, you’ll need to update to latest version of newt tool as well (both of these are in ‘develop' branch of their respective repositories. > Begin forwarded message: > > From: [email protected] > Subject: [1/2] incubator-mynewt-newt git commit: Add length of tlv area in > image header. > Date: February 17, 2016 at 10:28:07 AM PST > To: [email protected] > Reply-To: [email protected] > > Repository: incubator-mynewt-newt > Updated Branches: > refs/heads/develop [created] e7484b367 > > > Add length of tlv area in image header. > > > Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/repo > Commit: > http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/commit/0a6e35b5 > Tree: > http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/0a6e35b5 > Diff: > http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/0a6e35b5 > > Branch: refs/heads/develop > Commit: 0a6e35b55f5a31b62ca6284a376de3227776455e > Parents: ba86d5c > Author: Marko Kiiskila <[email protected]> > Authored: Tue Feb 16 15:32:55 2016 -0800 > Committer: Marko Kiiskila <[email protected]> > Committed: Tue Feb 16 15:32:55 2016 -0800 > > ---------------------------------------------------------------------- > newt/cli/image.go | 8 ++++---- > newt/newt.go | 2 +- > 2 files changed, 5 insertions(+), 5 deletions(-) > ---------------------------------------------------------------------- > > > http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0a6e35b5/newt/cli/image.go > ---------------------------------------------------------------------- > diff --git a/newt/cli/image.go b/newt/cli/image.go > index aee89fc..0f2ad6c 100644 > --- a/newt/cli/image.go > +++ b/newt/cli/image.go > @@ -55,12 +55,12 @@ type Image struct { > > type ImageHdr struct { > Magic uint32 > - Pad1 uint32 > + TlvSz uint32 > HdrSz uint32 > ImgSz uint32 > Flags uint32 > Vers ImageVersion > - Pad2 uint32 > + Pad uint32 > } > > type ImageTrailerTlv struct { > @@ -200,12 +200,12 @@ func (image *Image) Generate() error { > */ > hdr := &ImageHdr{ > Magic: IMAGE_MAGIC, > - Pad1: 0, > + TlvSz: 4 + 32, > HdrSz: IMAGE_HEADER_SIZE, > ImgSz: uint32(binInfo.Size()), > Flags: IMAGE_F_HAS_SHA256, > Vers: image.version, > - Pad2: 0, > + Pad: 0, > } > > err = binary.Write(imgFile, binary.LittleEndian, hdr) > > http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0a6e35b5/newt/newt.go > ---------------------------------------------------------------------- > diff --git a/newt/newt.go b/newt/newt.go > index 84cbdf3..223e24d 100644 > --- a/newt/newt.go > +++ b/newt/newt.go > @@ -1167,7 +1167,7 @@ func repoAddPkgListCmd(cmd *cobra.Command, args > []string) { > if len(args) != 2 { > NewtUsage(cmd, > cli.NewNewtError("Must specify both name and URL to "+ > - "larva install command")) > + "app add-pkg-list command")) > } > > name := args[0] >
