分页: 1 / 2

编译内核-玩的就是寂寞

发表于 : 2010-05-15 9:15
黄美姬

代码: 全选

安装编译环境:
sudo aptitude install g++ gcc make automake  build-essential kernel-package fakeroot linux-headers-$(uname -r)

去内核官网查找最新内核
http://www.kernel.org/
我令天看到的时linux-2.6.33.4
解压到 /home/user/linux-2.6.33.4

代码: 全选

cd /home/user/linux-2.6.33.4
sudo make menuconfig 
关键是到kernel hacking下面,把kernel debug选项关闭,否则编译出来生成的deb包无比巨大。其它看你硬件办
Screenshot-6.png
Screenshot-10.png

代码: 全选

开始编译内核

$sudo make-kpkg clean 
$sudo make-kpkg -initrd kernel_image kernel-headers
20分钟左右,/home/user/linux-2.6.33.4/的上层目录,生成大便包

linux-headers-2.6.33.4-10.00.Custom_amd64.deb 6.2M
linux-image-2.6.33.4-10.00.Custom_amd64.deb 30M
安装命令:(或者双击安装)
代码:
$ cd ..
$ sudo dpkg -i linux-image-(按tab键)
$ sudo dpkg -ilinux-headers-(按tab键)

编译内核时,下面E文什么意思

代码: 全选

dpkg-shlibdeps: 警告: dependency on libncurses.so.5 could be avoided if "/home/janker/linux-2.6.33.4/debian/linux-headers-2.6.33.4/usr/src/linux-headers-2.6.33.4/scripts/kconfig/conf" were not uselessly linked against it (they use none of its symbols).
编出来DEB包30M,vmlinuz-2.6.33.4有3.3M,启动不了,开机提示:

代码: 全选

[0527599] kernel panic -not syncing:VFS unable to mout root fs on unkown-block(0,0)
看grub.cfg

代码: 全选

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Ubuntu,Linux 2.6.33.4' --class ubuntu --class gnu-linux --class gnu --class os {
	recordfail
	insmod ext2
	set root='(hd0,7)'
	search --no-floppy --fs-uuid --set dd9ca791-d315-4f04-a55e-303f90664fbf
	linux	/vmlinuz-2.6.33.4 root=/dev/sda13 ro   quiet splash
}
原来少了initrd.img-2.6.33.4,再看/boot/下竟没有生成此文件 :em06

Re: 编译内核一些警告求翻译

发表于 : 2010-05-15 10:14
黄美姬
(通用版才需要生成此文件,scsi需要生成此文件,那我就必须生成了,我也有scsi)
代码:
cd /lib/modules/2.6.33.4
sudo mkinitramfs -o /boot/initrd.img-2.6.33.4


OK生成

代码:
sudo update-grub2

重启动还是进不了:

代码: 全选

FATAL:could not load /lib/modules/2.6.33.4/modules.dep:NO such file or directory
查看了,此文件是有的

Re: 编译内核一些警告求翻译

发表于 : 2010-05-15 10:42
黄美姬

代码: 全选

janker@souls:/boot$ sudo cp initrd.img-2.6.33.4  initrd.img-2.6.33.4.old
janker@souls:/boot$ sudo depmod -a
janker@souls:/boot$ sudo update-initramfs  -c -k 2.6.33.4
update-initramfs: Generating /boot/initrd.img-2.6.33.4
janker@souls:/boot$ cd /tmp
janker@souls:/tmp$ 

janker@souls:/tmp$ gzip -dc /boot/initrd.img-2.6.33.4| cpio -id
11286 块
janker@souls:/tmp$ touch lib/modules/2.6.33.4/modules.dep
janker@souls:/tmp$ find ./ | cpio -H newc -o > /boot/initrd.img-2.6.33.4.new
bash: /boot/initrd.img-2.6.33.4.new: 权限不够
janker@souls:/tmp$ sudo find ./ | cpio -H newc -o > /boot/initrd.img-2.6.33.4.new
bash: /boot/initrd.img-2.6.33.4.new: 权限不够
janker@souls:/tmp$ 
TMD,看到最后,原来人家此方法也是不行的,

怪事把update-grub2,改为update-grub就可以进入了,虽然提示了一个什么信息,一闪没看清

代码: 全选

janker@souls:~$ uname -r
2.6.33.4
janker@souls:~$ 



Re: 编译内核-玩的就是寂寞

发表于 : 2010-05-15 12:10
黄美姬
自编的内核启动还慢一点,WHY?
一些日志

代码: 全选

May 15 10:48:53 souls kernel: Kernel logging (proc) stopped.
May 15 10:49:24 souls kernel: imklog: Cannot read proc file system, 1.
May 15 11:59:52 souls kernel: imklog: Cannot read proc file system, 1.
May 15 12:01:28 souls kernel: imklog: Cannot read proc file system, 1.

Re: 编译内核-玩的就是寂寞

发表于 : 2010-05-15 13:18
Sucrose
围观寂寞
:em01

Re: 编译内核-玩的就是寂寞

发表于 : 2010-05-15 13:39
linuin
黄美姬 寂寞?????????????????????????????????? :em06 :em06

Re: 编译内核-玩的就是寂寞

发表于 : 2010-05-15 14:16
peteryeh64
不會的路過... :em06

Re: 编译内核-玩的就是寂寞

发表于 : 2010-05-15 18:53
黄美姬
问题来了,ctrl+F1,,F6都进不了tty :em04 :em04 :em04 :em06 :em06 :em06

Re: 编译内核-玩的就是寂寞

发表于 : 2010-05-19 10:39
peteryeh64
:em04 ......美姬姐.....您這個算是編譯內核的成功範例嗎...... :em20 (can i follow you...?)

Re: 编译内核-玩的就是寂寞

发表于 : 2010-05-21 18:01
ppdayz
现在在玩LFS这个不错的,玩好了准备自己也把ubuntu 再搞一遍

Re: 编译内核-玩的就是寂寞

发表于 : 2010-05-21 19:16
playeryang
:em11

Re: 编译内核-玩的就是寂寞

发表于 : 2010-05-28 10:17
iamfbi
类似问题,我编了也没生成initrd.img,后来我把原版的initrd.img复制一份给他用
不知道是不是编少了什么

Re: 编译内核-玩的就是寂寞

发表于 : 2010-05-29 20:36
bobo4548
成功后继续共享,关注中

Re: 编译内核-玩的就是寂寞

发表于 : 2010-05-29 21:11
xjpvictor
都是高手啊。。

Re: 编译内核-玩的就是寂寞

发表于 : 2010-05-30 0:05
黄美姬
bobo4548 写了:成功后继续共享,关注中

看四楼,
viewtopic.php?f=139&t=275762