LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-03-2016, 03:57 PM   #1
hooftey
LQ Newbie
 
Registered: Aug 2016
Posts: 3

Rep: Reputation: Disabled
Every PC is unique like DNA, tailored or generic Kernel?


Is there a benefit to compiling your own Kernel on the machine you plan to use it on?
 
Old 09-03-2016, 04:14 PM   #2
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
No, not if you don't need to (which for the vast majority of people is the case).

Every PC, hardware-wise, isn't unique, and the standard Linux kernel can handle most hardware combinations out there.
 
Old 09-03-2016, 04:14 PM   #3
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Building the kernel and kernel drivers used to be a basic task of *nix administrator. I always build my own, because my distro does not provide one and because I can. Your custom kernel will be much leaner than stock and there is no need for initrd.
 
1 members found this post helpful.
Old 09-03-2016, 04:38 PM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,978

Rep: Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624
Yes, no and maybe.

Hello and welcome to LQ by the way.

A custom kernel could improve your system depending on a number of things. One is you'd have to know how to configure it to support the system you are using.

A custom kernel has minimal impact on a home user usually.

Many times people could use a custom kernel for improvements to video or networking.
 
Old 09-03-2016, 06:25 PM   #5
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
There is no real performance improvement by doing your own. The customization that used to be helpful has been taken over by the loadable device drivers.

the current kernel only has 3 maybe 4 drivers built in - keyboard/vga video/ramdisk/ and sometimes USB. Everything else gets loaded from the initrd that is loaded with the kernel (it is used as a root filesystem). Once the real root is identified it can then have the appropriate filesystem loaded, then mounted. Once the switch to the real root occurs any additional drivers/modules needed can be loaded during the system start.

It is possible to speed some the boot by building in the root filesystem and drivers for the disk. This allows you to skip the initrd processing and go directly to the real root. This can knock of between 5-7 seconds (not that noticable). The disadvantage is that if you have to change motherboards and such - the system won't necessarily boot.

Last edited by jpollard; 09-03-2016 at 06:28 PM.
 
Old 09-03-2016, 08:04 PM   #6
hooftey
LQ Newbie
 
Registered: Aug 2016
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thank You everybody, Believe it or not all your responses make sense in their own way. I guess it comes down to, the time, the work, and the benefits.
Something to sleep on.
 
Old 09-03-2016, 08:08 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,978

Rep: Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624
It may be worth the effort to build a kernel just to say you did it.

People who run servers sometimes like to make their own kernel to suit the processing task and hardware.

Might peek at this for some small part of a kernel build. https://wiki.gentoo.org/wiki/Kernel/...guration_Guide


Custom kernels are not real easy to use like a distro's kernel might be. They tend to be almost useless on hardware changes.

A few pro's and a lot of con's in the real world use of custom kernels. You see some folks here always like to make them and they get good at it.
 
Old 09-03-2016, 08:26 PM   #8
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
The only reason to actually use a custom kernel is if you need a patch just put out - and need it for functionality (such as drivers) or for a security issue you MUST have covered.

When you have that need, the easiest way to build the kernel is to copy the configuration file that is with every kernel. Usually stored in /boot with the same version number as used by the distribution kernel.

Then do a "make menuconfig" (or "make oldconfig") - and continue with the build. This ensures that the configuration of the kernel matches that of the distribution kernel. You STILL have to be careful because sometimes the kernel may update the kernel structures that no longer match some rather tightly integrated tools (I found the VM support changed... and virtual machines could no longer be run until the user space tools had been updated). But other than this, there should be no real problem.

I have had to do this before - some for updated drivers for specific peripherals, some for rather exotic bugs. Usually there is no problem between userspace and the kernel (the VM changes I experienced was due to some security bugs being fixed - and that required changes to the tools). More significant changes happen with the major number change (which doesn't happen that often), even then, the changes usually have no issues with user space tools. Usually this just adds new features - but your configuration would tend to have new features disabled by default anyway.
 
Old 09-03-2016, 09:07 PM   #9
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
If you build your own, you lose the security updates when you update your distro. It used to be worth it to have the "extra" opcodes for your cpu type. But these days, unless you have an atom chipset that has "fewer" opcodes and would crash with a stock kernel, it's not needed. It depends on the application though. The make localmodconfig option can really slim down a kernel on embedded systems. Or otherwise lockdown a system by disabling usb ports by not including the modules. Or overcoming annoyances of various distros, like nfs not as a module in raspbian. Wasting limited ram and cpu cycles on something you're probably not using. *sigh*
 
Old 09-03-2016, 09:24 PM   #10
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939
Well, on one machine I had (*sniff* Old Dobbin ... which lives-on only in a disk drive now ...), I did compile a custom kernel, and got rid of the entire "initrd" sequence thereby. It became a game to see how fast I could get it to boot: I got it down to six seconds flat.

Not bad for a machine that had been sold with Windows 95.

I did it because I wanted to do it (using the Gentoo source-code based distribution, which meant that I actually compiled everything ...), but no, you generally don't have to do it.
 
Old 09-04-2016, 05:23 AM   #11
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Quote:
Originally Posted by Shadow_7 View Post
If you build your own, you lose the security updates when you update your distro. It used to be worth it to have the "extra" opcodes for your cpu type. But these days, unless you have an atom chipset that has "fewer" opcodes and would crash with a stock kernel, it's not needed. It depends on the application though. The make localmodconfig option can really slim down a kernel on embedded systems. Or otherwise lockdown a system by disabling usb ports by not including the modules. Or overcoming annoyances of various distros, like nfs not as a module in raspbian. Wasting limited ram and cpu cycles on something you're probably not using. *sigh*
Shouldn't - unless there is a compiler bug.

And if you are not using the USB for mouse/keyboard, you can remove the module (usually), or remove the driver module for the usb device... No need for custom build.

Raspbian is already an embedded kernel. There is no initrd to load optional drivers from so the drivers HAVE to be builtin. Though I grant, it would be possible to load NFS. And unfortunately there are a number of missing drivers - having iscsi for instance would useful to use a server for large disks... or remote DVDs. Using an embedded form does save some storage space (the initrd is frequently around 5MB, which can put some pressure on a 4GB sdcard, specially when that sdcard may hold 2 boot systems.

Last edited by jpollard; 09-04-2016 at 05:25 AM.
 
Old 09-04-2016, 12:16 PM   #12
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
Quote:
Originally Posted by jpollard View Post
Shouldn't - unless there is a compiler bug.
Older atom chipsets lacked the moov instruction (cmoov?). Which would crash randomly depending on the kernel / distro in use. Something I ran into while trying to dd a partition on my dads old laptop on ubuntu 14.04. It depends on the options used at compile time as the debian generic kernel didn't have that issue.
 
Old 09-21-2016, 03:31 AM   #13
hooftey
LQ Newbie
 
Registered: Aug 2016
Posts: 3

Original Poster
Rep: Reputation: Disabled
Kernel my own

I guess it comes down to, Doing it just to see if I can. That is pretty much how I know what I know. I know this is way off base but I tore an automatic transmission apart and rebuilt it. I got it correct the first time, gave me a sense of pride. Same thing here.
 
Old 09-21-2016, 07:21 AM   #14
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
This can be fun. If you are the type. I do make allnoconfig and start adding options/drivers I need. If there is something I do not know - there always is - I look it up. Configuring the kernel this way takes long time ... and I enjoy every minute of it. In the end you know alot more about hardware.
 
Old 09-21-2016, 05:00 PM   #15
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,978

Rep: Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624
I used to play with Gentoo and they used to have you build your system. I think it is worth the effort to at least do it once or twice to see.

My very first build was a BSD kernel some very long time ago.

Today we still point towards Linux From Scratch and is a great learning tool and functional distro.

Last edited by jefro; 09-21-2016 at 05:02 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] setting up initrd / generic kernel in Grub2...can't load generic Ubunoob001 Slackware 12 03-20-2015 07:32 AM
[SOLVED] Kernel Panic with generic kernel on Dell poweredge 2850 Slackware 14.1 Dieselchair Slackware 44 08-22-2014 06:46 PM
kernel-generic and kernel-generic-smp ?? liuyug Slackware - Installation 5 06-01-2014 07:01 PM
slack 12, switch to generic kernel from huge kernel, using grub? jaguarrh Slackware 8 09-19-2007 06:29 AM
ATI Driver's Tailored Kernel Module tricky_linux Linux - Software 9 10-20-2003 07:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration