Changeset 8c0eeba in rtems-libbsd for libbsd.txt


Ignore:
Timestamp:
Aug 10, 2016, 1:20:42 PM (3 years ago)
Author:
Christian Mauderer <Christian.Mauderer@…>
Branches:
7ece7548c1b05cf6bb10e6708b83b2401d45c250, 29cc431e0bcfe059d65ac3019f53eeafa5064ae8
Children:
c40e45b
Parents:
750b2d4
git-author:
Christian Mauderer <Christian.Mauderer@…> (08/10/16 13:20:42)
git-committer:
Sebastian Huber <sebastian.huber@…> (01/10/17 08:53:26)
Message:

userspace-header-gen.py: Simplify program ports

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libbsd.txt

    r750b2d4 r8c0eeba  
    810810lower the value the more transparent the source file it.
    811811
    812 == Porting of user space utilities
     812== Porting of userspace utilities
    813813
    814814The theory behind the described method is to put all BSS and initialized data
     
    820820. Import and commit the unchanged source files like described above.
    821821. Add the files to the libbsd.py and build them.
    822 . Use nm on the generated object files to find out which objects are initialized
    823   (either in BSS -- type b or B -- or in the initialized data segment -- type d
    824   or D). An example call could look like follows:
    825   `arm-rtems4.12-nm build/arm-rtems4.12-xilinx_zynq_a9_qemu/freebsd/contrib/pf/pfctl/pfctl.c.10.o | grep ' [DdbB] '`
    826822. Check the sources for everything that can be made const. This type of patches
    827823  should go back to the upstream FreeBSD sources.
    828 . Check the sources for every global variable that can be made static. This type
    829   of patches should go back to the upstream FreeBSD sources.
    830 . Move static variables out of functions. This patches should also go upstream.
    831 . Create one `xxx-data.h` file per c module. This header should contain
    832   declarations for the remaining initialized objects matching the original
    833   declarations but adding a section attribute. The section name has to match the
    834   name of the RTEMS_LINKER_RWSET defined further below. For an example look at
    835   `freebsd/contrib/pf/pfctl/pfctl-data.h`.
    836 . Include the header files at the end of the corresponding c files.
    837 . Add a rtems_bsd_command_xxx wrapper function to the c file containing the main
    838   function. For an example look at `rtems_bsd_command_pfctl(...)` in
    839   `freebsd/contrib/pf/pfctl/pfctl.c`.
     824. Move static variables out of functions if necessary (search for
     825  "<TAB>static"). These patches most likely will not be accepted into FreeBSD.
     826. Add a rtems_bsd_command_PROGNAME() wrapper function to the source file
     827  containing the main function (e.g. PROGNAME = pfctl). For an example look at
     828  `rtems_bsd_command_pfctl()` in `freebsd/sbin/pfctl/pfctl.c`.
     829. You probably have to use getopt_r() instead of getopt(). Have a look at
     830  `freebsd/sbin/pfctl/pfctl.c`.
     831. Build the libbsd without optimization.
     832. Use the `userspace-header-gen.py` to generate some necessary header
     833  files. It will generate one `rtems-bsd-PROGNAME-MODULE-data.h` per object file, one
     834  `rtems-bsd-PROGNAME-namespace.h` and one `rtems-bsd-PROGNAME-data.h`. To call
     835  the script, you have to compile the objects and afterwards run the helper
     836  script with a call similar to this one:
     837  `python ./userspace-header-gen.py build/arm-rtems4.12-xilinx_zynq_a9_qemu/freebsd/sbin/pfctl/*.o -p pfctl`
     838  Replace the name (given via -p option) by the name of the userspace tool. It
     839  has to match the name that is used in the RTEMS linker set further below.
     840. If you regenerated files that have already been generated, you may have to
     841  remove RTEMS-specific names from the namespace. The defaults (linker set names
     842  and rtems_bsd_program_xxx) should already be filtered.
     843. Put the generated header files into the same folder like the source files.
     844. Include `PROGNAME-rtems-bsd-namespace.h` at the top of each source file and
     845  the `PROGNAME-rtems-bsd-MODULE-data.h` after the include section of the
     846  corresponding source files.
     847. Include `machine/rtems-bsd-program.h` at the top of the include block in each
     848  source file.
    840849. Create one compilable commit.
    841850
Note: See TracChangeset for help on using the changeset viewer.