source: rtems-testing/qemu-support/qemu-nic @ 00c0764

Last change on this file since 00c0764 was ef065c7, checked in by Joel Sherrill <joel.sherrill@…>, on May 15, 2012 at 9:07:33 PM

rtems-testing - Remove CVS Ids (manual edits)

  • Property mode set to 100755
File size: 1.4 KB
Line 
1#!/bin/sh
2#
3# Run qemu with network interface if root.
4#
5# TODO:
6#    -s for gdb from command line
7
8QEMUDIR=/home/joel
9
10fatal()
11{
12  echo $*
13  echo "Usage: [-v] [-n NIC]"
14  echo ""
15  echo "Supported NICs: e1000 i82559er i82551 i82557b rtl8139 ne2k_isa"
16  exit 1
17}
18
19nic="none"
20verbose="no"
21
22while getopts "vn:" OPT
23do
24 case "$OPT" in
25   v) verbose="yes";;
26   n) nic="$OPTARG";;
27   *) fatal;;
28 esac
29done
30
31shiftcount=`expr $OPTIND - 1`
32shift $shiftcount
33
34args=$*
35
36GRAPHICS="-serial stdio"
37#GRAPHICS="${GRAPHICS} --nographic --monitor null"
38
39# Model - isapc for ISA PC or pc for PCI
40MODEL="-M pc"
41NIC=
42
43case ${nic} in
44  # PCI NIC model options that work with RTEMS:
45  #   fxp: i82559er, i82551, i82557b
46  #   rl:  rtl8139
47  #   em:  e1000
48  e1000|i82559er|i82551|i82557b|rtl8139) NIC=${nic};;
49  # ISA NIC model: ne2k_isa
50  ne2k_isa) MODEL="-M isapc" ; NIC=${nic} ;;
51  none) ;;
52  *)
53     fatal Unknown NIC ${nic}
54     ;;
55esac
56 
57ARGS="${MODEL} -m 128 \
58    -boot a -fda ${QEMUDIR}/qemu/pc386_fda \
59    -hda fat:${QEMUDIR}/qemu/hd  --no-reboot"
60if [ ${nic} != "none" ] ; then
61  if [ $EUID -eq 0 ] ; then
62    NICARGS="\
63      -net nic,model=${NIC} \
64      -net nic,macaddr=00:80:7F:22:61:77 \
65      -net tap,script=/etc/qemu-ifup"
66  else
67     echo "*** You are not root -- ignoring request for NIC ***"
68  fi
69
70  if [ ! -r /etc/qemu-ifup ] ; then
71    echo /etc/qemu-ifup not found
72    exit 1
73  fi
74
75  qemu ${ARGS} ${GRAPHICS} ${NICARGS}
76else
77  qemu ${ARGS} ${GRAPHICS}
78fi
79
80exit 0
Note: See TracBrowser for help on using the repository browser.