Changes between Version 25 and Version 26 of Developer/Simulators/QEMU


Ignore:
Timestamp:
Jul 18, 2008, 9:12:08 PM (11 years ago)
Author:
JoelSherrill
Comment:

/* Running RTEMS TCP/IP Applications */ New text

Legend:

Unmodified
Added
Removed
Modified
  • Developer/Simulators/QEMU

    v25 v26  
    148148= Running RTEMS TCP/IP Applications =
    149149
    150 TBD
     150
     151You can run RTEMS applications that use TCP/IP on QEMU.  It requires getting a few very picky things just right so hang on and this section should help.  The RTEMS application running on QEMU is executing on a virtual machine and thus QEMU must provide a simulation of a real NIC whose I/O is relayed or tunneled through a virtual interface to the real world.  For most testing purposes, it is sufficient to have the connection work between just your QEMU session and the host computer running QEMU.  AFAIK, for this to work, you must execute qemu as root.  In all other cases of running QEMU with RTEMS, you can be a regular user.  So the lesson here is only turn on TCP/IP support in QEMU when you really need it.
     152
     153This is the script I use to start QEMU 0.9.1 with networking enabled:
     154
     155{{{
     156qemu -cpu 486 -m 8 -boot a \
     157    -fda /home/joel/qemu/pc386_fda \
     158    -hda fat:/home/joel/qemu/hd \
     159    -net nic,macaddr=00:80:7F:22:61:77,model=ne2k_isa \
     160    -net tap,script=/etc/qemu-ifup  \
     161    -serial stdio --no-reboot
     162}}}
     163
     164This says you are simulating an i486 CPU, booting from the floppy image ''/home/joel/qemu/pc386_fda'' and using the directory ''/home/joel/qemu/hd'' as the HDA presented to the QEMU session as a FAT filesystem.  In my case, the floppy has GRUB on and always boots
     165quickly to run the file ''test.exe'' from HDA.  This is done to assist in automating test execution. All the script has to do it copy an executable to  ''/home/joel/qemu/hd/test.exe'' and it will quickly run.
     166
     167This RTEMS BSP is built with the console redirected to COM1 so ''-serial stdio'' ensures that the COM1 output goes to stdout.  This makes it easier to redirect the output.
     168
     169The QEMU session is configured to have a single NIC which is a Novell NE2000 ISA NIC with the specified MAC address.  This matches the configuration used by the file ''network-demos/networkconfig-qemu.h'' from RTEMS.  The network uses a GNU/Linux tap interface per the QEMU documentation.  You may have to do a ''modprobe tap'' command to get this to work and you will definitely have to have the script ''/etc/qemu-ifup'' with the following contents.
     170
     171{{{
     172#!/bin/sh
     173TUN_DEV=$1
     174TUN_HOST=10.0.2.2
     175/sbin/ifconfig $TUN_DEV $TUN_HOST
     176exit 0
     177}}}
     178
     179This matches the defaults as presented in the QEMU manual. The single network interface available to the RTEMS application will have the IP address 10.0.2.5.  All of the RTEMS network demos can run in this environment given proper configuration.
    151180= Debugging with QEMU =
    152181