Import source
[hvf.git] / scripts / gen_ipl_s.sh
blob4c7834d695b651de3756f51ef6d387f542ee55f5
1 #!/bin/bash
3 # Copyright (c) 2007 Josef 'Jeff' Sipek
6 len=80 # this is going the be the size of ipl.rto
7 len=$(expr $len + `stat -c %s ipl/setmode.rto`)
8 len=$(expr $len + `stat -c %s ipl/loader.rto`)
9 dif=`expr $len % 80`
11 if [ $dif -ne 0 ]; then
12 len=`expr $len - $dif`
13 len=`expr $len + 80`
16 if [ $len -gt `expr 65536` ]; then
17 echo "ERROR: loader code is too long" >&2
18 exit 1
21 ccw2=$len
23 ccw2h=`expr $ccw2 / 256`
24 ccw2l=`expr $ccw2 % 256`
26 sed -e "s/CCW2H/$ccw2h/g" \
27 -e "s/CCW2L/$ccw2l/g" \
28 "$1" > "$2"