!FreeBSDのカーネルモジュールの作り方 {{category FreeBSD}} /usr/share/examples/kldとかmanとか見ると詳しく書いてある。 gcc -D_KERNEL -DKLD_MODULE -c test1.c -o test1.o ld -d -warn-common -r -d -o test1.kld test1.o ld -Bshareable -d -warn-common -o test1.ko test1.kld で、何もしないカーネルモジュール #include #include #include static int test1_modevent(module_t mod, int type, void *unused) { switch (type) { case MOD_LOAD: return 0; case MOD_UNLOAD: return 0; } return EINVAL; } static moduledata_t test1_mod = { "test1", test1_modevent, 0 }; DECLARE_MODULE(test1, test1_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(test1, 1);