Changeset f71cbd0 in rtems-libbsd for libbsd.txt


Ignore:
Timestamp:
07/06/16 14:06:54 (8 years ago)
Author:
Christian Mauderer <Christian.Mauderer@…>
Branches:
5, 5-freebsd-12, 6-freebsd-12, freebsd-9.3, master
Children:
f1941b2
Parents:
df222eb
git-author:
Christian Mauderer <Christian.Mauderer@…> (07/06/16 14:06:54)
git-committer:
Christian Mauderer <Christian.Mauderer@…> (08/02/16 08:58:02)
Message:

libbsd.txt: Add guide for user space tools.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libbsd.txt

    rdf222eb rf71cbd0  
    760760measure on how much of a file differs from the original FreeBSD source. The
    761761lower the value the more transparent the source file it.
     762
     763== Porting of user space utilities
     764
     765The theory behind the described method is to put all BSS and initialized data
     766objects into a named section. This section then will be saved before the code is
     767executed and restored after it has finished. This method limits to a single
     768threaded execution of the application but minimizes the necessary changes to the
     769original FreeBSD code.
     770
     771. Import and commit the unchanged source files like described above.
     772. Add the files to the libbsd.py and build them.
     773. Use nm on the generated object files to find out which objects are initialized
     774  (either in BSS -- type b or B -- or in the initialized data segment -- type d
     775  or D). An example call could look like follows:
     776  `arm-rtems4.12-nm build/arm-rtems4.12-xilinx_zynq_a9_qemu/freebsd/contrib/pf/pfctl/pfctl.c.10.o | grep ' [DdbB] '`
     777. Check the sources for everything that can be made const. This type of patches
     778  should go back to the upstream FreeBSD sources.
     779. Check the sources for every global variable that can be made static. This type
     780  of patches should go back to the upstream FreeBSD sources.
     781. Move static variables out of functions. This patches should also go upstream.
     782. Create one `xxx-data.h` file per c module. This header should contain
     783  declarations for the remaining initialized objects matching the original
     784  declarations but adding a section attribute. The section name has to match the
     785  name of the RTEMS_LINKER_RWSET defined further below. For an example look at
     786  `freebsd/contrib/pf/pfctl/pfctl-data.h`.
     787. Include the header files at the end of the corresponding c files.
     788. Add a rtems_bsd_command_xxx wrapper function to the c file containing the main
     789  function. For an example look at `rtems_bsd_command_pfctl(...)` in
     790  `freebsd/contrib/pf/pfctl/pfctl.c`.
     791. Create one compilable commit.
    762792
    763793== Initialization of the BSD Library
Note: See TracChangeset for help on using the changeset viewer.