Custom iso with bsdinstall in FreeBSD

To build a custom iso, you will need to build from source. An easy way is to install with source or alternatively use svn to fetch source files. While using make command, ‘jX’ (X can be replaced by 4 or more depending upon the processor cores) parameter allows for speeding up of make by running multiple processes in parallel. Options for make can be explored using ‘man src.conf’[2]. For ex., if you are not interested in CLANG for the moment, use WITHOUT_CLANG flag. This could save upto 30 minutes if your build time.
# cd /usr/src
# make -j4 buildworld buildkernel
# cd /usr/src/release

Installation shell scripts are located at /usr/src/usr.sbin/bsdinstall/scripts/ . First file to run is ‘auto’, which then calls other files. To add extra files in the custom iso, include the filename in SCRIPTS section of /usr/src/usr.sbin/bsdinstall/Makefile and then upload the files to /usr/src/usr.sbin/bsdinstall/scripts/ [3]. A small tip: if you are including a .gz or .bz2  compressed file, it will be available to you in uncompressed format after installation in the bsdinstall directory (defaults to /usr/libexec/bsdinstall). Automating most of the tasks would involve modifying their respective shell scripts. The only exception I could see was the paritioning wizard which is written in C. I prefer to comment out the part which called the wizard and use the geom shell commands to directly create the basic partitions[4].

You do not need to repeat ‘make buildworld buildkernel’ if you are just making changes to the scripts file. I generally like to keep my custom iso as minimal as possible, so no docs, ports or src in the final iso[1].

Once the release has been built we now copy the iso, usb image, ftp files to the desired directory [5]
# make install DESTDIR=/usr/freebsd-snapshot clean

[1] release options:

[2] src options:

[3] bsdinstall itself is not documented very well as of now. It is being worked upon, and will see a lot of changes in 9.2 release. Check out the mail from Devin in freebsd-questions mailing list:

[4] How to use geom commands within the install process:

[5] To write the memory stick image to a usb drive, FreeBSD docs now refer to:


One thought on “Custom iso with bsdinstall in FreeBSD

Comments are closed.