Source string Read only

(itstool) path: listitem/para

128/1280
Context English State
<prompt>#</prompt> <userinput>sh nanobsd.sh -c myconf.nano</userinput>
Customization is done in two ways:
Configuration options
Custom functions
Configuration Options
buildworld
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.
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_SRC</literal> — Path to the source tree used to build the image.
<literal>NANO_KERNEL</literal> — Name of kernel configuration file used to build kernel.
<literal>CONF_BUILD</literal> — Options passed to the <_:buildtarget-1/> stage of the build.
<literal>CONF_INSTALL</literal> — Options passed to the <_:buildtarget-1/> stage of the build.
<literal>CONF_WORLD</literal> — Options passed to both the <_:buildtarget-1/> and the <_:buildtarget-2/> stage of the build.
<literal>FlashDevice</literal> — Defines what type of media to use. Check <filename>FlashDevice.sub</filename> for more details.
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:
cust_foo () (
echo "bar=baz" &gt; \
${NANO_WORLDDIR}/etc/foo
)
customize_cmd cust_foo
A more useful example of a customization function is the following, which changes the default size of the <filename>/etc</filename> directory from 5MB to 30MB:
cust_etc_size () (
cd ${NANO_WORLDDIR}/conf
echo 30000 &gt; default/etc/md_size
)
customize_cmd cust_etc_size
There are a few default pre-defined customization functions ready for use:
<literal>cust_comconsole</literal> — Disables <citerefentry><refentrytitle>getty</refentrytitle><manvolnum>8</manvolnum></citerefentry> on the VGA devices (the <filename>/dev/ttyv*</filename> device nodes) and enables the use of the COM1 serial port as the system console.
<literal>cust_allow_ssh_root</literal> — Allow <systemitem class="username">root</systemitem> to login via <citerefentry><refentrytitle>sshd</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
<literal>cust_install_files</literal> — Installs files from the <filename>nanobsd/Files</filename> directory, which contains some useful scripts for system administration.
Adding Packages
Packages can be added to a <application>NanoBSD</application> image using a custom function. The following function will install all the packages located in <filename>/usr/src/tools/tools/nanobsd/packages</filename>:
install_packages () (
mkdir -p ${NANO_WORLDDIR}/packages
cp /usr/src/tools/tools/nanobsd/packages/* ${NANO_WORLDDIR}/packages
cp $(which pkg-static) ${NANO_WORLDDIR}/
chroot ${NANO_WORLDDIR} sh -c 'cd packages; /pkg-static add *;cd ..;'
rm -rf ${NANO_WORLDDIR}/packages ${NANO_WORLDDIR}/pkg-static
)
customize_cmd install_packages
Configuration File Example
A complete example of a configuration file for building a custom <application>NanoBSD</application> image can be:
NANO_NAME=custom
NANO_SRC=/usr/src
NANO_KERNEL=MYKERNEL
NANO_IMAGES=2

CONF_BUILD='
WITHOUT_KLDLOAD=YES
WITHOUT_NETGRAPH=YES
WITHOUT_PAM=YES
'

CONF_INSTALL='
WITHOUT_ACPI=YES
WITHOUT_BLUETOOTH=YES
WITHOUT_FORTRAN=YES
WITHOUT_HTML=YES
WITHOUT_LPR=YES
WITHOUT_MAN=YES
WITHOUT_SENDMAIL=YES
WITHOUT_SHAREDOCS=YES
WITHOUT_EXAMPLES=YES
WITHOUT_INSTALLLIB=YES
WITHOUT_CALENDAR=YES
WITHOUT_MISC=YES
WITHOUT_SHARE=YES
'

CONF_WORLD='
WITHOUT_BIND=YES
WITHOUT_MODULES=YES
WITHOUT_KERBEROS=YES
WITHOUT_GAMES=YES
WITHOUT_RESCUE=YES
WITHOUT_LOCALES=YES
WITHOUT_SYSCONS=YES
WITHOUT_INFO=YES
'

FlashDevice SanDisk 1G

cust_nobeastie() (
touch ${NANO_WORLDDIR}/boot/loader.conf
echo "beastie_disable=\"YES\"" &gt;&gt; ${NANO_WORLDDIR}/boot/loader.conf
)

customize_cmd cust_comconsole
customize_cmd cust_install_files
customize_cmd cust_allow_ssh_root
customize_cmd cust_nobeastie

Loading…

No matching activity found.

Browse all component changes

Glossary

English English
No related strings found in the glossary.

Source information

Source string comment

(itstool) path: listitem/para

Flags
read-only
Source string location
article.translate.xml:280
String age
a year ago
Source string age
a year ago
Translation file
articles/nanobsd.pot, string 55