我想学学怎么编译更新内核,昨晚编译Linux内核2.6.35版, menuconfig里基本上没改什么重要设置,只是关掉了"压缩内核".
[/share/linux] # make
由于机器比较趴,然后我就睡觉了.今天早上起来发现vmlinux文件编译完成,同时也生成了System.map文件,没有make失败我想应该OK吧.
为了验证它确实可以引导:
[/share/linux] # cp System.map /boot/System.map-2.6.35
[/share/linux] # cp vmlinux vmlinuz-2.6.35
我把这两个文件复制到/boot下,把vmlinux重命名为vmlinuz是为了和/boot下的其它vmlinuz"对齐".
然后我发现ubuntu的vmlinuz都有一个initrd.img文件.
[/share/linux] # mkinitramfs -o initrd.img-2.6.35
我不知道initrd是啥,这个命令网上找到的,貌似用这个命令成功生成了一个,所以没有深究.
[/share/linux] # mv initrd* /boot
然后:
[/share/linux] # update-grub
重启之后,菜单中有了新的内核选项,我选择它启动却失败了,错误信息:
error: invalid magic number
error: you need to load the kernel first
press any key to continue...
然后我想,会不会因为内核没压缩过,而我起名为vmlinuz的问题,于是:
[/boot] # mv /boot/vmlinuz-2.6.35 /boot/vmlinux-2.6.35
[/boot] # update-grub
错误信息依旧.
我刚才说,机器比较趴嘛,所以在重新编译一个内核之前,上论坛来问问,有没有哪位大虾能帮帮忙,谢谢哦!
顺便附一下我的电脑磁盘分区:
Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders, total 156301488 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x71087376
Device Boot Start End Blocks Id System
/dev/sda1 * 57 12289718 6144831 b W95 FAT32
Partition 1 does not end on cylinder boundary.
/dev/sda2 12289725 16386299 2048287+ 82 Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3 16386300 156296384 69955042+ f W95 Ext'd (LBA)
Partition 3 does not end on cylinder boundary.
/dev/sda5 16386363 38925494 11269566 83 Linux
/dev/sda6 38925558 53882009 7478226 83 Linux
/dev/sda7 53882073 156296384 51207156 b W95 FAT32
Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x205f205f
Device Boot Start End Blocks Id System
/dev/sdb1 63 61448624 30724281 c W95 FAT32 (LBA)
/dev/sdb2 61448625 976768064 457659720 f W95 Ext'd (LBA)
/dev/sdb5 61448688 348176744 143364028+ 7 HPFS/NTFS
/dev/sdb6 348176808 552989429 102406311 b W95 FAT32
/dev/sdb7 552989493 976768064 211889286 7 HPFS/NTFS