Kernel Compilation and command usage of modules

Source: Internet
Author: User
This document describes how to compile the kernel and how to use the commands of the module. I. Linux kernel-related information [plain] # View Linux system [root @ serv01 ~] # UnameLinux # View all information [root @ serv01 ~] # Uname... kernel compilation and module-related commands this article explains how to compile the kernel and how to use the module-related commands. I. Linux kernel-related information [plain] # View Linux system [root @ serv01 ~] # Uname Linux # View all information [root @ serv01 ~] # Uname-a Linux serv01.host. com2.6.32-131.0.15.el6.x86 _ 64 #1 SMP Tue May 10 15:42:40 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux # kernel information [root @ serv01 ~] # Uname-r 2.6.32-131.0.15.el6.x86 _ 64 #/boot directory/boot # driver initrd-2.6.32-131.0.15.el6.x86_64kdump.img # kernel vmlinuz-2.6.32-131.0.15.el6.x86_64 # desktop version of the kernel storage location [root @ larrywen boot] # cd/usr/ src/kernels/2.6.32-131.0.15.el6.x86 _ 64/[root @ larrywen 2.6.32-131.0.15.el6.x86 _ 64] # ls arch crypto firmware include ipc lib Makefile. common Module. symvers samples security System. map usr block drivers fs init kernel Makef Ile mm net scripts sound tools virt # decompress the kernel to/usr/src [root @ serv01 ~] # Tar-xvf linux-2.6.38.tar.gz-C/usr/src/[root @ serv01 ~] # Cd/usr/src/linux-2.6.38/[root @ serv01 linux-2.6.38] # pwd/usr/src/linux-2.6.38 # The installed version has a configuration file [root @ larrywen ule-sa2] # cd/ usr/src/kernels/2.6.32-131.0.15.el6.x86 _ 64/[root @ larrywen 2.6.32-131.0.15.el6.x86 _ 64] # ls. config. config # view the configuration file [root @ serv01 linux-2.6.38] # vim/boot/config-2.6.32-131.0.15.el6.x86_64 # source code does not distinguish between 32-bit and 64-bit # View make help # need to be in the linux-2.6.38 Directory [root @ serv01 linux-2.6.38] # make help clean clear, keep the configuration file mrproper to clear, do not keep the configuration file, more thoroughly make menuconfig: graphical interface make xconfig: graphical interface, you need to install QT # <*>: make it into the kernel # [Plain] [root @ serv01 linux-2.6.38] # make menuconfig HOSTCC scripts/basic/fixdep HOSTCC scripts/basic/docproc HOSTCC scripts/kconfig/conf. o HOSTCC scripts/kconfig/kxgettext. o *** Unable to find the ncurses libraries or the *** required header files. * ** 'make menuconfig' requires the ncurses libraries. * ***** Install ncurses (ncurses-devel) and try again. * ** make [1]: *** [scripts/kconfig/d Ochecklxdialog] Error 1 make: *** [menuconfig] Error 2 [root @ serv01 linux-2.6.38] # yum install "ncurses-devel"-y # OCFS: oracle Class FileSystem # generated after configuration. config file [root @ serv01 linux-2.6.38] # ls. config [root @ serv01 linux-2.6.38] # vim Makefile [root @ serv01 linux-2.6.38] # lsarch/x86/boot/-d arch/x86/boot/Three compilation [plain] [root @ serv01 linux-2.6.38] # make bzImage Root device is (8, 2) Setup is 14908 bytes (p Added to 15360 bytes ). system is 3704 kB CRC 7521c374 Kernel: arch/x86/boot/bzImage is ready (#1) four compilation module [plain] [root @ serv01 linux-2.6.38] # make modules five installation module [plain] [root @ serv01 linux-2.6.38] # makemoudule_install # make moudule_install copy to this directory [root @ serv01 linux-2.6.38] # ls/lib/modules/2.6.32-131.0.15.el6.x86 _ 64/kernel/[root @ serv01 linux-2.6.38] # ls/lib/modules/2.6.38/kernel # This error occurs because the swap partition small/bin/s H: line 1: 10010 Killed/sbin/depmod-AE-F System. map2.6.38 make: *** [_ modinst_post] Error 137 six install [plain] [root @ serv01 linux-2.6.38] # make install # can compare the existing version and compiled version, (Build: Firewall not selected) [root @ serv01 linux-2.6.38] # ls/lib/modules/2.6.38/kernel/net/802 9 p bluetooth can dccp ieee802154 ipv6 llc phonet rfkill sctp wimax xfrm 8021q atm bridge core dns_resolver ipv4 key mac80211 rds sched sunrpc wireless [Root @ serv01 linux-2.6.38] # ls/lib/modules/2.6.32-131.0.15.el6.x86 _ 64/kernel/net/802 9 p bluetooth can dccp ipv4 key mac80211 phonet rfkill sctp wimax xfrm 8021q atm bridge core ieee802154 ipv6 llc netfilter rds sched sunrpc wireless [root @ serv01 linux-2.6.38] # ls/lib/modules/2.6.38/kernel/fs/ntfs. ko [root @ serv01 linux-2.6.38] # ls/boot/grub. conf/boot/grub. conf [root @ serv01 linux-2. 6.38] # cat/boot/grub. conf # grub. conf generated by anaconda #### Note that you do not have to rerun grubafter making changes to this file ## NOTICE: You have a/boot partition. thismeans that # all kernel and initrd paths are relative to/boot/, eg. # root (hd0, 0) # kernel/vmlinuz-version ro root =/dev/sda2 # initrd/initrd-[generic-] version. img # boot =/dev/sda default = 0 timeout = 5 splashimage = (hd0, 0)/grub/splash.xpm.gz hiddenmenu title Red Hat Enterprise Linux (2.6.32-131.0.15.el6.x86 _ 64) root (hd0, 0) kernel/vmlinuz-2.6.32-131.0.15.el6.x86_64 ro root = UUID = export rd_NO_LVM rd_NO_MD rd_NO_DMLANG = en_US.UTF-8 SYSFONT = latarcyrheb-sun16KEYBOARDTYPE = pc KEYTABLE = us crashkernel = auto rhgb quiet initrd/initramfs-2.6.32-131.0.15.el6.x86_64.img [Root @ serv01 linux-2.6.38] # cat/boot/grub. conf #/boot directory new file initramfs-2.6.38.img vmlinuz-2.6.38 # will add a new kernel information in this file [root @ serv01 linux-2.6.38] # cat/boot/grub. conf # an error occurs generally because the swap partition is too small. we can add swap partitions. For more information about how to add swap partitions, see System O & M skills (3) -- using the dd command to increase the swap partition seven module related commands using [SQL] # view the current system loaded module [root @ serv01 linux-2.6.38] # lsmod # manually loaded module [root @ serv01 linux-2.6.38] # cd/lib/modules/2.6.38 [root @ serv01 linux-2.6.38] # cd kernel/ns [root @ serv01 linux-2.6.38] # insmod/lib/modules/2.6.38/kernel/fs/fat/ fat. ko [root @ serv01 linux-2.6.38] # lsmod | grep fat [root @ serv01 linux-2.6.38] # insmod/lib/modules/2.6.38/kernel/fs/fat/vfat. ko [root @ serv01 linux-2.6.38] # lsmod | grep fat # Uninstall module, can be with the module name, can also be with the full path [root @ serv01 linux-2.6.38] # rmmod fat ERROR: module fat is in use by vfat [root @ serv01 linux-2.6.38] # rmmod vfat [root @ serv01 linux-2.6.38] # lsmod | grep fat # There is dependency between modules, add this cannot add [root @ serv01 linux-2.6.38] # insmod/lib/modules/2.6.38/kernel/fs/fat/vfat. ko # Automatic processing of dependencies, do not need to add full path [root @ serv01 linux-2.6.38] # modprobe vfat [root @ serv01 linux-2.6.38] # lsmod | grep fat #-r parameter, represents remove [root @ serv01 linux-2.6.38] # modprobe-r fat [root @ serv01 linux-2.6.38] # modprobe-rvfat # Record module dependency [root @ serv01 linux-2.6.38] # vim/lib/modules/ 2.6.32-131.0.15.el6.x86 _ 64/modules. dep [root @ larrywen pdf] # pwd/opt/soft/ule-sa2/pdf [root @ larrywen pdf] # ls ule-kerenl.pdf [root @ larrywen pdf] # ls ule-module.pdf # View module information [root @ serv01 linux-2.6.38] # modinfo vfat filename: /lib/modules/2.6.32-131.0.15.el6.x86 _ 64/kernel/fs/fat/vfat. ko author: Gordon Chaffee description: VFAT filesystem support license: GPL srcversion: ACCC2F7E9526F402F526976 depends: fat vermagic: 2.6.32-131.0.15.el6.x86 _ 64 SMPmod_unload modsions versions
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.