[PATCH] waf: Ensure network-config.h gets installed

Chris Johns chrisj at rtems.org
Tue Jul 6 23:51:20 UTC 2021


On 6/7/21 11:52 pm, Kinsey Moore wrote:
> On 7/6/2021 04:45, Chris Johns wrote:
>> On 3/7/21 11:16 am, Kinsey Moore wrote:
>>> network-config.h is now required for application compilation when using
>>> nexus-devices.h. This makes sure that it gets installed to resolve build
>>> errors.
>> I think it is a mistake to install this file. It is an internal file generated
>> by config.inc to ease creating the tests.
>>
>> I am concerned the internals of how tests are built will leaking to applications
>> and this creates a new set interfaces.
>>
>> I need to look at Peter's question that created this request. The preferred way
>> of doing this is to use rc.conf or craft your set of calls using BSd interfaces.
>>
>> Chris
> 
> I had that thought as well which leads me to the question: Is nexus-devices.h
> meant for test configuration or for application usage?

It is but indirectly used. See rtemsbsd/include/machine/rtems-bsd-config.h. All
I do in an application is:

/*
 * Configure LibBSD.
 */
#define RTEMS_BSD_CONFIG_DOMAIN_PAGE_MBUFS_SIZE (32 * 1024 * 1024)
#define RTEMS_BSD_CONFIG_BSP_CONFIG
#define RTEMS_BSD_CONFIG_INIT

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

int start(int iface)
{
  rtems_bsd_initialize();
  FILE* rc_conf = fopen("/etc/rc.conf", "w");
  fprintf(rc_conf, "hostname=\"test\"\n");
  fprintf(rc_conf, "ifconfig_cgem%d=\"DHCP rxcsum txcsum\"\n", iface);
  fclose(rc_conf);
  return rtems_bsd_run_etc_rc_conf(30, true);
}

> It is very clearly being used by applications as a place to store default
> configurations that should work for most hardware and I'm not sure we can (or
> should) change that.

You can provide special cases in your own code, for example in the section
above. his may be needed for a PC BSP where the card in the PCI bus is not one
listed.

> It would likely also be painful to change and raise the
> barrier to entry. On the other hand, recent conversations on this subject have
> pointed me toward nexus-devices.h being primarily for test usage while
> applications should provide their own set of definitions similar to nexus-devices.h

The including of network-config.h is a mistake. A grep shows the
network-config.h is only included by the tests.

> Maybe it would be better to have a test-specific include that goes into all
> tests and supplements nexus-devices.h. This would force things to be left out of
> the default-application-configuration-style nexus-devices.h to accomodate test
> needs, but would still provide a good starter configuration for applications.

I am not sure. What is in nexus-devices.h you need network-config.h for? I have
lost track of the problem you are wanting to solve?

Chris


More information about the devel mailing list