2.6 kernel version, I completed the rtc_driver.c file, added obj-$ (config_rtc_xxxx) + = rtc_driver.o To The makefile, modified kconfig, and added config rtc_xxxx
Bool "rtcrtcrtcrtcrtc", compile the kernel and kernel model, and only generate the. o file.
How can I generate a. Ko file capable of insmod? Should I add some statements in makefile?
The. Ko file has been generated,
[Root @ localhost char] # insmod rtc_driver.ko
Rtc_driver.ko: ELF File rtc_driver.ko not for this architecture
The compiled. Ko does not match the kernel.
Make-C/usr/src/Linux-'uname-R' subdirs = $ PWD modules
You can try to select m instead of * when making menuconfig, that is, it is compiled into a module. Instead of compiling it into the kernel ..
Modprobe:
Load module (s ):
Modprobe [-a-n-V] [-C config] [-T type] pattern or module1 module2... list modules:
Modprobe [-L] [-C config] [-T type] Pattern
Note: wildcard patterns shoshould be escaped
Show Configuration:
Modprobe [-C config]-C
Remove module (s) or autoclean:
Modprobe [-C config]-R [module...]
// Detailed description:
Options:
-A, -- all // load all matching modules
-C, -- showconfig // display the current configuration
-D, -- debug // display debugging information
-H, -- help // help
-K, -- autoclean // set the specified module to "auto-clear" mode.
Modules
-L, -- list // display all matching modules
-N, -- show // only displays the operation to be executed, not the actual operation.
-Q, -- Quiet // No error message is displayed
-R, -- remove // If a module is specified in the command, the specified module is deleted. Otherwise, the "Automatic Clearing" mode is specified.
-S, -- syslog // record the result to the system record
-T, -- type moduletype // specify the module type
-V, -- verbose // detailed information displayed during execution
-V, -- version // display version
-C, -- config configfile // specify the configuration file. The/etc/modules. conf file is used as the configuration file by default.
Several modprobe commands
1. The modprobe command loads all required modules based on the output/lib/modules/version/modules. Dep of depmod-.
2. The command for deleting a module is modprobe-r filename.
3. After the system is started, modules that work normally are listed in the/proc/modules file. You can use lsmod to display the same content.
4. An "automatic kernel module loading" function is compiled into the kernel. When you try to open a certain type of file, the kernel will try to load the corresponding module as needed. The/etc/modules. conf or/etc/modprobe. conf file is a control file that automatically processes the kernel module.