Building Dynamic Executables

This step is completely optional and most people will probably want to skip it as there is almost no benefit to doing this with FreeBSD 6.x. I'm only including this step for the sake of completeness.

If you want to save about 430 Kbytes, edit /etc/make.conf and add the line:

NO_SHARED=no

The table below shows you how much space you'll save by completing this step. As you can see, it's not much. But if every byte counts, it may be worth it to you.

Default Size
Size after compiling with NO_SHARED=no
/bin = 802K
/bin = 802K
/sbin = 1.2M
/sbin = 766K
/usr/bin = 3.3M
/usr/bin = 3.3M
/usr/sbin = 1.0M
/usr/sbin = 1.0M


Before you can re-build the binary executables, you must run sysinstall from within your FreeBSD jail by typing the following:

/usr/sbin/sysinstall

From the menu, choose:

  • Configure
    • Distributions
Within the Distributions page, arrow down until the cursor gets to the to the src option and hit Enter.

Within the src page, you want to select the following:
  • contrib
  • libexec
  • release
  • bin
  • sbin
  • ubin
  • usbin
Exit back to the main Options page.

Choose your Media source, and then choose Commit to perform the install.

Once the install is complete, exit out of sysinstall.

I have created a script that will save you a lot of boring typing. Download it, save it to your /root directory, make it executable, and then run it by typing the following:

cd /root
fetch http://www.ultradesic.com/pub/miniBSD_Files/build-dynamic-libs-6.sh
chmod 0700 /root/build-dynamic-libs-6.sh
/root/build-dynamic-libs-6.sh

If you ran my script, and didn't see any errors, you can continue to the next section.

If you prefer to do it all on your own, type the following and make sure you don't skip anything:

cd /usr/src/lib/libsm
make clean
make


(Note: there is no need to run make install after compiling a library. It's not just an oversight on my part.)

After compiling libsm above, next we compile and install bin. Type the following:

cd /usr/src/bin
make clean
make
make install


Next, type the following:

cd /usr/src/contrib/ipfilter/tools
make clean
make

 
cd /usr/src/sbin/ipf
make clean
make


Next we compile and install sbin. (You need to make sure the /usr/share/doc/atm directory exists or the sbin installation will fail.) Type the following:

mkdir -p /usr/share/doc/atm
cd /usr/src/sbin
make clean
make
make install


Next we compile and install usr.bin (which will be the /usr/bin files on your miniBSD system.) usr.bin requires several libraries to be compiled first. Type the following:

cd /usr/src/lib/bind
make clean
make

cd /usr/src/lib/libtelnet
make clean
make

cd /usr/src/lib/libsmutil
make clean
make

cd /usr/src/lib/libsmdb
make clean
make


(Note: Again, there is no need to run make install after compiling these libraries.)

And finally, we can install usr.bin. Type the following:

cd /usr/src/usr.bin
make clean
make
mkdir -p /usr/share/info
make install


That's it. Now continue to the next section.

(Note: In case you're wondering why I don't build the usr.sbin binaries, it's because I've tested it both ways and it doesn't make any difference in the file sizes.)