The translation is temporarily closed for contributions due to maintenance, please come back later.


(itstool) path: listitem/para
Configuration options
Context English Chinese (Simplified) (zh_CN) State
The partition containing <filename>/cfg</filename> should be mounted only at boot time and while overriding the configuration files. 只有在系统启动过程中, 以及需要修改配置文件的场合, 才需要挂接包含 <filename>/cfg</filename> 的那个分区。
Keeping <filename>/cfg</filename> mounted at all times is not a good idea, especially if the <application>NanoBSD</application> system runs off a mass storage medium that may be adversely affected by a large number of writes to the partition (like when the filesystem syncer flushes data to the system disks). 在任何时候都保持挂接 <filename>/cfg</filename> 不是一个好主意, 特别是当您把 <application>NanoBSD</application> 放在不适合进行大量写操作的分区时 (由于文件系统的同步进程会定期向系统盘写一些数据)。
Building a NanoBSD Image 构建 NanoBSD 映像
A <application>NanoBSD</application> image is built using a simple <filename></filename> shell script, which can be found in the <filename><replaceable>/usr</replaceable>/src/tools/tools/nanobsd</filename> directory. This script creates an image, which can be copied on the storage medium using the <citerefentry><refentrytitle>dd</refentrytitle><manvolnum>1</manvolnum></citerefentry> utility. <application>NanoBSD</application> 映像是通过使用非常简单的 <filename></filename> shell 脚本来构建的, 这个脚本可以在 <filename><replaceable>/usr</replaceable>/src/tools/tools/nanobsd</filename> 目录中找到。 这个脚本建立的映像文件, 可以用 <citerefentry><refentrytitle>dd</refentrytitle><manvolnum>1</manvolnum></citerefentry> 工具复制到存储介质上。
The necessary commands to build a <application>NanoBSD</application> image are: 构建 <application>NanoBSD</application> 映像所需的命令是:
<prompt>#</prompt> <userinput>cd /usr/src/tools/tools/nanobsd</userinput> <co xml:id="nbsd-cd"/>
<prompt>#</prompt> <userinput>sh</userinput> <co xml:id="nbsd-sh"/>
<prompt>#</prompt> <userinput>cd /usr/obj/nanobsd.full</userinput> <co xml:id="nbsd-cd2"/>
<prompt>#</prompt> <userinput>dd if=_.disk.full of=/dev/da0 bs=64k</userinput> <co xml:id="nbsd-dd"/>
<prompt>#</prompt> <userinput>cd /usr/src/tools/tools/nanobsd</userinput> <co xml:id="nbsd-cd"/>
<prompt>#</prompt> <userinput>sh</userinput> <co xml:id="nbsd-sh"/>
<prompt>#</prompt> <userinput>cd /usr/obj/nanobsd.full</userinput> <co xml:id="nbsd-cd2"/>
<prompt>#</prompt> <userinput>dd if=_.disk.full of=/dev/da0 bs=64k</userinput> <co xml:id="nbsd-dd"/>
Change the current directory to the base directory of the <application>NanoBSD</application> build script. 进入 <application>NanoBSD</application> 构建脚本的主目录。
Start the build process. 开始构建过程。
Change the current directory to the place where the built images are located. 进入构建好的映像文件所在的目录。
Install <application>NanoBSD</application> onto the storage medium. 在存储介质上安装 <application>NanoBSD</application>。
Customizing a NanoBSD Image 定制 NanoBSD 映像
This is probably the most important and most interesting feature of <application>NanoBSD</application>. This is also where you will be spending most of the time when developing with <application>NanoBSD</application>. 这可能是 <application>NanoBSD</application> 最为重要, 同时也是您最感兴趣的功能。 同时, 您在开发 <application>NanoBSD</application> 应用时, 这也是相当耗时的过程。
Invocation of the following command will force the <filename></filename> to read its configuration from <filename>myconf.nano</filename> located in the current directory: 执行下面的命令将使 <filename></filename> 从当前目录中的 <filename>myconf.nano</filename> 文件读取配置:
<prompt>#</prompt> <userinput>sh -c myconf.nano</userinput> <prompt>#</prompt> <userinput>sh -c myconf.nano</userinput>
Customization is done in two ways: 定制过程包含两步:
Configuration options 配置选项
Custom functions 定制函数
Configuration Options 配置选项
buildworld buildworld
installworld installworld
With configuration settings, it is possible to configure options passed to both the <_:buildtarget-1/> and <_:buildtarget-2/> stages of the <application>NanoBSD</application> build process, as well as internal options passed to the main build process of <application>NanoBSD</application>. Through these options it is possible to cut the system down, so it will fit on as little as 64MB. You can use the configuration options to trim down FreeBSD even more, until it will consists of just the kernel and two or three files in the userland. 通过对配置进行设置, 可以配置用以传递给 <application>NanoBSD</application> 构建过程中 <_:buildtarget-1/> 和 <_:buildtarget-2/> 阶段的联编和安装选项, 以及 <application>NanoBSD</application> 的主构建过程中的选项。 通过使用这些选项可以削减系统的尺寸, 使之能够放入 64MB 的存储。 您还可以进一步通过这些选项来削减 FreeBSD, 直到它只包含内核以及两三个用户环境文件为止。
The configuration file consists of configuration options, which override the default values. The most important directives are: 配置文件中包含用以代替默认值的配置选项。 最重要的语句包括:
<literal>NANO_NAME</literal> — Name of build (used to construct the workdir names). <literal>NANO_NAME</literal> ── 本次构建的名称 (用于创建工作目录的名字)。
<literal>NANO_SRC</literal> — Path to the source tree used to build the image. <literal>NANO_SRC</literal> ── 用以联编和构建映像的源码树的位置。
<literal>NANO_KERNEL</literal> — Name of kernel configuration file used to build kernel. <literal>NANO_KERNEL</literal> ── 用以联编内核的配置文件的名字。
<literal>CONF_BUILD</literal> — Options passed to the <_:buildtarget-1/> stage of the build. <literal>CONF_BUILD</literal> ── 用于传递给 <_:buildtarget-1/> 构建阶段的选项。
<literal>CONF_INSTALL</literal> — Options passed to the <_:buildtarget-1/> stage of the build. <literal>CONF_INSTALL</literal> ── 用于传递给 <_:buildtarget-1/> 构建阶段的选项。
<literal>CONF_WORLD</literal> — Options passed to both the <_:buildtarget-1/> and the <_:buildtarget-2/> stage of the build. <literal>CONF_WORLD</literal> ── 用以传递给 <_:buildtarget-1/> 和 <_:buildtarget-2/> 这两个构建阶段的选项。
<literal>FlashDevice</literal> — Defines what type of media to use. Check <filename>FlashDevice.sub</filename> for more details. <literal>FlashDevice</literal> ── 定义所用的介质类型。 要了解进一步的细节, 请参考 <filename>FlashDevice.sub</filename> 文件。
Custom Functions 功能定制
It is possible to fine-tune <application>NanoBSD</application> using shell functions in the configuration file. The following example illustrates the basic model of custom functions: 通过在配置文件中使用 shell 函数可以进一步微调 <application>NanoBSD</application>。 下面的例子展示了定制函数的基本模式:


No matching activity found.

Browse all component changes


English Chinese (Simplified) (zh_CN)
No related strings found in the glossary.

Source information

Source string comment
(itstool) path: listitem/para
Source string location
String age
a year ago
Source string age
a year ago
Translation file
articles/zh_CN/nanobsd.po, string 42