help: failed to use qemu

Till Straumann strauman at slac.stanford.edu
Wed Feb 11 21:16:39 UTC 2009


Daron Chabot wrote:
> I've had some limited success with the Etherboot/TFTP approach to  
> launching RTEMS networking apps with Qemu. Specifically, Till's  
> GeSys-2.4 (using TFTP FS). However, I'm getting ne2000 error messages  
> (see Qemu output below).
>
> Command line:
> ---------------------------------------------
> 	qemu -no-reboot -m 128 -boot n -tftp ./o-optimize -bootp /rtems.exe - 
> serial stdio
> 		-net nic,macaddr=00:ab:cd:ef:12:34 -net user,hostname=foo.bar
You forgot to choose the NIC model:

-net nic,model=ne2k_isa,macaddr=00:ab:cd:ef:12:34
>
> RTEMS network config:
> ---------------------------------------------
> static char ethernet_address[6] = { 0x00, 0xab, 0xcd, 0xef, 0x12,  
> 0x34 };
> static struct rtems_bsdnet_ifconfig netdriver_config[1] = {{
>      NIC_NAME,   /* name */
>      NIC_ATTACH, /* attach function */
>      0,          /* link to next interface */
>      FIXED_IP_ADDR,
>      FIXED_NETMASK,
>      ethernet_address,
>      irno:9,
>      port:0xc100
you must use the port# and irq # matching hardcoded qemu settings
(first ISA ne2k uses port 0x300, IRQ 9)

The default RTEMS settings (port 0x300, IRQ 5 [iirc]) don't work
(since the IRQs don't match up).

Hence you can use

irno: 9
port: 0x300

or the GeSys values

irno: 9
port: 0

(driver falls back on 0x300)

BTW: Is this 0xc100 value in a GeSys version I posted or sent you --
     AFAIK, GeSys-2.4 comes with the correct value of 0 and a comment
     regarding irno=9 ?


Anyways, I created a cdrom bootimage containing grub and
the binary you sent me and said

till at tillbook:~/box$ /opt/qemu-0.9.0/bin/qemu \
             -L /opt/qemu-0.9.0/share/qemu/ \
             -cdrom iso \
             -serial stdio \
             -net nic,model=ne2k_isa,macaddr=00:ab:cd:ef:12:34 \
             -net user \
             -s

I then connected gdb while grub was waiting

(gdb) file rtems.exe
(gdb) target remote localhost:1234
(gdb) break Init
(gdb) cont

and let the thing come up and hit the breakpoint.
At the breakpoint I patched the port

(gdb) set rtems_bsdnet_config.ifconfig->port = 0
(gdb) cont

and boom - I was in business ;-)

Could not open '/dev/kqemu' - QEMU acceleration layer not activated
Welcome to RTEMS GeSys
This system $Name: GeSys_2_4 $ was built on 20090211CST11:17:21
$Id: init.c,v 1.43 2008/03/22 20:36:13 guest Exp $
Installing TIOCGWINSZ line discipline: ok.
To skip initialization, press a key now...
network device 'ne1' <00:AB:CD:EF:12:34> initialized on port 0x300, irq 9
bootpc_init: using network interface 'ne1'
ne_init()

ne configuration:
ethernet addr: 0 AB CD EF 12 34
irq = 9
port = 0x300
accept_broadcasts = 1
byte_transfers = 0
ne_init_hardware()
ne_init_irq_handler(9)
ne_interrupt_on()
ne_init()

ne configuration:
ethernet addr: 0 AB CD EF 12 34
irq = 9
port = 0x300
accept_broadcasts = 1
byte_transfers = 0
bootpc hw address is 0:ab:cd:ef:12:34
Sne_tx_daemon
Uploading NE2000 packet
vTransmitting NE2000 packet
 >!NE2000 status 0x3 (8259 enabled: no; mask: FFEA)
ne_rx_daemon: start page 4C; current page 4F
<My ip address is 10 .0 .2 .15
Ignoring BOOTP/DHCP option code 53
Domain Name Server is 10 .0 .2 .3
Ignoring BOOTP/DHCP option code 51
Subnet mask is 255 .255 .255 .0
Server ip address is 10 .0 .2 .2
Gateway ip address is 10 .0 .2 .2
Log server ip address is 10 .0 .2 .2
ne_init()

ne configuration:
ethernet addr: 0 AB CD EF 12 34
irq = 9
port = 0x300
accept_broadcasts = 1
byte_transfers = 0
STrying symfile 'BUILTIN', system script '(NONE)'
ne_tx_daemon
Uploading NE2000 packet
vTransmitting NE2000 packet
 >!NE2000 status 0x2 (8259 enabled: no; mask: FFEA)
Type 'cexpsh.help()' for help (no quotes)
Cexp>

HTH
-- Till
> }};
>
> struct rtems_bsdnet_config rtems_bsdnet_config = {
>      &netdriver_config[0],         /* Network interface */
> #ifdef NIC_NAME
>      RTEMS_DO_BOOTP,/* Use BOOTP to get network configuration */
> #else
>      0,                        /* Use BOOTP to get network  
> configuration */
> #endif
>      NETWORK_TASK_PRIORITY,    /* Network task priority */
> #if   defined(MEMORY_CUSTOM)
>      MEMORY_CUSTOM,
> #elif defined(MEMORY_SCARCE)
>      100*1024,                 /* MBUF space */
>      200*1024,                 /* MBUF cluster space */
> #elif defined(MEMORY_HUGE)
>      2*1024*1024,              /* MBUF space */
>      5*1024*1024,              /* MBUF cluster space */
> #else
>      180*1024,                 /* MBUF space */
>      350*1024,                 /* MBUF cluster space */
> #endif
> };
>
> Qemu stdout:
> -------------------------------------------------------------------
>
> djc at TooLBox--> qemu -no-reboot -m 128 -boot n -tftp ./o-optimize - 
> bootp /rtems.exe -serial stdio -net nic,macaddr=00:ab:cd:ef:12:34 - 
> net user,hostname=foo.bar2009-02-11 08:13:12.358 i386-softmmu[27925] KO
> Welcome to RTEMS GeSys
> This system $Name: GeSys_2_4 $ was built on 20090210CST22:02:10
> $Id: init.c,v 1.43 2008/03/22 20:36:13 guest Exp $
> Installing TIOCGWINSZ line discipline: ok.
> To skip initialization, press a key now...
> network device 'ne1' <00:AB:CD:EF:12:34> initialized on port 0xC100,  
> irq 9
> bootpc_init: using network interface 'ne1'
> bootpc hw address is 0:ab:cd:ef:12:34
> My ip address is 10 .0 .2 .15
> Ignoring BOOTP/DHCP option code 53
> Domain Name Server is 10 .0 .2 .3
> Ignoring BOOTP/DHCP option code 51
> Hostname is foo.bar
> Boot file is /rtems.exe
> Subnet mask is 255 .255 .255 .0
> Server ip address is 10 .0 .2 .2
> Gateway ip address is 10 .0 .2 .2
> Log server ip address is 10 .0 .2 .2
> Trying symfile 'BUILTIN', system script 'st.sys'
> Type 'cexpsh.help()' for help (no quotes)
> 'st.sys':
> ne2000: device timeout
> ne2000: device timeout
> ne2000: device timeout
> ne2000: device timeout
> ne2000: device timeout
> opening script file: I/O error
> Type 'cexpsh.help()' for help (no quotes)
> Cexp>cexpMod
> cexpModIterate()                cexpModuleInitOnce()
> cexpModuleDumpGdbSectionInfo()  cexpModuleLoad()
> cexpModuleFindByName()          cexpModuleName()
> cexpModuleFree()                cexpModuleUnload()
> cexpModuleInfo()
> Cexp>cexpModuleInfo()
> Module 'SYSTEM-BUILTIN' (0x008bcb94):
>    Text starts at: 0xdeadbeef
> 0x00000000 (0)
> Cexp>
>
>
> Need a little help here...
>
>
> -- dc
>
> On 10-Feb-09, at 12:43 PM, Joel Sherrill wrote:
>
>> I am happy to report that the if_fxp (Intel i8255x driver)
>> works with QEMU with any of the following NIC models
>> specified:
>>
>> i82551
>> i82557b
>> i82559er
>>
>> That is in addition to the ne2k_isa we historically used.
>> That leaves pcnet, ne2k_pci,  pcnet, and rtl8139 as the
>> remaining NICs simulated for i386 qemu that we
>> don't support.
>>
>> --joel
>>
>> Joel Sherrill wrote:
>>> Daron Chabot wrote:
>>>
>>>> Joel Sherrill wrote:
>>>>
>>>>> Daron Chabot wrote:
>>>>>
>>>>>> On 10-Feb-09, at 7:02 AM, PowerMan wrote:
>>>>>>
>>>>>>
>>>>>>> I do it as the follow steps:
>>>>>>> 1. download QEMU from  http://bellard.org/qemu/qemu-0.9.1- 
>>>>>>> i386.tar.gz
>>>>>>> 2. install it
>>>>>>>     tar xfz qemu-0.9.1-i386.tar.gz -C /
>>>>>>> 3. download rtems floppy image from ftp server :
>>>>>>>     ftp://ftp.rtems.com/pub/rtems/qemu/i386-pc/rtems-boot.img
>>>>>>> 4. download ftp://ftp.rtems.com/pub/rtems/qemu/i386-pc/rtems- 
>>>>>>> grub.cfg
>>>>>>>     and copy it to my root directory /
>>>>>>> 5. mkdir /capture
>>>>>>>    cp hello.exe /capture/capture.exe
>>>>>>> 6. run qemu
>>>>>>>     qemu -fda rtems-boot.img -boot a -hda /dev/sda
>>>>>>>
>>>>>>> but the capture.exe (which is actually helloworld I build  
>>>>>>> with  rtems-4.7.3) does not run as I excepted.
>>>>>>> This capture.exe could run on my host by modifying /boot/grub/ 
>>>>>>> menu.lst
>>>>>>> I type the following commands in grub:
>>>>>>> grub> set root=(hd0,0)
>>>>>>> grub> set kernel=/capture/capture.exe
>>>>>>> grub> boot
>>>>>>>
>>>>>>> then grub told me:
>>>>>>> error: no loaded kernel
>>>>>>>
>>>>>>> I type the following commands in grub:
>>>>>>> grub> set root=(hd0,0)
>>>>>>> grub> multiboot /capture/capture.exe
>>>>>>>
>>>>>>> then grub told me:
>>>>>>> error: Couldn't open file
>>>>>>>
>>>>>>> Could somebody help me?
>>>>>>>
>>>>>>> My host is openSUSE 11.1, my disk information is:
>>>>>>> /dev/sda1              3091312    516528   2417752  18% /
>>>>>>> udev                    252876      5428    247448   3% /dev
>>>>>>> /dev/sda8              3605268    153972   3268160   5% /home
>>>>>>> /dev/sda7              1130540    221192    851920  21% /tmp
>>>>>>> /dev/sda9              6412052   3541120   2545216  59% /usr
>>>>>>> /dev/sda6              1130540    193556    879556  19% /var
>>>>>>>
>>>>>>> I type the following commands in grub:
>>>>>>> grub> ls
>>>>>>>
>>>>>>> then grub told me:
>>>>>>> (fd0) (hd0) (hd0,0) (hd0,4) (hd0,5) (hd0,6) (hd0,7) (hd0,8)
>>>>>>>
>>>>>>> they didn't match my host disk partition number
>>>>>>>
>>>>>>>
>>>>>> Grub is not a requirement for using Qemu, and may actually  
>>>>>> complicate  the matter.
>>>>>>
>>>>>> I've had success with variations on the following command:
>>>>>>
>>>>>>     qemu -no-reboot -m 128 -boot n -tftp /path/to/exe/parent/ 
>>>>>> directory - bootp /yourRtemsApp.exe -serial stdio
>>>>>>
>>>>> I can make this work for hello and ticker but not for networked
>>>>> applications.  Do you have a way to run networked applications
>>>>> this way?
>>>>>
>>>> Nope. Sorry. I haven't found the magic qemu-cmdline/network- 
>>>> config combo yet. It has been awhile since I was playing around  
>>>> with Qemu and networked RTEMS apps, but I recall that one of the  
>>>> problems for me was that mac os x has no concept of tun/tap  
>>>> interfaces (at least not natively; there is a third-party driver,  
>>>> but I had no luck with it).
>>>>
>>>> I'll revisit things tonight and see if I figure anything out.
>>>>
>>>>
>>> I can run networked applications just not after using tftp/bootp.
>>> I have to boot them from a floppy.
>>>
>>> I am curious if the Intel FXP driver works on qemu.  :)
>>>
>>>>> I am trying to have some demos for a GSoC/RTEMS presentation
>>>>> on Monday at University of Tennessee at Chattanooga and was
>>>>> actually trying this out today. :)
>>>>>
>>>>> --joel
>>>>>
>>>
>>>
>>
>> -- 
>> Joel Sherrill, Ph.D.             Director of Research & Development
>> joel.sherrill at OARcorp.com        On-Line Applications Research
>> Ask me about RTEMS: a free RTOS  Huntsville AL 35805
>>   Support Available             (256) 722-9985
>>
>>
>
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.com
> http://rtems.rtems.org/mailman/listinfo/rtems-users




More information about the users mailing list