requirements | dom0 | domU
see kernel-req
cd /usr/src/ screen -S kernel-build ver=5.18.19
it’s good to define a custom name in view to have different flavor for the very same version
– otherwise /lib/modules/THAT-ONE/ conflicts with the OTHER-ONE.
extra=xen-ufs-usb extra=nethence
grab the version you want e.g. here for being able to patch with hba mode we want 5.18
wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-$ver.tar.gz time tar xzf linux-$ver.tar.gz
and also eventually apply the latest available REISER4 patch
wget https://sourceforge.net/projects/reiser4/files/reiser4-for-linux-5.x/reiser4-for-5.16.patch.gz mv linux-$ver/ linux-$ver.$extra/ cd linux-$ver.$extra/
eventually apply the REISER4 patch
patch -p1 < ../reiser4-for-5.16.patch
clean-up in case you had previous builds
make mrproper
get a fresh copy slackware huge kernel config (loads of drivers built-in)
wget https://lab.nethence.com/confdiff/config-huge.clean.txt cp -f config-huge.clean.txt .config make olddefconfig mv -i Makefile Makefile.dist sed "s/^EXTRAVERSION =/EXTRAVERSION = .$extra/" Makefile.dist > Makefile diff -u Makefile.dist Makefile
proceed with adding the drivers you need e.g.
make xen.config # preview sed -nr 's/^(CONFIG_USB_STORAGE.*)=m/\1=y/p' # change config sed -ri 's/^(CONFIG_USB_STORAGE.*)=m/\1=y/' .config cat >> .config <<EOF CONFIG_UFS_FS=y CONFIG_UFS_FS_WRITE=y CONFIG_USB_UHCI_HCD=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_XHCI_HCD=y CONFIG_X86_X32=n EOF make olddefconfig grep -vE '^#' .config | sort -V > .config.clean diff -u config-huge.clean.txt .config.clean echo $MAKEFLAGS time make > ../linux-$ver.$extra.log && echo BUILT ls -ldF /lib/modules/$ver.$extra/ rm -rf /lib/modules/$ver.$extra/ time make modules_install >/dev/null && echo MODULES INSTALLED
and if you need to run that kernel on that very same machine where you built it from
cp -fv arch/x86/boot/bzImage /$ver.$extra.config cp -fv arch/x86/boot/bzImage /$ver.$extra.vmlinuz ln -svf $ver.$extra.vmlinuz /vmlinuz
otherwise I usually pack it up as such
mkdir -p /data/kernels/ cp -fv arch/x86/boot/bzImage /data/kernels/$ver.$extra.vmlinuz cp -fv .config /data/kernels/$ver.$extra.config time tar -C /lib/modules/ -I 'zstd -T0' -cf /data/kernels/$ver.$extra.modules.tar.zstd $ver.$extra/ time tar -C /usr/src/ -I 'zstd -T0' -cf /data/kernels/$ver.$extra.source.tar.zstd linux-$ver.$extra/
real 23m46.416s user 671m12.823s sys 61m14.924s # tar modules real 0m18.271s user 0m5.201s # tar source sys 0m1.875s real 0m7.675s user 0m47.714s sys 0m13.131s
ver=... config=... wget https://pub.nethence.com/bin/xen/build0.bash chmod +x build0.bash ./build0.bash linux-$ver $config #./build0.bash linux-5.16.20.tar config.txt reiser4-for-5.16.patch.gz
Xen https://wiki.gentoo.org/wiki/Xen
Mainline Linux Kernel Configs https://wiki.xenproject.org/wiki/Mainline_Linux_Kernel_Configs
Kernel/Traditional compilation https://wiki.archlinux.org/index.php/Kernels/Traditional_compilation
Complete Handbook/Building the Linux kernel https://wiki.gentoo.org/wiki/Complete_Handbook/Building_the_Linux_kernel
What exactly does Linux kernel’s make defconfig do?
https://stackoverflow.com/questions/41885015/what-exactly-does-linux-kernels-make-defconfig-do
CONFIG_IKCONFIG: Kernel .config support https://cateee.net/lkddb/web-lkddb/IKCONFIG.html
Kernel/IKCONFIG Support https://wiki.gentoo.org/wiki/Kernel/IKCONFIG_Support
Chapter 8. Customizing a Kernel https://www.linuxtopia.org/online_books/linux_kernel/kernel_configuration/ch08s02.html
tools/make-kernel-config https://github.com/juergh/tools/blob/master/make-kernel-config
Kernel/Configuration https://wiki.gentoo.org/wiki/Kernel/Configuration
Universal TUN/TAP device driver. https://www.kernel.org/doc/Documentation/networking/tuntap.txt
Obtain kernel config from currently running Linux system? https://superuser.com/questions/287371/obtain-kernel-config-from-currently-running-linux-system
Use the OverlayFS storage driver https://docs.docker.com/storage/storagedriver/overlayfs-driver/
Verify your Linux Kernel for Container Compatibility https://blog.hypriot.com/post/verify-kernel-container-compatibility/
https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel
https://help.ubuntu.com/community/Kernel/Compile
https://wiki.ubuntu.com/KernelTeam/GitKernelBuild
https://imil.net/blog/posts/2022/build-a-single-in-tree-linux-kernel-module-debian--clones/
https://github.com/torvalds/linux/blob/master/net/netfilter/Kconfig