Home | History | Annotate | Line # | Download | only in examples
README revision 1.13
      1 	$NetBSD: README,v 1.13 2020/04/01 01:57:20 kamil Exp $
      2 
      3                            Kernel Developer's Manual
      4 
      5 DESCRIPTION
      6      The kernel example dynamic modules.
      7 
      8      This directory contains the following example modules:
      9      * executor        - basic implementation of callout and RUN_ONCE
     10      * fopsmapper      - basic implementation of mmap with fileops fo_mmap
     11      * hello           - the simplest `hello world' module
     12      * luahello        - the simplest `hello world' Lua module
     13      * luareadhappy    - demonstrates calling Lua code from C
     14      * mapper          - basic implementation of mmap
     15      * panic_string    - shows how panic is being called through a device
     16      * ping            - basic ioctl(9)
     17      * ping_block      - basic ioctl(9) with a block device
     18      * properties      - handle incoming properties during the module load
     19      * readhappy       - basic implementation of read(9) with happy numbers
     20      * readhappy_mpsafe- demonstrates how to make a module MPSAFE
     21      * sysctl          - demonstrates adding a sysctl handle dynamically
     22 
     23      To build the examples you need a local copy of NetBSD sources. You also
     24      need the comp set with toolchain. To build the module just enter a
     25      directory with example modules and use make(1):
     26 
     27          # make
     28 
     29      To load, unload, and stat the module use modload(8), modunload(8) and
     30      modstat(8).
     31 
     32      The S parameter in the Makefile files points to src/sys and it can be
     33      overloaded in this way:
     34 
     35          # make S=/data/netbsd/src/sys
     36 
     37      The code of a module does not need to be in src/sys unless it uses
     38      the autoconf(9) framework.
     39 
     40      A cross-build of a module for a target platform is possible with the
     41      build.sh framework. You need to generate the toolchain and set
     42      appropriately PATH to point bin/ in the TOOLDIR path. An example command
     43      to cross-build a module with the amd64 toolchain is as follows:
     44 
     45         # nbmake-amd64 S=/data/netbsd/src/sys
     46 
     47 
     48      The example modules should not be used on a production machine.
     49 
     50      All modules that create a cdevsw (or bdevsw) should be verified that
     51      the major number(s) should not conflict with a real device.
     52 
     53 SEE ALSO
     54      modctl(2), module(7), modload(8), modstat(8), modunload(8), module(9),
     55      intro(9lua)
     56 
     57 HISTORY
     58      An example of handling incoming properties first appeared in NetBSD 5.0
     59      and was written by Julio Merino with further modifications by Martin
     60      Husemann, Adam Hamsik, John Nemeth and Mindaugas Rasiukevicius.
     61 
     62      This document and additional modules (hello, readhappy, properties,
     63      ping, luahello and luareadhappy) first appeared in NetBSD 8.0; they were
     64      written by Kamil Rytarowski.
     65 
     66      The readhappy_mpsafe, executor and sysctls modules first appeared in NetBSD
     67      9.0 and were authored by Siddharth Muralee.
     68 
     69      The panic_string module first appeared in NetBSD 9.0 and was authored by
     70      Harry Pantazis.
     71 
     72      The mapper module first appeared in NetBSD 9.0 and was authored by
     73      Akul Pillai.
     74      
     75      The ping_block module first appeared in NetBSD 10.0 and was authored by
     76      Nisarg Joshi.
     77 
     78      The fopsmapper module first appeared in NetBSD 10.0 and was authored by
     79      Aditya Vardhan Padala.
     80 
     81 AUTHORS
     82      This document was written by Kamil Rytarowski.
     83