LINUX学生会linux学习

Linux基础之CentOS7.3内核编译

2017-07-12  本文已影响43人  数据革命

Linux基础之内核编译

内核介绍

内核编译

环境检查

检查yum源

[root@localhost ~]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base epel
Cleaning up everything
Cleaning up list of fastest mirrors
[root@localhost ~]# yum makecache
Loaded plugins: fastestmirror
base                                                 | 3.6 kB     00:00     
epel                                                 | 4.3 kB     00:00     
(1/9): base/group_gz                                   | 155 kB   00:00     
(2/9): base/filelists_db                               | 6.6 MB   00:00     
(3/9): base/other_db                                   | 2.4 MB   00:00     
(4/9): epel/group_gz                                   | 170 kB   00:00     
(5/9): base/primary_db                                 | 5.6 MB   00:00     
(6/9): epel/updateinfo                                 | 757 kB   00:00     
(7/9): epel/filelists_db                               | 7.6 MB   00:00     
(8/9): epel/other_db                                   | 2.1 MB   00:00     
(9/9): epel/primary_db                                 | 4.6 MB   00:00     
Determining fastest mirrors
Metadata Cache Created

开发组包安装或检查

[root@localhost ~]# yum grouplist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Available Environment Groups:
   Minimal Install
   Compute Node
   Infrastructure Server
   File and Print Server
   MATE Desktop
   Basic Web Server
   Virtualization Host
   Server with GUI
   GNOME Desktop
   KDE Plasma Workspaces
   Development and Creative Workstation
Installed Groups: <<<<<<<<<<已安装的包组
   Development Tools
Available Groups:
   CIFS file server
   Compatibility Libraries
   Console Internet Tools
   Desktop
   Desktop Platform
   Desktop Platform Development
   Eclipse
   Educational Software
   Electronic Lab
   FCoE Storage Client
   Fedora Packager
   General Purpose Desktop
   Graphical Administration Tools
   Haskell
   Legacy UNIX Compatibility
   Messaging Client Support
   Messaging Server Support
   Milkymist
   MySQL Database client
   MySQL Database server
   NFS file server
   Network Storage Server
   SNMP Support
   Scientific Support
   Security Tools
   Server Platform
   Server Platform Development
   Smart Card Support
   Storage Availability Tools
   System Administration Tools
   System Management
   TeX support
   TurboGears application framework
   Virtualization
   Web-Based Enterprise Management
   Xfce
   iSCSI Storage Client
Done

开始编译

编译事项

- [root@localhost ~]# ll /boot/vmlinuz-3.10.0-327.el7.x86_64 
-rwxr-xr-x. 1 root root 5156528 Nov 19  2015 /boot/vmlinuz-3.10.0-327.el7.x86_64
- 那为什么要用他,因为这个模板对应的有个配置文件在/boot/config 里面,里面给我们说了当前那些模块打到里面去了,那些没有打进去
[root@localhost ~]# ll /boot/config-3.10.0-327.el7.x86_64 
-rw-r--r--. 1 root root 126426 Nov 19  2015 /boot/config-3.10.0-327.el7.x86_64

编译开始

[root@localhost ~]# ls
anaconda-ks.cfg  linux-4.12.tar.xz
[root@localhost ~]# ll
total 96868
-rw-------. 1 root root     1147 Jul  5 17:13 anaconda-ks.cfg
-rw-r--r--. 1 root root 99186576 Jul 11 08:47 linux-4.12.tar.xz
4.12.tar.xz
[root@localhost ~]# tar xfv linux-4.12.tar.xz 
linux-4.12/virt/kvm/arm/vgic/vgic-v3.c
linux-4.12/virt/kvm/arm/vgic/vgic.c
linux-4.12/virt/kvm/arm/vgic/vgic.h
linux-4.12/virt/kvm/async_pf.c
linux-4.12/virt/kvm/async_pf.h
linux-4.12/virt/kvm/coalesced_mmio.c
linux-4.12/virt/kvm/coalesced_mmio.h
linux-4.12/virt/kvm/eventfd.c
linux-4.12/virt/kvm/irqchip.c
linux-4.12/virt/kvm/kvm_main.c
linux-4.12/virt/kvm/vfio.c
linux-4.12/virt/kvm/vfio.h
linux-4.12/virt/lib/
linux-4.12/virt/lib/Kconfig
linux-4.12/virt/lib/Makefile
linux-4.12/virt/lib/irqbypass.c
 
[root@localhost ~]# ls
anaconda-ks.cfg  linux-4.12  linux-4.12.tar.xz
[root@localhost ~]# du -sh linux-4.12
842M    linux-4.12

编译功能模块

 [root@localhost boot]# ls /boot/config-3.10.0-327.el7.x86_64 
/boot/config-3.10.0-327.el7.x86_64
[root@localhost boot]# vim  /boot/config-3.10.0-327.el7.x86_64 
# Automatically generated file; DO NOT EDIT.
# Linux/x86_64 3.10.0-327.el7.x86_64 Kernel Configuration
#
CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_OUTPUT_FORMAT="elf64-x86-64"
CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig"
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_MMU=y
# CONFIG_LOCALVERSION_AUTO is not set
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_BZIP2=y
CONFIG_HAVE_KERNEL_LZMA=y
CONFIG_HAVE_KERNEL_XZ=y
CONFIG_HAVE_KERNEL_LZO=y
CONFIG_KERNEL_GZIP=y
# CONFIG_KERNEL_BZIP2 is not set
# CONFIG_KERNEL_LZMA is not set
# CONFIG_KERNEL_XZ is not set
# CONFIG_KERNEL_LZO is not set
CONFIG_TCP_CONG_ADVANCED=y
CONFIG_TCP_CONG_BIC=m
CONFIG_TCP_CONG_CUBIC=y
CONFIG_TCP_CONG_WESTWOOD=m
CONFIG_TCP_CONG_HTCP=m
CONFIG_TCP_CONG_HSTCP=m
CONFIG_TCP_CONG_HYBLA=m
CONFIG_TCP_CONG_VEGAS=m
CONFIG_TCP_CONG_SCALABLE=m
CONFIG_TCP_CONG_LP=m
CONFIG_TCP_CONG_VENO=m
CONFIG_TCP_CONG_YEAH=m
CONFIG_TCP_CONG_ILLINOIS=m
CONFIG_TCP_CONG_DCTCP=m
CONFIG_FAT_FS=m
CONFIG_MSDOS_FS=m
CONFIG_VFAT_FS=m
CONFIG_FAT_DEFAULT_CODEPAGE=437
CONFIG_FAT_DEFAULT_IOCHARSET="ascii"
# CONFIG_NTFS_FS is not set    《《《没有启用状态

#
# Pseudo filesystems
#
CONFIG_PROC_FS=y
CONFIG_PROC_KCORE=y
CONFIG_PROC_VMCORE=y
CONFIG_PROC_SYSCTL=y
[root@localhost boot]# cp  /boot/config-3.10.0-327.el7.x86_64  /root/linux-4.12/.config
snipaste_20170712_171649.png snipaste_20170712_171658.png snipaste_20170712_171705.png snipaste_20170712_171718.png snipaste_20170712_171731.png
[root@localhost linux-4.12]# lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                4
On-line CPU(s) list:   0-3
Thread(s) per core:    1
Core(s) per socket:    1
Socket(s):             4
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 58
Model name:            Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz
Stepping:              9
CPU MHz:               2594.107
BogoMIPS:              5188.21
Hypervisor vendor:     VMware
Virtualization type:   full
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              3072K
NUMA node0 CPU(s):     0-3
[root@localhost linux-4.12]# make -j 4
  HOSTCC  scripts/sign-file
scripts/sign-file.c:25:30: fatal error: openssl/opensslv.h: No such file or directory
 #include <openssl/opensslv.h>
- [root@localhost linux-4.12]# yum -y install openssl-devel
  IHEX2FW firmware/emi26/firmware.fw
  IHEX2FW firmware/emi26/bitstream.fw
  IHEX2FW firmware/emi62/loader.fw
  IHEX2FW firmware/emi62/bitstream.fw
  IHEX2FW firmware/emi62/spdif.fw
  IHEX2FW firmware/emi62/midi.fw
  H16TOFW firmware/edgeport/boot.fw
  H16TOFW firmware/edgeport/boot2.fw
  H16TOFW firmware/edgeport/down.fw
  H16TOFW firmware/edgeport/down2.fw
  IHEX2FW firmware/whiteheat_loader.fw
  IHEX2FW firmware/whiteheat.fw
  IHEX2FW firmware/keyspan_pda/keyspan_pda.fw
  IHEX2FW firmware/keyspan_pda/xircom_pgs.fw
[root@localhost linux-4.12]# make modules_install
[root@localhost linux-4.12]# ls /lib/modules
3.10.0-327.el7.x86_64  4.12.0-1.0-li-linux
[root@localhost linux-4.12]# make install
sh ./arch/x86/boot/install.sh 4.12.0-1.0-li-linux arch/x86/boot/bzImage \
    System.map "/boot"
snipaste_20170712_171740.png
上一篇下一篇

猜你喜欢

热点阅读