您的位置:首页 > 其它

解决编译内核系列问题

2011-12-03 21:34 519 查看
最近一段时间在玩Gentoo,编译内核,多次出现各种问题,现集锦如下:

一. 内核版本 3.1.1,使用新内核重启后无eth0 , ifconfig -a 也是没有eth0, 确定是因为网卡驱动未编译进内核所致。

1. 确定网卡类型():

在配置正确内核的系统中可以得到非常有用的信息,以下是本人的(lspci -v)输出

(Gentoo系统此命令需要 emerge sys-apps/pciutils )
# lspci -v
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 02)
        Subsystem: Giga-byte Technology GA-EP45-DS5 Motherboard
        Flags: bus master, fast devsel, latency 0, IRQ 41
        I/O ports at de00 [size=256]
        Memory at fdaff000 (64-bit, prefetchable) [size=4K]
        Memory at fdae0000 (64-bit, prefetchable) [size=64K]
        [virtual] Expansion ROM at fda00000 [disabled] [size=64K]
        Capabilities: [40] Power Management version 3
        Capabilities: [50] MSI: Enable+ Count=1/2 Maskable- 64bit+
        Capabilities: [70] Express Endpoint, MSI 01
        Capabilities: [b0] MSI-X: Enable- Count=2 Masked-
        Capabilities: [d0] Vital Product Data
        Capabilities: [100] Advanced Error Reporting
        Capabilities: [140] Virtual Channel
        Capabilities: [160] Device Serial Number 12-34-56-78-12-34-56-78
        Kernel driver in use: r8169
得到 r8169 这个重要参数后,可以去 make menuconfig 里找,不过最简单的方法却是:

在.config文件里查找 R8169,然后修改( 后来证实这是个 愚蠢的做法
)如下:
# filename: .config
# Search R8169 and edit

# CONFIG_E1000E is not set
# CONFIG_IGB is not set
# CONFIG_IGBVF is not set
# CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set
CONFIG_R8169=y
# CONFIG_SIS190 is not set
# CONFIG_SKGE is not set
# CONFIG_SKY2 is not set
# CONFIG_VIA_VELOCITY is not set


另外,VirtualBox 中是这样的:
界面名称:Realtek PCIe GBE Family Controller

控制芯片:Intel PRO/1000 MT Desktop (82540EM)

然后make menuconfig 选择:Device Drivers --> Network device support --> Ethernet (1000 Mbit) --> Intel (R) PRO/1000

2. 如果内核代码里找不到对应网卡型号,那就得自己下载驱动了(记得Dell有款电脑就必须得这样)

二. 系统启动是提示:Failed to set the system clock

解决办法:设置.config 内 CONFIG_RTC=y 即设置 Look at Device Drivers ---> Character devices ---> Enhanced Real Time Clock Support.

三. 重启后无法进入系统

提示:kernel panic - not syncing: VFS: Unable to mount root fs on unknow-block(0,0)

解决办法:暂无...(因素太多)

提示:kernel panic - not syncing: No init found. Try passing init= option to kernel.

解决办法: 一般是grub.conf 的问题,或/etc/fstab配置问题:以下是本人配置(可用,仅供参考)

# This is a sample grub.conf for use with Genkernel, per the Gentoo handbook
# http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=10#doc_chap2 # If you are not using Genkernel and you need help creating this file, you
# should consult the handbook. Alternatively, consult the grub.conf.sample that
# is included with the Grub documentation.

default 0
timeout 10
splashimage=(hd0,0)/boot/grub/splash.xpm.gz

title Gentoo Gnome
root (hd0,0)
kernel (hd0,0)/vmlinuz-3.0.6-gentoo #这里还是“绝对路径”靠谱

title Windows 7
root (hd0,2)
chainloader +1


/etc/fstab内容(记得有次把defaults 写成default, 结果(谁试试?)检查了一整天 ...)

# /etc/fstab: static file system information.
#
# <fs>			<mountpoint>	<type>		<opts>		<dump/pass>
# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/sda1		/boot		ext3		defaults,noatime	1 2
/dev/sda2		/		ext4		defaults,noatime	0 1
/dev/sda5		none		swap		sw			0 0
/dev/cdrom		/mnt/cdrom	auto		noauto,ro		0 0
/dev/fd0		/mnt/floppy	auto		noauto			0 0


四. Waiting ...

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐