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