[TUTORIAL] Proxmox VE 8.0 Mainline Kernel Builds

1vivy

New Member
Oct 13, 2023
2
0
1
I forked and modified the Proxmox kernel repo to build mainline releases with their modifications. The modifications I made feels like a fair amount of duct tape was used to make this work. But for now, it compiles mainline builds and I'll get around to cleaning it up + automating releases.

https://github.com/1vivy/pve-kernel is the repo.

You can grab a commit/tag for KERNEL_SHA1 and ZFS_SHA1 variables. The relevant upstream repos are in the README or .gitmodules
For KERNEL_SHA1, stick to tags with the naming scheme of cod/mainline/cod/tip/daily/2023-10-14, or cod/mainline/v6.6-rc5. Proxmox uses Ubuntu fork of the kernel (just some additional patches, configs and such; I'm sure someone can get the pure upstream to work).

Here's an overview of what you need to compile your own mainline build:
Bash:
# add proxmox devel repo
## need to install proxmox base & keys plus debian bookworm container, if not on a proxmox host
echo "deb http://download.proxmox.com/debian/devel/ bookworm main" >> /etc/apt/sources.list

# some apt packages around building debian/proxmox
apt-get update
apt-get install -y build-essential git git-email debhelper pve-doc-generator devscripts python-is-python3 dh-python sphinx-common quilt libtraceevents-dev libunwind-dev libzstd-dev pkg-config equivs

# clone repo & install apt dependencies
git clone https://github.com/1vivy/pve-kernel.git
cd pve-kernel
## (ex: ZFS_SHA1=zfs-2.2.0 and KERNEL_SHA1=cod/mainline/v6.5.7)
make prep ZFS_SHA1= KERNEL_SHA1=
make build-dir-fresh ZFS_SHA1= KERNEL_SHA1=
mk-build-deps -ir proxmox-kernel-*/debian/control
mk-build-deps -ir proxmox-kernel-*/modules/pkg-zfs/debian/control

# compile kernel
make deb ZFS_SHA1= KERNEL_SHA1=

# install compiled debs
## you need this package so os-prober hook script for grub doesn't complain and
## you don't get a "can't find /scripts/zfs" on boot
apt install zfs-initramfs
apt install ./proxmox-headers-..._amd64.deb ./proxmox-kernel-..._amd64.deb

Also I don't recommend using mainline kernel builds for Proxmox; but if you're here you probably need a set of patches only upstream, new hardware support, a driver, or whatever.

Keep an eye on patches/kernel as some maybe added upstream. Also keep an eye on ZFS upstream, as kernel ABI can change and break compatibility (ex: zfs-2.2.0 only works for v6.5 pretty sure).
 
Last edited:
Is it normal that the kernel package is then almost 20x as big as built from the official proxmox kernel sources?

97MB vs 1,7GB

1698448852730.png
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!