Compile FOS kernel

FOS kernels (Linux kernel used by the FOG OS - a minimal Linux OS doing all the imaging work) are updated regularly to provide drivers for newer hardware and fix issues. The vanilla Linux kernel is used and very few (currently none) patches are added to keep it as close to the official source as possible. In case you want to compile your own binaries for whatever reason you might want to follow the below instructions.


To be able to build the kernel from source you need tools to checkout and compile source code:

debian/ubuntu# sudo apt install git build-essential
fedora/centos# sudo yum install git gcc gcc-c++ make

Build script

Within the fos repository a build script is provided:

git clone
cd fos
./ --kernel-only --arch x64

Manual compilation

Checkout the code and download our config header files from github. The header files need to be a little different for BIOS and UEFI and therefore I usually checkout the source twice to have one ready for each platform.

mkdir fos
cd fos
tar xzf linux-5.10.83.tar.gz
cd linux-5.10.83/
git clone git://

Up to this point your kernel source is prepared and ready. Now you need to choose which architecture you want to compile for: Intel/AMD 64 bit or 32 bit or ARM 64 bit.

Intel/AMD 64 bit

make mrproper
wget -O .config
make oldconfig
make -j $(nproc) bzImage
cp arch/x86/boot/bzImage /var/www/html/fog/service/ipxe/bzImage

Intel/AMD 32 bit

make mrproper
wget -O .config
make ARCH=i386 oldconfig
make ARCH=i386 -j $(nproc) bzImage
cp arch/x86/boot/bzImage /var/www/html/fog/service/ipxe/bzImage32

ARM 64 bit

make mrproper
wget -O .config
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- oldconfig
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j $(nproc) Image
cp arch/arm64/boot/Image /var/www/html/fog/service/ipxe/arm_Image

Additional patches

As mentioned above the number of additional patches is kept low. For quite some time in the 4.x kernel series we added the following patches which are not need for 5.x kernels anymore.



Search for


and add this line



This is an important patch to help prevent from major performance issues in HyperV:

Search for


Delete the line and add this instead

if (PAGE_SIZE - 1 < 4096) {
    blk_queue_virt_boundary(sdevice->request_queue, 4096);
} else {
    blk_queue_virt_boundary(sdevice->request_queue, PAGE_SIZE - 1);