mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-06-01 18:13:53 +08:00
162 lines
5.6 KiB
Plaintext
162 lines
5.6 KiB
Plaintext
RTEMS BSD USB and TCP/IP Developers Guide
|
|
=========================================
|
|
Joel Sherrill <joel.sherrill@oarcorp.com>
|
|
:Author Initials: JRS
|
|
:toc:
|
|
:icons:
|
|
:numbered:
|
|
:website: http://www.rtems.org/
|
|
|
|
RTEMS uses FreeBSD as the source of its TCP/IP and USB stacks.
|
|
This is a developers guide which captures information on the
|
|
process of merging code from FreeBSD, building this library,
|
|
RTEMS specific support files, and general guidelines on what
|
|
modifications to the FreeBSD source are permitted.
|
|
|
|
Goals of this effort are:
|
|
|
|
* Update TCP/IP and provide USB in RTEMS
|
|
* Ease updating to future FreeBSD versions
|
|
* Ease tracking changes in FreeBSD code
|
|
* Minimize manual changes in FreeBSD code
|
|
* Define stable kernel/device driver API which is implemented
|
|
by both RTEMS and FreeBSD. This is the foundation of the port.
|
|
|
|
We will work to push our changes upstream to the FreeBSD Project
|
|
and minimize changes required at each update point.
|
|
|
|
**************************************************************
|
|
This is a work in progress and is very likely to be incomplete.
|
|
Please help by adding to it.
|
|
**************************************************************
|
|
|
|
== Source Code Version Information
|
|
|
|
* FreeBSD 8.2 SVN r222496
|
|
* RTEMS 4.11
|
|
- BSP must have support for all new BSD sys sections
|
|
- It is preferable if the BSP uses linkcmds.base.
|
|
- BSP must be from an architecture with Programmable Interrupt Controller
|
|
interrupt model.
|
|
|
|
The FreeBSD 8.2 SVN checkout will generally be referred to as the
|
|
FreeBSD source in this document.
|
|
|
|
== To Do
|
|
* Adapt generic IRQ PIC interface code to Simple Vectored Interrupt Model
|
|
so that those architectures can use new TCP/IP and USB code.
|
|
* in_cksum implementations for architectures not supported by FreeBSD.
|
|
This will require figuring out where to put implementations that do
|
|
not originate from FreeBSD and are populated via the script.
|
|
* generic in_cksum implementation is missing in_cksum_split so currently
|
|
cannot be used.
|
|
|
|
== FreeBSD Source
|
|
|
|
You should be able to rely on FreebSD manual pages and documentation
|
|
for details on the code itself.
|
|
|
|
=== Automatically Generated FreeBSD Files
|
|
|
|
The FreeBSD source tarball includes a file named Makefile.rtems which
|
|
has stanzas to automatically generate some files.
|
|
|
|
http://www.freebsd.org/cgi/man.cgi?query=kobj&apropos=0&sektion=0&manpath=FreeBSD+9.0-RELEASE&arch=default&format=html
|
|
|
|
=== Rules for Modifying FreeBSD Source
|
|
|
|
* Only add lines. Subtract code by added "ifndef __rtems__". This makes
|
|
merging easier in the future.
|
|
|
|
== libbsd Source
|
|
|
|
=== What is in git
|
|
|
|
The git source is a self-contained kit with FreeBSD and RTEMS components
|
|
pre-merged. The Makefile in this kit is automatically generated.
|
|
|
|
Any changes to sources in the freebsd or contrib directories will need to
|
|
be merged upstream into our master FreeBSD svn checkout.
|
|
|
|
=== Building git
|
|
|
|
You need to configure RTEMS for the desired BSP and install it. Then edit
|
|
the file config.inc to set RTEMS_MAKEFILE_PATH appropriately.
|
|
|
|
[listing]
|
|
----
|
|
make
|
|
make install
|
|
make -C testsuite
|
|
----
|
|
|
|
At this point, we expect multiple linker errors. That is what we are
|
|
currently working on.
|
|
|
|
=== Organization
|
|
|
|
The top level directory contains a few directories and files. The following
|
|
are important to understand:
|
|
|
|
* freebsd-to-rtems.py - script to convert to and free FreeBSD and RTEMS trees
|
|
* Makefile - automatically generated
|
|
* contrib/ - from FreeBSD by script.
|
|
* freebsd/ - from FreeBSD by script.
|
|
* rtemsbsd/ - RTEMS specific implementations of FreeBSD kernel support routines.
|
|
* testsuite/ - RTEMS specific tests
|
|
* libbsd.txt - Documentation in Asciidoc
|
|
|
|
== Moving Code Between FreeBSD SVN and RTEMS libbsd
|
|
|
|
The script freebsd-to-rtems.py is used to copy code from FreeBSD to the
|
|
RTEMS libbsd tree and to reverse this process. This script attempts to
|
|
automate this process as much as possible and performs some transformations
|
|
on the FreeBSD code. Its command line arguments are shown below:
|
|
|
|
[listing]
|
|
----
|
|
freebsd-to-rtems.py [args]
|
|
-?|-h|--help print this and exit
|
|
-d|--dry-run run program but no modifications
|
|
-e|--early-exit evaluate arguments, print results, and exit
|
|
-m|--makefile just generate Makefile
|
|
-R|--reverse default FreeBSD -> RTEMS, reverse that
|
|
-r|--rtems RTEMS directory
|
|
-f|--freebsd FreeBSD directory
|
|
-v|--verbose enable verbose output mode
|
|
----
|
|
|
|
In its default mode of operation, freebsd-to-rtems.py is used to copy code
|
|
from FreeBSD to the RTEMS libbsd tree and perform transformations. In forward
|
|
mode, the script may be requested to just generate the Makefile.
|
|
|
|
In "reverse mode", this script undoes those transformations and copies
|
|
the source code back to the FreeBSD SVN tree. This allows us to do
|
|
'svn diff', evaluate changes made by the RTEMS Project, and report changes
|
|
back to FreeBSD upstream.
|
|
|
|
In either mode, the script may be asked to perform a dry-run or be verbose.
|
|
Also, in either mode, the script is also smart enough to avoid copying over
|
|
files which have not changed. This means that the timestamps of files are
|
|
not changed unless the contents change. The script will also report the
|
|
number of files which changed. In verbose mode, the script will print
|
|
the name of the files which are changed.
|
|
|
|
The following is an example forward run with no changes.
|
|
|
|
[listing]
|
|
----
|
|
$ ~/newbsd/git/libbsd-8.2/freebsd-to-rtems.py \
|
|
-r /home/joel/newbsd/git/libbsd-8.2 \
|
|
-f /home/joel/newbsd/libbsd/freebsd-8.2 -v
|
|
Verbose: yes
|
|
Dry Run: no
|
|
Only Generate Makefile: no
|
|
RTEMS Directory: /home/joel/newbsd/git/libbsd-8.2
|
|
FreeBSD Directory: /home/joel/newbsd/libbsd/freebsd-8.2
|
|
Direction: forward
|
|
Generating into /home/joel/newbsd/git/libbsd-8.2
|
|
0 files were changed.
|
|
----
|
|
|