Compiling the kernel with additional patches


Recommended Posts

(I know there's already a thread on this subject, but this one is also about extra kernel patches. Mods, do with it as you wish :p )

Compiling the kernel and adding patches

---------------------------------------

There are many possible reasons for wanting to compile a kernel with additional patches. One can try new features, hope for a speed increase, require a security fix... In my case, I wanted to try the latest bcm43xx driver (I would like to run some tests and give feedback to the developers, and on top of that, the new driver is said to work better with my wireless card).

On request of h3xis, and keeping in mind that others might want to add patches before compiling their kernel, I've written this guide. I've recompiled my kernel on Ubuntu 6.10, so instructions for other distributions might be slightly different!

IMPORTANT NOTICE!! Compiling your kernel could cause damage to your system, especially if you use conflicting packages! So be very careful, and don't forget to make a back-up!

I've based this guide on this page, with a few differences.

If a command does not work, try it again with 'sudo' added at the beginning!

Note: if anything goes wrong, it's your own responsibility!

1. Installing the required packages for compiling the kernel:

sudo apt-get install build-essential bin86 kernel-package libqt3-headers libqt3-mt-dev wget libncurses5 libncurses5-dev && cd /usr/src

2. Downloading and unpacking the kernel:

First, go to http://kernel.org/pub/linux/kernel/v2.6/, and choose the kernel you wish to compile (normally, you'll need the most recent one). Download it and unpack it in /usr/src. You will then have a folder /usr/src/linux-VERSION.

3. Changing links:

Make sure you're in /usr/src right now.

We're going to remove the current symbolic link at /usr/src/linux, and replace it by a link to our new kernel (soon to be compiled). Then, we'll move into the /usr/src/linux directory.

It's possible you don't have a /usr/src/linux directory. In that case, you don't need to remove the symbolic link (however, you still need to do the rest of the step).

We'll do this by using the following code.

sudo rm -rf linux && sudo ln -s /usr/src/linux-VERSION linux && cd /usr/src/linux

4.A. Adding official kernel patches

It's possible that you already have the source of kernel 'VERSION.smallversion' on your computer, but would like to use kernel 'VERSION.smallversion+X' instead. You could download the entire source to kernel 'VERSION.smallversion+X' (over 50 MB), or you could download 'patch-VERSION.smallversion+1', 'patch-VERSION.smallversion+2' and so on (could be a few kB up to a few MB).

Suppose you already have the source of an earlier kernel. You could download a kernel patch 'patch-VERSION.smallversion', decompress it in /usr/src/linux, and type the following code to add it to the kernel source:

patch -p1 < patch-VERSION.smallversion-DECOMPRESSED

By doing this, you will have patched your kernel!

4.B. Adding other kernel patches

If you have a kernel patch you wish to add, you simply decompress the patch into the /usr/src/linux folder, and type the following code:

patch -p1 < patch-DECOMPRESSED

5. Importing your previous kernel configuration and configuring the kernel

In this step, you'll use the previous kernel configuration, followed by answering lots of questions (if you're unsure about these, it's easiest to just keep pressing enter -- but if you need to set additional options: don't! I pressed enter, and I'll have to compile again to enable a debug-option on my bcm43xx-driver.).

sudo cp /boot/config-`uname -r` .config && sudo make oldconfig && sudo make xconfig

6. Compiling the kernel

Debian (and distributions based on it) has a configuration utility, called make-kpkg. It replaces a combination of commands and makes compiling the kernel easier.

[TO-DO: add explanation for non-Debian-based systems]

make-kpkg clean

Then, we'll do the actual compiling. Grab yourself a book, type the following code, and wait a few hours...

make-kpkg -initrd --revision=386 kernel_image kernel_headers modules_image

7. Finishing the job

Last, but not least, we need to install the created kernel packages.

There should be 2 .deb-packages in your /usr/src (one is a kernel image, the other a kernel header), so type:

cd /usr/src

Then, to install them:

dpkg -i KERNELIMAGE.deb && dpkg -i KERNELHEADER.deb

8. You made it!?

Now simply reboot, and that's it!

(If you have any comments, improvements, or have noticed errors, please do mention!)

  • 3 months later...
  • 2 weeks later...
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Wow, imagine you dump hundreds of hours into completing things and unlocking stuff and you lose it all. Back in the day when cheats were built into games, you could at least unlock things again that way without spending hundreds of hours again. But those days are long gone for some reason as no one builds cheats into games anymore. So it's even more painful that studio that's on its 6th installment **** it up so badly.
    • Spotify finally removes the disco ball app icon in the latest update by Ivan Jenic Image: Spotify Spotify has just released an update that removes its now infamous disco ball icon. The update reverts the app icon to the familiar flat green logo after weeks of mixed reactions online. The icon arrived on May 13 as part of the company's 20th anniversary celebration and was always intended to be temporary, though Spotify only confirmed that after the backlash started. The disco ball took the internet by storm, as the reception was split. A vocal group of users called it ugly and disorienting, with some iOS users noting that the 3D glowing effect made the app look like it was stuck mid-update. On the other end, the icon picked up a following of its own. Its retro, three-dimensional look immediately stood out against the flat, minimalist aesthetic that has dominated app design for years. It even started a small movement, spawning what people started calling "discomorphism," a mashup of disco and skeuomorphism. Other brands started posting disco ball versions of their own logos, probably in an effort to ride the wave of memes that flooded the internet during late May. Spotify has had a turbulent relationship with its user base lately. Besides the disco ball icon, which certainly wasn't appreciated by everyone, the company has also received backlash for its willingness to include AI-generated music on its platform. On May 17, Spotify promised the old icon would return “in a few weeks.” And now it looks like that time has finally arrived. So, whether you liked the disco ball or it made you uncomfortable, it’s now gone for good. The next time you update the Spotify app on your phone, the old, flat-design icon will return.
  • Recent Achievements

    • One Year In
      slackerzz earned a badge
      One Year In
    • One Year In
      highriskpaym earned a badge
      One Year In
    • One Month Later
      highriskpaym earned a badge
      One Month Later
    • Week One Done
      highriskpaym earned a badge
      Week One Done
    • Week One Done
      FBSPL earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      520
    2. 2
      PsYcHoKiLLa
      197
    3. 3
      +Edouard
      157
    4. 4
      Steven P.
      84
    5. 5
      ATLien_0
      75
  • Tell a friend

    Love Neowin? Tell a friend!