本文主要是介绍Linux内核升级之制作initrd.img及其new-kernel-pkg(.sh)使用,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1、从编译好的源码中拷贝bzImage和System.map文件到/boot目录,并重命名。
# cp linux-2.6.32.6/arch/i386/boot/bzImage /boot/vmlinuz-2.6.32.6
# cp linux-2.6.32.6/System.map /boot/System.map-2.6.32.6
注意:
1)、vmlinuz和System.map的全名(包括版本号)一定要正确,要不new-kernel-pkg的脚本无法找到上述文件!
2)、编译过程中执行:make bzImage, make modules, make modules_install(拷贝*.ko文件到/lib/modules/2.6.32.6目录下)
2、执行命令制作initrd-2.6.32.6.img
# new-kernel-pkg --mkinitrd --depmod --install 2.6.32.6
3、/boot目录文件
4、new-kernel-pkg脚本
#!/bin/bash
#
# new-kernel-pkg
# Invoked upon installation or removal of a kernel package, the following
# tasks are/can be done here:
# creation/removal of initrd
# run of depmod/removal of depmod generated files
# addition/removal of kernel images from grub/lilo configuration (via grubby)
#
# Copyright 2002-2008 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
PATH=/sbin:/bin:$PATH
lilo=/sbin/lilo
# some defaults that are sane for most arches
kernelName=vmlinuz
if [ -x ./grubby ]; then
grubby=./grubby
else
grubby=/sbin/grubby
fi
[ -f /etc/sysconfig/kernel ] && . /etc/sysconfig/kernel
cfgGrub=""
cfgLilo=""
runLilo=""
grubConfig=""
ARCH=$(uname -m)
if [ $ARCH = 'ia64' ]; then
liloConfig=/boot/efi/EFI/redhat/elilo.conf
bootPrefix=/boot/efi/EFI/redhat
liloFlag=elilo
isx86=""
elif [ $ARCH = 'ppc64' -o $ARCH = 'ppc' ]; then
liloConfig=/etc/yaboot.conf
bootPrefix=/boot
lilo=/sbin/ybin
liloFlag=yaboot
runLilo="yes"
isx86=""
elif [ $ARCH = 'sparc' -o $ARCH = 'sparc64' ]; then
liloConfig=/etc/silo.conf
bootPrefix=/boot
liloFlag=silo
lilo=/sbin/silo
isx86=""
elif [ $ARCH = 's390' -o $ARCH = 's390x' ]; then
liloConfig=/etc/zipl.conf
bootPrefix=/boot
liloFlag=zipl
lilo=/sbin/zipl
runLilo="yes"
isx86=""
else
# this leaves i?86 and x86_64
liloConfig=/etc/lilo.conf
grubConfig=$(readlink -f /etc/grub.conf 2>/dev/null)
bootPrefix=/boot
liloFlag=lilo
isx86="yes"
fi
mode=""
version=""
initrd=""
dracut=""
initrdfile=""
moddep=""
verbose=""
makedefault=""
package=""
mbkernel=""
mbargs=""
adddracutargs=""
这篇关于Linux内核升级之制作initrd.img及其new-kernel-pkg(.sh)使用的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!