监控安装 ERP

系统集成论坛

 找回密码
 注册通行证

QQ登录

只需一步,快速开始

路由器交换机防火墙系统集成商城 优质产品采购平台
查看: 1728|回复: 1
打印 上一主题 下一主题

备份Linux内核的步骤

[复制链接]

37

主题

361

帖子

901

积分

版主

跳转到指定楼层
1
发表于 2009-12-1 22:21:41 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
华为金牌代理
随着我学习Suse的深入,我面临的问题也是越来越多,Suse编译内核都快让我痛疼了,要是上次成功编译SLED 10.0的内核,今天编译Suse 10.2内核直接导致我的Suse面临重装,要是备份Linux内核就好了,备份Linux内核相当的简单,下面就是步骤,英文也很简单,相信准备对内核有所动作的人都能轻易看懂。虽然是针对Suse写的,其它Linux发行版本也大同小异,下面就是备份Linux内核的简单步骤:
1) open terminal

2) su to root

3) change directory to /boot
#cd /boot

4) see what are the names of running kernels
#ls

5) make backup copy of your kernel and System.map
#cp vmlinuz-2.6.18.8-0.1-default vmlinuz-2.6.18.8-0.1-bak
#cp System.map-2.6.18.8-0.1-default System.map-2.6.18.8-0.1-bak
#cp -R /lib/modules/2.6.18.8-0.1-default /lib/modules/2.6.18.8-0.1-bak

6) create initrd
#mkinitrd -s 1024×768

7) check if new initrd was created:
#ls
and look for initrd-2.6.18.8-0.1-bak

8) make backup of your current GRUB menu (in the case that you may screw up editing)
#cp /boot/grub/menu.lst /boot/grub/menu.lst_bak

9) edit grub menu whatever editor (I use vi, but you may use kedit.gedit, joe, pico and so on as long as you run editor with root privileges)
boot/grub/menu.lst

10) add new entry at the end of the file (copy original entry for Suse Linux 10.2):
title Suse Linux 10.2 kernel backup
root (hd0,0)
kernel /vmlinuz-2.6.18.8-0.1-bak root=/dev/sda2 vga=0×317 vga=normal video=vesa:1024×768@60 resume=/dev/sda3 elevator=deadline splash=silent showopts
initrd /initrd-2.6.18.8-0.1-bak
important changes are marked bold. You may not have the other stuff or it may be different. Simply keep the rest of the file exactly the same as in the original entry for Suse Linux 10.2

11) save the file

12) restart computer and select from GRUB menu “Suse Linux 10.2 kernel backup”
if system boots successfully you have working kernel backup, now if Suse updates kernel next time and new kernel will not boot properly, you can always boot to Suse Linux 10.2 kernel backup which will never be modified (and safe from screwed updates)

举一反三的令一种方法:
ideally would be do something different:
1) install kernel sources

2) su to root

3) copy kernel sources to the new direcory:
#cp -R /usr/src/Linux-2.6.18.8-0.1 /usr/src/Linux-2.6.18.8-0.1-bak

4) change directory to /usr/src/Linux-2.6.18.8-0.1-bak
#cd /usr/src/Linux-2.6.18.8-0.1-bak

5) create config file
#make oldconfig

6) change kernel name (super important!!!)
by editing .config file (in /usr/src/Linux-2.6.18.8-0.1-bak) Tehre is a dot before “config”
scroll down to the line:
#
# General setup
#
CONFIG_LOCALVERSION=”"
and change local kernel name version by adding:
CONFIG_LOCALVERSION=”-bak”
if there is anything already written in the line
CONFIG_LOCALVERSION=”"
delete old name remember that new name must have quotation marks.

7) save file

8) compile kernel
#make bzImage && make modules && make modules_install && make install
You just created a new kernel! Exactly the same as the running one but the name will have “-bak” at the end
there is nothing more required. in your GRUB menu will appear a new entry pointing to the new kernel. Old kernel will not be affected (if you did exactly as I suggested)
new kernel is invisible to Yast and will never be changed.
Because the latest kernel upgrade is a real disaster I would make backup copy of grub menu (as root):
#cp /boot/grub/menu.lst /boot/grub/menu.lst_bak
now you can boot to the new kernel
you will get to command line (when booting to the new kernel) if you installed nvidia/ati drivers,
That is easy to fix of course. what is important, you have working Suse setup in spite of all Suse devs efforts to screw you up

通过我的介绍,这篇简单的备份Linux内核的文章会对你有帮助。其实我的主要目的就是提醒各位应用Linux的朋友,记得要备份Linux内核。
做人要厚道,看贴要回帖!

0

主题

8

帖子

28

积分

实习生

2
发表于 2009-12-5 15:22:29 | 只看该作者
华为金牌代理
很高深!全是english!
您需要登录后才可以回帖 登录 | 注册通行证

本版积分规则

联系我们| 手机版|系统集成论坛 ( 京ICP备11008917号 )

GMT+8, 2024-11-24 07:39 , Processed in 0.092031 second(s), 25 queries .

系统集成论坛

BBS.XTJC.COM

快速回复 返回顶部 返回列表