README revision 1.5
11.5Skamil $NetBSD: README,v 1.5 2018/04/13 01:20:27 kamil Exp $ 21.1Spgoyette 31.1Spgoyette Kernel Developer's Manual 41.1Spgoyette 51.1SpgoyetteDESCRIPTION 61.1Spgoyette The kernel example dynamic modules. 71.1Spgoyette 81.5Skamil This directory contains the following example modules 91.1Spgoyette * hello - the simplest `hello world' module 101.1Spgoyette * properties - handle incoming properties during the module load 111.1Spgoyette * readhappy - basic implementation of read(9) with happy numbers 121.1Spgoyette * ping - basic ioctl(9) 131.2Spgoyette * luahello - the simplest `hello world' Lua module 141.4Ssevan * luareadhappy - demonstrates calling Lua code from C 151.5Skamil * sysctl - demonstrates adding a sysctl handle dynamically 161.1Spgoyette 171.1Spgoyette To build the examples you need a local copy of NetBSD sources. You also 181.1Spgoyette need the comp set with toolchain. To build the module just enter a 191.1Spgoyette directory with example modules and use make(1): 201.1Spgoyette 211.1Spgoyette # make 221.1Spgoyette 231.1Spgoyette To load, unload, and stat the module use modload(8), modunload(8) and 241.1Spgoyette modstat(8). 251.1Spgoyette 261.1Spgoyette The S parameter in the Makefile files points to src/sys and it can be 271.1Spgoyette overloaded in this way: 281.1Spgoyette 291.1Spgoyette # make S=/data/netbsd/src/sys 301.1Spgoyette 311.1Spgoyette The code of a module does not need to be in src/sys unless you use 321.1Spgoyette the autoconf(9) framework. 331.1Spgoyette 341.1Spgoyette A cross-built of a module for a target platform is possible with the 351.1Spgoyette build.sh framework. You need to generate the toolchain and set 361.1Spgoyette appropriately PATH to point bin/ in the TOOLDIR path. An example command 371.1Spgoyette to cross-build a module with the amd64 toolchain is as follows: 381.1Spgoyette 391.1Spgoyette # nbmake-amd64 S=/data/netbsd/src/sys 401.1Spgoyette 411.1Spgoyette 421.1Spgoyette The example modules should not be used on a production machine. 431.1Spgoyette 441.1Spgoyette All modules that create a cdevsw should be verified that the major number 451.1Spgoyette should not conflict with a real device. 461.1Spgoyette 471.1SpgoyetteSEE ALSO 481.3Spgoyette modctl(2), module(7), modload(8), modstat(8), modunload(8), module(9), 491.3Spgoyette intro(9lua) 501.1Spgoyette 511.1SpgoyetteHISTORY 521.1Spgoyette An example of handling incoming properties first appeared in NetBSD 5.0 531.1Spgoyette and was written by Julio Merino with further modifications by Martin 541.1Spgoyette Husemann, Adam Hamsik, John Nemeth and Mindaugas Rasiukevicius. 551.1Spgoyette 561.1Spgoyette This document and additional modules (hello, readhappy, properties, 571.4Ssevan ping, luahello and luareadhappy) first appeared in NetBSD 8.0; they were 581.4Ssevan written by Kamil Rytarowski. 591.1Spgoyette 601.5Skamil The sysctl module first appeared in NetBSD 9.0 and was authored by 611.5Skamil Siddharth Muralee. 621.5Skamil 631.1SpgoyetteAUTHORS 641.1Spgoyette This document was written by Kamil Rytarowski. 65