diff options
-rwxr-xr-x | scripts/gen_sit.sh | 17 | ||||
-rwxr-xr-x | scripts/sit_template | 10 |
2 files changed, 27 insertions, 0 deletions
diff --git a/scripts/gen_sit.sh b/scripts/gen_sit.sh new file mode 100755 index 0000000..cca5a39 --- /dev/null +++ b/scripts/gen_sit.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +if [ $# -lt 1 ]; then + echo "Must set the sector offset of secondary image" + exit -1 +fi + +sector_num=`printf "0x%X" $1` + +sed -e s/%sectornum%/${sector_num}/g scripts/sit_template > sit_gen +chmod +x sit_gen + +./sit_gen +objcopy -I binary -O binary --pad-to 512 sit.bin + +rm sit_gen +echo "Generated sit.bin" diff --git a/scripts/sit_template b/scripts/sit_template new file mode 100755 index 0000000..93959ff --- /dev/null +++ b/scripts/sit_template @@ -0,0 +1,10 @@ +#! /usr/bin/perl -w +use strict; + +open(my $out, '>:raw', 'sit.bin') or die "Unable to open: $!"; +print $out pack("V", 0x0); # chipnum +print $out pack("V", 0x0); # driver type +print $out pack("V", 0x00112233); # tag +print $out pack("V", %sectornum%); # firstSectorNumber +print $out pack("V", 0x0); # Sector count, not used +close($out); |