Linux 内核升级攻略

in Linux with 0 comment

实例centos内核升级,环境digital ocean VPS

参考出处:http://blog.chinaunix.net/uid-26000296-id-4208526.html

[root@changda opt]# uname -r
2.6.18-416.el5

现在下载 linux-3.2.14.tar.gz 包进行升级操作

tar zxvf linux-3.2.14.tar.gz -C /usr/src/kernels/

drwxr-xr-x 19 root root 4096 Nov  1 01:11 2.6.18-416.el5-x86_64
drwxrwxr-x 23 root root 4096 Apr  3  2012 linux-3.2.14 #要升级内核文件

在简装centos下提示 -bash: make: command not found

则下边安装之
yum -y install gcc automake autoconf libtool make gcc-g++

Debian/Ubuntu把gcc-g++ 叫做g++

使用原内核的config配置文件命令为.config
cp /boot/config-2.6.18-416.el5 /usr/src/kernels/linux-3.2.14/.config

编译生成内核文件

make bzImage

ZOFFSET arch/x86/boot/zoffset.h
  AS      arch/x86/boot/header.o
  CC      arch/x86/boot/main.o
  CC      arch/x86/boot/mca.o
  CC      arch/x86/boot/memory.o
  CC      arch/x86/boot/pm.o
  AS      arch/x86/boot/pmjump.o
  CC      arch/x86/boot/printf.o
  CC      arch/x86/boot/regs.o
  CC      arch/x86/boot/string.o
  CC      arch/x86/boot/tty.o
  CC      arch/x86/boot/video.o
  CC      arch/x86/boot/video-mode.o
  CC      arch/x86/boot/version.o
  CC      arch/x86/boot/video-vga.o
  CC      arch/x86/boot/video-vesa.o
  CC      arch/x86/boot/video-bios.o
  LD      arch/x86/boot/setup.elf
  OBJCOPY arch/x86/boot/setup.bin
  OBJCOPY arch/x86/boot/vmlinux.bin
  HOSTCC  arch/x86/boot/tools/build
  BUILD   arch/x86/boot/bzImage
Setup is 15672 bytes (padded to 15872 bytes).
System is 2769 kB
CRC 6c5ef436
Kernel: arch/x86/boot/bzImage is ready  (#2)

编译生成模块

make modules

IHEX    firmware/kaweth/new_code_fix.bin
  IHEX    firmware/kaweth/trigger_code_fix.bin
  IHEX    firmware/ti_3410.fw
  IHEX    firmware/ti_5052.fw
  IHEX    firmware/mts_cdma.fw
  IHEX    firmware/mts_gsm.fw
  IHEX    firmware/mts_edge.fw
  H16TOFW firmware/edgeport/boot.fw
  H16TOFW firmware/edgeport/boot2.fw
  H16TOFW firmware/edgeport/down.fw
  H16TOFW firmware/edgeport/down2.fw
  IHEX    firmware/edgeport/down3.bin
  IHEX2FW firmware/whiteheat_loader.fw
  IHEX2FW firmware/whiteheat.fw
  IHEX2FW firmware/keyspan_pda/keyspan_pda.fw
  IHEX2FW firmware/keyspan_pda/xircom_pgs.fw


make modules_install // 安装模块

INSTALL /lib/firmware/edgeport/down3.bin
  INSTALL /lib/firmware/whiteheat_loader.fw
  INSTALL /lib/firmware/whiteheat.fw
  MKDIR   /lib/firmware/keyspan_pda
  INSTALL /lib/firmware/keyspan_pda/keyspan_pda.fw
  INSTALL /lib/firmware/keyspan_pda/xircom_pgs.fw
  DEPMOD  3.2.14

make install // 安装
grubby fatal error: unable to find a suitable template

到这一步失败了,分析是digital ocean的问题,也有很多人遇到这样的问题,官方建议在后台进行kernel更新

CENTOS

实际测试了一把当先安装的是高版本的核心转为低版本的核心时--->失败,转换后ssh登录不了了
从低版本到高版本也失败了,同样是ssh登录不了

Ubuntu 则成功

开始是高版本
root@changda:~# uname -r
3.13.0-103-generic
切换后为低版本
root@changda:~# uname -r
2.6.32-56-server

最后在虚拟机中实现了重新编译内核,见Linux鸟哥私房菜笔记六 (好像没有了)

评论