Foreword
This howto covers building IPFire from source code to create new packages and make changes.
When building a development environment, you should be aware that:
- This will require some patience and may take some time
- Ideally you should have a powerful PC, with a lot of RAM
- A two core CPU may take a long time to build
- although this procedure will work on any modern PC
- You will need to dedicate a significant chunk of disk space
- The instructions below assume always working as "normal" unprivileged user and you'll see
sudo
commands below.
Make sure the IPFire 2.x - Build Environment Setup steps are complete.
How To Build IPFire
This process may take several hours...
Step 1: Create a project folder
Make a new project folder and change to that directory:
mkdir myProject
cd myProject
Step 2: Grab the source
Check out the Source Code by picking which branch you'll be working on (pick stable or next or IPFire 3.x)
git clone git://git.ipfire.org/ipfire-2.x.git
Note - this will download in 1 to 2 minutes depending on download speed
Step 3: Configure sendemail.to destination
When sharing your efforts with IPFire you'll be sending git email to the same destination. And if you submit git code to other sites it does not make sense to set this globally. So we set sendemail.to per each project. Go to the ipfire-2.x
directory for your project and run these commands:
cd ~/myProject/ipfire-2.x
git config sendemail.to development@lists.ipfire.org
Step 4: Grab the source code
Download the source code tarballs of every upstream package.
cd ~/myProject/ipfire-2.x
sudo ./make.sh downloadsrc
Note - the make.sh downloadsrc
will download in 10 to 15 minutes depending on download speed
Step 5: Download precompiled toolchain
In order to speed up compilation download the first stage of the toolchain. This is recommended.
sudo ./make.sh gettoolchain
Note - the first stage of the toolchain make.sh gettoolchain
will download in about 10 seconds.
Step 6: First build
The build process automatically uses all available CPUs on the system to speed up the build as much as possible.
Start the build with:
sudo ./make.sh build
Note - the build stage will take 5 to 20 hours depending on your system.
Now just wait until it's finished. This is a important test for your development environment. Make sure this step completes with no errors before continuing to next step.
Step 7: Clean up before making new changes
sudo ./make.sh clean
Step 8: Create project branch
Create new branch and switch to that branch. It will be based on the "next" branch.
git checkout -b <yourBranchName> -t origin/next
Step 9: Double check - are we at the right branch?
List all of the branches in repository. Asterisk <- we are here
git branch
Step 10: Make needed changes
Create new packages, create new IPFire 2.x - Building Add-ons and/or make changes.
Step 11: Second build with changes
sudo ./make.sh build
Note - the second build stage will take 2 to 5 hours depending on your system.
Results of Build
Go to the cd ~/myProject/ipfire-2.x
directory. You'll find built .iso
and .img.xz
files with their md5 checksum files. This is your own customized IPFire with your changes installed.
$ cd ~/myProject/ipfire-2.x
$ ls -hl ipfire*
-rw-r--r-- 1 root root 385M Mar 2 17:52 ipfire-2.27.2gb-ext4.x86_64-full-core123.img.xz
-rw-r--r-- 1 root root 82 Mar 2 18:00 ipfire-2.27.2gb-ext4.x86_64-full-core123.img.xz.md5
-rw-r--r-- 1 root root 441M Mar 2 17:49 ipfire-2.27.x86_64-full-core123.iso
-rw-r--r-- 1 root root 70 Mar 2 18:00 ipfire-2.27.x86_64-full-core123.iso.md5
Log files
Go to the cd ~/myProject/ipfire-2.x/log
directory. All log files are located here including the build log files:
$ cd ~/myProject/ipfire-2.x/log
$ ls -hl *.log
-rw-r--r-- 1 root root 28M Mar 10 18:47 _build.base.log
-rw-r--r-- 1 root root 431K Mar 10 18:49 _build.installer.log
-rw-r--r-- 1 root root 67M Mar 10 18:48 _build.ipfire.log
-rw-r--r-- 1 root root 809K Mar 10 19:04 _build.packages.log
-rw-r--r-- 1 root root 83 Mar 10 12:26 _build.preparation.log
Benchmarks of building step
Ran the command sudo ./make.sh build
and took note of the Build time.
CPU | System | Version - Core Update | 1st Build | 2nd Build 1 |
---|---|---|---|---|
Intel Core i5 6400 32GB of RAM |
Kali 2019.4 XFCE | 2.23 - 139 | 8h 14m 31s | 3h 03m 02s |
Intel Core i5 6400 32GB of RAM |
Kali 2020.1 XFCE | 2.25 - 142 | 8h 06m 44s | 2h 57m 05s |
Intel Core i5-3470 3.2/3.6GHz, SSD & 8 GB RAM 4 core |
Debian 11 (bullseye) | 2.27 - 163 | 5h 52m 04s | 2h 12m 39s |
Intel Duo E7500 2.93GHz, SSD & 2 GB RAM 2 core |
Debian 11 (bullseye) | 2.27 - 165 | 14h 09m 27s | 4h 18m 52s |
Intel Xeon E5-1650 v2 3.5/3.9GHz,SSD & 16GB RAM 6 core |
Debian 11 (bullseye) | 2.27 - 168 | 4h 41m 00s | 2h 09m 47s |
Intel Core i5-4590T 2.0/3.0GHz,SSD & 8GB RAM 4core/4threads |
Debian 12 (bookworm) | 2.27 - 175 | 7h 05m 38s | 2h 48m 14s |
Intel Core i3-6100 3.7GHz,SSD & 8GB RAM 2core/4threads |
Debian 12 (bookworm) | 2.27 - 175 | 7h 46m 47s | 2h 53m 31s |
Intel Core i5-6400 2.7/3.3GHz,SSD & 8GB RAM 4core/4threads |
Debian 12 (bookworm) | 2.27 - 175 | 7h 14m 58s | 3h 15m 55s |
Intel Core i7-6700 3.4/4.0GHz,SSD & 8GB RAM 4core/8threads |
Debian 12 (bookworm) | 2.27 - 175 | 5h 39m 56s | 2h 53m 43s |
Intel Core i7-6700 3.4/4.0GHz,SSD & 24GB RAM 4core/8threads |
Debian 12 (bookworm) | 2.27 - 175 | 5h 30m 16s | 2h 44m 14s |
AMD Ryzen5 1600 3.2/3.6GHz,SSD & 16GB RAM 6core/12threads |
Debian 12 (bookworm) | 2.27 - 175 | 4h 55m 58s | 2h 45m 31s |
AMD Ryzen5 5600G 3.9/4.4GHz,SSD & 16GB RAM 6core/12threads |
Debian 12 (bookworm) | 2.27 - 175 | 2h 56m 40s | 1h 24m 59s |
AMD Ryzen9 5900X 3.7/4.8GHz,SSD & 16GB RAM 12core/24threads |
Debian 12 (bookworm) | 2.27 - 175 | 2h 13m 09s | 1h 13m 34s |
Duel Xeon E5-2680 v3 2.5/3.3GHz,SAS & 125GB RAM 12core/24threads |
CentOS Linux 9 | 2.27 - 178 | 4h 02m 10s | 2h 20m 20s |
-
Between the first and second build we ran
sudo ./make.sh clean
to test cache. ↩