Build x86_64 linux kernel on ubuntu how to: =========================================== Get the latest kernel at: https://www.kernel.org/ Can download kernel using wget for cli access. tar -xvf linux*xz sudo apt-get install git fakeroot build-essential ncurses-dev xz-utils libssl-dev bc flex libelf-dev bison cd linux-X.X.X *Get your all ready configured kernel setting (from previous made or official Ubuntu by): cp -v /boot/config-$(uname -r) .config make menuconfig *For ubuntu you must remove keys (requires secure boot in UEFI to be disabled after): scripts/config --disable SYSTEM_TRUSTED_KEYS scripts/config --disable SYSTEM_REVOCATION_KEYS *On Ubuntu 23.10, you may need these packaged installed in order to compile: sudo apt install libelf-dev Mow build: make -j$(nproc) -o2 Then install moduals: sudo make modules_install Strip unnessacary data from moduals to help prevent "out of memory" right on boot of new kernel: sudo su cd /lib/modules/ find . -name *.ko -exec strip --strip-unneeded {} + exit sudo make install sources (OG): https://phoenixnap.com/kb/build-linux-kernel https://forum.manjaro.org/t/cannot-switch-kernel-errors-out-of-memory-and-you-need-to-load-the-kernel-first/62575/13 https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1842320 https://unix.stackexchange.com/questions/120198/how-to-fix-boot-into-initramfs-prompt-and-mount-cant-read-etc-fstab-no-su https://unix.stackexchange.com/questions/270390/how-to-reduce-the-size-of-the-initrd-when-compiling-your-kernel Date (OG): December 6th 2022. Sources (Update 1): https://github.com/sslab-gatech/opensgx/issues/20 Date (Update 1): October 3rd 2023.