1

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:

  1. brand new install of Debian 11 from the .iso
  2. download what I believe is as close to the same kernel source from kernel.org.
  3. build,
  4. 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:

  1. 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.
  2. 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:

longterm:   5.10.93 

So, these are the commands I'm using:

wget https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.10.93.tar.xz
xz -cd linux*.tar.xz | tar xvf 
cd linux-5.10.93/
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
make -j11
sudo make modules_install
sudo make install
sudo reboot

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

cd linux-5.10.92/

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

sudo reboot

Thanks for the help.

7
  • What do you want to achieve? Replace the standard kernel? Install your locally built kernel as a new entry in grub? Maybe you should use the corresponding kernel-source Debian package instead of a plain kernel.org version. Please edit your question to add the requested information, don't use comments for this purpose.
    – Bodo
    Jan 26, 2022 at 15:07
  • I'm not sure if the edits help, but hopefully that makes my goal clearer. Jan 26, 2022 at 15:19
  • I did not complain that your question might not be valid. I only want to understand what you want to do. There are instructions about using a vanilla kernel on Debian that suggest to use make deb-pkg or make-kpkg. See e.g. krenger.ch/blog/debian-with-a-vanilla-kernel.
    – Bodo
    Jan 26, 2022 at 15:37
  • I'm trying to follow the Debian instructions, but not having a lot of luck. The first several steps work fine, but I don't really understand which of the later sections apply. For example: 4.2.4. Building many packages Should I do this? 4.2.5. Building packages for one flavour Or this? 4.3. Building a development version of the Debian kernel package Or this? 4.4. Generating orig tarball from newer upstream Probably not this. 4.5. Building a custom kernel from Debian kernel source This looks likely. Jan 26, 2022 at 19:06
  • Your last comment seem to be related to the answer. 4.2.4 build all possible packages for this architecture looks good, also 4.5
    – Bodo
    Jan 26, 2022 at 19:11

1 Answer 1

1

I would recommend using Debian's documentation for building kernels;

https://kernel-team.pages.debian.net/kernel-handbook/ch-common-tasks.html#s-common-official

You likely want to be building from a kernel source package, rather than from 'pristine' kernel.org linux kernel sources. The way you are trying to build the kernel isn't really recommended.

you can also find preempt-rt kernel packages and kernel source packages for debian 11 / bullseye right here;

https://packages.debian.org/bullseye/linux-image-5.10.0-10-rt-amd64

you should be able to use this as a template to build proper -rt packages for Debian. I'd recommend going down this path, rather than mucking around with kernel.org sources and doing everything manually.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .