1. fix the bug of sm502 pci configuration r/w
[qemu/qemu-loongson.git] / gdium_bios_pad.sh
blob30e8c384c6e90fdc47835940da2851fbae51ddfc
1 #!/bin/bash
2 # Copyright (C) 2009 yajin (yajin@vm-kernel.org)
4 # pad the BIOS image of gdium to 512K bytes
7 # gdium_bios_pad.sh <original_bios_image> <output_bios_image> <output_bios_size>
11 if [ ! -r "$1" ]; then
12 echo "Usage: $0 <original_bios_image> <output_bios_image> <output_bios_size>"
13 exit -1
16 original_bios_image=$1
17 bios_image_name=$2
18 bios_image_len=$3
19 bios_kbs=$[$bios_image_len/1024]
22 if [ -e "$2" ]; then
23 echo $bios_image_name" exist.Delete it first!"
24 rm -rf $bios_image_name
27 echo -en \\0377\\0377\\0377\\0377\\0377\\0377\\0377\\0377 > .8b
28 cat .8b .8b >.16b
29 cat .16b .16b >.32b
30 cat .32b .32b .32b .32b >.128b
31 cat .128b .128b .128b .128b >.512b
32 cat .512b .512b >.1024b
34 i=0
35 while [ $i -lt $bios_kbs ]
37 cat .1024b>>$bios_image_name
38 i=$[$i + 1]
39 done
41 dd if=$original_bios_image of=$bios_image_name conv=notrunc seek=0
42 rm .8b .16b .32b .128b .512b .1024b