insmod

insmod

功能说明:载入模块。
语  法:insmod [-fkmpsvxX][-o <模块名称>][模块文件][符号名称 = 符号值]
补充说明:Linux有许多功能是通过模块的方式,在需要时才载入kernel。如此可使kernel较为精简,进而提高效率,以及保有较大的弹性。这类可载入的模块,通常是设备驱动程序。
参  数:
 -f  不检查目前kernel版本与模块编译时的kernel版本是否一致,强制将模块载入。 
 -k  将模块设置为自动卸除。 
 -m  输出模块的载入信息。 
 -o<模块名称>  指定模块的名称,可使用模块文件的文件名。 
 -p  测试模块是否能正确地载入kernel。 
 -s  将所有信息记录在系统记录文件中。 
 -v  执行时显示详细的信息。 
 -x  不要汇出模块的外部符号。 
 -X  汇出模块所有的外部符号,此为预设置。


英文版本,欢迎翻译:

NAME insmod - install loadable kernel module

SYNOPSIS insmod [-fhkLmnpqrsSvVxXyY] [-e persist_name] [-o module_name] [-O blob_name] [-P prefix] module [ symbol=value ... ]

DESCRIPTION insmod installs a loadable module in the running kernel.

insmod tries to link a module into the running kernel by resolving all symbols from the kernels exported symbol table.

If the module file name is given without directories or extension, insmod will search for the module in some common default directories. The environment variable MODPATH can be used to override this default. If a module configuration file such as /etc/modules.conf exists, it will override the paths defined in MODPATH. The environment variable MODULECONF can also be used to select a different configuration file from the default /etc/modules.conf (or /etc/conf.modules (deprecated)). This environment variable will override all the definitions above.

OPTIONS -f --force Attempt load the module even if the version of the running kernel and the version of the kernel for which the module was compiled do not match. This only overrides the kernel version check, it has no effect on symbol name checks. If the symbol names in the module do not match the kernel then there is no way to force insmod to load the module.

-h --help Print the help text.

-k --autoclean Set the auto-clean flag on the module. This flag will be used by kerneld(8) to remove modules that have not been used in some period of time -- usually one minute.

-L --lock Use flock(2) to prevent simultaneous loads of the same module.

-m --map Output a load map on stdout, making it easier to debug the module in the event of a kernel panic.

-n --noload Dummy run, do everything except load the module into the kernel. If requested by -m or -O, the run will produce a map or blob file. Since the module is not loaded, the real kernel load address is unknown so the map and blob file are based on an arbitrary load address of 0x12340000.

-p --probe Probe the module to see if it could be successfully loaded. This includes locating the object file in the module path, checking version numbers, and resolving symbols. It does not check the relocations nor does it produce a map or blob file.

-q --quiet Do not print a list of any unresolved symbols. Do not complain about version mismatch. The problem will only be reflected in the exit status of insmod.

-r --root Some users compile modules under a non-root userid then install the modules as root. This process can leave the modules owned by the non-root userid, even though the modules directory is owned by root. If the non-root userid is compromised, an intruder can overwrite existing modules owned by that userid and use this exposure to bootstrap up to root access.

By default, modutils will reject attempts to use a module that is not owned by root. Specifying -r will toggle the check and allow root to load modules that are not owned by root. Note: the default value for root check can be changed when modutils is configured.

Use of -r to disable root checking or setting the default to "no root check" at configuration time is a major security exposure and is not recommended.

-s --syslog Output everything to syslog(3) instead of the terminal.

-S --kallsyms Force the loaded module to have kallsyms data, even if the kernel does not support it. This option is for small systems where the kernel is loaded without kallsyms data but selected modules need kallsyms for debugging.

-v --verbose Be verbose.

-X --export, -x --noexport Do and do not export all of the modules external symbols, respectively. The default is for the symbols to be exported. This option is only effective if the module does not explicitly export its own controlled symbol table, and thus is deprecated.

-Y --ksymoops, -y --noksymoops Do and do not add ksymoops symbols to ksyms. These symbols are used by ksymoops to provide better debugging if there is an Oops in this module. The default is for the ksymoops symbols to be defined. This option is independent of the -X/-x options.

ksymoops symbols add approximately 260 bytes per loaded module. Unless you are really short on kernel space and are trying to reduce ksyms to its minimum size, take the default and get more accurate Oops debugging. ksymoops symbols are required to save persistent module data.

-o module_name --name=module_name Explicitly name the module, rather than deriving the name from the base name of the source object file.

-O blob_name --blob=blob_name Save the binary object in blob_name. The result is a binary blob (no ELF headers) showing exactly what is loaded into the kernel, after section manipulation and relocation. Option -m is recommended to get a map of the object.

-P prefix --prefix=prefix This option can be used with versioned modules for an SMP or bigmem kernel, since such modules have an extra prefix added in their symbol names. If the kernel was built with symbol versions then insmod will automatically extract the prefix from the definition of "get_module_symbol" or "inter_module_get", one of which must exist in any kernel that supports modules. If the kernel has no symbol versions but the module was built with symbol versions then the user must supply -P.

-e persist_name --persist=persist_name Specifies where any persistent data for the module is read from on load and written to when this instantiantion of the module is unloaded. This option is silently ignored if the module has no persistent data. Persistent data is only read by insmod if this option is present, by default insmod does not process persistent data. As a shorthand form, -e "" (an empty string) is interpreted by insmod as the value of persistdir (see modules.conf(5)) followed by the filename of the module, relative to the module search path it was found in, minus any trailing ?gz, ?o and ?mod. If you specify persistdir= (i.e. persistdir is an empty field) then this shorthand form is silently ignored.

阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/sunlei0625/article/details/5645956
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭