source: rtems-libbsd/libbsd.txt @ e392fdb7

4.115-freebsd-12freebsd-9.3
Last change on this file since e392fdb7 was e392fdb7, checked in by Joel Sherrill <joel.sherrill@…>, on Mar 9, 2012 at 5:18:06 PM

Documentation additions.

  • Property mode set to 100644
File size: 5.6 KB
Line 
1RTEMS BSD USB and TCP/IP Developers Guide
2=========================================
3Joel Sherrill <joel.sherrill@oarcorp.com>
4:Author Initials: JRS
5:toc:
6:icons:
7:numbered:
8:website: http://www.rtems.org/
9
10RTEMS uses FreeBSD as the source of its TCP/IP and USB stacks.
11This is a developers guide which captures information on the
12process of merging code from FreeBSD, building this library,
13RTEMS specific support files, and general guidelines on what
14modifications to the FreeBSD source are permitted.
15
16Goals of this effort are:
17
18* Update TCP/IP and provide USB in RTEMS
19* Ease updating to future FreeBSD versions
20* Ease tracking changes in FreeBSD code
21* Minimize manual changes in FreeBSD code
22* Define stable kernel/device driver API which is implemented
23by both RTEMS and FreeBSD. This is the foundation of the port.
24
25We will work to push our changes upstream to the FreeBSD Project
26and minimize changes required at each update point.
27
28**************************************************************
29This is a work in progress and is very likely to be incomplete.
30Please help by adding to it.
31**************************************************************
32
33== Source Code Version Information
34
35* FreeBSD 8.2 SVN r222496
36* RTEMS 4.11
37  - BSP must have support for all new BSD sys sections
38  - It is preferable if the BSP uses linkcmds.base.
39  - BSP must be from an architecture with Programmable Interrupt Controller
40    interrupt model.
41
42The FreeBSD 8.2 SVN checkout will generally be referred to as the
43FreeBSD source in this document.
44
45== To Do
46* Adapt generic IRQ PIC interface code to Simple Vectored Interrupt Model
47  so that those architectures can use new TCP/IP and USB code.
48* in_cksum implementations for architectures not supported by FreeBSD.
49  This will require figuring out where to put implementations that do
50  not originate from FreeBSD and are populated via the script.
51* generic in_cksum implementation is missing in_cksum_split so currently
52  cannot be used.
53
54== FreeBSD Source
55
56You should be able to rely on FreebSD manual pages and documentation
57for details on the code itself.
58
59=== Automatically Generated FreeBSD Files
60
61The FreeBSD source tarball includes a file named Makefile.rtems which
62has stanzas to automatically generate some files.
63
64http://www.freebsd.org/cgi/man.cgi?query=kobj&apropos=0&sektion=0&manpath=FreeBSD+9.0-RELEASE&arch=default&format=html
65
66=== Rules for Modifying FreeBSD Source
67
68* Only add lines.  Subtract code by added "ifndef __rtems__". This makes
69merging easier in the future.
70
71== libbsd Source
72
73=== What is in git
74
75The git source is a self-contained kit with FreeBSD and RTEMS components
76pre-merged. The Makefile in this kit is automatically generated.
77
78Any changes to sources in the freebsd or contrib directories will need to
79be merged upstream into our master FreeBSD svn checkout.
80
81=== Building git
82
83You need to configure RTEMS for the desired BSP and install it. Then edit
84the file config.inc to set RTEMS_MAKEFILE_PATH appropriately.
85
86[listing]
87----
88make
89make install
90make -C testsuite
91----
92
93At this point, we expect multiple linker errors. That is what we are
94currently working on.
95
96=== Organization
97
98The top level directory contains a few directories and files. The following
99are important to understand:
100
101* freebsd-to-rtems.py - script to convert to and free FreeBSD and RTEMS trees
102* Makefile - automatically generated
103* contrib/ - from FreeBSD by script.
104* freebsd/ - from FreeBSD by script.
105* rtemsbsd/ - RTEMS specific implementations of FreeBSD kernel support routines.
106* testsuite/ - RTEMS specific tests
107* libbsd.txt - Documentation in Asciidoc
108
109== Moving Code Between FreeBSD SVN and RTEMS libbsd
110
111The script freebsd-to-rtems.py is used to copy code from FreeBSD to the
112RTEMS libbsd tree and to reverse this process. This script attempts to
113automate this process as much as possible and performs some transformations
114on the FreeBSD code. Its command line arguments are shown below:
115
116[listing]
117----
118freebsd-to-rtems.py [args]
119  -?|-h|--help     print this and exit
120  -d|--dry-run     run program but no modifications
121  -e|--early-exit  evaluate arguments, print results, and exit
122  -m|--makefile    just generate Makefile
123  -R|--reverse     default FreeBSD -> RTEMS, reverse that
124  -r|--rtems       RTEMS directory
125  -f|--freebsd     FreeBSD directory
126  -v|--verbose     enable verbose output mode
127----
128
129In its default mode of operation, freebsd-to-rtems.py is used to copy code
130from FreeBSD to the RTEMS libbsd tree and perform transformations.  In forward
131mode, the script may be requested to just generate the Makefile.
132
133In "reverse mode", this script undoes those transformations and copies
134the source code back to the FreeBSD SVN tree. This allows us to do
135'svn diff', evaluate changes made by the RTEMS Project, and report changes
136back to FreeBSD upstream.
137
138In either mode, the script may be asked to perform a dry-run or be verbose.
139Also, in either mode, the script is also smart enough to avoid copying over
140files which have not changed. This means that the timestamps of files are
141not changed unless the contents change. The script will also report the
142number of files which changed. In verbose mode, the script will print
143the name of the files which are changed.
144
145The following is an example forward run with no changes.
146
147[listing]
148----
149$ ~/newbsd/git/libbsd-8.2/freebsd-to-rtems.py \
150    -r /home/joel/newbsd/git/libbsd-8.2 \
151    -f /home/joel/newbsd/libbsd/freebsd-8.2 -v
152Verbose:                yes
153Dry Run:                no
154Only Generate Makefile: no
155RTEMS Directory:        /home/joel/newbsd/git/libbsd-8.2
156FreeBSD Directory:      /home/joel/newbsd/libbsd/freebsd-8.2
157Direction:              forward
158Generating into /home/joel/newbsd/git/libbsd-8.2
1590 files were changed.
160----
161
Note: See TracBrowser for help on using the repository browser.