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