Translation

(itstool) path: sect2/para

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>.
120/2170
Context English Chinese (Simplified) (zh_CN) State
The <filename>/etc</filename> and <filename>/var</filename> directories are <citerefentry><refentrytitle>md</refentrytitle><manvolnum>4</manvolnum></citerefentry> (malloc) disks. <filename>/etc</filename> 和 <filename>/var</filename> 目录均为 <citerefentry><refentrytitle>md</refentrytitle><manvolnum>4</manvolnum></citerefentry> (malloc) 盘。
The configuration file partition persists under the <filename>/cfg</filename> directory. It contains files for <filename>/etc</filename> directory and is briefly mounted read-only right after the system boot, therefore it is required to copy modified files from <filename>/etc</filename> back to the <filename>/cfg</filename> directory if changes are expected to persist after the system restarts. 配置文件分区保存在 <filename>/cfg</filename> 目录。 它包含了用于 <filename>/etc</filename> 目录的文件, 在启动之后暂时以只读方式挂接。 因此, 在需要从 <filename>/etc</filename> 向 <filename>/cfg</filename> 目录复制所进行的、 希望在重启时保持不变的配置时, 需要进行一些额外的操作。
Making Persistent Changes to <filename>/etc/resolv.conf</filename> 在 <filename>/etc/resolv.conf</filename> 中进行需要保持的修改
<prompt>#</prompt> <userinput>vi /etc/resolv.conf</userinput>
[...]
<prompt>#</prompt> <userinput>mount /cfg</userinput>
<prompt>#</prompt> <userinput>cp /etc/resolv.conf /cfg</userinput>
<prompt>#</prompt> <userinput>umount /cfg</userinput>
<prompt>#</prompt> <userinput>vi /etc/resolv.conf</userinput>
[...]
<prompt>#</prompt> <userinput>mount /cfg</userinput>
<prompt>#</prompt> <userinput>cp /etc/resolv.conf /cfg</userinput>
<prompt>#</prompt> <userinput>umount /cfg</userinput>
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>nanobsd.sh</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>nanobsd.sh</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 nanobsd.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 nanobsd.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>nanobsd.sh</filename> to read its configuration from <filename>myconf.nano</filename> located in the current directory: 执行下面的命令将使 <filename>nanobsd.sh</filename> 从当前目录中的 <filename>myconf.nano</filename> 文件读取配置:
<prompt>#</prompt> <userinput>sh nanobsd.sh -c myconf.nano</userinput> <prompt>#</prompt> <userinput>sh nanobsd.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/> 构建阶段的选项。

Loading…

No matching activity found.

Browse all component changes

Glossary

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

Source information

Source string comment

(itstool) path: sect2/para

Source string location
article.translate.xml:201
String age
a year ago
Source string age
a year ago
Translation file
articles/zh_CN/nanobsd.po, string 38