Advertisement
zcutlip

debian qemu scripts

Apr 9th, 2013
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. $ cat /etc/network/interfaces
  2. auto lo
  3. iface lo inet loopback
  4.  
  5. auto eth0
  6. iface eth0 inet dhcp
  7.  
  8. #auto br0
  9. iface br0 inet dhcp
  10. pre-up tunctl -t tap0 -g tuntap
  11. pre-up tunctl -t tap1 -g tuntap
  12. pre-up ip link set tap0 up
  13. pre-up ip link set tap1 up
  14. bridge_ports eth0 tap0 tap1
  15. bridge_stp off
  16. bridge_maxwait 0
  17. bridge_fd 0
  18. post-down ip link set tap0 down
  19. post-down ip link set tap1 down
  20. post-down tunctl -d tap0
  21. post-down tunctl -d tap1
  22.  
  23.  
  24. $ cat bin/debqemu.sh
  25. #!/bin/sh
  26.  
  27. quit()
  28. {
  29. ret=0
  30. if [ $# -gt 0 ];
  31. then
  32. ret=$1
  33. shift
  34. fi
  35. if [ $# -gt 0 ];
  36. then
  37. printf "$1\n"
  38. shift
  39. fi
  40. exit $ret
  41. }
  42.  
  43. image=""
  44. kernel=""
  45. if [ "x$1" = "xle" ];
  46. then
  47. qemu=qemu-system-mipsel
  48. image="$HOME/code/debian-qemu/le/debian_squeeze_mipsel_standard.qcow2"
  49. kernel="$HOME/code/debian-qemu/le/vmlinux-2.6.32-5-4kc-malta"
  50. iface=tap1
  51. # reset /etc/udev/rules.d/70-persistent-net.rules in qemu guest if you change mac addrs
  52. macaddr="52:54:00:12:34:57"
  53. elif [ "x$1" = "xbe" ];
  54. then
  55. qemu=qemu-system-mips
  56. image="$HOME/code/debian-qemu/be/debian_squeeze_mips_standard.qcow2"
  57. kernel="$HOME/code/debian-qemu/be/vmlinux-2.6.32-5-4kc-malta"
  58. iface=tap0
  59. # reset /etc/udev/rules.d/70-persistent-net.rules in qemu guest if you change mac addrs
  60. macaddr="52:54:00:12:34:56"
  61. else
  62. quit 1 "Specify le or be endianness."
  63. fi
  64.  
  65. if [ ! -d ~/code/debian-qemu ];
  66. then
  67. sudo mount /srv/endor/code || quit 1 "Failed to mount /srv/endor/code";
  68. fi
  69.  
  70. echo "Stopping eth0, starting br0."
  71.  
  72. bridge.sh || quit 1 "Failed to start br0."
  73.  
  74. echo "Starting Debian system QEMU session."
  75.  
  76.  
  77. $qemu -net nic,macaddr=$macaddr -net tap,ifname=$iface,script=no,downscript=no -nographic -M malta -kernel $kernel -hda $image -append "root=/dev/sda1 console=tty0"
  78.  
  79. $ cat /home/zach/bin/bridge.sh
  80. #!/bin/sh
  81.  
  82. sudo ifdown eth0
  83. sudo ifup br0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement