Crux Linux:Faster Builds

I recently started using Crux Linux as my main operating system, moving away from Gentoo (no hard feelings folks).

With that, one of the things I was doing with Gentoo was compile all of my packages in a ram disk to speed things up a bit and to reduce wear on my hard drive. Wanting to keep these benefits, I looked around how to do this in Crux.

The script that Crux uses to compile packages is called pkgmk. It stores its configurations at /etc/pkgmk.conf. Inside there, there is a variable, PKGMK_WORK_DIR. This varible points to the location where pkgmk will create the work directory, under which all of the compilation tasks occur. To compile in memory, we need to perform a few steps. The first is to tell pkgmk to compile elsewhere. I used /var/pkgmk/${name}, but it can be placed wherever.

# Original value
# PKGMK_WORK_DIR="$PWD/work"
# New and happy value
PKGMK_WORK_DIR="/var/pkgmk/${name}"

The next step is to update your /etc/fstab so a ram drive is mounted at the location you selected. That will look something like…​

# Ram disk for pkgmk to abuse
tmp   /var/pkgmk tmpfs  defaults,size=7G    0 0

After that, just execute a mount -a, and get to compiling!

Last edited: January 31, 2016