Changeset f71cbd0 in rtems-libbsd for libbsd.txt

Jul 6, 2016, 2:06:54 PM (3 years ago)
Christian Mauderer <Christian.Mauderer@…>
7ece7548c1b05cf6bb10e6708b83b2401d45c250, freebsd-9.3, 29cc431e0bcfe059d65ac3019f53eeafa5064ae8
Christian Mauderer <Christian.Mauderer@…> (07/06/16 14:06:54)
Christian Mauderer <Christian.Mauderer@…> (08/02/16 08:58:02)

libbsd.txt: Add guide for user space tools.

1 edited


  • 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.
     763== Porting of user space utilities
     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.
     771. Import and commit the unchanged source files like described above.
     772. Add the files to the 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.
    763793== Initialization of the BSD Library
Note: See TracChangeset for help on using the changeset viewer.