Home > Linux > Hacking the Linux 2.6 Kernel, Part 1 Hacking the Linux 2.6 Kernel, Part 1 Submitted by anonymous 2005-07-21 Linux 29 Comments In this first of a two-part series, learn about system and environment requirements, the best ways to acquire Linux source code, how to configure and boot your new kernel, and how to use the printk function to print messages during bootup. About The Author Thom Holwerda Follow me on Twitter @thomholwerda 29 Comments 2005-07-21 4:02 pm Ok, maybe I read through it too fast. However, how is it that I go from configuring the kernel straight to installing my new kernel? Shouldn’t there be a section on compiling my kernel (along with compiling my modules)? 2005-07-21 4:36 pm smitty_one_each Boot from a live CD and use http://ezix.sourceforge.net/software/lshw.html to figure out WTF your hardware. Kernel configuration can be exciting. Why can’t I burn a CD on an ATA device? Oh, SCSI compiled into kernel… I’d like to see more depth on the initrd. This is among the better treatments I’ve seen: http://www.linuxfromscratch.org/lfs/view/development/chapter07/udev… 2005-07-21 6:35 pm Good stuff, thanks, but what I really would like to see is more on initramfs. 2005-07-21 4:37 pm MrEcho ya, that was a waste of time. I was hoping for some cool boot parms or something. 2005-07-21 6:25 pm Using initrd is rather pointless and for distributors. See my tutorial in PDF format http://www.linuxforum.com/forums/index.php?showtopic=152070 2005-07-21 6:47 pm As a normal linux user, you already will need to how to compile your kernel – unless you are satisfied with the distributor one. 2005-07-21 8:11 pm The stock kernel is full of crap I don’t need and I’m not recompiling to get stuff out. 2005-07-21 8:44 pm rayiner Um, I’m a “normal Linux user” and I haven’t compiled a kernel in quite while. There is really no reason to anymore, the distributor kernels are all modular these days, so they’ll only load what you need. 2005-07-21 9:23 pm klynch What happens if you get a new piece of hardware that happens to not be supported “out of the box” by your distributor (but is by Linux)? Usually the only way to do this is to recompile the kernel to support the hardware. 2005-07-21 9:50 pm Phil It would be very strange if that happened, as most distros build the whole thing. On the odd occasion though, such as a when a driver hasn’t been accepted into the tree, it’s normally possible to just build one single driver as a kernel module. 2005-07-21 11:43 pm >> What happens if you get a new piece of hardware that happens to not be supported “out of the box” by your distributor (but is by Linux)? Load the proper module or use DKMS ! 2005-07-22 12:26 am rayiner Is that a serious question? How often does that really happen? It takes a significant amount of time for new drivers to appear in the mainline kernel, and by the time they appear, a new version of the distro is usually available. Desktop distros are aligned on a 6-month release cycle. What’re the odds that hardware is going to come out, have Linux drivers developed for it, and you’re going to buy it within that timeframe? Especially considering the fact that: a) A lot of hardware drivers are generic, supporting families of hardware rather than specific devices. This is especially true for USB or Firewire devices. b) Most big distros have some sort of backport mechanism for updating the drivers supported by the kernel. I can see the problem you’re describing happening to a user who doesn’t read the HCL, but to be honest, in years of using Linux, it’s never happened to me. 2005-07-21 7:47 pm klynch If you are interested in learning about how the kernel works, http://www.kernelnewbies.org/ is a good site to look at. It has a lot of good articles covering varying levels of knowledge about the Linux Kernel. 2005-07-21 9:56 pm Milo_Hoffman >What happens if you get a new piece of hardware that >happens to not be supported “out of the box” by your >distributor (but is by Linux)? Ahh…I see this as being more of a ‘WINDO-ISM’ than anything else. Its hard for people to let go of their old habits of going and downloading drivers from a dozen different places, installing from 20 cd’s etc just to get their hardware to work right. Thats the “windows way”. Linux supports more hardware out of the box than any other OS. In the Linux world, your hardware is basically supported or its not. Normal users are NEVER expected to add hardware support to their kernel themselves, thats what hardware compatibility lists are for. There are a couple of exceptions for some vendors who have automated the install of their hardware support so non-technical people can perform the install such as Nvidia, ATI etc.. but generally speaking a Linux “user” should never have to install a “driver” like the way you do with an OS that has such poor hardware support out of the box as Windows. 2005-07-21 11:07 pm Varg Vikernes I seriously don’t know if you’re trolling or are you just stupid? Because no other person could have written something like: Linux supports more hardware out of the box than any other OS. 2005-07-25 6:21 pm Well it does, Windows doesn’t support nForce, via out of the box and thats to name a few. I relies on drivers which you need to install. 2005-07-21 11:42 pm >> installing from 20 cd’s etc just to get their hardware to work right. It’s just because Windows XP was born in 2001 and your linux distribution has been created 2 minutes ago. 2005-07-22 6:06 am Devon — “It’s just because Windows XP was born in 2001 and your linux distribution has been created 2 minutes ago.” And whos fault is that??? The only fair comparison is between the most current versions available. If in Windows case its one from 2001, well then Microsoft made their own bed, didn’t they? The fact still remains that a current linux distro supports FAR more hardware out of the box, especially newer stuff, then Windows. 2005-07-22 1:17 pm zombie process Lets not forget the almighty SP2 either. If MS could tout that SP2 in nearly an entirely new OS then, I can certainly make comparisons between a recent linux and SP2. Oh, and burzum sucks shit. 2005-07-22 5:35 pm It’s nobody’s fault. Windows is an OS released on a commercial basis with substantial driver testing which pales compared to the open source world. Windows by default supports way more hardware than any Unix or Linux version simply because it is the dominant operating system. Now, this little fact of the world might not sit well with your fanboy mentality, but nontheless it is the state of the world. And I really doubt you have even written device drivers yourself (like I have, albeit on non-Linux system) otherwise you wouldn’t make such silly claims. You forget the fact that if you compare Windows from 2001 to a Linux from 2001 that neither will support devices from the last few years adequately. And if you will harp, like you do, about a current, NOTE: current, Linux distribution you are comparing apples and oranges. 2005-07-22 6:46 pm I don’t think its apples and oranges its comparing the latest versions I can go out and buy of either OS. Its just one of the many advantages linux has over windows. Windows has its advantages too but for total hardware support “out of the box” linux has windows beat hands down. 2005-07-22 12:30 am Hmm Just checked the link from IBM https://www14.software.ibm.com/webapp/iwm/web/preLogin.do?source=dw-… and did not work > ? 2005-07-22 12:47 am Upsss Fix the problem in Firefox 😉 2005-07-22 2:10 am I would consider myself a normal user of GNU/Linux and 99.99% of stock distros provide excatly whats needed for my hardware, with the expection of debian. The only kernel compiling I do is for embedded ARM work. 2005-07-22 8:20 am MS Windows => registering required => more features! IBM site => registering required => more features! ————————————– Linux => registering not required => less features? Free Internet => registering not required => less features? OSNews site => who’s side are you on? 2005-07-22 1:44 pm Any direct links? Somebody? 2005-07-22 3:44 pm Dark_Knight It would be nice for OSNews articles to not require additional registration just to read the article. It’s actually pointless when considering readers can read articles on most sites with out requiring registration. Understandable if it’s a requirement for users to post comments but if not then no sign up should be required. 2005-07-22 4:56 pm I totally agree. 2005-07-25 6:27 pm You’d be surprised how many distrubutors dont enable features like Preemption, 4kstacks which can speed up the desktop, SuSE and Madriva being two. Preemption option in 2.6.12-rc really does make things run smoother and more reliable like it says. Also turning off debug and stripping out stuff you dont need makes for better operation.