Linux 版 (精华区)

发信人: tcpip (俺的昵称改了), 信区: Linux
标  题: [转载]配置FreeBSD内核(转寄)
发信站: 哈工大紫丁香 (Mon Aug 23 15:10:24 1999), 转信

发信人: kxn (康师傅), 信区: FreeBSD       

标  题: [转载]配置 FreeBSD 内核

发信站: BBS 水木清华站 (Sat Mar 20 20:29:50 1999)

寄信人: calvin.bbs@bbs.netease.com

标  题: [转寄] 配制FREEBSD内核

注  意: 站外信件

日  期: Sat Mar 13 22:49:37 1999

发信人: highwaywj (pp), 信区: FreeBSD

标  题: 配制FREEBSD内核

发信站: 网易虚拟社区 (Sat Mar 13 22:37:07 1999), 转信

作为一个FREEBSD初手,有感FREEBSD资料太少,试着把FREEBSD HANDBOOT

中间翻了一点.希望有更多人加入FREEBSD.

                                      配制FREEBSD内核

                                                        翻译:  汪 骏

                                                        highwaywj@163.net

1.为什么定制内核

(略)

2.制作和安装自己的内核

首先,简单介绍下有关内核构造时的相关目录.所有MAKE内核所涉及的目录将和/u

sr/src/sys

有关,同时也可通过它的关联/sys存取.此目录下面有很多子目录,分别代表内核的

不同部                                                                    

分.其中对我们最重要是i386/conf.在此你可以编辑配制自己内核的,并编译它.这

儿就是你

内核构造生成区域.注意,这个目录树的逻辑结构包含所支持的设备文件系统和自

己子目录

的可选项.i386目录下包含的是有关PC的硬件信息.其它有关FREEBSD各平台的通用

信息在

i386目录外

(开始一个内核构造目录的快速教程)

注意如果你的系统中没有/usr/src/sys,说明你没有安装内核的源代码.最简单的

方法以root

用户运行/stand/sysinstall,选Configure,然后Distributions-> src-> then s

ys.

下一步,进入i386/conf目录下,copy GENERIC (你自己打算定制的内该名)某文件

名.

 如:

    # cd /usr/src/sys/i386/conf

    # cp GENERIC MYKERNEL

习惯上,文件名用大写字母,如果你在维护不同硬件的多种FREEBSD机器,后缀你的

机器

主机名是个好主意.

注意:你必须以root用户执行下面的命令,否则你得到``permission denied''        

 的出错提示.

现在,用你自己喜欢的编辑器编辑MYKERNEL.如果你用vi,它太复杂,这儿就不介绍



请自行参改有关资料.你可以方便的通过改变文件中有关注释行来反映你所要求内



配制情况,或改变与通用的GENERIC不同之处.

如果你在SUN OS或其它BSD操作系统中编译过内核,这个文件中很多部分你都是熟



的.但是如果你是从其它系统如DOS中转过来的,你可能对GENERIC配制文件无从下

手.

你可仔细阅读配制文件部分说明.

注意,如果你试图从FREEBSD老版本升级内核,你需要从新内核源代码处得到一个

config(8),版本,它位于

因此你必须同时下载这些代码.并且在运行下面命令前重新make和安装

当你完成这些后,下面开始编译安装你的内核.

    # /usr/sbin/config MYKERNEL

    # cd ../../compile/MYKERNEL

    # make depend

    # make                             

    # make install

新的内核将被copy到根目录下.作为/kernel老的内核被移至/kernel.old.现在关



用你的新内核重新启动.这时可能会有出错,在此文后附录有出错信息介绍,请

仔细阅读新内核不能启动部分.

注意,如果你加了新设备(如声卡),你在用它们前必须加设备点device node

到你的/dev下.

( Configuration File说明部分和有关新内核出错附录随后,我就不翻了)

译者水平有限,有不当处请指教.要原文与译者联系

highwaywj@163.net

The Configuration File

The general format of a configuration file is quite simple. Each line

contains a keyword and one or more

arguments. For simplicity, most lines only contain one argument. Anyth

ing following a # is considered a

comment and ignored. The following sections describe each keyword, gen

erally in the order they are listed in

GENERIC, although some related keywords have been grouped together in     

a single section (such as

Networking) even though they are actually scattered throughout the GEN

ERIC file. An exhaustive list of options

and more detailed explanations of the device lines is present in the L

INT configuration file, located in the same

directory as GENERIC. If you are in doubt as to the purpose or necessi

ty of a line, check first in LINT.

The kernel is currently being moved to a better organization of the op

tion handling. Traditionally, each option in

the config file was simply converted into a -D switch for the CFLAGS l

ine of the kernel Makefile. Naturally, this

caused a creeping optionism, with nobody really knowing which option h

as been referenced in what files.

In the new scheme, every #ifdef that is intended to be dependent upon

an option gets this option out of an

opt_foo.h declaration file created in the compile directory by config.

 The list of valid options for config

lives in two files: options that do not depend on the architecture are

 listed in /sys/conf/options,

architecture-dependent ones in /sys/arch/conf/options.arch, with arch 

being for example i386

Kernel will not boot

    If your new kernel does not boot, or fails to recognize your devic

es, do not panic! Fortunately, BSD has an

    excellent mechanism for recovering from incompatible kernels. Simp

ly type the name of the kernel you

    want to boot from (i.e. ``kernel.old'') at the FreeBSD boot prompt

 instead of pressing return. When

    reconfiguring a kernel, it is always a good idea to keep a kernel

that is known to work on hand.

    After booting with a good kernel you can check over your configura

tion file and try to build it again. One

    helpful resource is the /var/log/messages file which records, amon

g other things, all of the kernel

    messages from every successful boot. Also, the dmesg(8) command wi

ll print the kernel messages

    from the current boot.

                                                             

--

※ 来源:.网易虚拟社区 http://club.netease.com.[FROM: 202.102.201.218]

--

※ 转寄:.网易 BBS bbs.netease.com.[FROM: 202.103.137.152]        

--

※ 来源:·BBS 水木清华站 bbs.net.tsinghua.edu.cn·[FROM: 166.111.16

3.178]

--
☆ 来源:.哈工大紫丁香 bbs.hit.edu.cn.[FROM: bin@mtlab.hit.edu.cn]
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:9.651毫秒