diff options
-rwxr-xr-x | builder.py | 1 | ||||
-rw-r--r-- | buildset/default.ini | 16 | ||||
-rw-r--r-- | buildset/everything.ini | 15 | ||||
-rw-r--r-- | buildset/minimal.ini | 22 | ||||
-rw-r--r-- | buildset/sample.ini | 10 | ||||
-rw-r--r-- | dhcpcd/config.h | 1 | ||||
-rw-r--r-- | dhcpcd/dhcp6.c | 5 | ||||
-rw-r--r-- | dhcpcd/ipv6.c | 5 | ||||
-rw-r--r-- | dhcpcd/ipv6.h | 3 | ||||
-rw-r--r-- | dhcpcd/ipv6nd.c | 5 | ||||
-rw-r--r-- | dhcpcd/platform.h | 3 | ||||
-rw-r--r-- | freebsd/lib/libc/rpc/rpcb_clnt.c | 1 | ||||
-rw-r--r-- | freebsd/sbin/ifconfig/ifconfig.c | 5 | ||||
-rw-r--r-- | freebsd/sbin/ping6/ping6.c | 2 | ||||
-rw-r--r-- | libbsd.py | 10 | ||||
-rw-r--r-- | libbsd.txt | 17 | ||||
-rw-r--r-- | rtemsbsd/include/machine/rtems-bsd-user-space.h | 1 | ||||
-rw-r--r-- | rtemsbsd/include/rtems/bsd/local/opt_inet6.h | 5 | ||||
-rw-r--r-- | testsuite/commands01/test_main.c | 15 | ||||
-rw-r--r-- | testsuite/include/rtems/bsd/test/default-network-init.h | 19 | ||||
-rw-r--r-- | testsuite/media01/test_main.c | 13 |
21 files changed, 141 insertions, 33 deletions
@@ -186,6 +186,7 @@ def revertFixIncludes(data): data = re.sub('#include <util.h>', '#include <rtems/bsd/util.h>', data) data = re.sub('#include <bsd.h>', '#include <rtems/bsd/bsd.h>', data) data = re.sub('#include <zerocopy.h>', '#include <rtems/bsd/zerocopy.h>', data) + data = re.sub('#include <modules.h>', '#include <rtems/bsd/modules.h>', data) return data # fix include paths inside a C or .h file 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/lib/libc/rpc/rpcb_clnt.c b/freebsd/lib/libc/rpc/rpcb_clnt.c index b8f1dd0c..669c9bec 100644 --- a/freebsd/lib/libc/rpc/rpcb_clnt.c +++ b/freebsd/lib/libc/rpc/rpcb_clnt.c @@ -32,7 +32,6 @@ /* #ident "@(#)rpcb_clnt.c 1.27 94/04/24 SMI" */ - #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/ping6/ping6.c b/freebsd/sbin/ping6/ping6.c index 9faf09e2..972ef38e 100644 --- a/freebsd/sbin/ping6/ping6.c +++ b/freebsd/sbin/ping6/ping6.c @@ -69,6 +69,7 @@ * SUCH DAMAGE. */ +#if defined(__rtems__) && defined(INET6) #ifndef lint static const char copyright[] = "@(#) Copyright (c) 1989, 1993\n\ @@ -2835,3 +2836,4 @@ usage(void) " [-X timeout] [hops ...] host\n"); exit(1); } +#endif /* defined(__rtems__) && defined(INET6) */ @@ -2561,7 +2561,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( [ @@ -2804,7 +2804,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']) ) # @@ -2829,7 +2829,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']([]) ) # @@ -3840,7 +3840,6 @@ class contrib_libpcap(builder.Module): mm = self.manager cflags = ['-D__FreeBSD__=1', '-DBSD=1', - '-DINET6', '-D_U_=__attribute__((unused))', '-DHAVE_LIMITS_H=1', '-DHAVE_INTTYPES=1', @@ -4151,7 +4150,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'], @@ -4558,7 +4556,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( [ @@ -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/machine/rtems-bsd-user-space.h b/rtemsbsd/include/machine/rtems-bsd-user-space.h index 0b6a3a99..ac78b723 100644 --- a/rtemsbsd/include/machine/rtems-bsd-user-space.h +++ b/rtemsbsd/include/machine/rtems-bsd-user-space.h @@ -42,6 +42,7 @@ #define __FreeBSD__ 1 +#include <rtems/bsd/local/opt_inet6.h> #include <machine/rtems-bsd-version.h> #include <sys/cdefs.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 d26df03c..ee95d26e 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) @@ -327,7 +328,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, \ @@ -337,9 +352,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 |