« Freenas with Xen » : différence entre les versions

De TeriaHowto
Sauter à la navigation Sauter à la recherche
Ligne 3 : Ligne 3 :
== Build environment ==
== Build environment ==


* Install a Freebsd 9.3 (in a domU for example)
* Install Freebsd 9.3 (in a domU for example)
* Make a few adjustements
* Make a few adjustements
* Build Freenas
* Build Freenas

Version du 5 juin 2015 à 23:12

This howto is based on the excellent work made by My Wired House. It aims at building FreeNAS with Xen PVHVM support and ultimately at putting it into production with PCI passthrough.

Build environment

  • Install Freebsd 9.3 (in a domU for example)
  • Make a few adjustements
  • Build Freenas

Installation of Freebsd 9.3 in a domU

  • Install your Freebsd 9.3 on a disk / volume of 100 Go (building Frenas requires space !)
  • Configuration file for Xl
#
#  Kernel + memory size
#
builder      = 'hvm'
boot         = 'cd'
memory       = '2048'
vcpus        = '1'

#
#  Disk device(s).
#
disk        = [
                  'phy:/dev/system/freebsd-disk,xvda,w', 'file:/opt/ISO/FreeBSD-9.3-RELEASE-amd64-bootonly.iso,hdc:cdrom,r'
              ]


#
#  Hostname
#
name        = 'freebsd'

#
#  Networking
#
vif         = [ 'mac=00:16:3e:xx:xx:xx, model=e1000' ]

#
#  Behaviour
#
on_poweroff = 'destroy'
on_reboot   = 'restart'
on_crash    = 'restart'

sdl=0
vnc = 1
vncunused = 1
vnclisten = '0.0.0.0'
stdvga=0
serial='pty'
usb=1
usbdevice='tablet'
keymap='fr'
localtime=1
  • Note: To speed up the process, add RAM and vCPUs if you can !

Update & PVHVM configuration (to boost performances)

# freebsd-update fetch
# freebsd-update install
# reboot
# cd /usr/src
# make buildkernel KERNCONF=XENHVM
# make installkernel KERNCONF=XENHVM
# sed -i".backup" 's/ada/xbd/g' /etc/fstab
# sed -i".backup" 's/ifconfig_em0/ifconfig_xn0/' /etc/rc.conf
# reboot

Building Freenas

Install Freenas dependencies

Cf Readme on Github

# pkg install poudriere-devel git cdrtools pxz python grub2-pcbsd xorriso py27-sphinx py27-sphinxcontrib-httpdomain-1.2.1

Dowload Freenas 9.3 release

Dowload the latest Freenas 9.3 release on Github (e.g. 9.3-STABLE-201506042008.tar.gz)

# mkdir -p /home && wget --no-check-certificate -O /home/9.3-STABLE-201506042008.tar.gz https://github.com/freenas/freenas/archive/9.3-STABLE-201506042008.tar.gz
# cd /home
# tar xf 9.3-STABLE-201506042008.tar.gz
# mv freenas-9.3-STABLE-201506042008 freenas
# cd freenas
# make git-external

A few adjustements on Freenas sources

  • Modify "VERSION" in Makefile to reflect the custom release :
# sed -i".backup" 's/VERSION\?=9.3-STABLE/VERSION\?=9.3-STABLE-xen/' /home/freenas/Makefile
  • Edit /home/freenas/build/nanobsd-cfg/FREENAS.amd64 and at the end, add theses lines :
options         NO_ADAPTIVE_MUTEXES
options         NO_ADAPTIVE_RWLOCKS
options         NO_ADAPTIVE_SX

# Xen HVM support
options         XENHVM
device          xenpci
  • Remove the "problematic" "set -e" in create_iso.sh (I know, this is bad but the process would stop at this stage if not ...) :
# sed -i".backup" 's/set -e/#set -e/' /home/freenas/build/create_iso.sh

Build !

Depending on the ressources allocated to your Freebsd build machine, it will take a while !

# make checkout
# env _KEY=set NANO_LABEL=FreeNAS VERSION=9.3-STABLE-xen \
GIT_LOCATION=EXTERNAL \
BUILD_TIMESTAMP=`date '+%Y%m%d%H%M'` \
SEQUENCE=FreeNAS-9.3-STABLE-xen-201506042008 \
TRAIN=FreeNAS-9.3-STABLE-xen \
UPDATE_USER=sef FREENAS_KEYFILE=Keys/ix-nightly-key.key \
CHANGELOG=ChangeLog \
make release

Installation of Freenas 9.3 in a domU