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

Translation

(itstool) path: sect2/para
English
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.
Context English Chinese (Simplified) (zh_CN) State
Everything is read-only at run-time — It is safe to pull the power-plug. There is no necessity to run <citerefentry><refentrytitle>fsck</refentrytitle><manvolnum>8</manvolnum></citerefentry> after a non-graceful shutdown of the system. 所有对象在运行时均是只读的 ── 可以安全地拔掉电源插销。 在系统非正常关闭之后, 无需运行 <citerefentry><refentrytitle>fsck</refentrytitle><manvolnum>8</manvolnum></citerefentry>。
Easy to build and customize — Making use of just one shell script and one configuration file it is possible to build reduced and customized images satisfying any arbitrary set of requirements. 便于联编和定制 ── 只需使用一个 shell 脚本和一个配置文件, 您可以很容易地裁减和定制适于任意需求的映像。
NanoBSD Howto 如何使用 NanoBSD
The Design of NanoBSD NanoBSD 的设计
Once the image is present on the medium, it is possible to boot <application>NanoBSD</application>. The mass storage medium is divided into three parts by default: 一旦将映像存入介质, 就可以用它来引导 <application>NanoBSD</application> 了。 默认情况下, 大容量存储器会划分为三个区:
Two image partitions: <literal>code#1</literal> and <literal>code#2</literal>. 两个映像区: <literal>code#1</literal> 和 <literal>code#2</literal>。
The configuration file partition, which can be mounted under the <filename>/cfg</filename> directory at run time. 一个配置文件区, 运行环境中, 可以将其挂接到 <filename>/cfg</filename> 目录下。
These partitions are normally mounted read-only. 这些分区默认情况下以只读方式挂接。
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

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:160
String age
a year ago
Source string age
a year ago
Translation file
articles/zh_CN/nanobsd.po, string 30