Revision [1252]
This is an old revision of DevelopersBootStrapAndDevIso made by GeekGod on 2011-07-05 04:41:21.
These instructions are unsupported unless you have a BSDPerimeter support contract https://portal.pfsense.org/. Developers use the dev mailing list.
Pre-built environment
We now offer a pre-built pfSense development builder OVA file. You can import this right into ESX, ESXi or VirtualBOX and it will setup the necessary builder items that are done below in the "pfSense developer building bootstrapping - building a custom pfSense image" stage.
VMWare ESX users simply do a File -> Deploy (from vClient) and feed the url.
VirtualBox users download the file and double click to import.
The fully automated OVA file is here:
http://cvs.pfsense.org/~sullrich/pfSenseDevBuilder.ova
Not running VirtualBox ESXi or ESX? Proceed on below with help on how to create an ISO!
pfSense developer building bootstrapping - building a custom pfSense image
This document will go over the steps necessary in order to produce an environment where pfSense images can be built. Note that this used to include a "developer" ISO but that no longer works and is not officially supported. Following this guide will get you a bootable ISO and memstick image, and potentially NanoBSD images.
0. Install FreeBSD 7.1 ( http://www.freebsd.org/doc/en/books/handbook/install.html ) for pfSense 1.2.3 images ... or FreeBSD 8.1 if you want to build pfSense 2.0.
0a. (OPTIONAL and most likely broken on recent freebsd upgrades) Create a Jail or chroot environment to build pfSense in. Building pfSense can intrude in a lot of areas of your FreeBSD box and some folks prefer to keep the builder process seperate (pfSense developers included).
2a. Install the jail using this guide: http://www.freebsd.org/doc/en/books/handbook/jails.html
2b. Read and apply these settings: http://cvs.pfsense.org/~billm/pfsense_jail_builder_7_0.txt
2c. Apply this patch to the host: http://cvs.pfsense.org/~billm/pfsense_jail_builder_7_0.diff
2d. Build and install a new kernel containing the above jail fixes (refer to FreeBSD handbook if you need help with this)
2b. Read and apply these settings: http://cvs.pfsense.org/~billm/pfsense_jail_builder_7_0.txt
2c. Apply this patch to the host: http://cvs.pfsense.org/~billm/pfsense_jail_builder_7_0.diff
2d. Build and install a new kernel containing the above jail fixes (refer to FreeBSD handbook if you need help with this)
1. Begin pfSense bootstrap by running these shell commands:
echo "WITHOUT_X11=yo" >> /etc/make.conf echo "BATCH=yo" >> /etc/make.conf mkdir -p /home/pfsense/pfSenseGITREPO /usr/pfSensesrc
2. Grab ports and build GIT
portsnap fetch extract cd /usr/ports/textproc/expat2 && make depends install cd /usr/ports/devel/git && make depends install cd /usr/ports/sysutils/fastest_cvsup/ && make depends install # tcsh requires reloading available binaries - if you run this command and it fails -- don't worry. rehash
3. Continue on with the GIT repo checkouts:
cd /home/pfsense && git clone git://github.com/bsdperimeter/pfsense-tools.git tools cd /home/pfsense && git clone https://github.com/sullrich/pfSense-freesbie2.git freesbie2 cd /home/pfsense/tools/builder_scripts && chmod a+rx *.sh
4. Ensure FreeBSD sources are present
Some ports require sources in /usr/src to build correctly.csup -h `fastest_cvsup -c tld -q` /usr/share/examples/cvsup/standard-supfile
5. Invoke our new menu system by running:
cd /home/pfsense/tools/builder_scripts ./menu.sh
Note: You can use the following command if you do not wish to use the menu:
./set_version.sh
5.1. After invoking the menu system set the version you would like to build
Versions available are in the radio box or select custom and enter one of:
| RELENG_1_2 | pfSense RELENG_1_2 + FreeBSD RELENG_7_2 |
| RELENG_2_0 | pfSense HEAD (2.0) + FreeBSD RELENG_7_2 |
| RELENG_7_2 | pfSense RELENG_1_2 + FreeBSD RELENG_7_2 |
| RELENG_8_0 | pfSense HEAD + FreeBSD 8-CURRENT |
5.2. Invoke the Apply patches option
This will fetch the version of FreeBSD required and apply our patches. You should not see any errors during this step.
To run this outside of the menu system, use:
./apply_kernel_patches.sh
5.2a Ensure BSDInstaller is sound
rm -rf /home/pfsense/installer /cvsup_bsdinstaller ; ./rebuild_bsdinstaller.sh
5.3 Invoke the Build ISO option
pfSense will now build an iso. Sit back and wait while the operation proceeds.
To run this outside of the menu system, use:
./build_iso.sh
5.4 Plan for failure
It is expected that the first try to build the ports, and the first try to build an ISO will fail, but subsequent attempts work. This is because certain parts expect files or binaries to be present that get built on the first run but not fully used until the second. This may get fixed eventually, but because the workaround is easy (just run the build again), it's not a priority.
6. Testing
If all goes well you should have a pfSense.iso in /usr/obj.pfSense ... Test it.
7. Keeping in sync with pfSense Repo's
Invoke the Sync command to update tools and freesbie sources with rcs.pfsense.org.
8. Other images available for building
Once you have a working ISO you can build pretty much any pfSense image listed in the menu system.
Troubleshooting
If for some reason the build goes wrong you can wipe out *ALL* of /usr/local/ and restore back to a after installation state and start over completely by invoking the Clean option of menu system.
Further Reading
Recommended .tcshrc aliases
alias builder_scripts 'cd /home/pfsense/tools/builder_scripts' alias builder_profiles 'cd /home/pfsense/tools/builder_scripts/builder_profiles' alias build_iso.sh 'cd /home/pfsense/tools/builder_scripts && ./build_iso.sh' alias update_git_repos.sh 'cd /home/pfsense/tools/builder_scripts && ./update_git_repos.sh' alias clean_build.sh 'cd /home/pfsense/tools/builder_scripts && ./clean_build.sh' alias build_nano.sh 'cd /home/pfsense/tools/builder_scripts && ./build_nano.sh' alias apply_kernel_patches.sh 'cd /home/pfsense/tools/builder_scripts && ./apply_kernel_patches.sh'
Please note that only GeekGod has write privileges to this page. Please coordinate changes with him.