Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Ubuntu kernel PPA only provides linux-headers*.deb and linux-image*.deb packages. How can I build the corresponding linux-source*.deb package ?

Context:

I'm currently running Ubuntu 11.10 with the mainline kernel (3.2 rc6 now) to get a better support for my sandybridge IGP (Dell E6420 laptop with intel i5-2520M CPU).

Appears, i'd like to install this touchpad driver, ALPS touchpads being badly supported (see previous link bug report), while waiting for upstream support in kernel version 3.3.

Problem is, DKMS keeps complaining about not finding the full kernel source:

Module build for the currently running kernel was skipped since the
kernel source for this kernel does not seem to be installed.

Appears I may not need the full source but I'd still like to try having it installed to see if it solve my problem.

What I tried :

  1. Uncompressing the kernel.org source archive in /usr/src/. DKMS still complaining.
  2. Manually updating the kernel source package with uupdate and the mainline source package like explained here. Did not succeed.
  3. Manually building the linux-source package following @roadmr and @elmicha instructions. I eventually succeeded to build it but DKMS still complained about the missing source.
  4. At last I noticed an error I did not catch in the first place while reinstalling the kernel headers. Appears the .deb I got may have been corrupted, downloading it again did the trick :) Alas, while DKMS agreed to compile the module i ran into the following error which appears to have already been reported. This issue isn't yet solved but I won't try to because of the following: in the end I decided to test the precise kernel version 3.2-rc6 through the xorg-edgers ppa which appears to be correctly patched: it works.

Nevertheless, it might still be of some interest to know how to build the mainline linux-source package as the Ubuntu Kernel Team doesn't provide it. Not to mention that I learned a lot in the process ^^

share|improve this question
    
Is there a mainline kernel source package repository?, No. The Result you get from seraching "kernel mianline ppa" is all you get. –  Uri Herrera Dec 21 '11 at 17:29
    
Note that the mainline kernel on Ubuntu are built with an older toolchain which means that any kernel modules you built with DKMS cannot be unloaded within a session and will show up as "module-name [permanent]" in /proc/modules. –  Lekensteyn Dec 21 '11 at 17:37
add comment

6 Answers 6

Looks like you're brave enough :) you could try following these instructions to create your own .deb packages from the mainline kernel.

Try reading this general document first:

https://help.ubuntu.com/community/Kernel/Compile

Here are specific instructions on how to compile a kernel for 11.10 (although you'd be doing so from the 3.2 source tree, so some things may ebd up being different).

http://blog.avirtualhome.com/2011/10/28/how-to-compile-a-new-ubuntu-11-10-oneiric-kernel/

Now, the problem with these instructions is they assume a source tree with a debian/ directory, which is where the control files that let you build a package reside. It's not a big problem though; it's easy to get a packageable source tree:

  1. Get the mainline kernel tree

    git clone https://github.com/torvalds/linux.git
    
  2. Look at the latest mainline kernel (as of today http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.2-rc6-precise/). There are three patch files (0001-base-packaging.patch, 0002-debian-changelog.patch, 0003-default-configs.patch). Download these three files.

  3. Change to your fresh new linux source directory and apply all 3 patches in order:

    patch -p1 <0001-base-packaging.patch
    
    patch -p1 <0002-debian-changelog.patch
    
    patch -p1 <0003-default-configs.patch
    

You'll now have a nice debian/ directory with packaging information. Then you can apply the instructions in the two URLs I mention above to configure and build packages from your kernel. Hopefully this will also create a kernel-source package.

share|improve this answer
    
I gave it a try, got an error very similar to this one: askubuntu.com/q/27963/7567 but was able to build the linux-source package when not applying the patches. Don't really know what that changes... Also don't bother spending too much time on this as this is now more of educational interest for me now as i was able to solve my initial problem in the process :) Thanks! –  Maxime R. Dec 23 '11 at 19:30
add comment

It should be possible to build the upstream kernel sources. If you already unpacked it to /usr/src/linux-X.Y:

cd /usr/src/linux-X.Y
# copy the configuration of the running kernel:
cp /boot/config-$(uname -r) .config
make oldconfig
fakeroot make-kpkg --initrd --append-to-version=-custom kernel-image kernel-headers
cd ..
ls -lrt *-custom*deb
# only install the latest *-custom*deb here:
sudo dpkg -i *-custom*deb

I use that all the time and although I have a few DKMS packages installed they don't complain.

share|improve this answer
    
Thanks, appears, we need to –  Maxime R. Dec 23 '11 at 19:14
    
...specify the kernel-source target to get the linux-source*.deb –  Maxime R. Dec 23 '11 at 19:21
add comment

You can download the source code from kernel.org

The mainline kernel in the ppa is unpatched

By definition the mainline kernel builds are made from virgin unaltered mainline kernel sources and therefore do not, and should not, include any Ubuntu patches or drivers.

Ubuntu wiki MainlineBuilds

share|improve this answer
    
I know this but kernel.org provides a compressed archive while i'm asking if there is an already packaged .deb of this one. That would avoid me the burden of getting into manually installing/reinstalling/removing stuff from my setup. –  Maxime R. Dec 21 '11 at 17:38
1  
I could not fine one. I would suggest you mail the kernel team and ask if they would be willing to provide a .deb –  bodhi.zazen Dec 21 '11 at 17:42
    
Good idea, asked for info on IRC, will post any update i get. –  Maxime R. Dec 21 '11 at 18:08
add comment

When you say mainline I understand that you want the unmodified/official kernel.

So, to begin with, you'll not find it on a deb repository because it would be modified (by debian or ubuntu).

Here is a link on how to do it : http://blog.avirtualhome.com/compile-mainline-kernel-ubuntu/ Here is a link that shows how to compile the 3.6 kernel : http://blog.avirtualhome.com/linux-kernel-3-6-on-ubuntu/

share|improve this answer
add comment

To compile the mainline kernel for Ubuntu you can follow the instructions as posted on my blog below:

Compile the mainline Linux kernel for Ubuntu: A detailed, step by step article on how to compile and install your own version of the mainline kernel (v3.3) for Ubuntu (Precise).

Linux Kernel 3.6 on Ubuntu: A detailed, step by step article on how to compile and install your own version of the mainline 3.6 kernel for Ubuntu. It depends on steps performed by the article above.

share|improve this answer
add comment

I solved this by running:

sudo apt-get install linux-headers-3.5.0-17-generic

Of course, you'd have to replace the kernel version with the version that the virtualbox installer is looking for.

share|improve this answer
1  
Please review your answer, research if needed but be accurate when placing your answer. –  Ringtail Nov 6 '12 at 3:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.