source: rtems-libbsd/libbsd.txt @ b376ae1

55-freebsd-126-freebsd-12
Last change on this file since b376ae1 was 338f300, checked in by Christian Mauderer <christian.mauderer@…>, on 04/25/18 at 14:28: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.

  • Property mode set to 100644
File size: 41.8 KB
Line 
1RTEMS BSD Library Guide
2=======================
3:toc:
4:icons:
5:numbered:
6:website: http://www.rtems.org/
7
8RTEMS uses FreeBSD 9.2 as the source of its TCP/IP and USB stacks.
9This is a guide which captures information on the
10process of merging code from FreeBSD, building this library,
11RTEMS specific support files, and general guidelines on what
12modifications to the FreeBSD source are permitted.
13
14Goals of this effort are
15
16* update TCP/IP and provide USB in RTEMS,
17* ease updating to future FreeBSD versions,
18* ease tracking changes in FreeBSD code,
19* minimize manual changes in FreeBSD code, and
20* define stable kernel/device driver API which is implemented
21by both RTEMS and FreeBSD. This is the foundation of the port.
22
23We will work to push our changes upstream to the FreeBSD Project
24and minimize changes required at each update point.
25
26*******************************************************************************
27This is a work in progress and is very likely to be incomplete.
28Please help by adding to it.
29*******************************************************************************
30
31== Getting Started
32
33=== Tool Chain ===
34
35You need a tool chain for RTEMS based on at least RSB 5 April 2016 or later.
36
37=== Installation Overview ===
38
39. You must configure your BSP with the +--disable-networking+ option to disable
40the old network stack.  Make sure no header files of the old network stack are
41installed.
42
43. Clone the Git repository +git clone git://git.rtems.org/rtems-libbsd.git+.
44. Change into the RTEMS BSD library root directory.
45. If you want to run tests with a custom IP configuration instead of the default
46  one you can use an adjusted `config.inc` configuration file.
47. Run +waf configure ...+.
48. Run +waf+.
49. Run +waf install+.
50
51Refer to the README.waf for Waf building instructions.
52
53Make sure the submodules have been initialised and are updated. If a 'git
54status' says `rtems_waf` need updating run the submodule update command:
55
56 $ git submodule rtems_waf update
57
58=== Board Support Package Requirements ===
59
60The RTEMS version must be at least 5.  The Board Support Package (BSP)
61should support the
62http://www.rtems.org/onlinedocs/doxygen/cpukit/html/group\__rtems\__interrupt__extension.html[Interrupt Manager Extension]
63// The first underscores have to be masked to stop asciidoc interpreting them
64to make use of generic FreeBSD based drivers.
65
66The linker command file of the BSP must contain the following section
67definitions:
68
69-------------------------------------------------------------------------------
70.rtemsroset : {
71        KEEP (*(SORT(.rtemsroset.*)))
72}
73
74.rtemsrwset : {
75        KEEP (*(SORT(.rtemsrwset.*)))
76}
77-------------------------------------------------------------------------------
78
79The first output section can be placed in read-only memory.  The second output
80section must be placed in read-write memory.  The output section name is not
81relevant.  The output sections may also contain other input sections.
82
83=== Board Support Package Configuration and Build ===
84
85You need to configure RTEMS for the desired BSP and install it.  The BSP should
86be configured with a disabled network stack.  The BSD library containing the
87new network stack is a separate package.  Using a BSP installation containing
88the old network stack may lead to confusion and unpredictable results.
89
90The following script is used to build the `arm/xilinx_zynq_a9_qemu` BSP for
91our internal testing purposes:
92
93-------------------------------------------------------------------------------
94#!/bin/sh
95
96cd ${HOME}/sandbox
97rm -rf b-xilinx_zynq_a9_qemu
98mkdir b-xilinx_zynq_a9_qemu
99cd b-xilinx_zynq_a9_qemu
100${HOME}/git-rtems/configure \
101        --prefix=${HOME}/sandbox/install \
102        --target=arm-rtems5 \
103        --enable-rtemsbsp=xilinx_zynq_a9_qemu \
104        --disable-networking && \
105        make && \
106        make install
107-------------------------------------------------------------------------------
108
109The `arm/xilinx_zynq_a9_qemu` BSP running on the Qemu simulator has some
110benefits for development and test of the BSD library
111
112* it offers a NULL pointer read and write protection,
113* Qemu is a fast simulator,
114* Qemu provides support for GDB watchpoints,
115* Qemu provides support for virtual Ethernet networks, e.g. TUN and bridge
116devices (you can run multiple test instances on one virtual network).
117
118=== BSD Library Configuration and Build ===
119
120The build system based on the Waf build system. To build with Waf please refer
121to the README.waf file.
122
123Note that the libbsd supports different buildsets. These can be selected with
124the `--buildset=xxx.ini` option during the configure phase. Take a look at the
125comments in `buildset/*.ini` to see which build sets are officially supported.
126
127You can also create and provide your own buildset configuration. But remember
128that it's quite easy to break something by disabling the wrong modules. Only the
129configurations in the `buildset` directory are officially maintained.
130
131===== Example Configuration for Network Tests =====
132
133If you need some other IP configuration for the network tests that use a fixed
134IP config you can copy `config.inc` to a location outside to the source tree and
135adapt it. Then use the option `--net-test-config=NET_CONFIG` to pass the file to
136waf's configure command.
137
138-------------------------------------------------------------------------------
139NET_CFG_SELF_IP = 10.0.0.2
140NET_CFG_NETMASK = 255.255.0.0
141NET_CFG_PEER_IP = 10.0.0.1
142NET_CFG_GATEWAY_IP = 10.0.0.1
143-------------------------------------------------------------------------------
144
145=== BSD Library Initialization ===
146
147To initialise the BSD Library create a suitable rc.conf file. The FreeBSD man
148page rc.conf(5) provides the details needed to create a suitable format file:
149
150 https://www.freebsd.org/cgi/man.cgi?rc.conf
151
152You can call one of three functions to run the initialisation once BSD has
153initialised:
154
155 - rtems_bsd_run_etc_rc_conf: Run /etc/rc.conf.
156 - rtems_bsd_run_rc_conf: Run a user supplied file.
157 - rtems_bsd_run_rc_conf_script: Run the in memory line feed separated text string.
158
159For exapmle:
160
161 void
162 network_init(void)
163 {
164   rtems_status_code sc;
165
166   sc = rtems_bsd_initialize();
167   assert(sc == RTEMS_SUCCESSFUL);
168
169   rtems_bsd_run_etc_rc_conf(true); /* verbose = true */
170
171}
172
173By default the networking support is builtin. Other directives can be added and
174are found in 'machine/rtems-bsd-rc-conf-directives.h'. Please check the file
175for the list.
176
177The following network names are supported:
178
179  cloned_interfaces
180  ifconfig_'interface'
181  defaultrouter
182  hostname
183
184For example:
185
186 #
187 # My BSD initialisation.
188 #
189 hostname="myhost"
190 cloned_interfaces="vlan0 vlan1"
191 ifconfig_re0="inet inet 10.10.10.10 netmask 255.255.255.0"
192 fconfig_vlan0="inet 10.11.10.10 255.255.255.0 vlan 101 vlandev re0"
193 defaultrouter="10.10.10.1"
194
195You can also intialise the BSD library using code. The following code to
196initialize the BSD library:
197
198-------------------------------------------------------------------------------
199#include <assert.h>
200#include <sysexits.h>
201
202#include <machine/rtems-bsd-commands.h>
203#include <rtems/bsd/bsd.h>
204
205static void
206network_ifconfig_lo0(void)
207{
208        int exit_code;
209        char *lo0[] = {
210                "ifconfig",
211                "lo0",
212                "inet",
213                "127.0.0.1",
214                "netmask",
215                "255.255.255.0",
216                NULL
217        };
218        char *lo0_inet6[] = {
219                "ifconfig",
220                "lo0",
221                "inet6",
222                "::1",
223                "prefixlen",
224                "128",
225                NULL
226        };
227
228        exit_code = rtems_bsd_command_ifconfig(RTEMS_BSD_ARGC(lo0), lo0);
229        assert(exit_code == EX_OK);
230
231        exit_code = rtems_bsd_command_ifconfig(RTEMS_BSD_ARGC(lo0_inet6), lo0_inet6);
232        assert(exit_code == EX_OK);
233}
234
235void
236network_init(void)
237{
238        rtems_status_code sc;
239
240        sc = rtems_bsd_initialize();
241        assert(sc == RTEMS_SUCCESSFUL);
242
243        network_ifconfig_lo0();
244}
245-------------------------------------------------------------------------------
246
247This performs the basic network stack initialization with a loopback interface.
248Further initialization must be done using the standard BSD network
249configuration commands
250http://www.freebsd.org/cgi/man.cgi?query=ifconfig&apropos=0&sektion=8&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[IFCONFIG(8)]
251using `rtems_bsd_command_ifconfig()` and
252http://www.freebsd.org/cgi/man.cgi?query=route&apropos=0&sektion=8&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[ROUTE(8)]
253using `rtems_bsd_command_route()`.  For an example please have a look at
254`testsuite/include/rtems/bsd/test/default-network-init.h`.
255
256=== Task Priorities and Stack Size ===
257
258The default task priority is 96 for the interrupt server task (name "IRQS"), 98
259for the timer server task (name "TIME") and 100 for all other tasks.  The
260application may provide their own implementation of the
261`rtems_bsd_get_task_priority()` function (for example in the module which calls
262`rtems_bsd_initialize()`) if different values are desired.
263
264The task stack size is determined by the `rtems_bsd_get_task_stack_size()`
265function which may be provided by the application in case the default is not
266appropriate.
267
268=== Size for Allocator Domains ===
269
270The size for an allocator domain can be specified via the
271`rtems_bsd_get_allocator_domain_size()` function.  The application may provide
272their own implementation of the `rtems_bsd_get_allocator_domain_size()`
273function (for example in the module which calls `rtems_bsd_initialize()`) if
274different values are desired.  The default size is 8MiB for all domains.
275
276=== Redirecting or Disabling the Output ===
277
278A lot of system messages are printed to the stdout by default. If you want to
279redirect them you can overwrite the default print handler. That can even be done
280before the libbsd initialization to catch all messages. An example would look
281like follows:
282
283-------------------------------------------------------------------------------
284int my_vprintf_handler(int level, const char *fmt, va_list ap) {
285        /* Do something with the messages. */
286
287        return number_of_printed_chars;
288}
289
290...
291        /* In your initialization: */
292        rtems_bsd_vprintf_handler old;
293        old = rtems_bsd_set_vprintf_handler(my_vprintf_handler);
294...
295-------------------------------------------------------------------------------
296
297As a special case, you can set the `rtems_bsd_vprintf_handler_mute(...)`
298provided by libbsd to suppress all output.
299
300== Network Stack Features
301
302http://roy.marples.name/projects/dhcpcd/index[DHCPCD(8)]:: DHCP client
303
304https://developer.apple.com/library/mac/documentation/Networking/Reference/DNSServiceDiscovery_CRef/Reference/reference.html[dns_sd.h]:: DNS Service Discovery
305
306http://www.opensource.apple.com/source/mDNSResponder/mDNSResponder-320.10/mDNSCore/mDNSEmbeddedAPI.h[mDNS]:: Multi-Cast DNS
307
308http://www.freebsd.org/cgi/man.cgi?query=unix&sektion=4&apropos=0&manpath=FreeBSD+9.2-RELEASE[UNIX(4)]:: UNIX-domain protocol family
309
310http://www.freebsd.org/cgi/man.cgi?query=inet&sektion=4&apropos=0&manpath=FreeBSD+9.2-RELEASE[INET(4)]:: Internet protocol family
311
312http://www.freebsd.org/cgi/man.cgi?query=inet6&apropos=0&sektion=4&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[INET6(4)]:: Internet protocol version 6 family
313
314http://www.freebsd.org/cgi/man.cgi?query=tcp&apropos=0&sektion=4&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[TCP(4)]:: Internet Transmission Control Protocol
315
316http://www.freebsd.org/cgi/man.cgi?query=udp&apropos=0&sektion=4&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[UDP(4)]:: Internet User Datagram Protocol
317
318http://www.freebsd.org/cgi/man.cgi?query=route&sektion=4&apropos=0&manpath=FreeBSD+9.2-RELEASE[ROUTE(4)]:: Kernel packet forwarding database
319
320http://www.freebsd.org/cgi/man.cgi?query=bpf&apropos=0&sektion=4&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[BPF(4)]:: Berkeley Packet Filter
321
322http://www.freebsd.org/cgi/man.cgi?query=socket&apropos=0&sektion=2&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[SOCKET(2)]:: Create an endpoint for communication
323
324http://www.freebsd.org/cgi/man.cgi?query=kqueue&apropos=0&sektion=2&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[KQUEUE(2)]:: Kernel event notification mechanism
325
326http://www.freebsd.org/cgi/man.cgi?query=select&apropos=0&sektion=2&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[SELECT(2)]:: Synchronous I/O multiplexing
327
328http://www.freebsd.org/cgi/man.cgi?query=poll&apropos=0&sektion=2&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[POLL(2)]:: Synchronous I/O multiplexing
329
330http://www.freebsd.org/cgi/man.cgi?query=route&apropos=0&sektion=8&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[ROUTE(8)]:: Manually manipulate the routing tables
331
332http://www.freebsd.org/cgi/man.cgi?query=ifconfig&apropos=0&sektion=8&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[IFCONFIG(8)]:: Configure network interface parameters
333
334http://www.freebsd.org/cgi/man.cgi?query=netstat&apropos=0&sektion=1&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[NETSTAT(1)]:: Show network status
335
336http://www.freebsd.org/cgi/man.cgi?query=ping&apropos=0&sektion=8&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[PING(8)]:: Send ICMP ECHO_REQUEST packets to network hosts
337
338http://www.freebsd.org/cgi/man.cgi?query=ping6&apropos=0&sektion=8&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[PING6(8)]:: Send ICMPv6 ECHO_REQUEST packets to network hosts
339
340http://www.freebsd.org/cgi/man.cgi?query=sysctl&sektion=3&apropos=0&manpath=FreeBSD+9.2-RELEASE[SYSCTL(3)]:: Get or set system information
341
342http://www.freebsd.org/cgi/man.cgi?query=resolver&sektion=3&apropos=0&manpath=FreeBSD+9.2-RELEASE[RESOLVER(3)]:: Resolver routines
343
344http://www.freebsd.org/cgi/man.cgi?query=gethostbyname&sektion=3&apropos=0&manpath=FreeBSD+9.2-RELEASE[GETHOSTBYNAME(3)]:: Get network host entry
345
346== Network Interface Drivers
347
348=== Link Up/Down Events
349
350You can notifiy the application space of link up/down events in your network
351interface driver via the if_link_state_change(LINK_STATE_UP/LINK_STATE_DOWN)
352function.  The DHCPCD(8) client is a consumer of these events for example.
353Make sure that the interface flag IFF_UP and the interface driver flag
354IFF_DRV_RUNNING is set in case the link is up, otherwise ether_output() will
355return the error status ENETDOWN.
356
357== Shell Commands
358
359=== HOSTNAME(1)
360
361In addition to the standard options the RTEMS version of the HOSTNAME(1)
362command supports the -m flag to set/get the multicast hostname of the
363mDNS resolver instance.  See also rtems_mdns_sethostname() and
364rtems_mdns_gethostname().
365
366== Qemu
367
368Use the following script to set up a virtual network with three tap devices
369connected via one bridge device.
370
371-------------------------------------------------------------------------------
372#!/bin/sh -x
373
374user=`whoami`
375interfaces=(1 2 3)
376
377tap=qtap
378bri=qbri
379
380case $1 in
381        up)
382                sudo -i brctl addbr $bri
383                for i in ${interfaces[@]} ; do
384                        sudo -i tunctl -t $tap$i -u $user ;
385                        sudo -i ifconfig $tap$i up ;
386                        sudo -i brctl addif $bri $tap$i ;
387                done
388                sudo -i ifconfig $bri up
389                ;;
390        down)
391                for i in ${interfaces[@]} ; do
392                        sudo -i ifconfig $tap$i down ;
393                        sudo -i tunctl -d $tap$i ;
394                done
395                sudo -i ifconfig $bri down
396                sudo -i brctl delbr $bri
397                ;;
398esac
399-------------------------------------------------------------------------------
400
401Connect your Qemu instance to one of the tap devices, e.g.
402
403-------------------------------------------------------------------------------
404qemu-system-i386 -m 512 -boot a -cpu pentium3 \
405        -drive file=$HOME/qemu/pc386_fda,index=0,if=floppy,format=raw \
406        -drive file=fat:$HOME/qemu/hd,format=raw \
407        -net nic,model=e1000,macaddr=0e:b0:ba:5e:ba:11 \
408        -net tap,ifname=qtap1,script=no,downscript=no \
409        -nodefaults -nographic -serial stdio
410-------------------------------------------------------------------------------
411
412-------------------------------------------------------------------------------
413qemu-system-arm \
414        -serial null \
415        -serial mon:stdio \
416        -nographic \
417        -M xilinx-zynq-a9 \
418        -net nic,model=cadence_gem,macaddr=0e:b0:ba:5e:ba:11 \
419        -net tap,ifname=qtap1,script=no,downscript=no \
420        -m 256M \
421        -kernel build/arm-rtems5-xilinx_zynq_a9_qemu/media01.exe
422-------------------------------------------------------------------------------
423
424Make sure that each Qemu instance uses its own MAC address to avoid an address
425conflict (or otherwise use it as a test).
426
427To connect the Qemu instances with your local network use the following
428(replace 'eth0' with the network interface of your host).
429
430-------------------------------------------------------------------------------
431ifconfig eth0 0.0.0.0
432brctl addif qbri eth0
433dhclient qbri
434-------------------------------------------------------------------------------
435
436=== VDE and QEMU
437
438On FreeBSD you can create VDE or the Virtual Distributed Ethernet to create a
439network environment that does not need to run qemu as root or needing to drop
440the tap's privileges to run qemu.
441
442VDE creates a software switch with a default of 32 ports which means a single
443kernel tap can support 32 qemu networking sessions.
444
445To use VDE you need to build qemu with VDE support. The RSB can detect a VDE
446plug and enable VDE support in qemu when building. On FreeBSD install the VDE
447support with:
448
449 # pkg install -u vde2
450
451Build qemu with the RSB.
452
453To network create a bridge and a tap. The network is 10.10.1.0/24. On FreeBSD
454add to your /etc/rc.conf:
455
456 cloned_interfaces="bridge0 tap0"
457 autobridge_interfaces="bridge0"
458 autobridge_bridge0="re0 tap0"
459 ifconfig_re0="up"
460 ifconfig_tap0="up"
461 ifconfig_bridge0="inet 10.1.1.2 netmask 255.255.255.0"
462 defaultrouter="10.10.1.1"
463
464Start the VDE switch as root:
465
466 # sysctl net.link.tap.user_open=1
467 # sysctl net.link.tap.up_on_open=1
468 # vde_switch -d -s /tmp/vde1 -M /tmp/mgmt1 -tap tap0 -m 660 --mgmtmode 660
469 # chmod 660 /dev/tap0
470
471You can connect to the VDE switch's management channel using:
472
473 $ vdeterm /tmp/mgmt1
474
475To run qemu:
476
477 $ qemu-system-arm \
478        -serial null \
479        -serial mon:stdio \
480        -nographic \
481        -M xilinx-zynq-a9 \
482        -net nic,model=cadence_gem,macaddr=0e:b0:ba:5e:ba:11 \
483        -net vde,id=vde0,sock=/tmp/vde1
484        -m 256M \
485        -kernel build/arm-rtems5-xilinx_zynq_a9_qemu/rcconf02.exe
486
487== Issues and TODO
488
489* PCI support on x86 uses a quick and dirty hack, see pci_reserve_map().
490
491* Priority queues are broken with clustered scheduling.
492
493* Per-CPU data should be enabled once the new stack is ready for SMP.
494
495* Per-CPU NETISR(9) should be enabled onece the new stack is ready for SMP.
496
497* Multiple routing tables are not supported.  Every FIB value is set to zero
498  (= BSD_DEFAULT_FIB).
499
500* Process identifiers are not supported.  Every PID value is set to zero
501  (= BSD_DEFAULT_PID).
502
503* User credentials are not supported.  The following functions allow the
504  operation for everyone
505  - prison_equal_ip4(),
506  - chgsbsize(),
507  - cr_cansee(),
508  - cr_canseesocket() and
509  - cr_canseeinpcb().
510
511* A basic USB functionality test that is known to work on Qemu is desirable.
512
513* Adapt generic IRQ PIC interface code to Simple Vectored Interrupt Model
514  so that those architectures can use new TCP/IP and USB code.
515
516* freebsd-userspace/rtems/include/sys/syslog.h is a copy from the old
517  RTEMS TCP/IP stack. For some reason, the __printflike markers do not
518  compile in this environment. We may want to use the FreeBSD syslog.h
519  and get this addressed.
520
521* in_cksum implementations for architectures not supported by FreeBSD.
522  This will require figuring out where to put implementations that do
523  not originate from FreeBSD and are populated via the script.
524
525* MAC support functions are not thread-safe ("freebsd/lib/libc/posix1e/mac.c").
526
527* IFCONFIG(8): IEEE80211 support is disabled.  This module depends on a XML
528  parser and mmap().
529
530* get_cyclecount(): The implementation is a security problem.
531
532* What to do with the priority parameter present in the FreeBSD synchronization
533  primitives and the thread creation functions?
534
535* TASKQUEUE(9): Support spin mutexes.
536
537* ZONE(9): Review allocator lock usage in rtems-bsd-chunk.c.
538
539* KQUEUE(2): Choose proper lock for global kqueue list.
540
541* TIMEOUT(9): Maybe use special task instead of timer server to call
542  callout_tick().
543
544* sysctl_handle_opaque(): Implement reliable snapshots.
545
546* PING6(8): What to do with SIGALARM?
547
548* <sys/param.h>: Update Newlib to use a MSIZE of 256.
549
550* BPF(4): Add support for zero-copy buffers.
551
552* UNIX(4): Fix race conditions in the area of socket object and file node
553  destruction.  Add support for file descriptor transmission via control
554  messages.
555
556* PRINTF(9): Add support for log(), the %D format specifier is missing in the
557  normal printf() family.
558
559* Why is the interrupt server used?  The BSD interrupt handlers can block on
560synchronization primitives like mutexes.  This is in contrast to RTEMS
561interrupt service routines.  The BSPs using the generic interrupt support must
562implement the `bsp_interrupt_vector_enable()` and
563`bsp_interrupt_vector_disable()` routines.  They normally enable/disable a
564particular interrupt source at the interrupt controller.  This can be used to
565implement the interrupt server.  The interrupt server is a task that wakes-up
566in case an associated interrupt happens.  The interrupt source is disabled in
567a generic interrupt handler that wakes-up the interrupt server task.   Once the
568postponed interrupt processing is performed in the interrupt server the
569interrupt source is enabled again.
570
571* Convert all BSP linkcmds to use a linkcmds.base so the sections are
572easier to insert.
573
574* NIC Device Drivers
575- Only common PCI NIC drivers have been included in the initial set. These
576do not include any system on chip or ISA drivers.
577- PCI configuration probe does not appear to happen to determine if a
578NIC is in I/O or memory space. We have worked around this by using a
579static hint to tell the fxp driver the correct mode. But this needs to
580be addressed.
581- The ISA drivers require more BSD infrastructure to be addressed. This was
582outside the scope of the initial porting effort.
583
584== FreeBSD Source
585
586You should be able to rely on FreebSD manual pages and documentation
587for details on the code itself.
588
589== BSD Library Source
590
591== Initialization of the BSD Library
592
593The initialization of the BSD library is based on the FreeBSD SYSINIT(9)
594infrastructure.  The key to initializing a system is to ensure that the desired
595device drivers are explicitly pulled into the linked application.  This plus
596linking against the BSD library (`libbsd.a`) will pull in the necessary FreeBSD
597infrastructure.
598
599The FreeBSD kernel is not a library like the RTEMS kernel.  It is a bunch of
600object files linked together.  If we have a library, then creating the
601executable is simple.  We begin with a start symbol and recursively resolve all
602references.  With a bunch of object files linked together we need a different
603mechanism.  Most object files don't know each other.  Lets say we have a driver
604module.  The rest of the system has no references to this driver module.  The
605driver module needs a way to tell the rest of the system: Hey, kernel I am
606here, please use my services!
607
608This registration of independent components is performed by SYSINIT(9) and
609specializations:
610
611http://www.freebsd.org/cgi/man.cgi?query=SYSINIT
612
613The SYSINIT(9) uses some global data structures that are placed in a certain
614section.  In the linker command file we need this:
615
616-------------------------------------------------------------------------------
617.rtemsroset : {
618        KEEP (*(SORT(.rtemsroset.*)))
619}
620
621.rtemsrwset : {
622        KEEP (*(SORT(.rtemsrwset.*)))
623}
624-------------------------------------------------------------------------------
625
626This results for example in this executable layout:
627
628-------------------------------------------------------------------------------
629[...]
630 *(SORT(.rtemsroset.*))
631 .rtemsroset.bsd.modmetadata_set.begin
632                0x000000000025fe00        0x0 libbsd.a(rtems-bsd-init.o)
633                0x000000000025fe00                _bsd__start_set_modmetadata_set
634 .rtemsroset.bsd.modmetadata_set.content
635                0x000000000025fe00        0x8 libbsd.a(rtems-bsd-nexus.o)
636 .rtemsroset.bsd.modmetadata_set.content
637                0x000000000025fe08        0x4 libbsd.a(kern_module.o)
638[...]
639 .rtemsroset.bsd.modmetadata_set.content
640                0x000000000025fe68        0x4 libbsd.a(mii.o)
641 .rtemsroset.bsd.modmetadata_set.content
642                0x000000000025fe6c        0x4 libbsd.a(mii_bitbang.o)
643 .rtemsroset.bsd.modmetadata_set.end
644                0x000000000025fe70        0x0 libbsd.a(rtems-bsd-init.o)
645                0x000000000025fe70                _bsd__stop_set_modmetadata_set
646[...]
647.rtemsrwset     0x000000000030bad0      0x290
648 *(SORT(.rtemsrwset.*))
649 .rtemsrwset.bsd.sysinit_set.begin
650                0x000000000030bad0        0x0 libbsd.a(rtems-bsd-init.o)
651                0x000000000030bad0                _bsd__start_set_sysinit_set
652 .rtemsrwset.bsd.sysinit_set.content
653                0x000000000030bad0        0x4 libbsd.a(rtems-bsd-nexus.o)
654 .rtemsrwset.bsd.sysinit_set.content
655                0x000000000030bad4        0x8 libbsd.a(rtems-bsd-thread.o)
656 .rtemsrwset.bsd.sysinit_set.content
657                0x000000000030badc        0x4 libbsd.a(init_main.o)
658[...]
659 .rtemsrwset.bsd.sysinit_set.content
660                0x000000000030bd54        0x4 libbsd.a(frag6.o)
661 .rtemsrwset.bsd.sysinit_set.content
662                0x000000000030bd58        0x8 libbsd.a(uipc_accf.o)
663 .rtemsrwset.bsd.sysinit_set.end
664                0x000000000030bd60        0x0 libbsd.a(rtems-bsd-init.o)
665                0x000000000030bd60                _bsd__stop_set_sysinit_set
666[...]
667-------------------------------------------------------------------------------
668
669Here you can see, that some global data structures are collected into
670continuous memory areas.  This memory area can be identified by start and stop
671symbols.  This constructs a table of uniform items.
672
673The low level FreeBSD code calls at some time during the initialization the
674mi_startup() function (machine independent startup).  This function will sort
675the SYSINIT(9) set and call handler functions which perform further
676initialization.  The last step is the scheduler invocation.
677
678The SYSINIT(9) routines are run in mi_startup() which is called by
679rtems_bsd_initialize().
680
681This is also explained in "The Design and Implementation of the FreeBSD
682Operating System" section 14.3 "Kernel Initialization".
683
684In RTEMS we have a library and not a bunch of object files.  Thus we need a way
685to pull-in the desired services out of the libbsd.  Here the
686`rtems-bsd-sysinit.h` comes into play.  The SYSINIT(9) macros have been
687modified and extended for RTEMS in `<sys/kernel.h>`:
688
689-------------------------------------------------------------------------------
690#ifndef __rtems__
691#define C_SYSINIT(uniquifier, subsystem, order, func, ident)    \
692        static struct sysinit uniquifier ## _sys_init = {       \
693                subsystem,                                      \
694                order,                                          \
695                func,                                           \
696                (ident)                                         \
697        };                                                      \
698        DATA_SET(sysinit_set,uniquifier ## _sys_init)
699#else /* __rtems__ */
700#define SYSINIT_ENTRY_NAME(uniquifier)                          \
701        _bsd_ ## uniquifier ## _sys_init
702#define SYSINIT_REFERENCE_NAME(uniquifier)                      \
703        _bsd_ ## uniquifier ## _sys_init_ref
704#define C_SYSINIT(uniquifier, subsystem, order, func, ident)    \
705        struct sysinit SYSINIT_ENTRY_NAME(uniquifier) = {       \
706                subsystem,                                      \
707                order,                                          \
708                func,                                           \
709                (ident)                                         \
710        };                                                      \
711        RWDATA_SET(sysinit_set,SYSINIT_ENTRY_NAME(uniquifier))
712#define SYSINIT_REFERENCE(uniquifier)                           \
713        extern struct sysinit SYSINIT_ENTRY_NAME(uniquifier);   \
714        static struct sysinit const * const                     \
715        SYSINIT_REFERENCE_NAME(uniquifier) __used               \
716        = &SYSINIT_ENTRY_NAME(uniquifier)
717#define SYSINIT_MODULE_REFERENCE(mod)                           \
718        SYSINIT_REFERENCE(mod ## module)
719#define SYSINIT_DRIVER_REFERENCE(driver, bus)                   \
720        SYSINIT_MODULE_REFERENCE(driver ## _ ## bus)
721#define SYSINIT_DOMAIN_REFERENCE(dom)                           \
722        SYSINIT_REFERENCE(domain_add_ ## dom)
723#endif /* __rtems__ */
724-------------------------------------------------------------------------------
725
726Here you see that the SYSINIT(9) entries are no longer static.  The
727\*_REFERENCE() macros will create references to the corresponding modules which
728are later resolved by the linker.  The application has to provide an object
729file with references to all required FreeBSD modules.
730
731The FreeBSD device model is quite elaborated (with follow-ups):
732
733http://www.freebsd.org/cgi/man.cgi?query=driver
734
735The devices form a tree with the Nexus device at a high-level.  This Nexus
736device is architecture specific in FreeBSD.  In RTEMS we have our own Nexus
737device, see `rtemsbsd/bsp/bsp-bsd-nexus-devices.c`.
738
739=== SYSCTL_NODE Example
740
741During development, we had an undefined reference to
742_bsd_sysctl__net_children that we had trouble tracking down. Thanks to
743Chris Johns, we located it. He explained how to read SYSCTL_NODE
744definitions. This line from freebsd/netinet/in_proto.c is attempting
745to add the "inet" node to the parent node "_net".
746
747----
748SYSCTL_NODE(_net,      PF_INET,         inet,   CTLFLAG_RW, 0,
749        "Internet Family");
750----
751
752Our problem was that we could not find where _bsd_sysctl__net_children
753was defined. Chris suggested that when in doubt compile with -save-temps
754and look at the preprocessed .i files. But he did not need that. He
755explained that this the symbol name _bsd_sysctl__net_children was
756automatically generated by a SYSCTL_NODE as follows:
757
758* _bsd_ - added by RTEMS modifications to SYSCTL_NODE macro
759* sysctl_ - boilerplace added by SYSCTL_NODE macro
760* "" - empty string for parent node
761* net - name of SYSCTL_NODE
762* children - added by SYSCTL macros
763
764This was all generated by a support macro declaring the node as this:
765
766----
767struct sysctl_oid_list SYSCTL_NODE_CHILDREN(parent, name);
768----
769
770Given this information, we located this SYSCTL_NODE declaration in
771kern/kern_mib.c
772
773----
774SYSCTL_NODE(, CTL_KERN,   kern,   CTLFLAG_RW, 0,
775        "High kernel, proc, limits &c");
776----
777
778== Core FreeBSD APIs and RTEMS Replacements ==
779
780=== SX(9) (Shared/exclusive locks) ===
781
782http://www.freebsd.org/cgi/man.cgi?query=sx
783
784Binary semaphores (this neglects the ability to allow shared access).
785
786=== MUTEX(9) (Mutual exclusion) ===
787
788http://www.freebsd.org/cgi/man.cgi?query=mutex
789
790Binary semaphores (not recursive mutexes are not supported this way).
791
792=== RWLOCK(9) (Reader/writer lock) ===
793
794http://www.freebsd.org/cgi/man.cgi?query=rwlock
795
796POSIX r/w lock.
797
798=== RMLOCK(9) (Reader/writer lock optimized for mostly read access patterns) ===
799
800Note:  This object was implemented as a wrapper for RWLOCK in the rm_lock header file.
801
802http://www.freebsd.org/cgi/man.cgi?query=rmlock
803
804POSIX r/w lock.
805
806=== CONDVAR(9) (Condition variables) ===
807
808http://www.freebsd.org/cgi/man.cgi?query=condvar
809
810POSIX condition variables with modifications (hack).
811
812=== CALLOUT(9) (Timer functions) ===
813
814http://www.freebsd.org/cgi/man.cgi?query=callout
815
816Timer server.
817
818=== TASKQUEUE(9) (Asynchronous task execution) ===
819
820http://www.freebsd.org/cgi/man.cgi?query=taskqueue
821
822TBD.
823
824=== KTHREAD(9), KPROC(9) (Tasks) ===
825
826http://www.freebsd.org/cgi/man.cgi?query=kthread
827
828http://www.freebsd.org/cgi/man.cgi?query=kproc
829
830Tasks.
831
832=== ZONE(9) (Zone allocator) ===
833
834http://www.freebsd.org/cgi/man.cgi?query=zone
835
836TBD.
837
838=== devfs (Device file system) ===
839
840There is a minimal implementation based on IMFS. The mount point is fixed to
841"/dev". Note that the devfs is only used by the cdev subsystem. cdev has been
842adapted so that the full path (including the leading "/dev") is given to devfs.
843This saves some copy operations.
844
845devfs_create() first creates the full path and then creates an IMFS generic node
846for the device.
847
848TBD: remove empty paths on devfs_destroy().
849
850=== psignal (Signals) ===
851
852TBD.  Seems to be not needed.
853
854=== poll, select ===
855
856TBD.  Seems to be not needed.
857
858=== RMAN(9) (Resource management) ===
859
860http://www.freebsd.org/cgi/man.cgi?query=rman
861
862TBD.  Seems to be not needed.
863
864=== DEVCLASS(9), DEVICE(9), DRIVER(9), MAKE_DEV(9) (Device management) ===
865
866http://www.freebsd.org/cgi/man.cgi?query=devclass
867
868http://www.freebsd.org/cgi/man.cgi?query=device
869
870http://www.freebsd.org/cgi/man.cgi?query=driver
871
872http://www.freebsd.org/cgi/man.cgi?query=make_dev
873
874Use FreeBSD implementation as far as possible.  FreeBSD has a nice API for
875dynamic device handling.  It may be interesting for RTEMS to use this API
876internally in the future.
877
878=== BUS_SPACE(9), BUS_DMA(9) (Bus and DMA access) ===
879
880http://www.freebsd.org/cgi/man.cgi?query=bus_space
881
882http://www.freebsd.org/cgi/man.cgi?query=bus_dma
883
884Likely BSP dependent.  A default implementation for memory mapped linear access
885is easy to provide.  The current heap implementation supports all properties
886demanded by bus_dma (including the boundary constraint).
887
888== RTEMS Replacements by File Description ==
889
890Note:  Files with a status of USB are used by the USB test and have at least
891been partially tested.  If they contain both USB and Nic, then they are used
892by both and MAY contain methods that have not been tested yet.  Files that
893are only used by the Nic test are the most suspect.
894
895----
896rtems-libbsd File:      rtems-bsd-assert.c
897FreeBSD File:           rtems-bsd-config.h redefines BSD_ASSERT.
898Description:            This file contains the support method rtems_bsd_assert_func().
899Status:                 USB, Nic
900
901rtems-libbsd File:      rtems-bsd-autoconf.c
902FreeBSD File:           FreeBSD has BSP specific autoconf.c
903Description:            This file contains configuration methods that are used to setup the system.
904Status:                 USB
905
906rtems-libbsd File:      rtems-bsd-bus-dma.c
907FreeBSD File:           FreeBSD has BSP specific busdma_machdep.c
908Description:
909Status:                 USB, Nic
910
911rtems-libbsd File:      rtems-bsd-bus-dma-mbuf.c
912FreeBSD File:           FreeBSD has BSP specific busdma_machdep.c
913Description:
914Status:                 Nic
915
916rtems-libbsd File:      rtems-bsd-callout.c
917FreeBSD File:           kern/kern_timeout.c
918Description:
919Status:                 USB, Nic
920
921rtems-libbsd File:      rtems-bsd-cam.c
922FreeBSD File:           cam/cam_sim.c
923Description:
924Status:                 USB
925
926rtems-libbsd File:      rtems-bsd-condvar.c
927FreeBSD File:           kern/kern_condvar.c
928Description:
929Status:                 USB
930
931rtems-libbsd File:      rtems-bsd-copyinout.c
932FreeBSD File:           bsp specific copyinout.c )
933Description:            Note: The FreeBSD file is split with some methods being in rtems-bsd-support
934Status:                 Nic
935
936rtems-libbsd File:      rtems-bsd-delay.c
937FreeBSD File:           bsp specific file with multiple names
938Description:
939Status:                 USB, Nic
940
941rtems-libbsd File:      rtems-bsd-descrip.c
942FreeBSD File:           kern/kern_descrip.c
943Description:
944Status:                 Nic
945
946rtems-libbsd File:      rtems-bsd-generic.c
947FreeBSD File:           kern/sys_generic.c
948Description:
949Status:                 Nic
950
951rtems-libbsd File:      rtems-bsd-init.c
952FreeBSD File:           N/A
953Description:
954Status:                 USB, Nic
955
956rtems-libbsd File:      rtems-bsd-init-with-irq.c
957FreeBSD File:           N/A
958Description:
959Status:                 USB, Nic
960
961rtems-libbsd File:      rtems-bsd-jail.c
962FreeBSD File:           kern/kern_jail.c
963Description:
964Status:                 USB, Nic
965
966rtems-libbsd File:      rtems-bsd-lock.c
967FreeBSD File:           kern/subr_lock.c
968Description:
969Status:                 USB, Nic
970
971rtems-libbsd File:      rtems-bsd-log.c
972FreeBSD File:           kern/subr_prf.c
973Description:
974Status:                 Nic
975
976rtems-libbsd File:      rtems-bsd-malloc.c
977FreeBSD File:           kern/kern_malloc.c
978Description:
979Status:                 USB, Nic
980
981rtems-libbsd File:      rtems-bsd-mutex.c
982FreeBSD File:           kern/kern_mutex.c
983Description:
984Status:                 USB, Nic
985
986rtems-libbsd File:      rtems-bsd-newproc.c
987FreeBSD File:           N/A
988Description:
989Status:                 Nic
990
991rtems-libbsd File:      rtems-bsd-nexus.c
992FreeBSD File:           bsp specific nexus.c
993Description:
994Status:                 USB
995
996rtems-libbsd File:      rtems-bsd-panic.c
997FreeBSD File:           boot/common/panic.c
998Description:
999Status:                 USB, Nic
1000
1001rtems-libbsd File:      rtems-bsd-rwlock.c
1002FreeBSD File:           kern_rwlock.c
1003Description:
1004Status:                 USB, Nic
1005
1006rtems-libbsd File:      rtems-bsd-shell.c
1007FreeBSD File:           N/A
1008Description:
1009Status:                 USB
1010
1011rtems-libbsd File:      rtems-bsd-signal.c
1012FreeBSD File:           kern/kern_sig.c
1013Description:
1014Status:                 Nic
1015
1016rtems-libbsd File:      rtems-bsd-smp.c
1017FreeBSD File:           N/A
1018Description:
1019Status:                 Nic
1020
1021rtems-libbsd File:      rtems-bsd-support.c
1022FreeBSD File:           bsp specific copyinout.c
1023Description:            Note: the FreeBSD file is split with some methods being in rtems-bsd-copyinout.
1024Status:                 USB, Nic
1025
1026rtems-libbsd File:      rtems-bsd-sx.c
1027FreeBSD File:           kern/kern_sx.c
1028Description:            Status: USB, Nic
1029
1030rtems-libbsd File:      rtems-bsd-synch.c
1031FreeBSD File:           kern/kern_synch.c
1032Description:
1033Status:                 USB, Nic
1034
1035rtems-libbsd File:      rtems-bsd-syscalls.c
1036FreeBSD File:           User API for kern/uipc_syscalls.c
1037Description:
1038Status:                 Nic
1039
1040rtems-libbsd File:      rtems-bsd-sysctlbyname.c
1041FreeBSD File:           User API for sysctlbyname(3)
1042Description:
1043Status:
1044
1045rtems-libbsd File:      rtems-bsd-sysctl.c
1046FreeBSD File:           User API for sysctl(8)
1047Description:
1048Status:
1049
1050rtems-libbsd File:      rtems-bsd-sysctlnametomib.c
1051FreeBSD File:           User API for sysctlnametomib
1052Description:
1053Status:
1054
1055rtems-libbsd File:      rtems-bsd-taskqueue.c
1056FreeBSD File:           kern/subr_taskqueue.c
1057Description:
1058Status:                 Nic
1059
1060rtems-libbsd File:      rtems-bsd-thread.c
1061FreeBSD File:           kern/kern_kthread.c
1062Description:
1063Status:                 USB, Nic
1064
1065rtems-libbsd File:      rtems-bsd-timeout.c
1066FreeBSD File:           kern/kern_timeout.c
1067Description:
1068Status:                 Nic
1069
1070rtems-libbsd File:      rtems-bsd-timesupport.c
1071FreeBSD File:           kern/kern_clock.c
1072Description:
1073Status:                 Nic
1074
1075rtems-libbsd File:      rtems-bsd-vm_glue.c
1076FreeBSD File:           vm/vm_glue.c
1077Description:
1078Status:                 USB, Nic
1079----
1080
1081== Notes by File ==
1082
1083altq_subr.c - Arbitrary choices were made in this file that RTEMS would
1084not support tsc frequency change.  Additionally, the clock frequency
1085for machclk_freq is always measured for RTEMS.
1086
1087conf.h - In order to add make_dev and destroy_dev, variables in the cdev
1088structure that were not being used were conditionally compiled out. The
1089capability of supporting children did not appear to be needed and was
1090not implemented in the rtems version of these routines.
1091
1092== NICs Status ==
1093
1094----
1095Driver                  Symbol                          Status
1096======                  ======                          ======
1097RealTek                 _bsd_re_pcimodule_sys_init      Links
1098EtherExpress            _bsd_fxp_pcimodule_sys_init     Links
1099DEC tulip               _bsd_dc_pcimodule_sys_init      Links
1100Broadcom BCM57xxx       _bsd_bce_pcimodule_sys_init     Links
1101Broadcom BCM4401        _bsd_bfe_pcimodule_sys_init     Links
1102Broadcom BCM570x        _bsd_bge_pcimodule_sys_init     Needs Symbols (A)
1103E1000 IGB               _bsd_igb_pcimodule_sys_init     Links
1104E1000 EM                _bsd_em_pcimodule_sys_init      Links
1105Cadence                 ?                               Links, works.
1106----
1107
1108To add a NIC edit rtemsbsd/include/bsp/nexus-devices.h and add the driver
1109reference to the architecture and/or BSP. For example to add the RealTek driver
1110add:
1111
1112SYSINIT_DRIVER_REFERENCE(re, pci);
1113
1114and to add the MII PHY driver add:
1115
1116SYSINIT_DRIVER_REFERENCE(rge, miibus);
1117
1118The PC BSP has these entries.
1119
1120Symbols (A)
1121         pci_get_vpd_ident
1122
1123=== Cadence ===
1124
1125The cadence driver works on the Xilinx Zynq platform. The hardware checksum
1126support works on real hardware but does not seem to be supported on qemu
1127therefore the default state is to disable TXCSUM and RXCSUM and this can be
1128enabled from the shell with:
1129
1130  # ifconfig cgem0 rxcsum txcsum
1131
1132or with an ioctl call to the network interface driver with SIOCSIFCAP and the
1133mask IFCAP_TXCSUM and IFCAP_RXCSUM set.
1134
1135== PF (Firewall) ==
1136
1137It is possible to use PF as a firewall. See
1138[https://www.freebsd.org/doc/handbook/firewalls-pf.html] for details on the
1139range of functions and for how to configure the firewall.
1140
1141The following is necessary to use PF on RTEMS:
1142
1143- You have to provide a +/etc/pf.os+ file. The firewall can use it for passive
1144  OS fingerprinting. If you don't want to use this feature, the file may contain
1145  nothing except a line of comment (for example "# empty").
1146
1147- If some filters use protocol names (like tcp or udp) you have to provide a
1148  +/etc/protocols+ file.
1149
1150- If some filters use service names (like ssh or http) you have to provide a
1151  +/etc/services+ file.
1152
1153- Create a rule file (normally +/etc/pf.conf+). See the FreeBSD manual for the
1154  syntax.
1155
1156- Load the rule file using the pfctl command and enable pf. Please note that the
1157  pfctl command needs a lot of stack. You should use at least
1158  RTEMS_MINIMUM_STACK_SIZE + 8192 Bytes of stack. An example initialisation can
1159  look like follows:
1160
1161----
1162        int exit_code;
1163        char *params[] = {
1164                "pfctl",
1165                "-f",
1166                "/etc/pf.conf",
1167                "-e",
1168                NULL
1169        };
1170
1171        exit_code = rtems_bsd_command_pfctl(ARGC(params), params);
1172        assert(exit_code == EXIT_SUCCSESS);
1173----
1174
1175=== Known restrictions ===
1176
1177- Currently PF on RTEMS always uses the configuration for memory restricted
1178  systems (on FreeBSD that means systems with less than 100 MB RAM). This is
1179  fixed in +pfctl_init_options()+.
1180
1181== Wireless Network (WLAN) ==
1182
1183The libbsd provides a basic support for WLAN. Note that currently this support
1184is still in an early state. The WLAN support is _not_ enabled in the default
1185buildset. You have to configure libbsd with the
1186`--buildset=buildset/everything.ini` to enable that feature.
1187
1188The following gives a rough overview over the necessary steps to connect to an
1189encrypted network with an RTL8188EU based WiFi dongle:
1190
1191- Reference all necessary module for your BSP. For some BSPs this is already
1192  done in the nexus-devices.h:
1193
1194----
1195        SYSINIT_MODULE_REFERENCE(wlan_ratectl_none);
1196        SYSINIT_MODULE_REFERENCE(wlan_sta);
1197        SYSINIT_MODULE_REFERENCE(wlan_amrr);
1198        SYSINIT_MODULE_REFERENCE(wlan_wep);
1199        SYSINIT_MODULE_REFERENCE(wlan_tkip);
1200        SYSINIT_MODULE_REFERENCE(wlan_ccmp);
1201        SYSINIT_DRIVER_REFERENCE(rtwn_usb, uhub);
1202        SYSINIT_REFERENCE(rtwn_rtl8188eufw);
1203----
1204
1205- Create your wlan device using ifconfig:
1206  +ifconfig wlan0 create wlandev rtwn0 up+
1207
1208- Start a wpa_supplicant instance for that device:
1209  + wpa_supplicant_fork -Dbsd -iwlan0 -c/media/mmcsd-0-0/wpa_supplicant.conf+
1210
1211Note that the wpa_supplicant will only be active till the device goes down. A
1212workaround is to just restart it every time it exits.
1213
1214=== Known restrictions ===
1215
1216- The network interface (e.g. wlan0) is currently not automatically created. It
1217  would be nice, if some service would create it as soon as for example a USB
1218  device is connected. In FreeBSD the names are assigned via rc.conf with lines
1219  like +wlans_rtwn0="wlan0"+.
1220
1221- wpa_supplicant hast to be started after the device is created. It has to be
1222  restarted every time the connection goes down. Instead of this behaviour,
1223  there should be some service that starts and restarts wpa_supplicant
1224  automatically if a interface is ready. Probably the dhcpcd hooks could be used
1225  for that.
1226
1227- The current wpa_supplicant implementation is protected with a lock so it can't
1228  be started more than one time. If multiple interface should be used, all have
1229  to be handled by that single instance. That makes it hard to add interfaces
1230  dynamically. wpa_supplicant should be reviewed thoroughly whether multiple
1231  instances could be started in parallel.
1232
1233- The control interface of wpa_supplicant most likely doesn't work. The wpa_cli
1234  application is not ported.
1235
1236== Problems to report to FreeBSD ==
1237
1238The MMAP_NOT_AVAILABLE define is inverted on its usage.  When it is
1239defined the mmap method is called. Additionally, it is not used
1240thoroughly. It is not used in the unmap portion of the source.
1241The file rec_open.c uses the define MMAP_NOT_AVAILABLE to wrap
1242the call to mmap and file rec_close.c uses the munmap method.
Note: See TracBrowser for help on using the repository browser.