network support: libbsdport or rtems-libbsd for e1000 network chips on i386?

Chris Johns chrisj at rtems.org
Sun Oct 30 16:09:05 UTC 2016


On 29/10/16 1:14 pm, RMDerbes wrote:
> 
> I need to deploy rtems on a x86 host that has 2 Intel GbE network
> interfaces: I218 and I210.
> I'm a bit confused with rtems networking support, because there are the
> rtems-libbsd and the libbsdport projects
> in rtems git repo, although libbsdport sources are much older and only
> in Joel's repo.
> Which one may be use?

Use libbsd.

> It seems to me that drivers for these interfaces (I210 and I218) are
> implemented in rtems-libbsd/freebsd/sys/dev/e1000 folder,
> and I have built successfully a i386 BSP (disabling network support) and
> libbsd.
> I'm stuck now, I do not know how to initialize network using the drivers
> provided in libbsd, and, basically, how to use libbsd in my projects.
> I have not found any documentation about it

The following can be found in my debug server snaphots
(https://ftp.rtems.org/pub/rtems/people/chrisj/dbserver/).

I add to init.c (where I use confdefs.h):

 /*
  * Configure LibBSD.
  */
 #define RTEMS_BSD_CONFIG_DOMAIN_PAGE_MBUFS_SIZE (128 * 1024 * 1024)
 #define RTEMS_BSD_CONFIG_NET_PF_UNIX
 #define RTEMS_BSD_CONFIG_NET_IF_LAGG
 #define RTEMS_BSD_CONFIG_NET_IF_VLAN
 #define RTEMS_BSD_CONFIG_SERVICE_TELNETD
 #define RTEMS_BSD_CONFIG_BSP_CONFIG
 #define RTEMS_BSD_CONFIG_INIT

 #include <machine/rtems-bsd-config.h>

In main.c I have:

  printf("BSD Initialisation ...\n");

  rtems_bsd_initialize();

  r = rtems_bsd_run_etc_rc_conf(15, false);
  if (r < 0)
    fprintf(stderr, "error: loading BSD /etc/rc.conf failed: %s\n",
            strerror(errno));

and finally rc.conf contains:

 #
 # System initialisation.
 #
 hostname="p03"
 ifconfig_em0="inet 10.10.5.33 netmask 255.255.255.0"
 ifconfig_cgem0="inet 10.10.5.34 netmask 255.255.255.0"
 ifconfig_re0="inet 10.10.5.35 netmask 255.255.255.0"
 ifconfig_em1="DHCP"
 ifconfig_em2="DHCP"
 ifconfig_em3="DHCP"
 defaultrouter="10.10.5.1"

 # Services
 telnetd_enable="YES"

If you are not sure what the NIC's label is boot RTEMS and initailise
libbsd and see what it prints out when it detects the interfaces.

Chris


More information about the users mailing list