To be frank you do not need a new full source tree in order to just compile or build module against the running kernel i.e an exploded source tree is not required to build kernel driver or module. The instruction outlined below will benefit immensely to a developers/power users.
This is essential because if you just want to compile and install driver for new hardware such as Wireless card or SCSI device etc. With following method, you will save the time, as you are not going to compile entire Linux kernel.
Please note that to work with this hack you just need the Linux kernel headers and not the full kernel source tree. Install the linux-kernel-headers package which provides headers from the Linux kernel. These headers are used by the installed headers for GNU glibc and other system libraries as well as compiling modules. Use following command to install kernel headers:
# apt-get install kernel-headers-2.6.xx.xx.xx
Replace xx.xx with your actual running kernel version (e.g. 2.6.8.-2) and architecture name (e.g. 686/em64t/amd64). Use uname -r command to get actual kernel version name. Please note that above command will only install kernel headers and not the entire kernel source-code tree.
All you need to do is change Makefile to use current kernel build directory. You can obtain this directory name by typing following command:
$ ls -d /lib/modules/$(uname -r)/build
Output:
/lib/modules/2.6.15.4/build
Let, say you have .c source code file called hello.c. Now create a Makefile as follows in the directory containing hello.c program / file:
$ vi Makefile
Append following text:
obj-m := hello.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
Save and close the file. Type the following command to build the hello.ko module:
$ make
To load Linux kernel module type the command:
# modprobe hello
Updated for accuracy.
Host by is-Programmer.com | Power by Chito 1.3.3 beta
2022年11月15日 02:10
The Indian Health and family welfare department and India’s government have several implementations on the health system. The Reproductive and Child Health program and portal is a legal initiative launched on 15th October 1997 in India. Rch.nhm.gov.in/RCH/ The program covers the whole country to care for reproduction, maternity, newborn, child, and adolescent health.