Skip to content

Commit

Permalink
Target for making mp2 fsbl header
Browse files Browse the repository at this point in the history
  • Loading branch information
danngreen committed Jun 19, 2024
1 parent 3a8476d commit f16c0b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ image: $(BIN)
python3 fsbl_header.py $(BUILDDIR)/$(BINARYNAME).bin $(BUILDDIR)/$(BINARYNAME).stm32
@ls -l $(BUILDDIR)/$(BINARYNAME).stm32

image-mp2: $(BIN)
python3 fsbl_header.py --format=mp2 $(BUILDDIR)/$(BINARYNAME).bin $(BUILDDIR)/$(BINARYNAME).stm32
@ls -l $(BUILDDIR)/$(BINARYNAME).stm32

load: image
@read -p "What is the disk device (Enter for $(SD_DISK_DEV)): " DISK && \
DISK=$${DISK:-$(SD_DISK_DEV)} && \
Expand Down
4 changes: 2 additions & 2 deletions fsbl_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ def add_mp2_fsbl_header(binary_file):

payload = bytearray(binary_file[0x100:])

header = struct.pack("<ccccQQQQQQQQIIIIQQQIIII8xII",
header = struct.pack("<ccccQQQQQQQQIIIIIIIIIII8xII",
bytes('S', "ascii"), bytes('T', "ascii"), bytes('M', "ascii"), bytes('2', "ascii"), # Header magic
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # ECDSA signature (512bits=64Bytes=8 quads), unsigned here
sum(payload), # Checksum of payload, sum of all bytes
0x00020200, # Header version 1.0
len(payload), # Length of payload
0x2FFC0000 + 0x2400 + 0x100, # Entrypoint address. ????
0x00000000, 0x00000000, 0x00000000, # Reserved (96 bits = 3 quads)
0x00, 0x00, 0x00, # Reserved (96 bits = 3 quads)
0x00000000, # Image version (32bits)
0x00000000, # Option flags (32bits) , header padding disabled, auth disabled, decrypt disabled
0x00000000, # Header extension lengths (32bits)
Expand Down

0 comments on commit f16c0b1

Please sign in to comment.