My overall objective is to build an RT_PREEMPT kernel that I can modify. As an intermediate step, I'm trying to build and install (and run as a grub entry) a generic, non-RT_PREEMPT kernel. But I think the question below is valid, even without mentioning RT_PREEMPT.
Here's the scenario:
- brand new install of Debian 11 from the .iso
- download what I believe is as close to the same kernel source from kernel.org.
- boot fails with:
Loading initial ramdisk ...
error: out of memory.
Press any key to continue ...
If I press a key, the process continues briefly before the kernel panics because it can't mount root. I'm new to Linux, but this seems like such a basic thing that it should work. So I'm doing something wrong, but don't know what it is. The out of memory error seems not that common, so here I am asking for help. Here are more details of my process:
- download the .iso from debian.org (debian-11.2.0-amd64-netinst.iso) and install. The install is totally generic, and they only thing I add is KDE and SSH.
- log in and run uname -a. The output looks like:
Linux sdcc13 5.10.0-11-amd64 #1 SMP Debian 5.10.92-1 (2022-01-18) x86_64 GNU/Linux
This part is a little confusing, but I think this means that this is a version 5 kernel, patch level 10 and sublevel 92. On kernel.org, I think the closest version is:
So, these are the commands I'm using:
xz -cd linux*.tar.xz | tar xvf
cp /boot/config-$(uname -r) .config
sudo apt-get install git fakeroot build-essential ncurses-dev xz-utils libssl-dev bc flex libelf-dev bison
sudo make modules_install
sudo make install
And then the reboot fails as described above. I do have to edit the
.config to fix the CERT issue, but I don't change anything else. This seems incredibly generic, and it seems like it should work, so any help is appreciated. I've also tried
make menuconfig, and
make oldconfig as part of this process, but the result is the same. What am I missing?
I finally got the Debian instructions to work (with a few added lines). So, to build the same kernel that's on a stock debian 11 system, here is what I did. The scariest part is that you have to remove the stock kernel, so better to have at least one different kernel before doing this:
sudo apt-get install build-essential fakeroot
sudo apt-get build-dep linux
apt-get source linux
fakeroot make -j10 -f debian/rules.gen binary-arch_amd64
sudo apt remove --purge linux-image-5.10.0-11-amd64-unsigned
sudo dpkg -i linux-image-5.10.0-11-amd64-unsigned_5.10.92-1_amd64.deb
Thanks for the help.