Why Compile a Linux Kernel from Source?

29,263
0
Published 2024-03-06
I have had a few requests to walk through a linux kernel source build from start to finish, so today I am going to use Debian 12 stable as my starting point and I am going to compile and install the lated (as of today) Linux Kernel 6.7.9. I will also discuss some of the reasons why you might want to compile a Linux Kernel in this video.

Linux Kernel Documents: docs.kernel.org/

AI thumbnail: One of the most fascinating of all the trades a blacksmith working a forge to create something from a lump of metal.

Chapters
00:00 - Why Compile the Linux Kernel From Source?
05:01 - Retrieve the Linux Kernel Source Code
06:08 - Install Build Packages
10:00 - Compile TIme Errors
10:25 - Fixing the Error
11:22 - Install the Modules
11:49 - Make Install (Copy to /boot)
11:57 - Reboot
12:09 - Verify the Kernel is Working
12:48 - Final Thoughts

Support me on Patreon: www.patreon.com/DJWare
Follow me:
Twitter @djware55
Facebook:www.facebook.com/don.ware.7758

Gitlab: gitlab.com/djware27

All Comments (21)
  • @CyberGizmo
    Many of you who watch this channel know I use VM's for playing around, learning stuff and in this case compiling a linux kernel on a Debian 12 VM. My workstation is Fedora KDE which runs under Asahi Linux on a Mac Mini...so that is just how I roll. So suspicious .... I never ever put a new kernel on hardware until I have tested it out...one thing I do not need is a kernel build which fails, breaks or mutalates my data...
  • @604Nighthawk
    I fondly remember 20 - 30 years ago when the only way to add drivers was to recompile the kernel. (Before kernel modules were added)
  • @SajjadRizvi77
    Ability to compile your own kernel from source is a privilege in a world of today where everything is served to you based on general user requirements
  • @dingokidneys
    I first compiled a kernel in the mid 1990's. I had an old 386DX machine and wanted to have as stripped down a kernel as I could get so there were more resources for the stuff I was trying to do. Many hours and many broken compiles later I had something that worked and I felt great that I'd achieved that. The hardware was a lot simpler in those days and working through menuconfig wasn't as daunting a prospect as it would be today; I haven't tried a kernel build recently. I might just have to give it another shot, just for old time's sake.
  • @m1k3e
    Just compiled the latest version of the NetBSD 9.3 kernel for an old 486 system that was upgraded to an 83 MHz Pentium Overdrive. Compiling it myself reduced the footprint to <2 MB and built in ISA bus support. Worked perfectly!
  • @theplaymakerno1
    My favorite YouTuber providing us more useful information! Thank you for existing, sir!
  • @isopticon
    I love the Fedora icon for the KDE menu panel. Thank you for this great tutorial, I think we need more of this. You probably don't appriciate how much value your little tutorials have. Watching someone who did that gazillion times is completely different from watching tutorials by people who make tutorials. We can learn from your knowlege and experience, it's very much appriciated.
  • As a Gentoo user for 21 years now, compiling kernels for me is "par for the course" - once you have a good and working kernel config then just re-using that every time you upgrade works pretty flawlessly. Every couple of years I do try to streamline the configuration because of "bloat" due to blindly accepting default options when doing a "make oldconfig" to upgrade a config to a newer kernel release.
  • @whtiequillBj
    a good reason to compile the kernel is if you are using Linux From Scratch or Gentoo. There may be a few other distros too.
  • @drkskwlkr
    Due to the weirdness of YouTube algorithms, I hadn't watched a Cybergizmo episode for several months. Totally loving the beard!!
  • @abobader
    Nice one DJ, many thanks for this, sure indeed bring some old memories, well done!
  • @Torviticus
    Great video, I've never built a kernel outside Gentoo neat to see. I assumed it was both possible and well supported but id never tried... Must be nice not having to manually update grub config and initramfs.
  • @repairstudio4940
    You sir are absolutely awesome! This was most educational. I always look forward to all your content, thank you! 🎉
  • @Appalling68
    Hey DJ. Well this video was just fascinating. Thank you for this!!
  • @AntonioGallo73
    Last time I recall compiling custom kernel was for Asterisk's PBX because some phone card drivers requires unofficial kernel patches to be applied.
  • @No-no-no-no-nope
    It's funny that there are still magazines with Linux on DVD. I got my first PC with Windows 95 pre-installed when I was 13/14. I immediately unscrewed it because Windows kept crashing. Of course, it wasn't the hardware, so I went to the gas station and bought a booklet with a Linux CD. The magazine contained instructions on how to compile Linux. It was a bit more complicated, but at least the 133 MHZ, 16MB computer ran without any problems. Well, 26 years later I still use Linux.
  • @robertleemeyer
    Thanks, DJ! I just happened to be compiling 6.7.9 this week as I'm working on some new drivers for prototype hardware. Very timely!
  • @Nixima81
    Interesting info. Never crossed my mind that you can compile you're own kernel and that could easily become Pandora's box later down the road. I'm only 3+ years in atm so it's a later project but something to think about. Thanks for sharing.
  • That's why I am a Slackware user. Compiling your own kernel or just software in general is very easy to do with Slackware.