Would like advice on compiling the kernel

Kernels & Hardware, configuring network, installing services

Would like advice on compiling the kernel

Postby bedtime » 2020-07-04 13:42

Since I have extra time I've decided to compile my own kernel using this method:

https://debian-handbook.info/browse/stable/sect.kernel-compilation.html

It's basically the Debian way of compiling and installing the kernel, which involves making a kernel package and installing it as a .deb package. It's worked for me so far, but from previous experience, I know that things can get messed up if certain commands are not used.

Questions:

1. After I've configured the .config file with make menuconfig and issued a make deb-pkg, what package/packages do I need to install (using dpkg -i)? I see that there are 3 kernal-based packages:

Code: Select all
linux-image-4.19.118_4.19.118-2_amd64.deb
linux-headers-4.19.118_4.19.118-2_amd64.deb
linux-libc-dev_4.19.118-2_amd64.deb


Can I just install the one main kernal file (linux-image-4.19.118_4.19.118-2_amd64.deb)?

2. After compiling and rebooting into the new system, if all things are good, I want to take continue making chances to the .config file and then make and install the kernel. What do I need to do to make sure that everything will be updated and that the kernel will be install properly?

For example, I currently do:
Code: Select all
make clean
make deb-pkg j7
dpkg -i linux-image-4.19.118_4.19.118-2_amd64.deb


Do I need to do run 'make distclean'?

Also, any general advice would be much appreciated.
bedtime
 
Posts: 112
Joined: 2012-12-16 19:34

Re: Would like advice on compiling the kernel

Postby stevepusser » 2020-07-04 18:48

If you want a real Debian kernel built the way Debian builds it, you rebuild it like any other package--with the Debian packaging tools from the Debian source files--like this backported 5.7 kernel for Buster: https://build.opensuse.org/package/show ... source-5.7

Note that the backport from upstream requires some special tweaks I detail in the debian/changelog file, and the Debian kernel build process takes several times as long as your generic method, as well as needs more than 60 GB of free drive space. You don't have to tweak an existing Buster or buster-backports kernel source to build, though.
MX Linux packager and developer
User avatar
stevepusser
 
Posts: 12132
Joined: 2009-10-06 05:53

Re: Would like advice on compiling the kernel

Postby bedtime » 2020-07-04 21:04

stevepusser wrote:If you want a real Debian kernel built the way Debian builds it, you rebuild it like any other package--with the Debian packaging tools from the Debian source files--like this backported 5.7 kernel for Buster: https://build.opensuse.org/package/show ... source-5.7

Note that the backport from upstream requires some special tweaks I detail in the debian/changelog file, and the Debian kernel build process takes several times as long as your generic method, as well as needs more than 60 GB of free drive space. You don't have to tweak an existing Buster or buster-backports kernel source to build, though.

After having to reinstall all my data twice in the past few months, and having to fix broken headers and reinstall the kernel just now, I figure I'm just going to leave it alone.
bedtime
 
Posts: 112
Joined: 2012-12-16 19:34

Re: Would like advice on compiling the kernel

Postby Bulkley » 2020-07-04 22:13

bedtime wrote:After having to reinstall all my data twice in the past few months, and having to fix broken headers and reinstall the kernel just now, I figure I'm just going to leave it alone.


I suggest you make a habit of keeping two kernels, the most recent and an older one you know to be reliable. Doing so gives you a fallback when necessary. It also helps for testing other problems.
Bulkley
 
Posts: 6016
Joined: 2006-02-11 18:35

Re: Would like advice on compiling the kernel

Postby stevepusser » 2020-07-06 04:02

Yeah, what do I know? I've only been backporting kernels and drivers for MX Linux for years now. :)
MX Linux packager and developer
User avatar
stevepusser
 
Posts: 12132
Joined: 2009-10-06 05:53

Re: Would like advice on compiling the kernel

Postby cuckooflew » 2020-07-06 05:34

Am I missing something here ?
First the OP says:
by bedtime »(partial quote>
It's basically the Debian way of compiling and installing the kernel, which involves making a kernel package and installing it as a .deb package. It's worked for me so far, but from previous experience, I know that things can get messed up if certain commands are not used.

"It's worked for me so far", but then they say :
Do I need to do run 'make distclean'?

Also, any general advice would be much appreciated.

If it has worked for you so far, Why the need to ask ? But then, in the next post they make:
by bedtime » 2020-07-04 21:04>>>After having to reinstall all my data twice in the past few months, and having to fix broken headers and reinstall the kernel just now, I figure I'm just going to leave it alone.

This does not sound like it has worked so far, or ever worked at all, but then also if you are just going to give up, and leave it alone, which if it is working , probably is a good idea, .....but I don't understand why the topic was started in the first place ? Maybe I have missed something here, so apology in advance....I just can't make sense of it.
As for the question,
Do I need to do run 'make distclean'?

============================================
From: https://debian-handbook.info/browse/stable/sect.kernel-compilation.htmlNOTE Clean up before rebuilding
If you have already compiled once in the directory and wish to rebuild everything from scratch (for example, because you substantially changed the kernel configuration), you will have to run make clean to remove the compiled files. make distclean removes even more generated files, including your .config file too, so make sure to backup it first. If you copied the configuration from /boot/, you must change the system trusted keys option, providing an empty string is enough: CONFIG_SYSTEM_TRUSTED_KEYS = "".

Also, any general advice would be much appreciated.

Try reading the tutorial more careful,eg:
make distclean removes even more generated files, including your .config file too, so make sure to backup it first.
also listen to people like stevepusser, and the others, also practice makes perfect, keep trying, eventually you will compile one that works, then stick with the method that works. If you have a problem and it does not work, post something more specific then this, and explain details as to what went wrong. On the other hand, maybe you should just leave it alone, especially if it is wroking. :mrgreen:
Please Read What we expect you have already Done
Search Engines know a lot, and
"If God had wanted computers to work all the time, He wouldn't have invented RESET buttons"
and
Just say NO to help vampires!
cuckooflew
 
Posts: 683
Joined: 2018-05-10 19:34
Location: Some where out west

Re: Would like advice on compiling the kernel

Postby stevepusser » 2020-07-07 02:53

I'm willing to walk you through recompiling the Liquorix kernel the real "Debian" way, since that takes only a fraction of the time that the Debian kernel does to build. Or you can

Is this a learning experience only, since you're not making any changes to the kernel? Do you want a newer kernel version? If you're building the latest 5.7 kernel release, are you aware that many drivers in Debian Buster won't build on it, such as Nvidia drivers? If that's not the case, why not learn to do it the real Debian way--learning to rebuild packages and backport is a useful skillset. Your pet distro could make it to the top of the Distrowatch click-through rankings! :)
MX Linux packager and developer
User avatar
stevepusser
 
Posts: 12132
Joined: 2009-10-06 05:53


Return to System configuration

Who is online

Users browsing this forum: No registered users and 6 guests

fashionable