Commit 16f3de56 authored by Raphael Dupont's avatar Raphael Dupont Committed by Fabio Utzig
Browse files

imgtool: fix boot_magic when -e big and max-align > 8



Currently if max-align > 8, magic_boot only works in little endian

For example :
With max-align = 16 and endian = big, boot_magic starts with 0x10 0x00,
but it should be 0x00 0x10

Signed-off-by: default avatarRaphael Dupont <raphael7dup@gmail.com>
parent c89a94f1
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -172,10 +172,10 @@ class Image():
                0x35, 0x52, 0x50, 0x0f,
                0x2c, 0xb6, 0x79, 0x80, ])
        else:
            align_lsb = self.max_align & 0x00ff
            align_msb = (self.max_align & 0xff00) >> 8
            self.boot_magic = bytes([
                align_lsb, align_msb, 0x2d, 0xe1,
            lsb = self.max_align & 0x00ff
            msb = (self.max_align & 0xff00) >> 8
            align = bytes([msb, lsb]) if self.endian == "big" else bytes([lsb, msb])
            self.boot_magic = align + bytes([0x2d, 0xe1,
                                            0x5d, 0x29, 0x41, 0x0b,
                                            0x8d, 0x77, 0x67, 0x9c,
                                            0x11, 0x0f, 0x1f, 0x8a, ])