think tank forum

technology » Building linux modules

Chiken's avatar
12 years ago
link
Chiken
Don't Let Your Walls Down
Hey guys, I got a quick question that I hope you guys might be able to help me out on. The geniuses here at work decided to give me a prototype box with the customers custom linux OS on it but didn't include all the needed linux kernel modules for the software that they want to run on this thing. I got the kernel modules compiled and loaded using this method:

obj-m = foo.o
KVERSION = $(shell uname -r)
all:
make -C /lib/modules/$(KVERSION)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(KVERSION)/build M=$(PWD) clean

Basically I took the needed source file from the kernel source directory, put it in a tmp dir, and then did a make on it. The reason for this is there was already a Module.symvers file in the source files home dir, and I wasn't sure if by building this single module it would mess something up like the built in modules.

now, maybe i'm being retarded about this but there has got to be an easier way. Would I fuck anything up if I just left the source files in their normal dir and did the make on them in there using a custom make file?
nny's avatar
12 years ago
link
nny
M̮͈̣̙̰̝̃̿̎̍ͬa͉̭̥͓ț̘ͯ̈́t̬̻͖̰̞͎ͤ̇ ̈̚J̹͎̿̾ȏ̞̫͈y̭̺ͭc̦̹̟̦̭̫͊̿ͩeͥ̌̾̓ͨ
should work. most modules can be built and even installed from the makefiles in their directory.

since you have access to their src repot as well as a full dev environment it shouldn't be a serious concern.

I'd just check the makefile for the module and see what was included in that makefile.
Chiken's avatar
12 years ago
link
Chiken
Don't Let Your Walls Down
So if you don't mind me ask, what exactly is the Module.symvers file?
Chiken's avatar
12 years ago
link
Chiken
Don't Let Your Walls Down
so I was trying to use the default Makefile in the modules dir, and I just realized I'm an idiot. These are the three I was trying to build


obj-$(CONFIG_INET_AH) += ah4.o
obj-$(CONFIG_INET_ESP) += esp4.o
obj-$(CONFIG_INET_IPCOMP) += ipcomp.o

from some snooping around this morning, I guess $(CONFIG_INET_<blah>) was not evaluating to either y or m, so thats why I never even got a .o file in the dir for those modules. So to add to this, where are the $(variable) usually defined? I checked the Kbuild file in the root kernel source dir but no dice.