Ubuntu 10.04手动更新kernel(2)

mkinitramfs 2.6.36.2 -o /boot/initrd.img-2.6.36.2  

如果不进行这一步可能不能成功引导kernel,原因是:在grub引导kernel的时候无法识别kernel所在的位置,即没有驱动程序来加载硬盘的分区,而initrd恰好是干这件事的。

ls /boot/     

abi-2.6.32-21-generic     config-2.6.36.2               memtest86+.bin                vmcoreinfo-2.6.32-25-generic
abi-2.6.32-25-generic     grub                          System.map-2.6.32-21-generic  vmcoreinfo-2.6.32-27-generic
abi-2.6.32-27-generic     initrd.img-2.6.32-21-generic  System.map-2.6.32-25-generic  vmlinuz-2.6.32-21-generic
config-2.6.32-21-generic  initrd.img-2.6.32-25-generic  System.map-2.6.32-27-generic  vmlinuz-2.6.32-25-generic
config-2.6.32-25-generic  initrd.img-2.6.32-27-generic  System.map-2.6.36.2           vmlinuz-2.6.32-27-generic
config-2.6.32-27-generic  initrd.img-2.6.36.2           vmcoreinfo-2.6.32-21-generic  vmlinuz-2.6.36.2

update-grub                #更新grub,让我们的kernel能被grub识别并添加到启动菜单中去  

Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.36.2
Found initrd image: /boot/initrd.img-2.6.36.2
Found linux image: /boot/vmlinuz-2.6.32-27-generic
Found initrd image: /boot/initrd.img-2.6.32-27-generic
Found linux image: /boot/vmlinuz-2.6.32-25-generic
Found initrd image: /boot/initrd.img-2.6.32-25-generic
Found linux image: /boot/vmlinuz-2.6.32-21-generic
Found initrd image: /boot/initrd.img-2.6.32-21-generic
Found memtest86+ image: /boot/memtest86+.bin
done

执行上面的命令后,可以在中发现我们的新kernel被添加进去了,见下面的vi部分输出,自动为我们添加了两项哦

vi /boot/grub/grub.cfg   

### BEGIN /etc/grub.d/10_linux ### menuentry 'UbuntuLinux 2.6.36.2' --class ubuntu --class gnu-linux --class gnu --class os {
        recordfail
        insmod ext2
        set root='(hd0,1)'
        search --no-floppy --fs-uuid --set 62a097ef-4767-4b5e-8494-ef5fa3298037
        linux   /boot/vmlinuz-2.6.36.2 root=UUID=62a097ef-4767-4b5e-8494-ef5fa3298037 ro   quiet splash
        initrd  /boot/initrd.img-2.6.36.2
}
menuentry 'Ubuntu,Linux 2.6.36.2 (恢复模式)' --class ubuntu --class gnu-linux --class gnu --class os {
        recordfail
        insmod ext2
        set root='(hd0,1)'
        search --no-floppy --fs-uuid --set 62a097ef-4767-4b5e-8494-ef5fa3298037
        echo    '载入 Linux ...'
        linux   /boot/vmlinuz-2.6.36.2 root=UUID=62a097ef-4767-4b5e-8494-ef5fa3298037 rosingle
        echo    '载入引导虚拟磁盘 ...'
        initrd  /boot/initrd.img-2.6.36.2
}
menuentry 'Ubuntu,Linux 2.6.32-27-generic' --class ubuntu --class gnu-linux --class gnu --class os {
        recordfail
        insmod ext2
        set root='(hd0,1)'
        search --no-floppy --fs-uuid --set 62a097ef-4767-4b5e-8494-ef5fa3298037
        linux   /boot/vmlinuz-2.6.32-27-generic root=UUID=62a097ef-4767-4b5e-8494-ef5fa3298037 ro   quiet splash
        initrd  /boot/initrd.img-2.6.32-27-generic

}


E:  重启验证

为了以防万一,在重启验证前我们修改一个地方,显示启动菜单,默认可能不会显示的:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/23476.html