User Tools

Site Tools


How to compile XigmaNAS from Scratch

Quickstart Guide for Developers and interested Users


After reading this Guide you will know how to Setup a FreeBSD System for compiling XigmaNAS from Scratch. This Document will use the current XigmaNAS Version based on FreeBSD 11.2. If you want to know more about FreeBSD 11.2 i refer to the FreeBSD 11.2-RELEASE Announcement

You need!
  • a dedicated PC or a Virtual Machine (good example: VMware Workstation)
  • a connection to the Internet
  • 10GB Harddiskspace
  • FreeBSD RELEASE amd64 dvd1.iso:


It isn't necessary to use a dedicated box to compile XigmaNAS. In this Guide we will setup our XigmaNAS build environment inside a VirtualBox. This virtualisation software can be downloaded for free. (get VirtualBox). Virtualbox is available for Windows, Mac, Linux ,OpenSolaris and also for FreeBSD.

Also you can use VMware Workstation or Qemu.

Note on i386 and amd64
For compiling you need to setup a FreeBSD system according to the target architecture. This means if you like to build XigmaNAS 64-bits you need to setup a FreeBSD amd64 system.

Please read the documentation of your Virtualisation Software for how to setup. Following a short explanation for VirtualBox.


Installing VirtualBox

  1. Follow the Installation instruction acording to your Operatingsystem. Manual

Create a Virtual Machine for FreeBSD

  1. Create “New” Virtual Machine
  2. Selecte the Name you want to use ( FreeBSD 11.2 - XigmaNAS from Scratch)
  3. Operating System: BSD - Version: FreeBSD
  4. Select Memory you want to assign to your VirtualBox ( 1024 MB is suggested)
  5. Create New Harddrive with 35 GB of Diskspace

Installing FreeBSD 11.0

Now its time to download FreeBSD 11.0 if you have not already done that. There is no better Setup Guide for FreeBSD then the original one from the FreeBSD Handbook.

see: FreeBSD Handbook - Chapter 2 Installing FreeBSD

Preparing FreeBSD

After successful installation there are some steps needed to prepare the system.
In this example we install prebuild binaries Let'z Go!!

Connecting via SSH

The easiest way to work with the VirtualBox is connecting via SSH.
On Linux and Mac boxes your can use the Terminal to connect via SSH. On Windows you can use a SSH-Client like

Putty which can be downloaded here: PuTTY Download Page

If you don't know the IP of your FreeBSD system type

xigmanas-dev# ifconfig
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 00:e0:4c:d2:7e:ba
        inet netmask 0xffffff00 broadcast
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active

Now you can connect via ssh. Use the username you created during setup and the IP of your FreeBSD/Virtual Machine. To become the superuser root type

xigmanas-dev# su
Why I cannot su to root?

Be sure that your user is member of the group “wheel”. This group is able to become superuser. If not, following command will add your user to group wheel:

xigmanas-dev# pw usermod YOUR_USERNAME -G wheel

If you don't have a user run

xigmanas-dev# adduser

Be sure to assign the user to group “wheel”.

Updating FreeBSD

The first step is to update our FreeBSD system.
The command

xigmanas-dev# uname -a

shows you the current FreeBSD version. For example on my Virtual Maschine

FreeBSD 9.1-RELEASE FreeBSD 9.1-RELEASE #0: Sun Mar 21 08:46:54 UTC 2012  i386

Start updating your FreeBSD with

xigmanas-dev# freebsd-update fetch install

This will fetch and install all updates.
After a reboot with

xigmanas-dev# reboot

The command

xigmanas-dev# uname -a

Should show you that you updated FreeBSD. see the -p1 in my example. This means we updated to “patchlevel 1”.

xigmanas-dev# uname -a
FreeBSD 9.1-RELEASE FreeBSD 9.1-RELEASE #0: Sun Mar 21 08:46:54 UTC 2012  i386

Installing necessary applications

Following the commands you should execute to install the applications we need before compiling XigmaNAS from scratch can start.

xigmanas-dev# cd /usr/ports/shells/bash
xigmanas-dev# make install clean

xigmanas-dev# cd /usr/ports/ports-mgmt/portupgrade
xigmanas-dev# make install clean

xigmanas-dev# cd /usr/ports/sysutils/cdrtools
xigmanas-dev# make install clean

xigmanas-dev# cd /usr/ports/devel/subversion
xigmanas-dev# make install clean
Depending on your shell execute “rehash” to publish new commands

Fetching the ports-tree

Now we fetch the ports-tree.
The ports-tree conatains all information we need to compile an application from source.

xigmanas-dev# portsnap fetch extract

This takes a few minutes. After fetching and extracting you find everything under /usr/ports. For more information about the ports-tree see Using the Ports Collection

If you later want to update the ports-tree you can use

xigmanas-dev# portsnap update

Also cvsup can be used - more on this topic later.

Downloading FreeBSD Sourcecode

For downloading the FreeBSD sources we use cvsup which we have already installed. Cvsup can also be used for updating the ports-tree. Do:

xigmanas-dev# cp /usr/share/examples/cvsup/ports-supfile /etc
xigmanas-dev# cp /usr/share/examples/cvsup/standard-supfile /etc/source-supfile

Then use your favorite editor ( nano, ee, vi) to change following lines in the files we copied above:

xigmanas-dev# ee /etc/source-supfile

see for a mirror next to you.

After editing the files run:

xigmanas-dev# cvsup -L 2 -g /etc/source-supfile
xigmanas-dev# cvsup -L 2 -g /etc/ports-supfile

for updating. ( ports-tree should be already uptodate)

Updating installed Ports

Earlier in this Guide we have installed the applications we need as prebuild binaries.
Sometimes these binaries are not 100% uptodate. To avoid this you can now run

portupgrade -av

This well use your ports-tree to compile this applications again with the most actual source from the ports-tree. While updating “portupgrade” ask you some options you ould use for building the applications from source. Its ok to use the default settings.

To avoid building X11 ( Graphical Desktop related) we create or edit /etc/make.conf and add the line
Perhaps this the right time to create a Snapshot of your system. See The manual of your Virtual Machine for a “HowTo”
For VirtualBox see: First steps - Snapshots

Building XigmaNAS

Setup XigmaNAS build environment

Now we are going to setup the necessary directories and download the XigmaNAS SVN.
Developers use Subversion to maintain current and historical versions of files such as source code, web pages, and documentation.
see: Apache Subversion on

Then i will guide you step by step through the interactive buildscript.

Getting XigmaNAS from svn

Everything is build under /usr/local/xigmanas, so we create the directory and checkout the svn code.

xigmanas-dev# mkdir /usr/local/xigmanas 
xigmanas-dev# cd /usr/local/xigmanas/ 

xigmanas-dev# svn co svn 
Error validating server certificate for '':
 - The certificate is not issued by a trusted authority.\\
 Use the fingerprint to validate the certificate manually!
Certificate information:
 - Hostname: *
 - Valid: from Mon, 04 Jan 2012 14:21:55 GMT until Sat, 05 Feb 2013 09:03:23 GMT
 - Issuer: Equifax Secure Certificate Authority, Equifax, US
 - Fingerprint: ea:d1:3e:01:cc:16:e9:9b:c2:ab:4b:0c:cc:26:5f:25:78:ea:89:b4
(R)eject, accept (t)emporarily or accept (p)ermanently?

Here you can answer with (p), cause this isn't a error. You just don't have downloaded the certificate.

Compiling XigmaNAS

To start the XigmaNAS build script run

nas4free-dev# /usr/local/xigmanas/svn/build/

The first screen appears and we can start

Welcome to the XigmaNAS build environment.
1  - Update the sources to CURRENT
2  - Build system from scratch
10 - Create 'Embedded' (IMG) file (rawrite to CF/USB/DD)
11 - Create 'LiveCD' (ISO) file
12 - Create 'LiveCD' (ISO) file without 'Embedded' file
13 - Create 'Full' (TGZ) update file
*  - Quit

For a first run you should go through all steps. Following i will guide you from here to your first XigmaNAS LiveCD and embedded image.

Everything should be uptodate, but we do this step again just to illustrate later builds.

Select 1 - Update the sources to CURRENT

and if everything work as expected the answer should be

Checked out revision 43.
=> Successful

Seclect 2 - Build system from scratch

Bulding system from scratch
1 - Update source tree and ports collection
2 - Create filesystem structure
3 - Build kernel
4 - Build world
5 - Build ports
6 - Build bootloader
7 - Add necessary libraries
8 - Modify file permissions
* - Quit

Select 1 - Update source tree and ports collection

          ┌──────────────── XigmaNAS - Update sources ───────────────┐
          │             Please select what to update.                │
          │ ┌──────────────────────────────────────────────────────┐ │
          │ │ [X] cvsup           Update source tree               │ │
          │ │ [X] freebsd-update  Fetch and install binary updates │ │
          │ │ [X] portsnap        Update ports collection          │ │
          │ └─────v(+)─────────────────────────────────────────────┘ │
          │                  [  OK  ]       Cancel                   │
These steps we have already done, but it doesn't hurt you if you do it again!

Select 2 - Create filesystem structure

Should explain itself!

Select 3 - Build kernel

This will build the Kernel for your XigmaNAS system.

  ┌──────────────────── XigmaNAS - Build/Install kernel ────────────────────┐
  │    Please select whether you want to build or install the kernel.       │
  │ ┌─────────────────────────────────────────────────────────────────────┐ │
  │ │               [X] prebuild  Apply kernel patches                    │ │
  │ │               [X] build     Build kernel                            │ │
  │ │               [X] install   Install kernel + modules                │ │
  │ └─────────────────────────────────────────────────────────────────────┘ │
  │                         [  OK  ]       Cancel                           │

  ┌─────────────────────── XigmaNAS - Kernel patches ───────────────────────┐
  │ Select the patches you want to add. Make sure you have clean/origin     │
  │ kernel sources (via cvsup) to apply patches successful.                 │
  │ ┌─────────────────────────────────────────────────────────────────────┐ │
  │ │         [X] 3ware   3ware serial ATA RAID controller driver         │ │
  │ │         [X] a100u2  A100U2 U2W-SCSI-Controller                      │ │
  │ │         [X] aac     Adaptec Raid Controller driver                  │ │
  │ │         [X] ata     Misc. ATA driver patches                        │ │
  │ │         [X] iscsi   iSCSI initiator                                 │ │
  │ │         [X] nkpt    Patch number of kernel page tables              │ │
  │ │         [X] wol     WOL for nVidia(nfe(4)) and 3Com(xl(4))          │ │
  │ │                                                                     │ │
  │ │                                                                     │ │
  │ │                                                                     │ │
  │ │                                                                     │ │
  │ │                                                                     │ │
  │ │                                                                     │ │
  │ │                                                                     │ │
  │ └─────────────────────────────────────────────────────────────────────┘ │
  │                         [  OK  ]       Cancel                           │

If unsure keep all settings as is. This will compile the same Kernel who is released with the official XigmaNAS builds!
Now your System need some time to build the Kernel.

Now you are back on the previous screen, and we start building the world

Select 4 - Building World

This will copy all necessary files from the build system the your NAS4Free environment.

Now we start building the Ports.

Select 5 - Build ports

And select “build”.
Then you can select which ports you like to build. Select “ALL” for a standard NAS4Free build.

                 ┌────── XigmaNAS - Build/Install Ports ─────┐
                 │ Please select whether you want to build   │
                 │ or install ports.                         │
                 │ ┌───────────────────────────────────────┐ │
                 │ │        build    Build ports           │ │
                 │ │        install  Install ports         │ │
                 │ └───────────────────────────────────────┘ │
                 │          [  OK  ]       Cancel            │

  ┌──────────────────────────── XigmaNAS - Ports ───────────────────────────┐
  │                 Select the ports you want to process.                   │
  │ ┌─────────────────────────────────────────────────────────────────────┐ │
  │ │[X] AA_geomraid5      GEOM RAID5 filesystem                          │ │
  │ │[X] arcconf           Adaptec SCSI RAID administration tool          │ │
  │ │[X] ataidle           Utility to set spindown timeout for ATA drives │ │
  │ │[X] bash              The GNU Project's Bourne Again SHell           │ │
  │ │[X] bsnmp-ucd         A bsnmpd module impl. parts of UCD-SNMP-MIB    │ │
  │ │[X] bsnmptools        SNMP client-side tools                         │ │
  │ │[X] cdialog           An enhanced version of 'dialog'                │ │
  │ │[X] clog              Circular log file tool                         │ │
  │ │[X] e2fsprogs         Utilities to manipulate ext2/3/4 filesystems   │ │
  │ │[X] fdisk             PC slice table maintenance utility (fixed)     │ │
  │ │[X] firefly           Multithread daapd Apple iTunes server          │ │
  │ │[X] fuppes            Free UPnP Entertainment Service                │ │
  │ │[X] fusefs-ntfs       Mount NTFS partitions and disk images          │ │
  │ │[X] geom_eli          GEOM Eli filesystem encryption                 │ │
  │ └────v(+)─────────────────────────────────────────────────────────────┘ │
  │                         [  OK  ]       Cancel                           │

Select 5 - Build ports

Select this option again, but now choose “install” instead of “build”

  install  Install ports   

This will install all your prebuild ports along with needed files from you base FreeBSD system.

Select 6 - Build bootloader

To build and install the bootloader.

Select 7 - Add necessary libraries

Should be self explained.

Select 8 - Modify file permissions

The last step will set the correct permissions for your XigmaNAS files.

Now quit with * and you are back on the previous screen.

Welcome to the XigmaNAS build environment.
1  - Update the sources to CURRENT
2  - Build system from scratch
10 - Create 'Embedded' (IMG) file (rawrite to CF/USB/DD)
11 - Create 'LiveCD' (ISO) file
12 - Create 'LiveCD' (ISO) file without 'Embedded' file
13 - Create 'Full' (TGZ) update file
*  - Quit

Now the last step in our build process. Choose one of the option from 10 - 13 to create the final XigmaNAS ISO-Image or embedded file.

In this example i choose option 11 for creating a LiveCD.

Thats all

After a successful build you find your Ready to Use XigmaNAS ISO and/or IMG files in /usr/local/xigmanas folder.

[root@harry /]# ls /usr/local/xigmanas
XigmaNAS-x86-        builds
XigmaNAS-x86-LiveCD-      rootfs
XigmaNAS-x86-embedded-    svn
bootloader                              work

Hopefully this document helps you to build your own XigmaNAS from scratch.

documentation/howto/quickstart_guide_-_how_to_compile_xigmanas_from_scratch.txt · Last modified: 2018/07/13 01:41 by zoon01