воскресенье, 28 марта 2010 г.

LPI exam 102 prep: Kernel

Краткие заметки, сделанные при подготовке к сдаче экзамена LPI 117-102 (Junior Level Linux Professional (LPIC-1)).


Runtime kernel management


The uname command prints information about your system and its kernel.

-s Print the kernel name. This is the default if no option is specified.
-n Print the nodename or hostname.
-r Print the release of the kernel. This option is often used with module-handling commands.
-v Print the version of the kernel.
-m Print the machine's hardware (CPU) name.
-o Print the operating system name.


Use the lsmod command to display the modules that are currently loaded on your
system.

In addition to the module name, lsmod also shows the module size and the number
of users of the module. If the module is used by any other modules, these are listed.

The modinfo command displays information about one or more modules.

On 2.6 kernels you can also use modinfo to limit requests to specific information
about a module. Use the -F option to extract a single information type, such as
parm, description, license, filename, or alias.

To remove a mod, use the rmmod command along with the module name

insmod command, which takes the full path name of the module to be reloaded,
along with any module options that may be required

The modprobe command provides a higher-level interface that
operates with the module name instead of file path. It also handles loading additional
modules upon which a module depends, and can remove modules as well as load
them.

The depmod command scans the modules in the subdirectories of /lib/modules for
the kernel you are working on and freshens the dependency information.

You can customize the behavior of modprobe and depmod using the configuration
file /etc/modules.conf.

Customize and build kernels and kernel modules

The ultimate source for the Linux kernel is the Linux Kernel Archives
The compressed source is normally uncompressed in /usr/src, and it creates a new subdirectory for the kernel version, such as linux-2.6.15, containing the tree of files
needed to build your kernel.

The .config file in your kernel build directory contains configuration information for
your kernel, including the target machine environment, the features to be included,
and whether a feature should be compiled into the kernel or built as a module.
Creating a .config file is the first step to building or rebuilding a kernel.

If you are not sure of the state of your build tree, run make clean before
configuring your new kernel. For an even more extreme cleanup target, run make
mrproper; this will remove your .config file as well as some other files used by the
build process. If you do this and then need to restore a backed up .config file, you
will need to run make oldconfig before configuring.

When you have completed building your kernel, you still have a couple of steps to
go. First, you need to run make modules_install to install your kernel modules
in a new subdirectory of ./lib/modules.

Finally, you need to run make install to install the new kernel and initial RAM
disk in /boot and update your boot loader configuration.

Комментариев нет: