Commit 72e7a517 authored by David Brown's avatar David Brown Committed by David Brown
Browse files

Change the image header magic

Since we've changed the meaning of several fields in the header, bump
the header to a new magic number.  The fields that are still present are
in the same place, but all of the signature and TLV information is moved
into the TLV itself, which is still immediately after the image.

As of this commit, this defines the new image header/TLV format used for
1.0.

Based on work by Marko Kiiskila <marko@runtime.io>

Signed-off-by: default avatarMarko Kiiskila <marko@runtime.io>
Signed-off-by: default avatarDavid Brown <david.brown@linaro.org>
parent f5b33d8b
Loading
Loading
Loading
Loading
+3 −4
Changes for boot/bootutil/include/bootutil/image.h: 3 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -28,7 +28,8 @@ extern "C" {

struct flash_area;

#define IMAGE_MAGIC                 0x96f3b83c
#define IMAGE_MAGIC                 0x96f3b83d
#define IMAGE_MAGIC_V1              0x96f3b83c
#define IMAGE_MAGIC_NONE            0xffffffff
#define IMAGE_TLV_INFO_MAGIC        0x6907

@@ -71,9 +72,7 @@ struct image_version {
/** Image header.  All fields are in little endian byte order. */
struct image_header {
    uint32_t ih_magic;
    uint16_t _pad00;
    uint8_t  _pad0;
    uint8_t  _pad1;
    uint32_t _pad1;
    uint16_t ih_hdr_size; /* Size of image header (bytes). */
    uint16_t _pad2;
    uint32_t ih_img_size; /* Does not include header. */
+1 −1
Changes for scripts/imgtool/image.py: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ from . import version as versmod
import hashlib
import struct

IMAGE_MAGIC = 0x96f3b83c
IMAGE_MAGIC = 0x96f3b83d
IMAGE_HEADER_SIZE = 32

# Image header flags.
+1 −1
Changes for sim/src/main.rs: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -750,7 +750,7 @@ fn install_image(flash: &mut Flash, offset: usize, len: usize,

    // Generate a boot header.  Note that the size doesn't include the header.
    let header = ImageHeader {
        magic: 0x96f3b83c,
        magic: 0x96f3b83d,
        tlv_size: tlv.get_size(),
        _pad1: 0,
        hdr_size: 32,