| Files | Description |
|---|---|
/etc/modules.conf | used by modprobe before inserting a module |
/lib/modules/ | directory where the modules for given kernel version are stored |
/lib/modules/ | list of module dependencies created by depmod |
| Command | Description |
|---|---|
| depmod | See depmod(8).
kernel modules can provide services (called "symbols")
for other modules to use (using EXPORT_SYMBOL
in the code). If a second
module uses this symbol, that second module clearly depends on the first
module. depmod creates a list of module dependencies,
by reading each module under
/lib/modules/
and determining what symbols it exports, and what symbols it needs.
By default this list is written to modules.dep in
the same directory |
| insmod | See insmod(8). A trivial program to insert a module into the kernel: if the filename is a hyphen, the module is taken from standard input. Most users will want to use modprobe(8) instead, which is cleverer |
| make clean | delete all object files in the source tree |
| make config | configure the Linux kernel |
| make dep | creates a list of extra headers in files called
.depend needed to satisfy module dependencies |
| make menuconfig | configure the Linux kernel using a menu |
| make modules | compile all the external/dynamic modules for this kernel |
| make modules_install | install the compiled modules in
/lib/module/
|
| make oldconfig | create a default .config if it doesn't exist.
If a .config file already exists the chosen
configuration is unchanged.
If the source tree has changed, for example after a patch (see LPI 201)
or the .config file corresponds to an older kernel,
then extra configuration options must be supplied |
| make xconfig | configure a Linux kernel using a menu |
| lsmod | list all dynamically loaded modules |
| modinfo | print information about a kernel module such as the author
(-a), the description (-d), the
license (-l) or parameters (-p) |
| modprobe | See modprobe(8).
Will automatically load all base modules needed in a module
stack, as described by the dependency file modules.dep.
If the loading of one of these modules fails, the whole current stack of
modules loaded in the current session will be unloaded
automatically |
| rmmod | See rmmod(8). Tries to unload a set of modules from the kernel, with the restriction that they are not in use and that they are not referred to by other modules |
Before starting with the exercises make sure you dont have an
existing kernel tree in /usr/src/. If you do, pay attention
to the /usr/src/linux symbolic link.
Manually recompile the kernel following the compilation steps.
Get the
kernel-
package from an FTP mirror site or a CD.
Installing this package will also give you a list of dependencies, such as
the gcc compiler or
binutils package if they haven't
yet been met.version.src.rpm
Install the package with -i (this will put all
the code in /usr/src/)
Go into the
/usr/src/linux-
directory and list the versionconfigs directory
Copy the kernel config file that matches your architecture into the
current directory and call it .config
Run
make oldconfig
at the command line to take into account this new
.config file.
Edit the Makefile and make sure the version is
not the same as your existing kernel. You can get information on your
current kernel by running uname -a at
the command line or list the /lib/modules directory.
Run
make menuconfig # or menu or xconfig
and remove ISDN support from the kernel.
When you exit the above program the .config file
is altered but the changes have not yet taken place in the rest of the
source tree. You next need to run
make dep
Finally to force new object files (.o) to be
compiled with these changes you delete all previously compiled code with
make clean
You can now build the kernel the modules and install the modules with:
make bzImage modules modules_install
The modules are now installed in the
/lib/modules/version directory. The kernel is called
bzImage and is in the
/usr/src/linux/arch/i386/boot/
directory. We need to manually install this kernel (2 steps):
cp /usr/src/linux/arch/i386/boot/bzImage \
/boot/vmlinuz-full-kernel-version
That was easy so far! We next edit the bootloader configuration file:
If you are using LILO, edit /etc/lilo.conf
and add an image paragraph that will tell LILO where to
find this kernel and the root filesystem. Run
/sbin/lilo and reboot
If you are using GRUB, edit
/boot/grub/grub.conf or
/boot/grub/menu.lst
Since we downloaded the
kernel-
package we can now use this package to recompile a RedHat preconfigured kernel.
Notice that although no intervention is needed you wont be able to change the
version.src.rpm.config menu.
First rebuild the compiled binary package with
rpm --rebuild kernel-version.src.rpm # ...wait!
This will eventually generate the
kernel-
in version.i368.rpm/usr/src/redhat/RPMS/i386/.
Next, upgrade you kernel with the RPM manager using the
-U option.