Verified Commit 80961d1f authored by Rahix's avatar Rahix
Browse files

chore(bootloader): Cleanup generation scripts



Signed-off-by: Rahix's avatarRahix <rahix@rahix.de>
parent f49d850f
#!/bin/sh
set -e
echo "build multi image" $1 $2 $3 $4
PYTHON="$1"
BIN1="$2"
BIN2="$3"
BINOUT="$4"
dd if=/dev/zero ibs=1k count=448 | tr "\000" "\377" > "$BINOUT"
dd if="$BIN1" of="$BINOUT" conv=notrunc
dd if="$BIN2" of="$BINOUT" conv=notrunc oflag=append
dd if=/dev/zero ibs=1k count=448 2>/dev/null | tr "\000" "\377" > "$BINOUT"
dd if="$BIN1" of="$BINOUT" conv=notrunc 2>/dev/null
dd if="$BIN2" of="$BINOUT" conv=notrunc oflag=append 2>/dev/null
"$PYTHON" "$(dirname "$0")/crc_patch.py" "$BINOUT"
......@@ -2,16 +2,19 @@
import sys
import crc16
crc = 0
data = open(sys.argv[1], 'rb').read()
crc = crc16.crc16xmodem(data)
print(crc)
def main():
data = open(sys.argv[1], 'rb').read()
crc = crc16.crc16xmodem(data)
# print(crc)
padded = data + bytes([crc >> 8, crc & 0xFF])
padded = data + bytes([crc >> 8, crc & 0xFF])
crc = 0
crc = crc16.crc16xmodem(padded)
print(crc)
crc = crc16.crc16xmodem(padded)
# print(crc)
open(sys.argv[1], 'wb').write(padded)
open(sys.argv[1], 'wb').write(padded)
if __name__ == "__main__":
main()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment