Monday July 24, 2017 16:49:00 UTC
Folding && BOINC - PXE / TFTP Diskless Network Boot Image

Modifying the Image

Modifying the PXE disk image is simple. The image is kept as vanilla as possible for simplicty. The initrd file consists of the root file system and can be decompressed and mounted using loopback interface. Image 1.8.0 and newer uses xz compression and the older images uses gzip.
xz:
mv initrd.img initrd.img.xz
xz -d initrd.img.xz
mount -o loop initrd.img /mnt

gzip:
mv initrd.img initrd.img.gz
gzip -d initrd.img.gz
mount -o loop initrd.img /mnt
Make the modifications of your choosing in /mnt. The core of the image is based on busybox. Init is tied to busybox and /etc/rc.d/rc.S is called from /etc/inittab. This file is also where the local and serial consoles are fired up from. All rc scripts are in /etc/rc.d and the rc scripts are somewhat similar to the format of Slackware rc scripts. These scripts handle TFTP connectivity, NFS mounting, file system overlay, FAH and BOINC service control, and other services.

Once done, umount the file system and recompress.
umount /mnt

xz:
xz --check=crc32 --x86 --lzma2 initrd.img
mv initrd.img.xz initrd.img

gzip:
gzip -9 initrd.img
mv initrd.img.gz initrd.img

Image Directory structure

/etc/rc.d - Init scripts
/lib - 32-bit glibc
/lib64 - 64-bit glibc
/usr/local/boinc32 - 32-bit BOINC
/usr/local/boinc - 64-bit BOINC
/usr/local/fah - Folding@home
/var/spool/cron - Crontabs

Kernel configuration

The kernels built for the PXE image are vanilla from ftp.kernel.org. The only patches I add are AUFS which unfortunately is not included with the kernel source and BFS for a separate set of kernel builds for anyone preferring BFS scheduler. Kernel configuration files are included with the image and found in the kernels directory.

The AUFS patch can be found here:

http://aufs.sourceforge.net/
cd linux-2.6
git clone http://git.c3sl.ufpr.br/pub/scm/aufs/aufs2-standalone.git \
    aufs2-standalone.git
cd aufs2-standalone.git
git checkout origin/aufs2.1-39
cp -a Documentation/ fs/ include/ ..
cd ..
cat aufs2-standalone.git/aufs2-kbuild.patch | patch -p1
cat aufs2-standalone.git/aufs2-base.patch | patch -p1
cat aufs2-standalone.git/aufs2-standalone.patch | patch -p1

Building NVIDIA drivers for BOINC CUDA projects

The NVIDIA driver source can be extracted using the -x flag.
./NVIDIA-Linux-x86_64-270.41.06.run -x
The NVIDIA kernel source to build the kernel module is found in the kernel directory. An example for building and installing the module:
ROOT=/tmp/k.39
KROOT=/usr/src/linux-2.6.39
KERNEL=2.6.39

mkdir -p $ROOT/lib/modules/$KERNEL/kernel/drivers/video
(
  cd ~/NVIDIA-Linux-x86_64-270.41.06/kernel
  make clean
  make SYSSRC=$KROOT module
  cp nvidia.ko $ROOT/lib/modules/$KERNEL/kernel/drivers/video
  echo "kernel/drivers/video/nvidia.ko:" >> $ROOT/lib/modules/$KERNEL/modules.dep
)

Busybox configuration

This configuration file is for the busybox build included with the image:

Busybox 1.17.4 Configuration