tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

How to build a custom module under NetBSD--9.x and newer?



	Hello.  I'm working on porting an old zaptel kernel module which I've used under NetbSD-3
and NetBSd-5 for years to a version 9-current from January 2021.  I have the module built,
using the bsd.module.mk make file from /usr/share, but when I try to perform a modload on the
final .kmod file, I get the following output:

DEBUG: module: Loading module from /stand/amd64/9.99.77/modules/zaptel/zaptel.kmod
DEBUG: module: Loading plist from /stand/amd64/9.99.77/modules/zaptel/zaptel.plist
DEBUG: module: plist load returned error 2 for `/stand/amd64/9.99.77/modules/zaptel/zaptel.kmod'
WARNING: module error: `link_set_modules' section wrong size (got 16, wanted 8)
WARNING: module error: cannot fetch info for `zaptel', error 8

	this looks like some kind of error in the linking phase of the process, but I'm not sure
how to go about debugging it.

Maybe someone can give me a clue on what to try next?  Is there a flag I need to specify the
correct section size?
In looking at the make.log, below, the VERSION environment variable is non-existent in the
build environment I'm using.  Could this be the issue?  If it is, what should that environment
variable contain?

-thanks
-Brian



#   compile  zaptel/zaptel.o
gcc -O2 -g   -std=gnu99    -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-sign-compare  -Wsystem-headers   -Wno-traditional   -Wa,--fatal-warnings  -Wreturn-type -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wextra -Wno-unused-parameter -Wno-sign-compare -Werror   -ffreestanding  -fno-strict-aliasing -Wno-pointer-sign -mno-red-zone -mno-mmx -mno-sse -mno-avx -msoft-float -mcmodel=kernel -fno-omit-frame-pointer   -I/usr/src/common/include -DDIAGNOSTIC -I/usr/home/buhrow/src/asterisk/zaptel -I/usr/local/netbsd/src-9977/sys -I/usr/src/common/include -DDIAGNOSTIC  -nostdinc -I. -I/home/buhrow/src/asterisk/zaptel-netbsd-20230118/zaptel -isystem /usr/home/buhrow/src/asterisk -isystem /usr/home/buhrow/src/asterisk/arch -isystem /usr/home/buhrow/src/asterisk/../common/include -D_KERNEL -D_MODULE -DSYSCTL_INCLUDE_DESCR -c -Wno-error=implicit-fallthrough   zaptel.c -o zaptel.o.o
ctfconvert -L VERSION -o zaptel.o zaptel.o.o && rm -f zaptel.o.o
#   compile  zaptel/ztdummy.o
gcc -O2 -g   -std=gnu99    -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-sign-compare  -Wsystem-headers   -Wno-traditional   -Wa,--fatal-warnings  -Wreturn-type -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wextra -Wno-unused-parameter -Wno-sign-compare -Werror   -ffreestanding  -fno-strict-aliasing -Wno-pointer-sign -mno-red-zone -mno-mmx -mno-sse -mno-avx -msoft-float -mcmodel=kernel -fno-omit-frame-pointer   -I/usr/src/common/include -DDIAGNOSTIC -I/usr/home/buhrow/src/asterisk/zaptel -I/usr/local/netbsd/src-9977/sys -I/usr/src/common/include -DDIAGNOSTIC  -nostdinc -I. -I/home/buhrow/src/asterisk/zaptel-netbsd-20230118/zaptel -isystem /usr/home/buhrow/src/asterisk -isystem /usr/home/buhrow/src/asterisk/arch -isystem /usr/home/buhrow/src/asterisk/../common/include -D_KERNEL -D_MODULE -DSYSCTL_INCLUDE_DESCR -c    ztdummy.c -o ztdummy.o.o
ctfconvert -L VERSION -o ztdummy.o ztdummy.o.o && rm -f ztdummy.o.o
#      link  zaptel/zaptel.kmod
gcc  -Wl,--warn-shared-textrel -Wl,-z,relro -nostdlib -r -Wl,-T,/usr/libdata/ldscripts/kmodule,-d  -Wl,-Map=zaptel.kmod.map  -o zaptel.kmod zaptel.o ztdummy.o
ctfmerge -t -L VERSION -o zaptel.kmod zaptel.o ztdummy.o


Home | Main Index | Thread Index | Old Index