Kernel compilation

Asked by Paulo

(kubuntu dapper)

Kernel source seems not to match the current kernel image! I cannot compile the kernel just copying the config file in /boot.

Besides, the kernel suffix generated does not correspond to the version of the kernel.

I can provide any further information if needed.

Here is the output:

  LD [M] drivers/net/ndiswrapper/ndiswrapper.o
  CC [M] drivers/usb/net/zd1211/zdusb.o
In file included from drivers/usb/net/zd1211/zdusb.c:41:
drivers/usb/net/zd1211/zddevlist.h:7:2: error: #error "Error in source
file, line 35"
make[4]: *** [drivers/usb/net/zd1211/zdusb.o] Error 1
make[3]: *** [drivers/usb/net/zd1211] Error 2
make[2]: *** [drivers/usb/net] Error 2
make[1]: *** [drivers/usb] Error 2
make: *** [drivers] Error 2

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Soren Hansen (soren) said :
#1

I'm a bit confused. The output you supply does not in any way relate to your questions regarding /boot/config-* and the kernel suffix thing..

About the suffix: It's not contained in the kernel's .config. To see exactly how the ubuntu kernels are build, you can take a look at the build script for the linux-image packages. Run: apt-get source linux-image-2.6.15-25-686 and take a look at debian/rules in the created directory.

If you want more help you can e.g. explain exactly which commands you run.

Revision history for this message
Paulo (psdasilva-deactivatedaccount) said :
#2

Ok. My message was not clear ... sorry.

What I did:

1. I used aptitude to download linux-sources.
I got a tar.bz2 file.

2. I "bunzip/untared" it and got a kernel tree.

3. I creted a link from "linux" to that kernel, changed into the kernel tree and copied the config file from /boot to this dir as .config.

4. make menuconfig
and changed nothing except "YES" to save it.

5. make
I got the message I posted before.

6. If I used
make-kpkg kernel_image
instead of
make
I got a .deb package with wrong version suffix.

I'll try your suggestion i.e.
apt-get source ...
and will be back. (I did not know about this - I am new dealing with debian stuff)

Thank you very much.

Revision history for this message
Paulo (psdasilva-deactivatedaccount) said :
#3

Still too complicated to recompile the kernel ...

apt-get source linux-image-2.6.15-25-686
apt-get build-dep linux-image-2.6.15-25-686
UBUNTUBUILD=1 make-kpkg --append-to-version "-25-686" --stem linux -us -uc --initrd kernel_image

I get this after looking at few files from the kernel tree.

Problems:

1. Didn't get initrd image. --initrd option doesn't do anything. I had to hack the existent initrd image file using gzip and cpio.

2. If i need to add some suffix to the new kernel name, I have to change the control file. I also needed to add "--stem linux" (--stem is not in the make-kpkg man page) because the generated kernel began with "kernel-image" and this is not in the control file.

3. There was a wrong kernel version (EXTRAVERSION) in the Makefile. That's why I got a wrong kernel version on my first atempts to recompile the kernel.

    VERSION = 2
    PATCHLEVEL = 6
    SUBLEVEL = 15
    EXTRAVERSION = .7-ubuntu1
    ...

I also tried
dpkg-buildpackage -uc -b
but this took hours and produced all subarch kernels and other packages whose purpose I don't know.
May be there are some other parameters to use ...

IMHO the kernel recompilation must be simplified. At least a simple howto should be written. The available howtos (for debian) do not work. I thought of writing one but I am not sure to have full undersood this stuff.

Revision history for this message
Paulo (psdasilva-deactivatedaccount) said :
#4

About point 1 of my last post:

In fact, initrd image is created when using
dpkg -i <kernel>.deb

I still needed to hack it to copy some missing video modules. Without these modules there was no boot splash. Just a black screen.

Revision history for this message
JTRIP (jtripp) said :
#5

Regarding to the first post: You need to de-select the driver zd1211 wich ist causing the error( i experienced that error myself, and compiled errorless after removing it).

To UTC: Would you mind telling me what do i need to do to fix the no splash thingy wich im experiencing too?

Thanx, Joseph.

Revision history for this message
Paulo (psdasilva-deactivatedaccount) said :
#6

About point 1 of my last post:

In fact, initrd image is created when using
dpkg -i <kernel>.deb

I still needed to hack it to copy some missing video modules. Without these modules there was no boot splash. Just a black screen.

For last kernel, 2.6.15-26-686, I can not get boot splash to work. Perhaps the video modules I am copying do not work with my new generated kernel. I wander where those modules come for ...

Is there anyone who could provide a simple way to compile the kernel?!

Revision history for this message
Paulo (psdasilva-deactivatedaccount) said :
#7

About my last post ...

I made a mistake somewhere ... Unpacking initrd image (cpio), copying the new generated modules and repacking it got boot splash back ...

Still needing a more simple way ...

Revision history for this message
Ben Collins (ben-collins) said :
#8

a) Install the build-deps. That's why zd1211 is failing

b) The suffixes are done by setting EXTRA_VERSION in the build (using make-kpkg).

c) There is a wiki page that explains how to build exactly as we do.

https://wiki.ubuntu.com/KernelCustomBuild

This ticket should be rejected.

Revision history for this message
Paulo (psdasilva-deactivatedaccount) said :
#9

From https://wiki.buntu.com/KernelCustomBuild

"Also note that this page describes how to do things for the Edgy (2.6.17) kernel and newer! Until this kernel source, we did not have any mechanisms in place that would allow people to build their own kernels easily. This was intentional."

I'll give it a try when I change to Edgy.

Thank you.

Revision history for this message
Paulo (psdasilva-deactivatedaccount) said :
#10

After installing Edgy, I tryed to compile the kernel as is in https://wiki.ubuntu.com/KernelCustomBuild.

After
AUTOBUILD=1 fakeroot debian/rules binary-debs flavours=686-smp
I got:

make: *** No rule to make target `binary-debs'. Stop.

Revision history for this message
zigi (ziegleka) said :
#11

Hi,
 I try compile my own kernel. Everything went well, but size of my initrd.img is >17MB and size of initrd.img to distribution's kernel is cca 6,5MB. How is it possible? In /etc/initrams-tools configuration is setting in to most used modules.

I used make-kpkg method.

Revision history for this message
Francesc Vicent (fransex) said :
#12

Zigi, here is the answer to the size question:

http://lkml.org/lkml/2007/6/6/302 :

    For some reason I haven't looked into, copying the Ubuntu .config
file always results in having "Build the kernel with debug info"
set, which makes the resulting kernel huge. Ubuntu's distributed
kernel binary certainly doesn't have this stuff built in, so turn it
off in the "Kernel Hacking" menu.

    If you find that your new kernel spews a lot of messages like "PM:
adding device nobus:yourmom", flip "Power Management Debugging" off
under the "Power management" menu also. I wouldn't do this
preemptively, though -- it turns off other stuff too, and I think
Ubuntu's kernel is patched not to do that (and newer kernels have the
options separated, I think).

    Flipping the option and building a new package is pretty quick --
it doesn't rebuild much.

--
Joseph Fannin

Revision history for this message
Ben Collins (ben-collins) said :
#13

Most of the "problems" have long since been fixed.

Plenty of info is provided on how to build Ubuntu kernels. "Ease" of performing this task will never be good enough for everyone.

The assumption that if someone is building their own kernel means they are trying to modify it from the original in some way, makes it easy to also assume they should have some basic knowledge of building the kernel.

Can you help with this problem?

Provide an answer of your own, or ask Paulo for more information if necessary.

To post a message you must log in.