Table of contents

  1. Requirements
  2. Build FarmPi From within FarmPi / Raspbian / Debian / Ubuntu
  3. Building FarmPi Variants
  4. Building Using Docker
  5. Building Using Vagrant
  6. Usage

Requirements

  • qemu-arm-static
  • CustomPiOS
  • Downloaded Ubuntu image.
  • root privileges for chroot
  • Bash
  • git
  • sudo (the script itself calls it, running as root without sudo won’t work)

Build FarmPi From within FarmPi / Raspbian / Debian / Ubuntu

FarmPi can be built from Debian, Ubuntu, Raspbian, or even FarmPi. Build requires about 2.5 GB of free space available. You can build it by issuing the following commands:

sudo apt-get install gawk util-linux qemu-user-static git p7zip-full python3

git clone https://github.com/guysoft/CustomPiOS.git
git clone https://github.com/mkevenaar/FarmPi.git
cd FarmPi/src/image
wget -c --trust-server-names 'https://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.5-preinstalled-server-arm64+raspi.img.xz'
cd ..
../../CustomPiOS/src/update-custompios-paths
sudo modprobe loop
sudo bash -x ./build_dist

Building FarmPi Variants

FarmPi supports building variants, which are builds with changes from the main release build. An example and other variants are available in CustomPiOS, folder src/variants/example.

docker exec -it mydistro_builder:

sudo docker exec -it mydistro_builder build [Variant]

Or to build a variant inside a container:

sudo bash -x ./build_dist [Variant]

Building Using Docker

See Building with docker entry in wiki

Building Using Vagrant

There is a vagrant machine configuration to let build FarmPi in case your build environment behaves differently. Unless you do extra configuration, vagrant must run as root to have nfs folder sync working.

Make sure you have a version of vagrant later than 1.9!

If you are using older versions of Ubuntu/Debian and not using apt-get from the download page.

To use it:

sudo apt-get install vagrant nfs-kernel-server virtualbox
sudo vagrant plugin install vagrant-nfs_guest
sudo modprobe nfs
cd ../FarmPi
git clone https://github.com/guysoft/CustomPiOS.git
cd FarmPi/src
../../CustomPiOS/src/update-custompios-paths
cd FarmPi/src/vagrant
sudo vagrant up
run_vagrant_build.sh

After provisioning the machine, its also possible to run a nightly build which updates from devel using:

cd FarmPi/src/vagrant
run_vagrant_build.sh

To build a variant on the machine simply run:

cd src/vagrant
run_vagrant_build.sh [Variant]

Usage

  • If needed, override existing config settings by creating a new file src/config.local. You can override all settings found in src/modules/farmpi/config. If you need to override the path to the Raspbian image to use for building FarmPi, override the path to be used in ZIP_IMG. By default the most recent file matching *-raspbian.zip found in src/image will be used.
  • Run src/build_dist as root.
  • The final image will be created at the src/workspace