mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-10-14 09:25:17 +08:00
buildset: Add minimal and everything config.
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. Close #3351.
This commit is contained in:
@@ -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
|
||||
|
@@ -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
|
||||
|
15
buildset/everything.ini
Normal file
15
buildset/everything.ini
Normal file
@@ -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
|
22
buildset/minimal.ini
Normal file
22
buildset/minimal.ini
Normal file
@@ -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
|
@@ -1,10 +0,0 @@
|
||||
#
|
||||
# Currently this is mostly a sample configuration.
|
||||
#
|
||||
|
||||
[general]
|
||||
name = sample
|
||||
extends = default.ini
|
||||
|
||||
[modules]
|
||||
dev_nic_broadcomm = off
|
@@ -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)
|
||||
|
@@ -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) */
|
||||
|
@@ -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) */
|
||||
|
@@ -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
|
||||
|
@@ -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) */
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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();
|
||||
|
@@ -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) */
|
||||
|
10
libbsd.py
10
libbsd.py
@@ -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(
|
||||
[
|
||||
|
17
libbsd.txt
17
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:
|
||||
|
@@ -42,6 +42,7 @@
|
||||
|
||||
#define __FreeBSD__ 1
|
||||
|
||||
#include <rtems/bsd/local/opt_inet6.h>
|
||||
#include <machine/rtems-bsd-version.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
|
@@ -1 +1,4 @@
|
||||
#define INET6 1
|
||||
#include <rtems/bsd/modules.h>
|
||||
#ifdef RTEMS_BSD_MODULE_NETINET6
|
||||
#define INET6 1
|
||||
#endif
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user