1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
#! /bin/sh
#rom extension extractor (ported to shell from the pascal version of 1997)
#see http://www.firmware.com/support/bios/romext.htm for more info
#extracts system, scsi, video bios
#gurkan@linuks.mine.nu, www.linuks.mine.nu
#scan from c0000 - f0000 in 512 byte blocks
#U{l}{code}
#l*512=length of the code including headers
#200 hex = 512, dd wants 512 blocks
case "$@" in
-nbc|--i-dont-have-no-bc)
start=1536
last=1920
;;
*)
start=`echo "ibase=16;C0000/200"|bc`
last=`echo "ibase=16;F0000/200"|bc`
;;
esac
for a in `seq $start 1 $last`; do
b=`dd if=/dev/mem skip=$a count=1 2>/dev/null |head -c2`
case "$@" in
-nbc|--i-dont-have-no-bc)
location=$[a*512]
;;
*)
location=`echo "obase=16; $a*512"|bc`
;;
esac
echo -ne "[1GPlease wait, scanning... $location"
if [ "$b" = "U" ]; then
size=`dd if=/dev/mem skip=$a count=1 2>/dev/null |tail -c+3`
s=`echo $size |perl -e 'print ord(<>);'`
case "$@" in
-nbc|--i-dont-have-no-bc)
file=$[a*512]
size=$[s*512]
;;
*)
file=`echo "obase=16; $a*512"|bc`
size=`echo $s*512 |bc`
;;
esac
echo -e "\nFound something at $file ($size)"
dd if=/dev/mem of=${file}.rom skip=$a count=$s 2>/dev/null
strings ${file}.rom |awk '{if (length($0)>40)print $0}' |grep "[A-Z]"
fi
done
#save bios rom
#case "$@" in
# -nbc|--i-dont-have-no-bc)
# start=1920
# count=128
# ;;
# *)
# start=`echo "ibase=16;F0000/200"|bc`
# count=`echo 1*65536/512|bc`
# ;;
#esac
#echo -e "\nFound system bios at F0000 (65536)"
#dd if=/dev/mem of=F0000.rom skip=$start count=$count 2>/dev/null
|