Notice: We have migrated to GitLab launching 2024-05-01 see here:

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

07/18/08 21:12:08 (16 years ago)

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


  • Developer/Simulators/QEMU

    v25 v26  
    148148= Running RTEMS TCP/IP Applications =
    150 TBD
     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.
     153This is the script I use to start QEMU 0.9.1 with networking enabled:
     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
     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.
     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.
     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.
     175/sbin/ifconfig $TUN_DEV $TUN_HOST
     176exit 0
     179This matches the defaults as presented in the QEMU manual. The single network interface available to the RTEMS application will have the IP address  All of the RTEMS network demos can run in this environment given proper configuration.
    151180= Debugging with QEMU =