                                 NanoBSD ******

  Daniel Gerzo

   ******: 163ba6b752

   ****** (c) 2006 The FreeBSD Documentation Project

   FreeBSD *** FreeBSD************************

   ***************************************************************************************************._
   ************************************** FreeBSD Project
   ***************************************** '(TM)' *** '(R)'
   ***************._

   2014-05-29 16:48:07 +0000 *** Li-Wen Hsu.
   ******

   *************************** NanoBSD ***********************
   ************************************************************ FreeBSD
   ***************** *************** Compact Flash ***(************)._

   [ ************ / ************ ]

     ----------------------------------------------------------------------

   ************

   1. NanoBSD ******

   2. ************ NanoBSD

   ******

1. NanoBSD ******

   NanoBSD *** Poul-Henning Kamp *********************************._
   ****************************************************** FreeBSD
   ***************** *************** Compact Flash ***(**************mass
   storage medium)._

   ************************************************** ******************
   "***************(computer appliances)" ***************,_************._
   ****************************************************************
   ***********************************************************._
   ********************************************************(*********)************._

   NanoBSD ***********************

     * ********* FreeBSD ************ Ports *** Packages --
       ********************************* NanoBSD *****************
       ************ FreeBSD ************._

     * ****************** -- *** FreeBSD ********************************
       NanoBSD *********** ****************** NanoBSD **************
       ************************._

     * *************************************** --
       *********************************._
       ***************************************** fsck(8) ***._

     * ***************,_************ -- ****************** shell script
       ********************
       *********************************************************._

2. ************ NanoBSD

  2.1. NanoBSD *********

   ***************************************************************** NanoBSD
   ***._ *************************************************

     * ************************** code#1 *** code#2._

     * **********************************************
       ******************(mount)*** /cfg *********._

   ***********************************************************._

   /etc *** /var ************ md(4)(malloc)******._

   ****************************** /cfg ******._ ****************** /etc
   ***********************************************************._
   ********************************************** ****************** /etc
   *************************** /cfg ************._

   ****** 1. ************ /etc/resolv.conf ******************

 # vi /etc/resolv.conf
 [...]
 # mount /cfg
 # cp /etc/resolv.conf /cfg
 # umount /cfg

  ******:

   *******************************************************************************************
   /cfg ******************._

   *************** /cfg ***************************************** NanoBSD
   ******************************************************
   (**************************************************************************)._

  2.2. ****** NanoBSD *********

   NanoBSD *************************************** nanobsd.sh shell script
   ******************** script ********* /usr/src/tools/tools/nanobsd
   ***************._ ****** script ***************************** dd(1)
   ******************************._

   ****** NanoBSD *****************************

 # cd /usr/src/tools/tools/nanobsd 1
 # sh nanobsd.sh 2
 # cd /usr/obj/nanobsd.full 3
 # dd if=_.disk.full of=/dev/da0 bs=64k 4

   1   ****** NanoBSD ****** script ************._   
   2   ******************._                          
   3   ******************************************._  
   4   ********************* NanoBSD._               

  2.3. ************ NanoBSD *********

   ************ NanoBSD ************** ************************************._
   ***************** NanoBSD
   ***********************************************._

   *************************** nanobsd.sh ***************************
   myconf.nano **************

 # sh nanobsd.sh -c myconf.nano

   *******************************************

     * ************

     * ************

    2.3.1. ************

   ************************************** NanoBSD *************** buildworld
   *** installworld ***************,_******************** NanoBSD
   ******************************._
   *********************************************************************** 64
   MB ************._ ************************************************
   FreeBSD** ****************** kernel *************** userland
   ************._

   *********************************************************._**************************************

     * NANO_NAME -- *********************(******************************)._

     * NANO_SRC -- ************,_****************** source tree *********._

     * NANO_KERNEL -- ********************* kernel ***************._

     * CONF_BUILD -- ****** buildworld *********************._

     * CONF_INSTALL -- ****** installworld *********************._

     * CONF_WORLD -- ****** buildworld *** installworld
       ******************************._

     * FlashDevice -- ************************************._ ***************
       FlashDevice.sub ***._

    2.3.2. ************

   ****************************** shell *****************************
   NanoBSD._ *****************************************************

 cust_foo()(
         echo "bar=topless" > \
                 ${NANO_WORLDDIR}/etc/foo
 )
 customize_cmd cust_foo

   ************************************************** /etc *****************
   5MB ********* 30MB**

 cust_etc_size()(
         cd ${NANO_WORLDDIR}/conf
         echo 30000 > default/etc/md_size
 )
 customize_cmd cust_etc_size

   *******************************************************************

     * cust_comconsole -- ********* VGA ****************** getty(8)
       (/dev/ttyv*)********* serial port *** COM1 *************** console._

     * cust_allow_ssh_root -- ****** sshd(8) ********* root ************._

     * cust_install_files -- *** nanobsd/Files
       *********************************************************** script ._

    2.3.3. ******************

   ****************************** NanoBSD **************************

 NANO_NAME=custom
 NANO_SRC=/usr/src
 NANO_KERNEL=MYKERNEL
 NANO_IMAGES=2

 CONF_BUILD='
 NO_KLDLOAD=YES
 NO_NETGRAPH=YES
 NO_PAM=YES
 '

 CONF_INSTALL='
 NO_ACPI=YES
 NO_BLUETOOTH=YES
 NO_CVS=YES
 NO_FORTRAN=YES
 NO_HTML=YES
 NO_LPR=YES
 NO_MAN=YES
 NO_SENDMAIL=YES
 NO_SHAREDOCS=YES
 NO_EXAMPLES=YES
 NO_INSTALLLIB=YES
 NO_CALENDAR=YES
 NO_MISC=YES
 NO_SHARE=YES
 '

 CONF_WORLD='
 NO_BIND=YES
 NO_MODULES=YES
 NO_KERBEROS=YES
 NO_GAMES=YES
 NO_RESCUE=YES
 NO_LOCALES=YES
 NO_SYSCONS=YES
 NO_INFO=YES
 '

 FlashDevice SanDisk 1G

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

 customize_cmd cust_comconsole
 customize_cmd cust_install_files
 customize_cmd cust_allow_ssh_root
 customize_cmd cust_nobeastie

  2.4. ****** NanoBSD

   ****** NanoBSD ****** FreeBSD ********************

    1. *************************** NanoBSD *********._

    2. ************************************ NanoBSD
       ***************************._

       ********************* NanoBSD *****************
       ************************************************** _.disk.full
       ***(*********************************)** ************ _.disk.image
       *********(***********************************************)._

    3. ********************************************************._

    4. **************************************************._

    5. *****************************************************************
       (*********************,_
       ******************)*****************************._
       ********************************************************************************._

   ********************* NanoBSD
   ************************************************** /root *********
   updatep1 *** updatep2 script ** ************************
   script*****************************************************************._

   *************** NanoBSD *****************************
   ****************************************************************************************

    2.4.1. ****** ftp(1)

   ****************************************************************

 # ftp myhost
 get _.disk.image "| sh updatep1"

    2.4.2. ****** ssh(1)

   *************************************************

 # ssh myhost cat _.disk.image.gz | zcat | sh updatep1

    2.4.3. ****** nc(1)

   ****************************** ftp(1) ******************** sshd(8)
   **************

    1. ******************************************** TCP
       listen***************************** client**

 myhost# nc -l 2222 < _.disk.image

  ******:

       ************************ port ****************************** NanoBSD
       client ***************._

    2. ************************************************** updatep1 ******
       script**

 # nc myhost 2222 | sh updatep1

******

  N

   NanoBSD, NanoBSD ******
