network build

D. Peter Siddons siddons at bnl.gov
Wed May 16 19:24:54 UTC 2001


Hi Robert,
    I feel your pain! I have just been through a similar
procedure, with much help from Eric Norum, and finally I
was successful to run netdemo.exe on a system with a 3c509
card. Let me pass on to you the step-by-step instructions
I got from Eric for installing the environment. Forgive me
if you are already along the hard way, but for me this worked
in the end. After that I pass on the things I did to make the 
netdemo compile and run.

*****************************************************************************
Eric wrote:
Here are some notes I put together on how to obtain and install RTEMS. 
It's a bit of a tedious procedure, but it's not impossible.  The notes
are for setting up a generic pc386 target.  Other targets are left as an
execise for the reader....

Please let me know how this works.


Preliminary
=============================================================================
Make some directories.  Start with the RTEMS root directory.   All the
cross-development source/tools/libraries will reside beneath the this
directory.  There should be at least 200 Mbytes of space available on
the drive where the RTEMS root directory is located.  The suggested
location
is /opt/rtems.  If you must place the root of the RTEMS tree in some
other
location, it is a good idea to make a symbolic link from /opt/rtems to
the
actual root of the RTEMS tree.

mkdir -p /opt/rtems
mkdir -p /opt/rtems/src /opt/rtems/build

Add RTEMS cross-development tools to your search path (bash/ksh):
PATH="$PATH:/opt/rtems/bin/"

Set up RTEMS Makefile path (bash/ksh):
export RTEMS_MAKEFILE_PATH=/opt/rtems/i386-rtems/pc386

Step 1.  Obtain cross-development tools
=============================================================================
Download C cross-utilities:
wget
ftp://ftp.oarcorp.com/pub/rtems/snapshots/c_tools/binutils-2.10-2/linux_x86/RPMS
/rtems-base-binutils-2.10-2.i386.rpm
wget
ftp://ftp.oarcorp.com/pub/rtems/snapshots/c_tools/binutils-2.10-2/linux_x86/RPMS
/i386-rtems-binutils-2.10-2.i386.rpm


Download C cross-compiler and libraries:
wget
ftp://ftp.oarcorp.com/pub/rtems/snapshots/c_tools/gcc2.95.2newlib1.9.0-1/RPMS/rt
ems-base-gcc-gcc2.95.2newlib1.9.0-1.i386.rpm   
wget
ftp://ftp.oarcorp.com/pub/rtems/snapshots/c_tools/gcc2.95.2newlib1.9.0-1/RPMS/i3
86-rtems-gcc-gcc2.95.2newlib1.9.0-1.i386.rpm

Install everything:
rpm -i /tmp/rtems-base-binutils-2.10-2.i386.rpm
rpm -i /tmp/i386-rtems-binutils-2.10-2.i386.rpm
rpm -i /tmp/rtems-base-gcc-gcc2.95.2newlib1.9.0-1.i386.rpm
rpm -i /tmp/i386-rtems-gcc-gcc2.95.2newlib1.9.0-1.i386.rpm

****
I am a Debian user, so I used Alien to convert these .rpms to .debs
and then dpkg -i'd the resulting packages. Pete.
****

Step 2.  Obtain RTEMS
=============================================================================
wget
ftp://ftp.oarcorp.com/pub/rtems/snapshots/rtems/ss-20010126/rtems-ss-20010424.tgz
cd /opt/rtems/src
tar xfz /tmp/rtems-ss-20010424.tgz


Step 3.  Configure and install RTEMS
=============================================================================
cd /opt/rtems/build
/opt/rtems/src/rtems-ss-20010126/configure --prefix=/opt/rtems
--target=i386-rtems
make RTEMS_BSP=pc386
make RTEMS_BSP=pc386 install

****
Eric's original instruction had --prefix=/opt/rtems/i386-rtems, but I
found that the
more recent snapshots expect the simple /opt/rtems, otherwise you run
into trouble with
relative paths in the build. Pete.
****

At this point you may want to try some of the sample RTEMS applications
in /opt/rtems/i386-rtems/pc386/samples/
The hello.exe, ticker.exe, and paranoia.exe sample applications are good
ones to try.  If you can run these on your target machine you can be
reasonably confident that other applications will also work.

****
I also downloaded
ftp://ftp.oarcorp.com/pub/rtems/releases/4.5.0/contrib/pc386_lilo_image/
since I was unfamiliar with grub. It has worked fine for me so far.
Pete.
****
*****************************************************************************
OK, so now to the network card stuff.
Which driver gets used seems to be defined in 
/opt/rtems/src/rtems-ss-20010326/c/src/lib/libbsp/i386/pc386/include/bsp.h
where you will find a list of definitions of the form:

#define BSP_NE2000_NETWORK_DRIVER_NAME      "ne1"
#define BSP_NE2000_NETWORK_DRIVER_ATTACH    rtems_ne_driver_attach

You need to add to that list an apropriate pair of entries for the 3c509
driver, i.e. 

#define BSP_3C509_NETWORK_DRIVER_NAME      "ep0"
#define BSP_3C509_NETWORK_DRIVER_ATTACH    rtems_3c509_driver_attach


It is important that the name be "ep0". As far as I can tell, the
"ep" is hard-coded in the driver, and it numbers all the cards it finds
as ep0, ep1 etc. Then at the end of the list in bsp.h you need to switch
the lines

#define RTEMS_BSP_NETWORK_DRIVER_NAME   BSP_DEC21140_NETWORK_DRIVER_NAME
#define RTEMS_BSP_NETWORK_DRIVER_ATTACH
BSP_DEC21140_NETWORK_DRIVER_ATTACH

to:
#define RTEMS_BSP_NETWORK_DRIVER_NAME   BSP_3C509_NETWORK_DRIVER_NAME
#define RTEMS_BSP_NETWORK_DRIVER_ATTACH BSP_3C509_NETWORK_DRIVER_ATTACH

There is one more hiccup. The 3c509.c code must be rather old, because
it
is missing one parameter in its call:

int rtems_3c509_driver_attach (struct rtems_bsdnet_ifconfig *config )

should read:

int rtems_3c509_driver_attach (struct rtems_bsdnet_ifconfig *config, int
attach )

The build complains about it, so it needs to be changed.
I don't know enough yet to know what to do with the extra parameter, it
is supposed
to allow the same call to unattach an interface, but none of the drivers
seem to 
implement it. I just exited with return(0) if this parameter was zero on
entry.

Using pc386-lilo is painless if you have used lilo in Linux. make
zImage;
make BOOTIMAGE=<program executable> zdisk
will give you a bootable floppy.

That all worked for me. I hope it helps. This system really needs
step-by-step
info like this for newbies like me to even get started, and I'm
incredibly grateful
for Eric Norum's patience with me. I hope by sending this to the list,
other people
can benefit too.

Pete Siddons.



rwas rwas wrote:
> 
> I managed to fake my way through my theory on how to
> do this and got rtems to find the nic card.
> 
> However, I get the error:
> 
> Can't create initial socket: too many open files in
> system
> 
> as well as:
> 
> No routes!
> 
> Help?
> 
> Robert Wasierski
> 
> --- rwas rwas <mc68332 at yahoo.com> wrote:
> > Hello,
> >
> > I've successfully built and run the dist rtems-4.5.0
> > on redhat 6.2. My target was pc386. I've been able
> > to
> > run simple examples like "hello-world".
> >
> > I recently attempted to run the rpc_demo from
> > netdemos-4.5.0.
> >
> > I get:
> >  RTEMS: DEC PCI network card not found !!
> >
> > Which is interesting because the bsp for the pc386
> > does'nt have a DEC PCI card listed. It has an NE2000
> > driver and a 3c509 driver.
> >
> > After digging around I find references to:
> > RTEMS_BSP_NETWORK_DRIVER_NAME.
> >
> > In the bsp target directory I find:
> >  bsp.h.
> >
> > In it I find:/*
> >  * Network driver configuration
> >  */
> >
> > .
> > .
> > .
> > struct rtems_bsdnet_ifconfig;
> > extern int rtems_wd_driver_attach (struct
> > rtems_bsdnet_ifconfig *config);
> > extern int rtems_dec21140_driver_attach (struct
> > rtems_bsdnet_ifconfig *config);
> >
> >
> > #if 0
> > #define RTEMS_BSP_NETWORK_DRIVER_NAME "wd1"
> > #define RTEMS_BSP_NETWORK_DRIVER_ATTACH
> > rtems_wd_driver_attach
> > #endif
> >
> > #if 1
> > #define RTEMS_BSP_NETWORK_DRIVER_NAME "dc1"
> > #define RTEMS_BSP_NETWORK_DRIVER_ATTACH
> > rtems_dec21140_driver_attach
> > #endif
> > .
> > .
> > .
> >
> > My question is: Is this file where rtems is made
> > aware
> > of the drivers?
> >
> > If so, do I need to follow the example I see here
> > for
> > "wd" and "dec" drivers and hack in one (driver name)
> > specific for this bsp?
> >
> > If this is so, why was'nt this change already made
> > to
> > bsp.h for the i386/pc386 target bsp?
> >
> >
> > Robert Wasierski
> > Dynacs Engineering
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Auctions - buy the things you want at great
> > prices
> > http://auctions.yahoo.com/
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great prices
> http://auctions.yahoo.com/



More information about the users mailing list