CENTOS linux kernel 内核编译
为什么80%的码农都做不了架构师?>>>
题记:今天装docker,提示我最好用3.10以上的内核
一.环境
1.1 系统环境
[root@test kernels]# lsb
lsblk lsb_release
[root@test kernels]# lsb_release -a
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.5 (Final)
Release: 6.5
Codename: Final
1.2 当前内核版本
Display all 259 possibilities? (y or n)
[root@test kernels]# more /proc/version
Linux version 2.6.32-431.el6.x86_64 (mockbuild@c6b8.bsys.dev.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) ) #1 SMP Fri Nov 22 03:15:09 UTC 2013
二.安装
2.1 获取高版本内核,并解压到/usr/src/kernels
网址:https://www.kernel.org/
cd /root/soft
wget
cd /usr/src/kernels
tar -xJvf /root/soft/linux-3.10.87.tar.xz
2.2 编译&安装
A:进入内核目录,执行make menuconfig 修改编译配置文件
[root@test kernels]# cd linux-3.10.87/
[root@test linux-3.10.87]# pwd
/usr/src/kernels/linux-3.10.87
[root@test linux-3.10.87]# make menuconfigHOSTCC scripts/basic/fixdepHOSTCC scripts/kconfig/conf.oHOSTCC scripts/kconfig/lxdialog/checklist.oHOSTCC scripts/kconfig/lxdialog/inputbox.oHOSTCC scripts/kconfig/lxdialog/menubox.oHOSTCC scripts/kconfig/lxdialog/textbox.oHOSTCC scripts/kconfig/lxdialog/util.oHOSTCC scripts/kconfig/lxdialog/yesno.oHOSTCC scripts/kconfig/mconf.oSHIPPED scripts/kconfig/zconf.tab.cSHIPPED scripts/kconfig/zconf.lex.cSHIPPED scripts/kconfig/zconf.hash.cHOSTCC scripts/kconfig/zconf.tab.oHOSTLD scripts/kconfig/mconf
scripts/kconfig/mconf Kconfig
#
# using defaults found in /boot/config-2.6.32-431.el6.x86_64
#
/boot/config-2.6.32-431.el6.x86_64:497:warning: symbol value 'm' invalid for X86_INTEL_PSTATE
/boot/config-2.6.32-431.el6.x86_64:565:warning: symbol value 'm' invalid for PCCARD_NONSTATIC
/boot/config-2.6.32-431.el6.x86_64:2730:warning: symbol value 'm' invalid for MFD_WM8400
/boot/config-2.6.32-431.el6.x86_64:2731:warning: symbol value 'm' invalid for MFD_WM831X
/boot/config-2.6.32-431.el6.x86_64:2732:warning: symbol value 'm' invalid for MFD_WM8350
/boot/config-2.6.32-431.el6.x86_64:2745:warning: symbol value 'm' invalid for MFD_WM8350_I2C
/boot/config-2.6.32-431.el6.x86_64:2747:warning: symbol value 'm' invalid for AB3100_COR
注意:此处我的系统是64位,所以要选用64-bit kernel
然后保存,检查配置文件 .config
[root@test linux-3.10.87]# ls -al
总用量 684
drwxrwxr-x 23 root root 4096 8月 20 14:39 .
drwxr-xr-x. 4 www root 4096 8月 20 14:16 ..
drwxrwxr-x 32 root root 4096 8月 17 11:52 arch
drwxrwxr-x 3 root root 4096 8月 17 11:52 block
-rw-r----- 1 root root 119834 8月 20 14:39 .config
-rw-rw-r-- 1 root root 18693 8月 17 11:52 COPYING
-rw-rw-r-- 1 root root 95317 8月 17 11:52 CREDITS
drwxrwxr-x 4 root root 4096 8月
B:编译 make all 这一步 执行的时间很长,我这边有一个小时左右
[root@test linux-3.10.87]# pwd
/usr/src/kernels/linux-3.10.87
[root@test linux-3.10.87]# make all
C: 安装模块
[root@test linux-3.10.87]# make modules_install
D:执行make install
[root@test linux-3.10.87]# make install
sh /usr/src/kernels/linux-3.10.87/arch/x86/boot/install.sh 3.10.87 arch/x86/boot/bzImage \System.map "/boot"
ERROR: modinfo: could not find module xt_MARK
ERROR: modinfo: could not find module ipt_MASQUERADE
ERROR: modinfo: could not find module iptable_nat
ERROR: modinfo: could not find module nf_nat
ERROR: modinfo: could not find module vmhgfs
ERROR: modinfo: could not find module vsock
ERROR: modinfo: could not find module vmware_balloon
ERROR: modinfo: could not find module vmci
[root@test linux-3.10.87]#
报错了
暂时未解决
解决问题:在系统上lsmod 确实有上面几个模块
[root@test 2.6.32-504.3.3.el6.x86_64]# lsmod | grep xt_MARK
xt_MARK 1057 3
[root@test 2.6.32-504.3.3.el6.x86_64]# pwd
/usr/src/kernels/2.6.32-504.3.3.el6.x86_64
但是我在/usr/src/kernels/2.6.32-504.3.3.el6.x86_64/.config 里也没找到这些模块
[root@test 2.6.32-504.3.3.el6.x86_64]# grep ipt_MASQUERADE .config
[root@test 2.6.32-504.3.3.el6.x86_64]# grep xt_MARK .config
[root@test 2.6.32-504.3.3.el6.x86_64]# grep iptable_nat .config
[root@test 2.6.32-504.3.3.el6.x86_64]# grep nf_nat .config
[root@test 2.6.32-504.3.3.el6.x86_64]# grep vmhgfs .config
[root@test 2.6.32-504.3.3.el6.x86_64]# grep vsock .config
[root@test 2.6.32-504.3.3.el6.x86_64]# grep vmware_balloon .config
[root@test 2.6.32-504.3.3.el6.x86_64]# grep vmci .config
[root@test 2.6.32-504.3.3.el6.x86_64]# lsmod | grep xt_MARK
xt_MARK 1057 3
[root@test 2.6.32-504.3.3.el6.x86_64]# pwd
/usr/src/kernels/2.6.32-504.3.3.el6.x86_64
[root@test 2.6.32-504.3.3.el6.x86_64]# pwd
/usr/src/kernels/2.6.32-504.3.3.el6.x86_64
所以上面的报错可能不影响正常使用,正在继续测试中
E:修改启动文件 /boot/grub/grub.conf
步骤:先备份该文件
[root@test boot]# cd grub/
[root@test grub]# ls -al
总用量 280
drwxr-xr-x. 2 root root 1024 8月 24 22:26 .
dr-xr-xr-x. 5 root root 1024 8月 24 22:12 ..
-rw-r--r--. 1 root root 63 10月 25 2014 device.map
-rw-r--r--. 1 root root 13380 10月 25 2014 e2fs_stage1_5
-rw-r--r--. 1 root root 12620 10月 25 2014 fat_stage1_5
-rw-r--r--. 1 root root 11748 10月 25 2014 ffs_stage1_5
-rw------- 1 root root 1080 8月 24 22:26 grub.conf
-rw------- 1 root root 1080 8月 24 22:26 grub.conf.bak
-rw-r--r--. 1 root root 11756 10月 25 2014 iso9660_stage1_5
-rw-r--r--. 1 root root 13268 10月 25 2014 jfs_stage1_5
lrwxrwxrwx. 1 root root 11 10月 25 2014 menu.lst -> ./grub.conf
-rw-r--r--. 1 root root 11956 10月 25 2014 minix_stage1_5
-rw-r--r--. 1 root root 14412 10月 25 2014 reiserfs_stage1_5
-rw-r--r--. 1 root root 1341 11月 15 2010 splash.xpm.gz
-rw-r--r--. 1 root root 512 10月 25 2014 stage1
-rw-r--r--. 1 root root 126100 10月 25 2014 stage2
-rw-r--r--. 1 root root 12024 10月 25 2014 ufs2_stage1_5
-rw-r--r--. 1 root root 11364 10月 25 2014 vstafs_stage1_5
-rw-r--r--. 1 root root 13964 10月 25 2014 xfs_stage1_5
[root@test grub]# pwd
/boot/grub
[root@test grub]# cp grub.conf grub.conf.bak
然后修改参数default=0
0表示启动第一个
1表示启动第二个
下面是我的已修改版:
[root@test grub]# less grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/mapper/VolGroup-lv_root
# initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (3.10.87)root (hd0,0)kernel /vmlinuz-3.10.87 ro root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS rd_NO_MD rd_LVM_LV=VolGroup/lv_swap crashkernel=auto.UTF-8 rd_LVM_LV=VolGroup/lv_root KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quietinitrd /initramfs-3.10.87.img
title CentOS (2.6.32-431.el6.x86_64)root (hd0,0)kernel /vmlinuz-2.6.32-431.el6.x86_64 ro root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS rd_NO_MD rd_LVM_LV=VolGroup/lv_swap crashkernel=auto.UTF-8 rd_LVM_LV=VolGroup/lv_root KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quietinitrd /initramfs-2.6.32-431.el6.x86_64.img
三 验证
3.1 重启
[root@test grub]# reboot
3.2 检查
[root@test grub]# uname -a
Linux test.localdomain 3.10.87 #1 SMP Mon Aug 24 21:43:03 CST 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@test grub]# cat /proc/version
Linux version 3.10.87 (root@test.localdomain) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) ) #1 SMP Mon Aug 24 21:43:03 CST 2015
[root@test grub]#
参考文章:http://blog.itpub.net/27771627/viewspace-1256552
http://smilejay.com/2013/11/kernel-install-error-could-not-find-module/
转载于:https://my.oschina.net/tacg/blog/495213
CENTOS linux kernel 内核编译相关推荐
- centos linux内核编译环境,CENTOS linux kernel 内核编译
题记:今天装docker,提示我最好用3.10以上的内核 一.环境 1.1 系统环境 [root@test kernels]# lsb lsblk lsb_release [root@t ...
- Linux kernel内核编译配置选项详解
转载于:http://lamp.linux.gov.cn/Linux/kernel_options.html 作者:金步国 Code maturity level options 代码成熟度选项 Pr ...
- 最新历史版本 :LINUX KERNEL 配置编译中文指南
LINUX KERNEL 配置编译中文指南 序言 近几年,linux大行其道,令不满windows蓝屏的使用者跃跃欲试,结果发现linux安装不及windows方便,界面不及windows友好,配置不 ...
- [linux kernel] 内核下ksz8081驱动调试
系统版本:Ubuntu18.04-64 编译器版本:gcc version 7.4.0 (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1) uboot版本:2018.07 - ...
- 嵌入式Linux的内核编译
实验环境 VMware Workstation Player Ubuntu16.04 kernel-3.2.tar.bz2 Linux内核编译 在ubuntu上编译嵌入式Linux内核,需要大家提前安 ...
- Linux内核学习(七):linux kernel内核启动(一):概述篇
Linux内核学习(七):linux kernel内核启动(一):概述篇 这一篇让我们来大致的了解一下Linux内核的启动过程 这篇文章不涉及源码,重在让你知道这个linux内核的启动过程,源码详细的 ...
- 【Linux系统移植】NXP 官方开发板 kernel内核 编译与烧录
1.下载 NXP 官方 I.MX6ULL EVK 开发板的kernel :linux-imx-rel_imx_4.1.15_2.1.0_ga.tar.bz2 2.使用 FileZilla Client ...
- Linux kernel 内核升级与降级实战
安装 / 升级的方法和建议 1.对于 CentOS/RHEL 系统,尽量使用 yum 方式或 RPM 包安装 / 升级内核,需要注意的是红帽的 Red Hat Linux 服务需要订阅. 2.使用安装 ...
- LINUX操作系统的内核编译内幕详解一
内核简介 内核,是一个操作系统的核心.它负责管理系统的进程.内存.设备驱动程序.文件和网络系统,决定着系统的性能和稳定性. Linux的一个重要的特点就是其源代码的公开性,所有的内核源程序都可以在/u ...
最新文章
- 一些改进模型速度/精度的工程方法
- 听过TB、PB级大数据,ZB级的大数据探索与应用实践是怎么样的?【附PPT】
- c语言排序算法实际案例,[C语言] 部分经典排序算法详解(有图解)
- c语言样本,C语言样本教案 第二章
- Json-server 创建模拟API服务器
- BZOJ2938:[Poi2000]病毒
- Asp.Net分页生成页码超链接方法
- 你觉得成都这类城市,哪方面发展最值得期待?
- 【3ds Max】 - 如何使用分布式渲染?
- 管理员登录页面html代码,自己做的一个后台管理员登陆界面 .cshtml
- 某宝双十一自动养猫,解放你的双手得喵币
- linux 怎么临时修改ip,linux中临时、永久修改ip(示例代码)
- vue3 setup写法(语法糖版本)
- ECSHOP模板堂商品最小起订量插件
- 读书笔记——我知道的杨振宁(葛墨林/2022)
- 优秀网页翻译:DS3231与 PCF2129 RTC比较
- 防坑指南 | 转行产品经理你需要了解什么?
- 【C盘瘦身】如何清理Wechat Files,经常使用电脑微信用户必知的常识!
- win10 pxe 安装linux,win10+TPLINK,用PXE安装redhat系统
- js验证银行卡号,并自动识别银行信息。js验证手机码。js验证数字