没有合适的资源?快使用搜索试试~ 我知道了~
linux内核调试技术手册
3星 · 超过75%的资源 需积分: 16 15 下载量 90 浏览量
2008-09-27
12:29:22
上传
评论 2
收藏 159KB PDF 举报
温馨提示
试读
11页
linux内核调试技术 , linux内核开发者必备。 linux内核调试技术 , linux内核开发者必备。
资源推荐
资源详情
资源评论
Kernel Module Packages Manual
for CODE 10
March 6, 2006
This document specifies the requirements for rpm packages that contain kernel modules, and
describes the processes surrounding those packages including building, signing, installing,
and upgrading. A complete example is given and explained.
This version of the Kernel Module Packages Manual applies to the Novell/SUSE CODE 10
code base, which includes SUSE Linux 10.1, SLES 10 (SUSE Linux Enterprise Server), as
well as all products based on SLES 10. An second version of this document for CODE 9 is
available as well; the CODE 9 version covers SLES 9 and SUSE Linux 10.0.
A few issues related to the new package manager and dependency resolver library still need to
be tested and documented here. The relevant places in this document are highlighted like this
paragraph.
Introduction
The Linux kernel supports adding functionality at runtime through kernel loadable modules.
It includes more than 1500 modules, about 75 percent of which are hardware drivers. These
modules are shipped as part of the kernel packages. In some cases it is desirable to add
additional modules or replace existing ones. (For example, a driver for a particular storage
controller that was not available at the time of product release might be added later in order to
support new hardware.)
Kernel modules interact with the kernel by the means of exported symbols, in a way similar to
how binaries use shared libraries.
1
To ensure that the kernel and modules refer to the same
symbols, a version checksum (aka modversion) is added to each symbol that is computed
from the symbol’s type: in the case of function symbols, the checksum is determined by the
function’s parameters and return type.
When any of a function’s parameters or the return type changes, the checksum changes as
well. This includes all the data types involved recursively: if a function takes a struct
task_struct as parameter and struct task_struct includes a field of type struct dentry, then a
change to struct dentry will cause the symbol’s version checksum to change as well. Symbol
version checksums for different kernel flavors (e.g., kernel-default vs. kernel-smp) will not
match, and symbol versions of the same kernel package on different architectures (e.g.,
kernel-default on i386 vs. x86_64) will not match, either. This mechanism ensures that the
kernel and kernel modules agree on the types of data structures that they use to communicate.
Unless symbol version checking is disabled, modules will only load if the checksums of the
symbols they use match the checksums of the symbols that the kernel exports. The exported
symbols and their version checksums comprise the kernel Application Binary Interface (ABI).
When an update kernel includes kernel ABI changes, kernel modules that use any modified
symbols must be updated as well.
1 The /proc/kallsyms file lists all symbols currently known to the kernel.
Kernel Module Packages Manual
During its multi-year life cycle, products like SUSE Linux Enterprise Server (SLES) undergo
continuous changes, and different kinds of updates like Service Packs (SPs), maintenance / security
updates, and customer-specific updates (PTFs = Program Temporary Fixes) are released. The
Application Binary Interface (ABI) between the kernel and kernel modules is volatile, and some
kernel updates will change the kernel ABI by adding or removing exported symbols, or existing
symbol checksums may change because of changes in data structures they reference. We strive to
keep the kernel ABI stable in maintenance / security and customer-specific updates, but sometimes
we cannot avoid changes. In Service Packs, we reserve the right to introduce more intrusive
changes, which increases the likelihood of ABI changes. We believe that the added flexibility
outweighs the disadvantages of breaking older modules. Please see kABI Stability in SLES [1] and
The Linux Kernel Driver Interface [2] for discussions of this topic.
All Linux products that Novell/SuSE offers primarily use the RPM Package Manager for software
management. This also applies to kernel modules, which must be packaged following a number of
rules that ensure that the resulting Kernel Module Packages (which are also referred to as Kernel
Driver Packages) can be installed and updated appropriately, in sync with kernel updates.
This document specifies Kernel Module Packages, describes how they fit into the build system, and
how to create, sign, and deploy them.
1 Kernel Packages
All Novell/SUSE products based on 2.6.x kernels contain a set of kernel packages that all share the
same version and release number; they are built from the same kernel sources. These packages are:
kernel-flavor
A binary kernel package. Each architecture has its own set of kernel flavors (e.g., kernel-default,
kernel-smp, kernel-bigsmp, kernel-um, kernel-xen). These are the packages that the kernel
modules will be used with.
kernel-source
The kernel source tree, generated by unpacking the vanilla kernel sources and applying all
necessary patches. While the kernel-flavor packages technically are not built from the
kernel-source package, they are built from the same source tree. This tree should be used for
module building.
kernel-syms
Kernel symbol version information for compiling external modules. This package is required for
building external modules. If this package is not used, the resulting modules will be missing
symbol version information, which will cause them to break during kernel updates. The
kernel-source and kernel-syms packages used for compiling external modules must match each
other exactly.
Please refer to Working With The SUSE 2.6.x Kernel Sources [3] for more information.
2 Kernel Modules
Documentation on general kernel module building can be found in abundance on the Internet [5, 6].
Novell/SUSE specific information is found in Working With The SUSE 2.6.x Kernel Sources [3].
Novell/SUSE March 6, 2006 2
Kernel Module Packages Manual
Once built, kernel module binaries are installed below /lib/modules/version-release-flavor on the
file system (e.g., /lib/modules/2.6.16-97-default for the kernel-default-2.6.16-97 package). Different
kernels have different module directories, and will not usually see each other’s modules.
Update modules must be stored below the /lib/modules/version-release-flavor/updates/ directory.
Modules in the updates/ directory have precedence over other modules with the same name. Never
replace modules from the kernel package by overwriting files: this would lead to inconsistencies
between the file system and the rpm database.
Modules usually remain compatible with a range of kernel-flavor packages. To make such modules
visible to other kernel-flavor packages, symbolic links to compatible modules are put in
/lib/modules/version-release-flavor/weak-updates/ directories. Modules in the weak-updates/
directory has lower priority than modules in the updates/ directory, but higher priority than all other
modules in /lib/modules/version-release-flavor. If more than one compatible module is available for
a kernel, the module with the highest kernel release is chosen.
Kernel modules must never be installed as individual files on a production system, and always as
part of a Kernel Module Package.
3 Kernel Module Packages
Kernel Module Package spec files define a main package, and a sub-package for each kernel flavor
supported. The kernel-specific sub-packages are defined with the %suse_kernel_module_package
rpm macro. The macro automatically determines for which kernel flavors to generate sub-packages.
Several options are available to modify the macro’s behavior, which are described below:
%suse_kernel_module_package [-s subpkg] [-f filelist] [-p preamble] [-n name] [-v version]
[-r release] [-x] [flavor] ...
The main package of a Kernel Module Package can either contain no %files section, in which case
rpm will not create a binary package with the main package’s name, or it can be used for the
user-space part associated with the kernel modules that end up in the kernel specific sub-packages.
(The example Kernel Module Package in Appendix A has a main package without a %files
section.)
Kernel Module Packages must adhere to the following rules:
● The package Name should consist of two components: a unique provider prefix, and a driver
name. Hyphens are disallowed in the provider prefix, and allowed in the driver name. The
provider prefix serves to create a non-overlapping name space for all providers.
The sub-package names is composed of the main package name, followed by a dash, and the
flavor of the supported kernel. The first component (main package name) can be overridden with
a different value with the -n option of the %suse_kernel_module_package macro.
● The kernel module package Version can have an arbitrary value.
The sub-package versions are composed of the main package version, followed by an underscore,
and the version of the kernel supported. Since sub-packages already include the supported
kernel’s flavor in their name, the flavor is not again included in the sub-package’s version.
Dashes in the kernel release are replaced by underscores. The first component (main package
version) can be overridden with the -v option of the %suse_kernel_module_package macro.
● The kernel module package Release can be assigned freely as required. It must be incremented at
least once for each package release.
Novell/SUSE March 6, 2006 3
剩余10页未读,继续阅读
资源评论
- djinglan2012-08-10对了解内核和模块是如何交互的有些用处
getmoon
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功