wok-next diff linux/stuff/bootloader.sh @ rev 9129
Up: qt4 to 4.7.2.
author | Christopher Rogers <slaxemulator@gmail.com> |
---|---|
date | Sat Mar 05 16:37:25 2011 +0000 (2011-03-05) |
parents | 39cb6f60c89e |
children | cfdc7a358251 |
line diff
1.1 --- a/linux/stuff/bootloader.sh Thu Oct 14 17:08:12 2010 +0200 1.2 +++ b/linux/stuff/bootloader.sh Sat Mar 05 16:37:25 2011 +0000 1.3 @@ -58,10 +58,11 @@ 1.4 # usage: store16 offset data16 file 1.5 store16() 1.6 { 1.7 - echo $(( $2 + 0x10000 )) | \ 1.8 - awk '{ printf "\\\\x%02X\\\\x%02X",$1%256,($1/256)%256 }' | \ 1.9 - xargs echo -en | \ 1.10 - dd bs=2 conv=notrunc of=$3 seek=$(( $1 / 2 )) 2> /dev/null 1.11 + n=$2; i=2; while [ $i -ne 0 ]; do 1.12 + printf '\\\\x%02X' $(($n & 255)) 1.13 + i=$(($i-1)); n=$(($n >> 8)) 1.14 + done | xargs echo -en | \ 1.15 + dd bs=2 conv=notrunc of=$3 seek=$(( $1 / 2 )) 2> /dev/null 1.16 [ -n "$DEBUG" ] && printf "store16(%04X) = %04X\n" $1 $2 1>&2 1.17 } 1.18 1.19 @@ -69,9 +70,10 @@ 1.20 # usage: storelong offset data32 file 1.21 storelong() 1.22 { 1.23 - echo $2 | awk '{ printf "\\\\x%02X\\\\x%02X\\\\x%02X\\\\x%02X", 1.24 - $1%256,($1/256)%256,($1/256/256)%256,($1/256/256/256)%256 }' | \ 1.25 - xargs echo -en | \ 1.26 + n=$2; i=4; while [ $i -ne 0 ]; do 1.27 + printf '\\\\x%02X' $(($n & 255)) 1.28 + i=$(($i-1)); n=$(($n >> 8)) 1.29 + done | xargs echo -en | \ 1.30 dd bs=4 conv=notrunc of=$3 seek=$(( $1 / 4 )) 2> /dev/null 1.31 [ -n "$DEBUG" ] && printf "storelong(%04X) = %08X\n" $1 $2 1>&2 1.32 }