Utilite Pro as a server

I got aย  Utilite Pro to replace my aging Fit-PC2. It’s significantly more powerful than the Fit-PC2 and contains an ARM processor. The standard package contains a slightly customised version of Ubuntu (mainly the kernel includes a few extra drivers for the onboard hardware). It turns out, however, that a number of useful features in the kernel have been disabled. These include lots of useful filesystems, including btrfs and xfs. It also has the kernel cryptographic routines disabled, which means you’re out of luck if you want to use some encryption software to protect your data. In the end, recompiling the kernel was pretty straightforward and Utilite provide pretty comprehensive instructions on how to do so.

In case it’s useful (and as a reminder to myself), here’s the link to the instructions, but here’s my little script to automate the process:

#!/usr/bin/env bash

set -eu

# Build a new kernel for the Utilite Pro. See:
# http://www.utilite-computer.com/wiki/index.php/Utilite_Linux_Kernel

OLD="yes" # run 'make oldconfig' instead of 'make menuconfig'?

TODAY=$(date +%Y-%m-%d)

mkdir -p $ROOTFS/boot

export ARCH=arm

make utilite_defconfig

# Are we using the existing .config?
if [ $OLD == "yes" ]; then
make oldconfig
make menuconfig # this is interactive but you need to save a .config manually
make -j4 # parallelise the build
make uImage
INSTALL_MOD_PATH=$ROOTFS make modules_install

cp -v $CWD/arch/arm/boot/uImage $ROOTFS/boot/$IMAGE
tar -C $ROOTFS -czvf $TARBALL .

# Display the commands to actually install the new kernel.
boot_partition=$(awk '{for (i=1; i<=NF; i++) {if($i~/root=/) {print substr($i,6,length($i)-6)"1"}}}' /proc/cmdline) echo '# mount the /boot partition:' echo "mount $boot_partition /boot" if [ ! -f /boot/$IMAGE-$TODAY ]; then echo '# back up the existing image:' echo mv /boot/$IMAGE /boot/$IMAGE-$TODAY else echo "WARNING: EXISTING KERNEL IMAGE BACKUP IN /boot: $IMAGE-$TODAY" fi echo '# extract the new kernel to the installation:' echo tar -C / -xvf $TARBALL

To use the script, place it in the cloned git repository and execute (probably best as root). It creates a tarball and prints the instructions for installing the new kernel after the compilation has completed. It refuses to overwrite an existing tarball (if you've run this script multiple times in the same day, you'll need to remove the old tarball before running the script again.

I've attached an example of the kernel .config to this post which enables a lot more filesystems (including btrfs and xfs) as well as including the kernel cryptographic functions.