S3C: Added support for changeable xtal speed
[qemu/mini2440.git] / mini2440 / qemu-local-img-mount.sh
blob95e2ca8177825909db99b6167f50ec4c27c6867c
1 #!/bin/bash
3 # Mount a local .img qemi file on the local host via the new qemu-nbd
4 # The syntax specify the file, the mount point, and the partition
6 # example:
7 # sudo ./mini2440/qemu-local-img-mount.sh mini2440/emdebian_1GB.img /mnt/arm p2
9 # Mounting mini2440/emdebian_1GB.img - /dev/mapper/nbd1p2 to /mnt/arm
10 # /dev/mapper/nbd1p2 903024 225196 631848 27% /mnt/arm
11 # ...
12 # umount /mnt/arm
13 # ./qemu-nbd -d /dev/nbd1
16 if [ ! -f $1 -o ! -d $2 ]; then
17 echo "$0 <image filename> <mount point> [pX]"
18 exit 1
21 nbd=nbd1
23 modprobe nbd
25 ./qemu-nbd -c /dev/$nbd $1
26 kpartx -a /dev/$nbd
28 if [ -b "/dev/mapper/${nbd}$3" ]; then
29 part="/dev/mapper/${nbd}$3"
30 else
31 part="/dev/mapper/${nbd}p1"
34 echo Mounting $1 - $part to $2
36 #ls -l /dev/mapper/${nbd}*
38 mount $part $2
40 df -h|grep $part