akaros/scripts/kvm-up.sh
<<
>>
Prefs
   1#!/bin/bash
   2# example of brho's kvm-up.sh, which I run every time I boot my dev machine.
   3# you'll need to change paths, usernames, and other things for your machine.
   4
   5# set up networking.  feel free to comment this out.
   6modprobe tun
   7brctl addbr br0
   8tunctl -u brho -t tap0
   9ifconfig tap0 0.0.0.0 up
  10brctl addif br0 tap0
  11sleep 2
  12/etc/init.d/net.br0 start
  13/etc/init.d/dnsmasq start
  14
  15# set up some variables
  16MNTDIR=/home/brho/classes/ros/ros-kernel/mnt
  17MNTPOINT=$MNTDIR/hdd
  18HDDIMG=$MNTDIR/hdd.img
  19
  20# mount the hdd image
  21modprobe loop max_part=10
  22losetup /dev/loop5 $HDDIMG
  23sleep 5
  24mount -o sync /dev/loop5p1 $MNTPOINT
  25chown -R brho:brho $MNTPOINT
  26
  27## Alternative method if you have the loopback built into the kernel
  28## mount the hdd image with a hardcoded offset, specific to the image we
  29## provide
  30#losetup /dev/loop5 $HDDIMG
  31#losetup -o 1048576 /dev/loop6 /dev/loop5
  32#mount -o sync /dev/loop6 $MNTPOINT
  33#chown -R brho:brho $MNTPOINT
  34
  35