Request Help with NFS Client Test

Till Straumann strauman at slac.stanford.edu
Tue Jul 17 00:36:04 UTC 2007


Joel Sherrill wrote:
> Till Straumann wrote:
>> Your test program works fine under qemu (0.9.0)
>>
> I have it working now.  Thanks.
>
> How do you get the tap0 interface to stay alive all the time
> so you don't have to start and restart the dhcpd every time
> you start or stop qemu?
Same problem here (plus: I hate running qemu as root but
as the tuntap readme explains, mere ownership and/or write-permission
to the device are not enough for configuring it).

Maybe the 'fd' option could be exploited?

T.
>> netconfig.h:
>>  - use bootp
>>  - driver name "ne1"
>>  - driver attach rtems_ne_driver_attach
>>  - *** irqno  9 *** [qemu uses 9 not 5 !! ]
>>
>> init.c:
>>
>> mount(
>>   & dummy,
>>   & nfs_fs_ops,
>>   RTEMS_FILESYSTEM_READ_WRITE,
>>   "10.0.0.2:/remote",  /* use export applicable to you */
>>   "/home"
>> );
>>
>> I created a iso CD image with grub 0.94 (booting over virtual
>> network with etherboot 5.4.3 also works) and I use
>>
>> qemu -cdrom isoimg -net tap -net nic,model=ne2k_isa
>>
>> /etc/qemu-ifup:
>>
>> ifconfig tap0 10.0.0.2 netmask 255.255.255.0 up
>>
>> /etc/dhcpd.conf (note that 'filename' is not applicable here;
>> we boot using grub. I used this filename for recent etherboot tests)
>>
>> subnet 10.0.0.0 netmask 255.255.255.0 {
>>        option routers 10.0.0.2;
>>        next-server    10.0.0.2;
>>        option ntp-servers 10.0.0.2;
>>        option domain-name-servers 0.0.0.0;
>>        host qemu {
>>         hardware ethernet 52:54:00:12:34:56;
>>         fixed-address 10.0.0.15;
>>         filename "ssrlApps/i386-rtems/pc686/bin/rtems.exe";
>>         option uarg "HELLO=hello";
>>        }
>> }
>>
>> After setting up the NFS server to export to 10.0.0.15
>> and the dhcp server (after launching qemu which creates
>> the tap0 IF and configures it to 10.0.0.2) I boot
>>
>> (grub) kernel (cd)/bin/nfsClientTest.exe
>> (grub) boot
>>
>> Then the test boots and runs just fine. It lists
>> the NFS mount and terminates.
>>
>> HTH
>> -- Till
>>
>>
>> Joel Sherrill wrote:
>>> Till Straumann wrote:
>>>> How do you use qemu/PPC with RTEMS?
>>>> What BSP do you use and how do you boot it?
>>> I wish we could use qemu/ppc with RTEMS. :(
>>>
>>> I recompiled for pc386 and used the regular old Fedora
>>> qemu RPM binary.
>>
>>>
>>> qemu -M isapc -m 8 -boot a -fda /home/joel/qemu/pc386_fda \
>>>   -hda fat:/home/joel/qemu/hd -serial stdio \
>>>   -net nic,vlan=0,macaddr=00:80:7F:22:61:77,model=ne2k_isa \
>>>   -net tap,vlan=0
>>>
>>> /etc/qemu-ifup is:
>>>
>>> #!/bin/sh
>>>   TUN_DEV=$1
>>>   TUN_HOST=10.0.2.2
>>> /sbin/ifconfig $TUN_DEV $TUN_HOST
>>>
>>> I am using the same old qemu specific networkconfig.h but I had
>>> to switch the static IP to 10.0.2.5 to make it work.  As best I can
>>> tell, 10.0.2.4 is used by a virtual SMB server now.  I have attached
>>> this file.
>>>
>>> I didn't have any luck getting the RTEMS application to use DHCP
>>> inside of qemu.
>>>
>>> I can ping, run the netdemo, run httpd and run nfsclient.  But 
>>> nfsclient
>>> doesn't successfully mount the remote filesystem.  It could easily
>>> be a routing problem on qemu.
>>> I appreciate the help.  Ralf is finishing up merging the NFS client and
>>> I want to have a test of it in the network demos.
>>>
>>> --joel
>>>>
>>>> T.
>>>>
>>>> Joel Sherrill wrote:
>>>>> Joel Sherrill wrote:
>>>>>>> In order to make the information provided more useful
>>>>>>> you should:
>>>>>>>
>>>>>>> a) change your BSP so it produces a stack trace
>>>>>>>     from the exception handler (try
>>>>>>>     libcpu/powerpc/shared/src/stack.c: CPU_print_stack())
>>>>>>>
>>>>>>> b) post your binary (elf file) along with the register
>>>>>>>     and stack dump.
>>>>>>>
>>>>>>>       
>>>>>> Wouldn't it be easier to run my test and see if
>>>>>> it works for you with the NFS mounts changed
>>>>>> or is horribly broken?
>>>>>>
>>>>>> The back track shows it is a NULL jump in the
>>>>>> network driver.
>>>>>> 0x00053EA8--> 0x0004E080--> 0x0004E164--> 0x00000006--> 0x0004B5D8
>>>>>> 0x0004C2E0--> 0x00069458--> 0x00098A24--> 0x0009899C
>>>>>>
>>>>>> 0x00053EA8--> CPU_print_stack
>>>>>> 0x0004E080--> C_exception_handler
>>>>>> 0x0004E164--> push_normalized_frame
>>>>>> 0x00000006--> ?????
>>>>>> 0x0004B5D8--> mpc5200_eth_mii_read
>>>>>> 0x0004C2E0--> mpc5200_fec_txDaemon
>>>>>> 0x00069458--> soconnsleep
>>>>>> 0x00098A24--> _Thread_Handler
>>>>>> 0x0009899C--> _Thread_Handler
>>>>>>
>>>>>> Thomas .. can you try this test on your hardware.  I
>>>>>> will commit the NFS client test to the network demos
>>>>>> and hopefully you can track it down.
>>>>>>   
>>>>> Doesn't crash on qemu.  I can't mount a filesystem
>>>>> on the host OS yet but I suspect that I need to
>>>>> add a route.
>>>>> Till could you try to get this working on qemu and
>>>>> see what magic I am missing?  I have to be close.
>>>>>
>>>>> Please.
>>>>>
>>>>>>> That said -- looking at your source code it seems
>>>>>>> that (at least on the 4.7 branch) using a NULL pointer
>>>>>>> for the first argument to RTEMS 'mount' is illegal.
>>>>>>>       
>>>>>> I saw your comment (gripe?) in the README
>>>>>> and fixed it Friday in CVS.  :)
>>>>>>  
>>>>>>> You could also use the convenience wrapper 'nfsMount()'
>>>>>>> which does a DNS lookup (non thread-safe gethostbyname!)
>>>>>>> and creates a mount-point (not nested directories, though)
>>>>>>> if necessary:
>>>>>>>
>>>>>>> nfsMount("server","/export","/home")
>>>>>>>
>>>>>>> both methods are explained in the rtemsNFS README.
>>>>>>>       
>>>>>> I was trying hard to follow that to create
>>>>>> the example.
>>>>>> I tried the nfsMount call and it didn't even change
>>>>>> the behavior.  Maybe this is just tripping a bug in
>>>>>> the NIC driver. <sigh>
>>>>>>
>>>>>> I am going to try this on another BSP and see what happens.
>>>>>>
>>>>>> --joel
>>>>>>  
>>>>>>> HTH
>>>>>>> T.
>>>>>>>     
>>>>>> _______________________________________________
>>>>>> rtems-users mailing list
>>>>>> rtems-users at rtems.com
>>>>>> http://rtems.rtems.org/mailman/listinfo/rtems-users
>>>>>>   
>>>>>
>>>>
>>>>
>>>
>>> ------------------------------------------------------------------------ 
>>>
>>>
>>> /*
>>>  * Network configuration
>>>  *  ************************************************************
>>>  * EDIT THIS FILE TO REFLECT YOUR NETWORK CONFIGURATION     *
>>>  * BEFORE RUNNING ANY RTEMS PROGRAMS WHICH USE THE NETWORK! * 
>>>  ************************************************************
>>>  *
>>>  *  networkconfig.h,v 1.8 2001/08/31 18:11:43 joel Exp
>>>  */
>>>
>>> #ifndef _RTEMS_NETWORKCONFIG_H_
>>> #define _RTEMS_NETWORKCONFIG_H_
>>>
>>> /*
>>>  *  The following will normally be set by the BSP if it supports
>>>  *  a single network device driver.  In the event, it supports
>>>  *  multiple network device drivers, then the user's default
>>>  *  network device driver will have to be selected by a BSP
>>>  *  specific mechanism.
>>>  */
>>>
>>> #undef RTEMS_BSP_NETWORK_DRIVER_NAME
>>> #undef RTEMS_BSP_NETWORK_DRIVER_ATTACH
>>> #define RTEMS_BSP_NETWORK_DRIVER_NAME    "ne1"
>>> #define RTEMS_BSP_NETWORK_DRIVER_ATTACH  rtems_ne_driver_attach
>>>
>>> #ifndef RTEMS_BSP_NETWORK_DRIVER_NAME
>>> #warning "RTEMS_BSP_NETWORK_DRIVER_NAME is not defined"
>>> #define RTEMS_BSP_NETWORK_DRIVER_NAME "ne0"
>>> #endif
>>>
>>> #ifndef RTEMS_BSP_NETWORK_DRIVER_ATTACH
>>> #warning "RTEMS_BSP_NETWORK_DRIVER_ATTACH is not defined"
>>> #define RTEMS_BSP_NETWORK_DRIVER_ATTACH 0
>>> #endif
>>>
>>> #ifdef RTEMS_USE_BOOTP
>>> #undef RTEMS_USE_BOOTP
>>> #endif
>>>
>>> /* #define RTEMS_USE_BOOTP */
>>>
>>> #include <bsp.h>
>>>
>>> /*
>>>  * Define RTEMS_SET_ETHERNET_ADDRESS if you want to specify the
>>>  * Ethernet address here.  If RTEMS_SET_ETHERNET_ADDRESS is not
>>>  * defined the driver will choose an address.
>>>  */
>>> //#define RTEMS_SET_ETHERNET_ADDRESS
>>> #ifdef RTEMS_SET_ETHERNET_ADDRESS
>>> #undef RTEMS_SET_ETHERNET_ADDRESS
>>> #endif
>>>
>>> #if (defined (RTEMS_SET_ETHERNET_ADDRESS))
>>> /* static char ethernet_address[6] = { 0x08, 0x00, 0x3e, 0x12, 0x28, 
>>> 0xb1 }; */
>>> static char ethernet_address[6] = { 0x00, 0x80, 0x7F, 0x22, 0x61, 
>>> 0x77 };
>>>
>>> #endif
>>>
>>> #ifdef RTEMS_USE_LOOPBACK /*
>>>  * Loopback interface
>>>  */
>>> extern void rtems_bsdnet_loopattach();
>>> static struct rtems_bsdnet_ifconfig loopback_config = {
>>>     "lo0",                /* name */
>>>     rtems_bsdnet_loopattach,    /* attach function */
>>>
>>>     NULL,                /* link to next interface */
>>>
>>>     "127.0.0.1",            /* IP address */
>>>     "255.0.0.0",            /* IP net mask */
>>> };
>>> #endif
>>>
>>> /*
>>>  * Default network interface
>>>  */
>>> static struct rtems_bsdnet_ifconfig netdriver_config = {
>>>     RTEMS_BSP_NETWORK_DRIVER_NAME,        /* name */
>>>     RTEMS_BSP_NETWORK_DRIVER_ATTACH,    /* attach function */
>>>
>>> #ifdef RTEMS_USE_LOOPBACK     &loopback_config,        /* link to 
>>> next interface */
>>> #else
>>>     NULL,                /* No more interfaces */
>>> #endif
>>>
>>> #if (defined (RTEMS_USE_BOOTP))
>>>     NULL,                /* BOOTP supplies IP address */
>>>     NULL,                /* BOOTP supplies IP net mask */
>>> #else
>>>     "10.0.2.4",            /* IP address */
>>>     "255.255.255.0",        /* IP net mask */
>>> #endif /* !RTEMS_USE_BOOTP */
>>>
>>> #if (defined (RTEMS_SET_ETHERNET_ADDRESS))
>>>     ethernet_address,               /* Ethernet hardware address */
>>> #else
>>>     NULL,                           /* Driver supplies hardware 
>>> address */
>>> #endif
>>>     0,                /* Use default driver parameters */
>>>     0, /* mtu */
>>>     0, /* rbuf_count */
>>>     0, /* xbuf_count */
>>>     0, /* port */
>>>     9 /* irq */
>>> };
>>>
>>> /*
>>>  * Network configuration
>>>  */
>>> struct rtems_bsdnet_config rtems_bsdnet_config = {
>>>     &netdriver_config,
>>>
>>> #if (defined (RTEMS_USE_BOOTP))
>>>     rtems_bsdnet_do_bootp,
>>> #else
>>>     NULL,
>>> #endif
>>>
>>>     0,            /* Default network task priority */
>>>     0,            /* Default mbuf capacity */
>>>     0,            /* Default mbuf cluster capacity */
>>>
>>> #if (!defined (RTEMS_USE_BOOTP))
>>>     "rtems",        /* Host name */
>>>     "",        /* Domain name */
>>>     "10.0.2.2",        /* Gateway */
>>>     "10.0.0.1",        /* Log host */
>>>     {"10.0.2.3" },    /* Name server(s) */
>>>     {"" },    /* NTP server(s) */
>>>
>>>     /*
>>>      *  A real example -- DO NOT USE THIS YOURSELF!!!
>>>      */
>>>
>>> #if 0
>>>     "dy4",            /* Host name */
>>>     "NOT_oarcorp.com",    /* Domain name */
>>>     "192.168.1.2",       /* Gateway */
>>>     "192.168.1.2",         /* Log host */
>>>     {"192.168.1.2" },    /* Name server(s) */
>>>     {"192.168.1.2" },    /* NTP server(s) */
>>> #endif
>>> #endif /* !RTEMS_USE_BOOTP */
>>>
>>> };
>>>
>>> /*
>>>  * For TFTP test application
>>>  */
>>> #if (defined (RTEMS_USE_BOOTP))
>>> #define RTEMS_TFTP_TEST_HOST_NAME "BOOTP_HOST"
>>> #define RTEMS_TFTP_TEST_FILE_NAME "BOOTP_FILE"
>>> #else
>>> #define RTEMS_TFTP_TEST_HOST_NAME "XXX.YYY.ZZZ.XYZ"
>>> #define RTEMS_TFTP_TEST_FILE_NAME "tftptest"
>>> #endif
>>>
>>> #endif /* _RTEMS_NETWORKCONFIG_H_ */
>>>   
>>
>>
>





More information about the users mailing list