I'm trying to build Linux kernel from scratch.
My current system with an Intel Xeon Gold 6242 CPU, running Linux 5.4.0-050400-generic kernel on Ubuntu 20.04.3 LTS.
The steps I have followed to build the kernel are as follows:
cd /path/to/new/kernel/source
(the source hasn't been modified after download)cp -v /boot/config-5.4.0-050400-generic ./.config
make menuconfig
, load and save the copied.config file
(the.config
contents don't really change but the order of lines do change)make -j32
make modules_install install
Everything runs fine with no errors until I eventually do reboot and when I choose the new kernel to boot with, it fails with the following message:
Here are some other options I have tried to get it to work:
- Build Linux 5.18.0 from source (because Ubuntu 20.04.3 LTS uses Linux 5.4 as its main kernel so I thought maybe versions from the past might not work): fails with the same error message
- Instead of copying the
.config
file that is already in use, just make a new.config
file withmake menuconfig
and not loading/saving from an existing.config
file: fails with the same error message - Instead of building kernels from source, try to install a new kernel directly from the Ubuntu mainline kernels: works fine (Linux 5.15.0)
I have checked out some similar questions like Compiling the Linux kernel and booting with UEFI, not syncing: VFS: Unable to mount root fs on unknown-block(0,0), and Unable to boot using self built kernel but haven't had any luck.
One last thing: this is a duplicate question from Reddit I posted a few days ago, but am reposting here because unfortunately I haven't received much help there.
Any suggestions will be greatly appreciated. Thanks!