1. modprobe load kernel module
a) Find alias in /etc/module.conf
b) Determine if there is a dependency in lib/modules/version/module.dep The module needs to be loaded ahead of time (the file is created by depmod-a)
2. The 2.4 kernel does not have to use init_module and cleanup_module to do the start and end functions, but need to use module_init and
Module_exit declaration.
3. Macros __init and __exit can cause functions to automatically reclaim memory after running (limited to modules), __initdata for variables,
Example:
# Include //need to include the header file
static int ntest __initdata = 3;
static int __init test_init(void) {...}
static void __exit test_exit( Void) {...}
module_init(test_init); //Declare after the implementation function
module_exit(test_exit);
4. Some module descriptions are relevant Macro, you can use objdump to view related information.
MODULE_LICENSE() Description Code License Type
MODULE_DESCRIPTION() Module Description
MODULE_AUTHOR() Author
MODULE_SUPPORTED_DEVICE() Module Supported Devices
5. Parameter passing uses the macro MODULE_PARM (variable name, type).
Supported types are "b"bit"h"short"i"integer"l"long "s"string
static int myint = 9;
static char *mystr = "test"; //Note that you need to pass the default value of the parameter
MODULE_PARM(myint, "i");
MODULE_PARM(mystr , "s");
6. Compiling multiple files into one kernel module:
a) Need to add
#define __NO_VERSION__
#include
b) Compile with a normal single kernel file
c) Connection: ld -m elf_i386 -r -o <1st src file.o> <2nd Src file.o>
7. strace Check the system call used by a program
8. About the file_operations structure is defined in the linux/fs.h file.
Usage:
struct file_operations fops = {read: device_read,write: device_write,open: device_open,release: device_release}C99 usage: struct file_operations fops = {.read = device_read ,.write = device_write,.open = device_open,.release = device_release}
First look at the TCP server side of the program: #include <stdlib.h> #include <stdio.h>
First time when the basic network configuration is 1. Check the network mac address first[root@cento
That day, my colleague showed me an operation step on my computer, using an env command, well, I adm
The Linux boot file is stored in the grub.conf configuration file in the /boot/grub/directory. 1.
How to disable ROOT account login under Linux
NVIDIA graphics card to solve Ubuntu Linux resolution problem
Taiwan's Linux Education Revolution
Linux operating system history command is fully controlled
Linux zombie process and its solution
Two ways to modify the Linux system 22 first port of
Teach you 5 steps to restore the password of Ubuntu system
How to add drivers to the Linux kernel
Linux executable program to make services and boot self-start method
Windows Vista System File Integrity Check Method
WP8 version of IT home v1.0.3 officially released
How to register Skype simultaneous translation with Win10
Windows 10 set the password password method
Modify the registry to expand the number of IE commonly used websites
How to shut down win8? Teach you 4 kinds of win8 shutdown method
Win7 system Sogou input method set knowledge Daquan
What should I do if the U disk system encounters the Internal Error 36000 error message?