#!/bin/sh # (C) 2003-2007 Willem Jan Hengeveld # Web: http://www.xs4all.nl/~itsme/ # http://wiki.xda-developers.com/ # # $Id: $ # # script to compress a gsm rom image, with bcl.sourceforge.net # as found in recent HTC smartphones blocksize=$[0x60000] split -b $blocksize $1 _bcl for i in _bcl*; do bcl c lz $i _y$i.nb >/dev/null; done rm _bcl* rm -f $2 args= offset=0 for i in _y*.nb; do filesize=`wc -c<$i` args="$args `printf ' -pl %x:%s:%x:%x' $offset $i 0 $filesize`" offset=$[$offset+0x50000] done args="$args `printf ' -pb %x:00' $[$offset-1] `" touch $2 hexedit $2 $args # note : other method of creating aligned blocks: # n=1 # for i in _y*.nb; do # cat $i >> $2 # dd if=/dev/null bs=320k of=$2 seek=$n # n=$[$n+1] # done rm _y*.nb