

  NanoBSD


Daniel Gerzo


 

Copyright  2006, 2009     FreeBSD
$FreeBSD: doc/el_GR.ISO8859-7/articles/nanobsd/article.sgml,v 1.2 2009/10/08
21:02:56 keramida Exp $
 FreeBSD       FreeBSD Foundation.
          
           
 .           
      FreeBSD     
 ,      : [TM]  .
         NanoBSD,  
        
FreeBSD  embedded ,      Compact Flash (
  ).
-------------------------------------------------------------------------------

1.   NanoBSD

 NanoBSD          Poul-Henning
Kamp <phk@FreeBSD.org>.       FreeBSD
 embedded ,    Compact Flash (  
).
       , 
       computer appliance. 
           
.         
.          
 () .
    NanoBSD :

*  ports       FreeBSD --  
         FreeBSD  
       NanoBSD       .
*     --         FreeBSD,
             NanoBSD,   
           NanoBSD.
*  NanoBSD         . 
             .  
      fsck(8)      
   .
*          NanoBSD.  
             
        .

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

2.   NanoBSD


2.1.    NanoBSD

     NanoBSD    ,  
      FreeBSD.  
       :

*   : code#1  code#2.
*   ,       /cfg 
     NanoBSD.

         .
  /etc  /var    md(4) (malloc).
        /cfg. 
      /etc.    
         
      /etc.     
            
,       /etc  
,        /cfg.
Example 1.     /etc/resolv.conf

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


     Note:       /cfg  
              
        /cfg.
               /cfg.
              
       NanoBSD      (
     ..   CF),     
               
      (syncer).

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

2.2.     NanoBSD

   NanoBSD      , 
nanobsd.sh,        /usr/src/tools/nanobsd.
      ,     
        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.

  _(2)_
          .

  _(3)_
                 
      NanoBSD.

  _(4)_
        NanoBSD    .

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

2.3.     NanoBSD

          
NanoBSD.           NanoBSD
           
.
      nanobsd.sh       
 myconf.nano     :

  # sh nanobsd.sh -c myconf.nano

     NanoBSD     :

*  
*  

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

2.3.1.  

   NanoBSD      
      FreeBSD.  
    buildworld  installworld  NanoBSD, 
       .   
  NanoBSD         
      FreeBSD     64MB.
       NanoBSD  
         -  
 .
    NanoBSD       
        . 
     :

* NANO_NAME --     NanoBSD   
  (        ).
* NANO_SRC --          
      .
* NANO_KERNEL --         
         .
* CONF_BUILD --      buildworld  
   FreeBSD.
* CONF_INSTALL --      installworld 
    .
* CONF_WORLD --          
  ,   buildworld   installworld.
* FlashDevice --         .
        FlashDevise.sub.

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

2.3.2.  

    NanoBSD       
          .
   ,     . 
,          
   :

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

     ,     
  ,    .   cust_etc_size
       /etc  5MB  30MB:

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

      NanoBSD    
      :

* cust_comconsole --   getty(8)   VGA (  /
  dev/ttyv*)        COM1  
  .
* cust_allow_ssh_root --      root   sshd(8).
* cust_install_files --      nanobsd/Files. 
            
    NanoBSD.

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

2.3.3.  

   NanoBSD      ,  
       Ports.   
          . 
,           
   /usr/src/tools/tools/nanobsd/packages:

  install_packages () (
  mkdir -p ${NANO_WORLDDIR}/packages
  cp /usr/src/tools/tools/nanobsd/packages/* ${NANO_WORLDDIR}/packages
  chroot ${NANO_WORLDDIR} sh -c 'cd packages; pkg_add -v *;cd ..;'
  rm -rf ${NANO_WORLDDIR}/packages
  )

  customize_cmd install_packages

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

2.3.4.     NanoBSD

       NanoBSD,   
    FreeBSD      ,
    :

  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   :

  1.     NanoBSD,    .
  2.          
       NanoBSD.
                
     NanoBSD       _.disk.full (   
        ),    _.disk.image (
             ).
  3.         
     .
  4.    ,   .
  5.    ,      
      (     ,   ). 
             .
           ,   
     .

         NanoBSD,   
  ,       updatep1 
 updatep2.         /root.
          
NanoBSD,           
:
-------------------------------------------------------------------------------

2.4.1.   ftp(1)

      ,   FTP  
  :

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

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

2.4.2.   ssh(1)

              
      ssh(1),     SSH:

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

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

2.4.3.   nc(1)

           NanoBSD  
 ftpd(8)  sshd(8),       
,   nc(1):

  1.     TCP        
     ,             
     :

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


          Note:         
                  
           NanoBSD     ,  
          ,  ,    
          (firewall).

  2.    NanoBSD  ,      
        ,      updatep1  
        nc(1):

       # nc myhost 2222 | sh updatep1


-------------------------------------------------------------------------------
  ,   ,     ftp://ftp.FreeBSD.org/
                               pub/FreeBSD/doc/.
          FreeBSD,     
                   <questions@FreeBSD.org>.
             ,  e-mail 
                              <doc@FreeBSD.org>.
