11.15Schristos $NetBSD: README,v 1.15 2020/04/30 00:48:10 christos Exp $ 21.1Spgoyette 31.1Spgoyette Kernel Developer's Manual 41.1Spgoyette 51.1SpgoyetteDESCRIPTION 61.1Spgoyette The kernel example dynamic modules. 71.1Spgoyette 81.6Skamil This directory contains the following example modules: 91.14Skamil * current_time - prints current date and time in GMT/UTC 101.6Skamil * executor - basic implementation of callout and RUN_ONCE 111.13Skamil * fopsmapper - basic implementation of mmap with fileops fo_mmap 121.1Spgoyette * hello - the simplest `hello world' module 131.6Skamil * luahello - the simplest `hello world' Lua module 141.6Skamil * luareadhappy - demonstrates calling Lua code from C 151.9Skamil * mapper - basic implementation of mmap 161.8Skamil * panic_string - shows how panic is being called through a device 171.8Skamil * ping - basic ioctl(9) 181.11Skamil * ping_block - basic ioctl(9) with a block device 191.1Spgoyette * properties - handle incoming properties during the module load 201.15Schristos * pollpal - implementation of basic poll(9) using palindrome 211.1Spgoyette * readhappy - basic implementation of read(9) with happy numbers 221.7Skamil * readhappy_mpsafe- demonstrates how to make a module MPSAFE 231.5Skamil * sysctl - demonstrates adding a sysctl handle dynamically 241.1Spgoyette 251.1Spgoyette To build the examples you need a local copy of NetBSD sources. You also 261.1Spgoyette need the comp set with toolchain. To build the module just enter a 271.1Spgoyette directory with example modules and use make(1): 281.1Spgoyette 291.1Spgoyette # make 301.1Spgoyette 311.1Spgoyette To load, unload, and stat the module use modload(8), modunload(8) and 321.1Spgoyette modstat(8). 331.1Spgoyette 341.1Spgoyette The S parameter in the Makefile files points to src/sys and it can be 351.1Spgoyette overloaded in this way: 361.1Spgoyette 371.1Spgoyette # make S=/data/netbsd/src/sys 381.1Spgoyette 391.12Spgoyette The code of a module does not need to be in src/sys unless it uses 401.1Spgoyette the autoconf(9) framework. 411.1Spgoyette 421.12Spgoyette A cross-build of a module for a target platform is possible with the 431.1Spgoyette build.sh framework. You need to generate the toolchain and set 441.1Spgoyette appropriately PATH to point bin/ in the TOOLDIR path. An example command 451.1Spgoyette to cross-build a module with the amd64 toolchain is as follows: 461.1Spgoyette 471.1Spgoyette # nbmake-amd64 S=/data/netbsd/src/sys 481.1Spgoyette 491.1Spgoyette 501.1Spgoyette The example modules should not be used on a production machine. 511.1Spgoyette 521.12Spgoyette All modules that create a cdevsw (or bdevsw) should be verified that 531.12Spgoyette the major number(s) should not conflict with a real device. 541.1Spgoyette 551.1SpgoyetteSEE ALSO 561.3Spgoyette modctl(2), module(7), modload(8), modstat(8), modunload(8), module(9), 571.3Spgoyette intro(9lua) 581.1Spgoyette 591.1SpgoyetteHISTORY 601.1Spgoyette An example of handling incoming properties first appeared in NetBSD 5.0 611.1Spgoyette and was written by Julio Merino with further modifications by Martin 621.1Spgoyette Husemann, Adam Hamsik, John Nemeth and Mindaugas Rasiukevicius. 631.1Spgoyette 641.1Spgoyette This document and additional modules (hello, readhappy, properties, 651.4Ssevan ping, luahello and luareadhappy) first appeared in NetBSD 8.0; they were 661.4Ssevan written by Kamil Rytarowski. 671.1Spgoyette 681.7Skamil The readhappy_mpsafe, executor and sysctls modules first appeared in NetBSD 691.7Skamil 9.0 and were authored by Siddharth Muralee. 701.5Skamil 711.8Skamil The panic_string module first appeared in NetBSD 9.0 and was authored by 721.8Skamil Harry Pantazis. 731.8Skamil 741.9Skamil The mapper module first appeared in NetBSD 9.0 and was authored by 751.9Skamil Akul Pillai. 761.10Skamil 771.10Skamil The ping_block module first appeared in NetBSD 10.0 and was authored by 781.10Skamil Nisarg Joshi. 791.9Skamil 801.13Skamil The fopsmapper module first appeared in NetBSD 10.0 and was authored by 811.13Skamil Aditya Vardhan Padala. 821.13Skamil 831.14Skamil The current_time module first appeared in NetBSD 10.0 and was authored by 841.14Skamil Apurva Nandan. 851.14Skamil 861.15Schristos The pollpall module first appeared in NetBSD 10.0 and was authored by 871.15Schristos Ayushi Sharma. 881.15Schristos 891.1SpgoyetteAUTHORS 901.1Spgoyette This document was written by Kamil Rytarowski. 91