[PATCH v2 4/4] buildset: Add minimal and everything config.

Christian Mauderer christian.mauderer at embedded-brains.de
Fri Apr 27 11:17:51 UTC 2018


This adds two new buildset configurations: One that leaves out as much
features as possible and one that enables all features. For the default
configuration WiFi support is now disabled.

To disable IPv6 for the minimal configuration, all -DINET6 are
eliminated in libbsd.py. They are now replaced by a #ifdef that checks
for RTEMS_BSD_MODULE_NETINET6 instead.

Update #3351.
---
 buildset/default.ini                               | 16 ++++++++++------
 buildset/everything.ini                            | 15 +++++++++++++++
 buildset/minimal.ini                               | 22 ++++++++++++++++++++++
 buildset/sample.ini                                | 10 ----------
 dhcpcd/config.h                                    |  1 +
 dhcpcd/dhcp6.c                                     |  5 +++++
 dhcpcd/ipv6.c                                      |  5 +++++
 dhcpcd/ipv6.h                                      |  3 +++
 dhcpcd/ipv6nd.c                                    |  5 +++++
 dhcpcd/platform.h                                  |  3 +++
 freebsd/contrib/libpcap/config.h                   |  4 ++++
 freebsd/lib/libc/net/getaddrinfo.c                 |  3 +++
 freebsd/lib/libc/net/getnameinfo.c                 |  3 +++
 freebsd/lib/libc/net/name6.c                       |  3 +++
 freebsd/lib/libc/net/rcmd.c                        |  3 +++
 freebsd/lib/libc/rpc/bindresvport.c                |  3 +++
 freebsd/lib/libc/rpc/clnt_bcast.c                  |  3 +++
 freebsd/lib/libc/rpc/rpc_generic.c                 |  3 +++
 freebsd/lib/libc/rpc/rpcb_clnt.c                   |  4 +++-
 freebsd/sbin/ifconfig/ifconfig.c                   |  5 +++++
 freebsd/sbin/pfctl/pf_print_state.c                |  1 +
 freebsd/sbin/ping6/ping6.c                         |  5 +++++
 freebsd/sbin/route/route.c                         |  3 +++
 freebsd/usr.bin/netstat/if.c                       |  3 +++
 freebsd/usr.bin/netstat/inet.c                     |  3 +++
 freebsd/usr.bin/netstat/inet6.c                    |  3 +++
 freebsd/usr.bin/netstat/mroute6.c                  |  3 +++
 freebsd/usr.bin/netstat/netstat.h                  |  3 +++
 freebsd/usr.sbin/tcpdump/tcpdump/config.h          |  7 +++++++
 libbsd.py                                          | 11 +++++------
 libbsd.txt                                         | 17 ++++++++++++++---
 rtemsbsd/include/rtems/bsd/local/opt_inet6.h       |  5 ++++-
 testsuite/commands01/test_main.c                   | 15 +++++++++++++++
 .../include/rtems/bsd/test/default-network-init.h  | 19 ++++++++++++++++---
 testsuite/media01/test_main.c                      | 13 ++++++++++---
 35 files changed, 197 insertions(+), 33 deletions(-)
 create mode 100644 buildset/everything.ini
 create mode 100644 buildset/minimal.ini
 delete mode 100644 buildset/sample.ini
 create mode 100644 freebsd/contrib/libpcap/config.h

diff --git a/buildset/default.ini b/buildset/default.ini
index e58ea99f..a5cbdf9c 100644
--- a/buildset/default.ini
+++ b/buildset/default.ini
@@ -1,5 +1,9 @@
 #
-# Default configuration.
+# Default configuration. Contains most features except for some big or slow ones
+# like WiFi or IPSec.
+#
+# At all developers: Please allways add all modules to this file and mark them
+# as explicitly "off" if they are not used.
 #
 
 [general]
@@ -30,8 +34,8 @@ dev_usb_net = on
 dev_usb_quirk = on
 dev_usb_serial = on
 dev_usb_storage = on
-dev_usb_wlan = on
-dev_wlan_rtwn = on
+dev_usb_wlan = off
+dev_wlan_rtwn = off
 dhcpcd = on
 dpaa = on
 evdev = on
@@ -43,7 +47,7 @@ mghttpd = on
 mmc = on
 mmc_ti = on
 net = on
-net80211 = on
+net80211 = off
 netinet = on
 netinet6 = on
 opencrypto = on
@@ -53,6 +57,6 @@ rtems = on
 tests = on
 tty = on
 user_space = on
-user_space_wlanstats = on
+user_space_wlanstats = off
 usr_sbin_tcpdump = on
-usr_sbin_wpa_supplicant = on
+usr_sbin_wpa_supplicant = off
diff --git a/buildset/everything.ini b/buildset/everything.ini
new file mode 100644
index 00000000..0d9cc5fb
--- /dev/null
+++ b/buildset/everything.ini
@@ -0,0 +1,15 @@
+#
+# This configuration has the target to provide all features of libbsd even the
+# big and slow ones.
+#
+
+[general]
+name = everything
+extends = default.ini
+
+[modules]
+dev_usb_wlan = on
+dev_wlan_rtwn = on
+net80211 = on
+user_space_wlanstats = on
+usr_sbin_wpa_supplicant = on
diff --git a/buildset/minimal.ini b/buildset/minimal.ini
new file mode 100644
index 00000000..c5ad8214
--- /dev/null
+++ b/buildset/minimal.ini
@@ -0,0 +1,22 @@
+#
+# This configuration has the target to provide the smallest possible libbsd
+# during link time. It should disable everything that can be disabled without
+# loosing basic functionality. As a target, it should once only provide the
+# following functions:
+#
+# - basic IPv4 only networking
+# - basic USB support
+# - all device drivers that don't increase the application size without being
+#   explicitly linked in
+#
+# ATTENTION: This configuration will loose functionality in the future as soon
+# as it is possible to disable the functionality.
+#
+
+[general]
+name = minimal
+extends = default.ini
+
+[modules]
+crypto_openssl = off
+netinet6 = off
diff --git a/buildset/sample.ini b/buildset/sample.ini
deleted file mode 100644
index 5d73e2a5..00000000
--- a/buildset/sample.ini
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# Currently this is mostly a sample configuration.
-#
-
-[general]
-name = sample
-extends = default.ini
-
-[modules]
-dev_nic_broadcomm = off
diff --git a/dhcpcd/config.h b/dhcpcd/config.h
index 27174eb8..cf6c5fb1 100644
--- a/dhcpcd/config.h
+++ b/dhcpcd/config.h
@@ -14,6 +14,7 @@
 #include <spawn.h>
 #include <stdint.h>
 #include "compat/pollts.h"
+#include <rtems/bsd/local/opt_inet6.h>
 uint32_t arc4random(void);
 static inline int dhcpcd_flock(int a, int b) { return -1; }
 #define flock(a, b) dhcpcd_flock(a, b)
diff --git a/dhcpcd/dhcp6.c b/dhcpcd/dhcp6.c
index ec585883..d775e312 100644
--- a/dhcpcd/dhcp6.c
+++ b/dhcpcd/dhcp6.c
@@ -27,6 +27,10 @@
 
 /* TODO: We should decline dupliate addresses detected */
 
+#ifdef __rtems__
+#include <rtems/bsd/local/opt_inet6.h>
+#endif /* __rtems__ */
+#if defined(__rtems__) && defined(INET6)
 #include <sys/stat.h>
 #include <sys/utsname.h>
 
@@ -2809,3 +2813,4 @@ dhcp6_env(char **env, const char *prefix, const struct interface *ifp,
 
 	return n;
 }
+#endif /* defined(__rtems__) && defined(INET6) */
diff --git a/dhcpcd/ipv6.c b/dhcpcd/ipv6.c
index 3f3a1033..c6d69d27 100644
--- a/dhcpcd/ipv6.c
+++ b/dhcpcd/ipv6.c
@@ -25,6 +25,10 @@
  * SUCH DAMAGE.
  */
 
+#ifdef __rtems__
+#include <rtems/bsd/local/opt_inet6.h>
+#endif /* __rtems__ */
+#if defined(__rtems__) && defined(INET6)
 #include <sys/param.h>
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -1045,3 +1049,4 @@ ipv6_buildroutes(void)
 	free(routes);
 	routes = nrs;
 }
+#endif /* defined(__rtems__) && defined(INET6) */
diff --git a/dhcpcd/ipv6.h b/dhcpcd/ipv6.h
index 6b5dc1df..7ba9425d 100644
--- a/dhcpcd/ipv6.h
+++ b/dhcpcd/ipv6.h
@@ -31,6 +31,9 @@
 #include <sys/queue.h>
 
 #include <netinet/in.h>
+#ifdef __rtems__
+#include <rtems/bsd/local/opt_inet6.h>
+#endif /* __rtems__ */
 
 #define ALLROUTERS "ff02::2"
 #define HOPLIMIT 255
diff --git a/dhcpcd/ipv6nd.c b/dhcpcd/ipv6nd.c
index 2fd20842..5709ed19 100644
--- a/dhcpcd/ipv6nd.c
+++ b/dhcpcd/ipv6nd.c
@@ -25,6 +25,10 @@
  * SUCH DAMAGE.
  */
 
+#ifdef __rtems__
+#include <rtems/bsd/local/opt_inet6.h>
+#endif /* __rtems__ */
+#if defined(__rtems__) && defined(INET6)
 #include <sys/ioctl.h>
 #include <sys/param.h>
 #include <sys/socket.h>
@@ -1833,3 +1837,4 @@ ipv6nd_startrs(struct interface *ifp)
 	ipv6nd_sendrsprobe(ifp);
 	return 0;
 }
+#endif /* defined(__rtems__) && defined(INET6) */
diff --git a/dhcpcd/platform.h b/dhcpcd/platform.h
index 46797c16..d5066311 100644
--- a/dhcpcd/platform.h
+++ b/dhcpcd/platform.h
@@ -27,6 +27,9 @@
 
 #ifndef PLATFORM_H
 #define PLATFORM_H
+#ifdef __rtems__
+#include <rtems/bsd/local/opt_inet6.h>
+#endif /* __rtems__ */
 
 char *hardware_platform(void);
 #ifdef INET6
diff --git a/freebsd/contrib/libpcap/config.h b/freebsd/contrib/libpcap/config.h
new file mode 100644
index 00000000..6f1b31ee
--- /dev/null
+++ b/freebsd/contrib/libpcap/config.h
@@ -0,0 +1,4 @@
+#ifndef LIBPCAP_CONFIG_H
+#define LIBPCAP_CONFIG_H
+#include <rtems/bsd/local/opt_inet6.h>
+#endif /* LIBPCAP_CONFIG_H */
diff --git a/freebsd/lib/libc/net/getaddrinfo.c b/freebsd/lib/libc/net/getaddrinfo.c
index 630bb291..c190dfd6 100644
--- a/freebsd/lib/libc/net/getaddrinfo.c
+++ b/freebsd/lib/libc/net/getaddrinfo.c
@@ -56,6 +56,9 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#ifdef __rtems__
+#include <rtems/bsd/local/opt_inet6.h>
+#endif /* __rtems__ */
 #include "namespace.h"
 #include <sys/param.h>
 #include <sys/socket.h>
diff --git a/freebsd/lib/libc/net/getnameinfo.c b/freebsd/lib/libc/net/getnameinfo.c
index e042c549..a447594b 100644
--- a/freebsd/lib/libc/net/getnameinfo.c
+++ b/freebsd/lib/libc/net/getnameinfo.c
@@ -46,6 +46,9 @@
  *   beware on merge.
  */
 
+#ifdef __rtems__
+#include <rtems/bsd/local/opt_inet6.h>
+#endif /* __rtems__ */
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
diff --git a/freebsd/lib/libc/net/name6.c b/freebsd/lib/libc/net/name6.c
index da65015b..03eec927 100644
--- a/freebsd/lib/libc/net/name6.c
+++ b/freebsd/lib/libc/net/name6.c
@@ -85,6 +85,9 @@
  *	Atsushi Onoe <onoe at sm.sony.co.jp>
  */
 
+#ifdef __rtems__
+#include <rtems/bsd/local/opt_inet6.h>
+#endif /* __rtems__ */
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
diff --git a/freebsd/lib/libc/net/rcmd.c b/freebsd/lib/libc/net/rcmd.c
index aff5584c..7214ff79 100644
--- a/freebsd/lib/libc/net/rcmd.c
+++ b/freebsd/lib/libc/net/rcmd.c
@@ -29,6 +29,9 @@
  * SUCH DAMAGE.
  */
 
+#ifdef __rtems__
+#include <rtems/bsd/local/opt_inet6.h>
+#endif /* __rtems__ */
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)rcmd.c	8.3 (Berkeley) 3/26/94";
 #endif /* LIBC_SCCS and not lint */
diff --git a/freebsd/lib/libc/rpc/bindresvport.c b/freebsd/lib/libc/rpc/bindresvport.c
index 77e03568..5b74ed5d 100644
--- a/freebsd/lib/libc/rpc/bindresvport.c
+++ b/freebsd/lib/libc/rpc/bindresvport.c
@@ -30,6 +30,9 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifdef __rtems__
+#include <rtems/bsd/local/opt_inet6.h>
+#endif /* __rtems__ */
 #if defined(LIBC_SCCS) && !defined(lint)
 static char *sccsid2 = "from: @(#)bindresvport.c 1.8 88/02/08 SMI";
 static char *sccsid = "from: @(#)bindresvport.c	2.2 88/07/29 4.0 RPCSRC";
diff --git a/freebsd/lib/libc/rpc/clnt_bcast.c b/freebsd/lib/libc/rpc/clnt_bcast.c
index d17e9166..0a4d8c2f 100644
--- a/freebsd/lib/libc/rpc/clnt_bcast.c
+++ b/freebsd/lib/libc/rpc/clnt_bcast.c
@@ -33,6 +33,9 @@
  * Copyright (c) 1986-1991 by Sun Microsystems Inc. 
  */
 
+#ifdef __rtems__
+#include <rtems/bsd/local/opt_inet6.h>
+#endif /* __rtems__ */
 #if defined(LIBC_SCCS) && !defined(lint)
 #ident	"@(#)clnt_bcast.c	1.18	94/05/03 SMI"
 static char sccsid[] = "@(#)clnt_bcast.c 1.15 89/04/21 Copyr 1988 Sun Micro";
diff --git a/freebsd/lib/libc/rpc/rpc_generic.c b/freebsd/lib/libc/rpc/rpc_generic.c
index bb8c606b..1cfd9ab2 100644
--- a/freebsd/lib/libc/rpc/rpc_generic.c
+++ b/freebsd/lib/libc/rpc/rpc_generic.c
@@ -33,6 +33,9 @@
  * Copyright (c) 1986-1991 by Sun Microsystems Inc. 
  */
 
+#ifdef __rtems__
+#include <rtems/bsd/local/opt_inet6.h>
+#endif /* __rtems__ */
 /* #pragma ident	"@(#)rpc_generic.c	1.17	94/04/24 SMI" */
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
diff --git a/freebsd/lib/libc/rpc/rpcb_clnt.c b/freebsd/lib/libc/rpc/rpcb_clnt.c
index b8f1dd0c..e1cbaa37 100644
--- a/freebsd/lib/libc/rpc/rpcb_clnt.c
+++ b/freebsd/lib/libc/rpc/rpcb_clnt.c
@@ -32,7 +32,9 @@
 
 /* #ident	"@(#)rpcb_clnt.c	1.27	94/04/24 SMI" */
 
-
+#ifdef __rtems__
+#include <rtems/bsd/local/opt_inet6.h>
+#endif /* __rtems__ */
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)rpcb_clnt.c 1.30 89/06/21 Copyr 1988 Sun Micro";
 #endif
diff --git a/freebsd/sbin/ifconfig/ifconfig.c b/freebsd/sbin/ifconfig/ifconfig.c
index 956a9dfe..b9ba236a 100644
--- a/freebsd/sbin/ifconfig/ifconfig.c
+++ b/freebsd/sbin/ifconfig/ifconfig.c
@@ -54,6 +54,7 @@ static const char rcsid[] =
 #undef option
 #include <machine/rtems-bsd-program.h>
 #include <machine/rtems-bsd-commands.h>
+#include <rtems/bsd/modules.h>
 #endif /* __rtems__ */
 #include <sys/param.h>
 #include <sys/ioctl.h>
@@ -382,8 +383,12 @@ mainwrapper(int argc, char *argv[])
 	gre_ctor();
 	group_ctor();
 	ifmedia_ctor();
+#ifdef RTEMS_BSD_MODULE_IEEE80211
 	ieee80211_ctor();
+#endif
+#ifdef RTEMS_BSD_MODULE_NETINET6
 	inet6_ctor();
+#endif
 	inet_ctor();
 	lagg_ctor();
 	link_ctor();
diff --git a/freebsd/sbin/pfctl/pf_print_state.c b/freebsd/sbin/pfctl/pf_print_state.c
index 1e09a01f..12768989 100644
--- a/freebsd/sbin/pfctl/pf_print_state.c
+++ b/freebsd/sbin/pfctl/pf_print_state.c
@@ -40,6 +40,7 @@
 __FBSDID("$FreeBSD$");
 
 #ifdef __rtems__
+#include <rtems/bsd/local/opt_inet6.h>
 #include <machine/rtems-bsd-program.h>
 #endif /* __rtems__ */
 #include <sys/types.h>
diff --git a/freebsd/sbin/ping6/ping6.c b/freebsd/sbin/ping6/ping6.c
index 9faf09e2..74bb718d 100644
--- a/freebsd/sbin/ping6/ping6.c
+++ b/freebsd/sbin/ping6/ping6.c
@@ -69,6 +69,10 @@
  * SUCH DAMAGE.
  */
 
+#ifdef __rtems__
+#include <rtems/bsd/local/opt_inet6.h>
+#endif /* __rtems__ */
+#if defined(__rtems__) && defined(INET6)
 #ifndef lint
 static const char copyright[] =
 "@(#) Copyright (c) 1989, 1993\n\
@@ -2835,3 +2839,4 @@ usage(void)
 	    "             [-X timeout] [hops ...] host\n");
 	exit(1);
 }
+#endif /* defined(__rtems__) && defined(INET6) */
diff --git a/freebsd/sbin/route/route.c b/freebsd/sbin/route/route.c
index dfa7c21c..ef4f1221 100644
--- a/freebsd/sbin/route/route.c
+++ b/freebsd/sbin/route/route.c
@@ -33,6 +33,9 @@
  * SUCH DAMAGE.
  */
 
+#ifdef __rtems__
+#include <rtems/bsd/local/opt_inet6.h>
+#endif /* __rtems__ */
 #ifndef lint
 static const char copyright[] =
 "@(#) Copyright (c) 1983, 1989, 1991, 1993\n\
diff --git a/freebsd/usr.bin/netstat/if.c b/freebsd/usr.bin/netstat/if.c
index 210660bc..59e83c68 100644
--- a/freebsd/usr.bin/netstat/if.c
+++ b/freebsd/usr.bin/netstat/if.c
@@ -43,6 +43,9 @@ static char sccsid[] = "@(#)if.c	8.3 (Berkeley) 4/28/95";
 #ifdef __rtems__
 #include <machine/rtems-bsd-program.h>
 #endif /* __rtems__ */
+#ifdef __rtems__
+#include <rtems/bsd/local/opt_inet6.h>
+#endif /* __rtems__ */
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
diff --git a/freebsd/usr.bin/netstat/inet.c b/freebsd/usr.bin/netstat/inet.c
index 299eee3d..f3f061e5 100644
--- a/freebsd/usr.bin/netstat/inet.c
+++ b/freebsd/usr.bin/netstat/inet.c
@@ -42,6 +42,9 @@ static char sccsid[] = "@(#)inet.c	8.5 (Berkeley) 5/24/95";
 #ifdef __rtems__
 #include <machine/rtems-bsd-program.h>
 #endif /* __rtems__ */
+#ifdef __rtems__
+#include <rtems/bsd/local/opt_inet6.h>
+#endif /* __rtems__ */
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
diff --git a/freebsd/usr.bin/netstat/inet6.c b/freebsd/usr.bin/netstat/inet6.c
index 6f8d4c53..84253aa1 100644
--- a/freebsd/usr.bin/netstat/inet6.c
+++ b/freebsd/usr.bin/netstat/inet6.c
@@ -43,6 +43,9 @@ static char sccsid[] = "@(#)inet6.c	8.4 (Berkeley) 4/20/94";
 #ifdef __rtems__
 #include <machine/rtems-bsd-program.h>
 #endif /* __rtems__ */
+#ifdef __rtems__
+#include <rtems/bsd/local/opt_inet6.h>
+#endif /* __rtems__ */
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
diff --git a/freebsd/usr.bin/netstat/mroute6.c b/freebsd/usr.bin/netstat/mroute6.c
index c4a87de1..08308710 100644
--- a/freebsd/usr.bin/netstat/mroute6.c
+++ b/freebsd/usr.bin/netstat/mroute6.c
@@ -74,6 +74,9 @@
 #ifdef __rtems__
 #include <machine/rtems-bsd-program.h>
 #endif /* __rtems__ */
+#ifdef __rtems__
+#include <rtems/bsd/local/opt_inet6.h>
+#endif /* __rtems__ */
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
diff --git a/freebsd/usr.bin/netstat/netstat.h b/freebsd/usr.bin/netstat/netstat.h
index 776c09e7..4c4b46b2 100644
--- a/freebsd/usr.bin/netstat/netstat.h
+++ b/freebsd/usr.bin/netstat/netstat.h
@@ -30,6 +30,9 @@
  * $FreeBSD$
  */
 
+#ifdef __rtems__
+#include <rtems/bsd/local/opt_inet6.h>
+#endif /* __rtems__ */
 #include <sys/cdefs.h>
 
 #define	satosin(sa)	((struct sockaddr_in *)(sa))
diff --git a/freebsd/usr.sbin/tcpdump/tcpdump/config.h b/freebsd/usr.sbin/tcpdump/tcpdump/config.h
index 354a65db..cca58a36 100644
--- a/freebsd/usr.sbin/tcpdump/tcpdump/config.h
+++ b/freebsd/usr.sbin/tcpdump/tcpdump/config.h
@@ -4,6 +4,13 @@
 /* config.h.  Generated from config.h.in by configure.  */
 /* config.h.in.  Generated from configure.in by autoheader.  */
 
+#ifdef __rtems__
+#include <rtems/bsd/modules.h>
+#ifdef RTEMS_BSD_MODULE_NETINET6
+  #define INET6
+#endif
+
+#endif /* __rtems__ */
 /* define if you want to build the possibly-buggy SMB printer */
 #define ENABLE_SMB 1
 
diff --git a/libbsd.py b/libbsd.py
index a256594e..b0db8291 100644
--- a/libbsd.py
+++ b/libbsd.py
@@ -2576,7 +2576,7 @@ class user_space(builder.Module):
                 'lib/libc/db/recno/rec_seq.c',
                 'lib/libc/db/recno/rec_utils.c',
             ],
-            mm.generator['source']('-D__DBINTERFACE_PRIVATE -DINET6')
+            mm.generator['source']('-D__DBINTERFACE_PRIVATE')
         )
         self.addRTEMSHeaderFiles(
             [
@@ -2819,7 +2819,7 @@ class user_space(builder.Module):
                 'usr.bin/vmstat/vmstat.c',
                 'usr.sbin/arp/arp.c',
             ],
-            mm.generator['source'](['-DINET6', '-DINET'])
+            mm.generator['source'](['-DINET'])
         )
 
 #
@@ -2844,7 +2844,7 @@ class user_space_wlanstats(builder.Module):
                 'tools/tools/net80211/wlanstats/wlanstats.c',
                 'lib/libbsdstat/bsdstat.c',
             ],
-            mm.generator['source'](['-DINET6', '-DINET'])
+            mm.generator['source']([])
         )
 
 #
@@ -3855,7 +3855,7 @@ class contrib_libpcap(builder.Module):
         mm = self.manager
         cflags = ['-D__FreeBSD__=1',
                   '-DBSD=1',
-                  '-DINET6',
+                  '-DHAVE_CONFIG_H=1',
                   '-D_U_=__attribute__((unused))',
                   '-DHAVE_LIMITS_H=1',
                   '-DHAVE_INTTYPES=1',
@@ -4166,7 +4166,6 @@ class usr_sbin_tcpdump(builder.Module):
                 'contrib/tcpdump/util-print.c',
             ],
             mm.generator['source'](['-D__FreeBSD__=1',
-                                    '-DINET6',
                                     '-D_U_=__attribute__((unused))',
                                     '-DHAVE_CONFIG_H=1',
                                     '-DHAVE_NET_PFVAR_H=1'],
@@ -4573,7 +4572,7 @@ class dhcpcd(builder.Module):
                 'dhcpcd/compat/pselect.c',
                 'dhcpcd/crypt/hmac_md5.c',
             ],
-            mm.generator['source']('-D__FreeBSD__ -DTHERE_IS_NO_FORK -DMASTER_ONLY -DINET -DINET6')
+            mm.generator['source']('-D__FreeBSD__ -DTHERE_IS_NO_FORK -DMASTER_ONLY -DINET')
         )
         self.addRTEMSSourceFiles(
             [
diff --git a/libbsd.txt b/libbsd.txt
index 3cbb642d..c7a90f64 100644
--- a/libbsd.txt
+++ b/libbsd.txt
@@ -120,6 +120,14 @@ devices (you can run multiple test instances on one virtual network).
 The build system based on the Waf build system. To build with Waf please refer
 to the README.waf file.
 
+Note that the libbsd supports different buildsets. These can be selected with
+the `--buildset=xxx.ini` option during the configure phase. Take a look at the
+comments in `buildset/*.ini` to see which build sets are officially supported.
+
+You can also create and provide your own buildset configuration. But remember
+that it's quite easy to break something by disabling the wrong modules. Only the
+configurations in the `buildset` directory are officially maintained.
+
 ===== Example Configuration for Network Tests =====
 
 If you need some other IP configuration for the network tests that use a fixed
@@ -1173,9 +1181,12 @@ The following is necessary to use PF on RTEMS:
 == Wireless Network (WLAN) ==
 
 The libbsd provides a basic support for WLAN. Note that currently this support
-is still in an early state. The following gives a rough overview over the
-necessary steps to connect to an encrypted network with an RTL8188EU based WiFi
-dongle:
+is still in an early state. The WLAN support is _not_ enabled in the default
+buildset. You have to configure libbsd with the
+`--buildset=buildset/everything.ini` to enable that feature.
+
+The following gives a rough overview over the necessary steps to connect to an
+encrypted network with an RTL8188EU based WiFi dongle:
 
 - Reference all necessary module for your BSP. For some BSPs this is already
   done in the nexus-devices.h:
diff --git a/rtemsbsd/include/rtems/bsd/local/opt_inet6.h b/rtemsbsd/include/rtems/bsd/local/opt_inet6.h
index 1aaf3a65..8a124cfd 100644
--- a/rtemsbsd/include/rtems/bsd/local/opt_inet6.h
+++ b/rtemsbsd/include/rtems/bsd/local/opt_inet6.h
@@ -1 +1,4 @@
-#define INET6 1
+#include <rtems/bsd/modules.h>
+#ifdef RTEMS_BSD_MODULE_NETINET6
+  #define INET6 1
+#endif
diff --git a/testsuite/commands01/test_main.c b/testsuite/commands01/test_main.c
index f0ddab50..2e61a933 100644
--- a/testsuite/commands01/test_main.c
+++ b/testsuite/commands01/test_main.c
@@ -40,6 +40,7 @@
 #include <machine/rtems-bsd-commands.h>
 
 #include <rtems/libcsupport.h>
+#include <rtems/bsd/modules.h>
 
 #define TEST_NAME "LIBBSD COMMANDS 1"
 
@@ -108,6 +109,7 @@ test_ifconfig_lo0(void)
 		"255.255.255.0",
 		NULL
 	};
+#ifdef RTEMS_BSD_MODULE_NETINET6
 	char *lo0_inet6[] = {
 		"ifconfig",
 		"lo0",
@@ -117,37 +119,46 @@ test_ifconfig_lo0(void)
 		"128",
 		NULL
 	};
+#endif /* RTEMS_BSD_MODULE_NETINET6 */
 	char *status[] = {
 		"ifconfig",
 		"lo0",
 		"inet",
 		NULL
 	};
+#ifdef RTEMS_BSD_MODULE_NETINET6
 	char *status_inet6[] = {
 		"ifconfig",
 		"lo0",
 		"inet6",
 		NULL
 	};
+#endif /* RTEMS_BSD_MODULE_NETINET6 */
 
 	exit_code = rtems_bsd_command_ifconfig(ARGC(lo0), lo0);
 	assert(exit_code == EX_OK);
 
+#ifdef RTEMS_BSD_MODULE_NETINET6
 	exit_code = rtems_bsd_command_ifconfig(ARGC(lo0_inet6), lo0_inet6);
 	assert(exit_code == EX_OK);
+#endif /* RTEMS_BSD_MODULE_NETINET6 */
 
 	rtems_resource_snapshot_take(&snapshot);
 
 	exit_code = rtems_bsd_command_ifconfig(ARGC(status), status);
 	assert(exit_code == EX_OK);
 
+#ifdef RTEMS_BSD_MODULE_NETINET6
 	exit_code = rtems_bsd_command_ifconfig(ARGC(status_inet6), status_inet6);
 	assert(exit_code == EX_OK);
+#endif /* RTEMS_BSD_MODULE_NETINET6 */
 
 	rtems_resource_snapshot_take(&snapshot);
 
+#ifdef RTEMS_BSD_MODULE_NETINET6
 	exit_code = rtems_bsd_command_ifconfig(ARGC(status_inet6), status_inet6);
 	assert(exit_code == EX_OK);
+#endif /* RTEMS_BSD_MODULE_NETINET6 */
 
 	assert(rtems_resource_snapshot_check(&snapshot));
 }
@@ -195,6 +206,7 @@ test_ping(void)
 static void
 test_ping6(void)
 {
+#ifdef RTEMS_BSD_MODULE_NETINET6
 	rtems_resource_snapshot snapshot;
 	int exit_code;
 	char *ping6[] = {
@@ -214,6 +226,7 @@ test_ping6(void)
 	assert(exit_code == EXIT_SUCCESS);
 
 	assert(rtems_resource_snapshot_check(&snapshot));
+#endif
 }
 
 static void
@@ -260,6 +273,7 @@ test_netstat(void)
 static void
 test_wlanstats(void)
 {
+#ifdef RTEMS_BSD_MODULE_USER_SPACE_WLANSTATS
 	rtems_resource_snapshot snapshot;
 	char *wlanstats[] = {
 		"wlanstats",
@@ -271,6 +285,7 @@ test_wlanstats(void)
 	rtems_resource_snapshot_take(&snapshot);
 	rtems_bsd_command_wlanstats(ARGC(wlanstats), wlanstats);
 	assert(rtems_resource_snapshot_check(&snapshot));
+#endif /* RTEMS_BSD_MODULE_USER_SPACE_WLANSTATS */
 }
 
 static void
diff --git a/testsuite/include/rtems/bsd/test/default-network-init.h b/testsuite/include/rtems/bsd/test/default-network-init.h
index d6949b8b..322f7a69 100644
--- a/testsuite/include/rtems/bsd/test/default-network-init.h
+++ b/testsuite/include/rtems/bsd/test/default-network-init.h
@@ -47,6 +47,7 @@
 #include <rtems/printer.h>
 #include <rtems/stackchk.h>
 #include <rtems/bsd/bsd.h>
+#include <rtems/bsd/modules.h>
 
 #if defined(DEFAULT_NETWORK_DHCPCD_ENABLE) && \
     !defined(DEFAULT_NETWORK_NO_STATIC_IFCONFIG)
@@ -323,7 +324,21 @@ Init(rtems_task_argument arg)
 
 #include <rtems/netcmds-config.h>
 
+#ifdef RTEMS_BSD_MODULE_USER_SPACE_WLANSTATS
+  #define SHELL_WLANSTATS_COMMAND &rtems_shell_WLANSTATS_Command,
+#else
+  #define SHELL_WLANSTATS_COMMAND
+#endif
+
+#ifdef RTEMS_BSD_MODULE_USR_SBIN_WPA_SUPPLICANT
+  #define SHELL_WPA_SUPPLICANT_COMMAND &rtems_shell_WPA_SUPPLICANT_Command,
+#else
+  #define SHELL_WPA_SUPPLICANT_COMMAND
+#endif
+
 #define CONFIGURE_SHELL_USER_COMMANDS \
+  SHELL_WLANSTATS_COMMAND \
+  SHELL_WPA_SUPPLICANT_COMMAND \
   &bsp_interrupt_shell_command, \
   &rtems_shell_ARP_Command, \
   &rtems_shell_HOSTNAME_Command, \
@@ -333,9 +348,7 @@ Init(rtems_task_argument arg)
   &rtems_shell_IFCONFIG_Command, \
   &rtems_shell_TCPDUMP_Command, \
   &rtems_shell_SYSCTL_Command, \
-  &rtems_shell_VMSTAT_Command, \
-  &rtems_shell_WLANSTATS_Command, \
-  &rtems_shell_WPA_SUPPLICANT_Command
+  &rtems_shell_VMSTAT_Command
 
 #define CONFIGURE_SHELL_COMMAND_CPUINFO
 #define CONFIGURE_SHELL_COMMAND_CPUUSE
diff --git a/testsuite/media01/test_main.c b/testsuite/media01/test_main.c
index f929cba1..c9d902dc 100644
--- a/testsuite/media01/test_main.c
+++ b/testsuite/media01/test_main.c
@@ -200,7 +200,16 @@ early_initialization(void)
 
 #include <rtems/netcmds-config.h>
 
+#ifdef RTEMS_BSD_MODULE_USR_SBIN_WPA_SUPPLICANT
+  #define SHELL_WPA_SUPPLICANT_COMMANDS \
+    &rtems_shell_WPA_SUPPLICANT_Command, \
+    &rtems_shell_WPA_SUPPLICANT_FORK_Command,
+#else
+  #define SHELL_WPA_SUPPLICANT_COMMANDS
+#endif
+
 #define CONFIGURE_SHELL_USER_COMMANDS \
+  SHELL_WPA_SUPPLICANT_COMMANDS \
   &bsp_interrupt_shell_command, \
   &rtems_shell_ARP_Command, \
   &rtems_shell_HOSTNAME_Command, \
@@ -209,9 +218,7 @@ early_initialization(void)
   &rtems_shell_NETSTAT_Command, \
   &rtems_shell_SYSCTL_Command, \
   &rtems_shell_IFCONFIG_Command, \
-  &rtems_shell_VMSTAT_Command, \
-  &rtems_shell_WPA_SUPPLICANT_Command, \
-  &rtems_shell_WPA_SUPPLICANT_FORK_Command
+  &rtems_shell_VMSTAT_Command
 
 #define CONFIGURE_SHELL_COMMAND_CPUINFO
 #define CONFIGURE_SHELL_COMMAND_CPUUSE
-- 
2.13.6



More information about the devel mailing list