随着学习Suse的深入,面临的问题也是越来越多,Suse编译内核是非常头疼的,今天编译Suse 10.2内核直接导致Suse面临重装,要是备份Linux内核就好了,备份Linux内核相当的简单,下面就是步骤,英文也很简单,相信准备对内核有所动作的人都能轻易看懂。虽然是针对Suse写的,其它Linux发行版本也大同小异,下面就是备份Linux内核的简单步骤:
1)openterminal 2)sutoroot 3)changedirectoryto/boot #cd/boot 4)seewhatarethenamesofrunningkernels #ls 5)makebackupcopyofyourkernelandSystem.map #cpvmlinuz-2.6.18.8-0.1-defaultvmlinuz-2.6.18.8-0.1-bak #cpSystem.map-2.6.18.8-0.1-defaultSystem.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)createinitrd #mkinitrd-s1024×768 7)checkifnewinitrdwascreated: #ls andlookforinitrd-2.6.18.8-0.1-bak 8)makebackupofyourcurrentGRUBmenu(inthecasethatyoumayscrewupediting) #cp/boot/grub/menu.lst/boot/grub/menu.lst_bak 9)editgrubmenuwhatevereditor(Iusevi,butyoumayusekedit.gedit,joe,picoandsoonaslongasyouruneditorwithrootprivileges) boot/grub/menu.lst 10)addnewentryattheendofthefile(copyoriginalentryforSuseLinux10.2): titleSuseLinux10.2kernelbackup root(hd0,0) kernel/vmlinuz-2.6.18.8-0.1-bakroot=/dev/sda2vga=0×317vga=normalvideo=vesa:1024×768@60resume=/dev/sda3elevator=deadlinesplash=silentshowopts initrd/initrd-2.6.18.8-0.1-bak importantchangesaremarkedbold.Youmaynothavetheotherstufforitmaybedifferent.SimplykeeptherestofthefileexactlythesameasintheoriginalentryforSuseLinux10.2 11)savethefile 12)restartcomputerandselectfromGRUBmenu“SuseLinux10.2kernelbackup” ifsystembootssuccessfullyyouhaveworkingkernelbackup,nowifSuseupdateskernelnexttimeandnewkernelwillnotbootproperly,youcanalwaysboottoSuseLinux10.2kernelbackupwhichwillneverbemodified(andsafefromscrewedupdates) 举一反三的令一种方法: ideallywouldbedosomethingdifferent: 1)installkernelsources 2)sutoroot 3)copykernelsourcestothenewdirecory: #cp-R/usr/src/Linux-2.6.18.8-0.1/usr/src/Linux-2.6.18.8-0.1-bak 4)changedirectoryto/usr/src/Linux-2.6.18.8-0.1-bak #cd/usr/src/Linux-2.6.18.8-0.1-bak 5)createconfigfile #makeoldconfig 6)changekernelname(superimportant!!!) byediting.configfile(in/usr/src/Linux-2.6.18.8-0.1-bak)Tehreisadotbefore“config” scrolldowntotheline: # #Generalsetup # CONFIG_LOCALVERSION=”" andchangelocalkernelnameversionbyadding: CONFIG_LOCALVERSION=”-bak” ifthereisanythingalreadywrittenintheline CONFIG_LOCALVERSION=”" deleteoldnamerememberthatnewnamemusthavequotationmarks. 7)savefile 8)compilekernel #makebzImage&&makemodules&&makemodules_install&&makeinstall Youjustcreatedanewkernel!Exactlythesameastherunningonebutthenamewillhave“-bak”attheend thereisnothingmorerequired.inyourGRUBmenuwillappearanewentrypointingtothenewkernel.Oldkernelwillnotbeaffected(ifyoudidexactlyasIsuggested) newkernelisinvisibletoYastandwillneverbechanged. BecausethelatestkernelupgradeisarealdisasterIwouldmakebackupcopyofgrubmenu(asroot): #cp/boot/grub/menu.lst/boot/grub/menu.lst_bak nowyoucanboottothenewkernel youwillgettocommandline(whenbootingtothenewkernel)ifyouinstallednvidia/atidrivers, Thatiseasytofixofcourse.whatisimportant,youhaveworkingSusesetupinspiteofallSusedevseffortstoscrewyouup
通过我的介绍,这篇简单的备份Linux内核的文章会对你有帮助。其实我的主要目的就是提醒各位应用Linux的朋友,记得要备份Linux内核。
相关文章
标签:系统运维