|
|
Building External Linux Kernel Modules Under Fedora Core 3 |
|
|
Courses |
Kernel PreparationFirst you need to fetch the proper kernel source rpm. Obtain your kernel version using the command: # uname -r My computer gives: 2.6.9-1.667
Fetch the kernel source rpm from a rpmfind web site. I obtained
# rpm -ivh kernel-2.6.9-1.667.FC3.src.rpm
Now change your working directory to the # cd /usr/src/redhat/SPECS # rpmbuild -bp kernel-2.6.spec
# cd /usr/src/redhat/BUILD/kernel-2.6.9/linux-2.6.9 # uname -m i686 # cp configs/kernel-2.6.9-i686.config .config
The final step to prepare the kernel is to build the make target
# make modules_prepare Building External ModulesAfter creating a # cd ~/mydriver # vi Makefile # vi mydevice.c # make -C /usr/src/redhat/BUILD/kernel-2.6.9/linux-2.6.9 M=$PWD modules
You can use the target Building Specific Internal ModulesTo build all configured modules
within a particular subdirectory in the Linux kernel tree, issue
the same make command as for external modules. Only modules that
have been configured in the CONFIG_MTD_BLKMTD=m
The associated make variable name can be found in the local
Makefile, for this case in # cd /usr/src/redhat/BUILD/kernel-2.6.9/linux-2.6.9/drivers/mtd/devices # make -C /usr/src/redhat/BUILD/kernel-2.6.9/linux-2.6.9 M=$PWD modules Alternatively, you can copy the desired files out of the kernel source tree, edit the Makefile, and treat the result like an external module. Again, see The Linux Kernel Module Programming Guide to help you edit the Makefile. # cp blkmtd.c Makefile /tmp # vi Makefile # make -C /usr/src/redhat/BUILD/kernel-2.6.9/linux-2.6.9 M=$PWD modules
|
|
|
Last update: |
|