refactor changebootloader

This commit is contained in:
4am 2019-09-20 20:56:24 -04:00
parent 852f6123ea
commit c3922613ea
3 changed files with 4 additions and 16 deletions

View File

@ -87,7 +87,7 @@ dsk: md asm
$(CADIUS) ADDFOLDER build/"$(DISK)" "/$(VOLUME)/X" "build/X" >>build/log
bin/buildfileinfo.sh build/PRELAUNCH "06" "0106" >>build/log
$(CADIUS) ADDFOLDER build/"$(DISK)" "/$(VOLUME)/PRELAUNCH" "build/PRELAUNCH" >>build/log
bin/changebootloader.py build/"$(DISK)" res/proboothd
bin/changebootloader.sh build/"$(DISK)" res/proboothd
asm: md asmlauncher asmfx asmprelaunch

View File

@ -1,15 +0,0 @@
#!/usr/bin/env python3
import sys
import os.path
target_2mg_file, bootloader = sys.argv[1:]
assert(os.path.splitext(target_2mg_file)[-1].lower() == ".2mg")
with open(bootloader, 'rb') as f:
boot = f.read()
assert(len(boot) == 512)
with open(target_2mg_file, 'rb') as f:
data = bytearray(f.read())
data[64:64+len(boot)] = boot
with open(target_2mg_file, 'wb') as f:
f.write(data)

3
bin/changebootloader.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
dd of="$1" bs=1 seek=64 count=512 conv=notrunc < "$2"