An easy way to speed up the process of building and installing the new system is to use more processors to increase the computational power.
To find out what's the number of the processors you have to speed up the process:
sysctl hw.ncpu
For example:
hw.ncpu: 1
Let's set the $NUMBER_OF_PROCESSORS
environmental variable then:
export $NUMBER_OF_PROCESSORS=$(sysctl hw.ncpu | tr -d 'a-z.: ')
FreeBSD project use SVN as default SCM. Source could be download with svnlite
software.
cd /usr/src svnlite checkout https://svn.freebsd.org/base/head .
cd /usr/src svnlite checkout https://web.freebsd.org/base/release/11.0.0 .
You can also get source from frozen tarball with fetch
command
cd /tmp fetch http://ftp.freebsd.org/pub/FreeBSD/releases/amd64/11.0-RELEASE/src.txz cd /usr/src tar xJvf /tmp/src.txz
cd /tmp fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/11.0-RELEASE/src.txz cd /usr/src tar xJvf /tmp/src.txz
git clone https://github.com/freebsd/freebsd freebsdsrc
Go to the directory with the source code:
cd freebsdsrc
Go to the directory with the kernel's configuration code:
# If your system is 32-bit. cd sys/i386/conf/ # If your system is 64-bit. cd sys/amd64/conf/
Get a copy of the GENERIC kernel (let's call it MODEDKERNEL). It will be the base of your customisations.
cp GENERIC MODEDKERNEL
Modify the MODEDKERNEL
file at your will.
Go to the freebsdsrc/
(the root directory of the FreeBSD source tree you've already downloaded) and build the world:
sudo make -j${NUMBER_OF_PROCESSORS} buildworld KERNCONF=MODEDKERNEL -DNO_CLEAN
To build the kernel run:
sudo make -j${NUMBER_OF_PROCCESORS} buildkernel KERNCONF=UFFIE -DNO_CLEAN
Let's configure the destination directory for the root filesystem of
your new FreeBSD (for example /usr/home/beastie/MODEDKERNEL
).
Add the following lines to /etc/src.conf
to set it up:
.if ${KERNCONF} == "MODEDKERNEL" DESTDIR?=/usr/home/beastie/MODEDKERNEL MODULES_OVERRIDE=md ufs .endif
Remember to use spaces not tabs if you wish to indent the code.
Create the root file system now:
Make distribution directories:
sudo make distrib-dirs KERNCONF=MODEDKERNEL
Estimated time on Hasee Q540S: a few seconds.
Make the distribution:
sudo make distribution KERNCONF=UFFIE
Estimated time on Hasee Q540S: 3 minutes.
sudo make installworld KERNCONF=MODEDKERNEL
Estimated time on Hasee Q540S: 5 minutes.
sudo make installkernel KERNCONF=MODEDKERNEL
Estimated time on Hasee Q540S: a few seconds.