LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Compiling Kernel (http://www.linuxquestions.org/questions/linux-general-1/compiling-kernel-946105/)

miykle 05-21-2012 05:32 AM

Compiling Kernel
 
G'Day; I'm trying to learn to compile a kernel and all goes well until I get to "stage 2" then I get the following error;;

Building modules, stage 2.
MODPOST 3400 modules
ERROR: "__modver_version_show" [drivers/staging/rts5139/rts5139.ko] undefined!
ERROR: "handle_edge_irq" [drivers/gpio/gpio-pch.ko] undefined!
ERROR: "irq_to_desc" [drivers/gpio/gpio-pch.ko] undefined!
make[2]: *** [__modpost] Error 1
make[1]: *** [modules] Error 2
make[1]: Leaving directory `/home/miykel/Downloads/3.4/linux-3.4.o-3.2'
make: *** [debian/stamp/build/kernel] Error 2
Can anyone help please

Regards Miykle

Didier Spaier 05-21-2012 05:49 AM

You have possibly an inconsistent .config file.

Try reusing the .config of a working kernel (shipped with your distribution) then run
Code:

make oldconfig
before tuning your kernel's configuration if needed.

onebuck 05-21-2012 09:42 AM

Member response
 
Hi,

You should look at: https://help.ubuntu.com/community/Kernel/Compile

Several good links and justification/cautions for compiling a kernel for Ubuntu.

miykle 05-22-2012 01:21 AM

G'Day and thanks for the replies guy's. I've tried every option I've found and been supplied from forums but nothing makes any difference, I always end up at the same error message, even tried different methods nothing seems to work just end up at the same place....very frustrating.
Thanks Again regards Miykel

fogpipe 05-22-2012 01:29 AM

What kernel version are you building? I just built and installed 3.3.5 with gcc-4.5.2 and it went off without a hitch.
The command line i usually use is "make && make modules && make modules_install&& make install"
make sure to back up your lilo.conf and /boot directory so you can boot from a cd and restore them if need be.
If you are building a version that came with your distro, that sometimes doesnt work as well as getting the source off kernel.org and starting clean.
If you do need to restore your lilo.conf, dont forget to run lilo after you restore it.

miykle 05-22-2012 04:33 AM

G'Day and thanks fogpipe,
The distro is Ubuntu 12.10
1. kernel 3.4.0-2 from mainline
2. Kernel 3.3.0 liquorix

I'm trying to compile 3.4.0-2.6 generic from mainline

I wonder if having more than 1 kernel installed has anything to do with it. ????
Regards miykel

Didier Spaier 05-22-2012 06:07 AM

Quote:

Originally Posted by miykle (Post 4684571)
I wonder if having more than 1 kernel installed has anything to do with it. ????

No.

To understand your problem, please provide :
- the exact steps you followed (which commands you did issue, in what order)
- the .config file you are using (renamed e.g. as config.txt).

PS you should type "make menuconfig" (or "make gconfig", "make xconfig", whatever) before "make".
Preferably, as I said before, reuse the .config from your running kernel before all that first, e.g.
Code:

zcat /proc/config.gz > /path_to_your_new_kernel_directory
make oldconfig


miykle 05-22-2012 09:10 AM

Thanks for the interest guys I certainly appreciate it, tried to post the config file but it's to big.
What I have been doing is ;
1 Extract tar.gz to /usr/src
2 cd /usr/src/ubuntu-quantal
3 copy/paste current kernel config file from /boot to /usr/src/ubuntu-quantal/usr as a template for make oldconfig
4 sudo make oldconfig....run ok
5 sudo make
make run ok until it reached stage 2 then received error messages
tracked down the gpio but no .ko files
The kernel I got from mainline repository, tried several methods but all end up at the same point.
Hope this is helpful
Kind Regards Miykle

Didier Spaier 05-22-2012 09:41 AM

Step 3, you should put then current kernel config file in the directory created by the extraction at step 2 and name it ".config", e.g.
Code:

mv linux-3.4.tar.bz2 /somewhere
cd /somewhere
tar xf linux-3.4.tar.bz2
cp /boot/configxxx /somewhere/linux-3.4/.config
cd /somewhere/linux-3.4
make oldconfig

Otherwise "make oldconfig" won't take the current config file as a basis.

onebuck 05-22-2012 09:47 AM

Member response
 
Hi,
Quote:

Originally Posted by miykle (Post 4684734)
Thanks for the interest guys I certainly appreciate it, tried to post the config file but it's to big.
<snip>

Try using pastebin.

fogpipe 05-22-2012 12:18 PM

Where are you getting the kernel source code you are using? Its not some distro specific thing is it?
Because alot of distros pee on the kernel a bit, i guess because just linux isnt good enough for them.

miykle 05-22-2012 05:46 PM

Thanks again guys;
@ Didier; I left out a step (damn) after;
3 copy/paste current kernel config file from /boot to /usr/src/ubuntu-quantal/usr as a template for make oldconfig
I did cd /usr/src/ubuntu-Quantal/usr
Then make oldconfig.
This was a sugestion I got from searching online so the make would use the config file as a template for the new one without influence from any other config file in /boot
Seemed to make sense at the time, but it could be a red herring

@ Fogpipe; I get the tar.gz friom the launchpad/mainline repository, I assume that is the best place from what I've read.

Postbin........... http://pastebin.com/4PiGCvHS

Kind Regards Miykle

Didier Spaier 05-22-2012 07:24 PM

Quote:

Originally Posted by miykle (Post 4685110)
Thanks again guys;
@ Didier; I left out a step (damn) after;
3 copy/paste current kernel config file from /boot to /usr/src/ubuntu-quantal/usr as a template for make oldconfig
I did cd /usr/src/ubuntu-Quantal/usr
Then make oldconfig.
This was a sugestion I got from searching online so the make would use the config file as a template for the new one without influence from any other config file in /boot
Seemed to make sense at the time, but it could be a red herring

I think this is a red herring. Anyhow we did know the exact wording of the commands you typed at the terminal, e.g. did you write
Code:

cp /boot/configxxx /usr/src/ubuntu-quantal/usr
or
Code:

cp /boot/configxxx /usr/src/ubuntu-quantal/usr/.config
So please copy/paste here the exact sequence of all the commands you typed in the terminal.

miykle 05-22-2012 07:48 PM

G'Day I didn't move the file by terminal I just copied the config file from /boot and pasted it into ubuntu-quantal/usr
but first chown.....ubuntu-quantal/usr
to allow me to paste into it
then cd /usr/src/ubuntu-quanatl/usr
then ran sudo make oldconfig.
one thing though I can never find where the oldconfig is stored after it makes it
although the terminal says it has done it ????
( scarey when the terminal refers to it's self in the first person...Hal revisited...lol. )
I hope this helps
Regards Miykel

Didier Spaier 05-22-2012 08:17 PM

Miykle,

to compile the kernel you should do everything using the terminal.

The way you have copied the file it was certainly not renamed .config in the process, hence "make oldconfig" didn't consider it.

In short do what follows (I suppose that configxxx is the name of your current config file and you already stored the new kernel source file, named linux-3.4-02.tar.bz2, in /usr/src; else adapt the commands accordingly)
- open a terminal
- become root typing "sudo su"
- then type in sequence:
Code:

cd /usr/src/
tar xf linux-3.4-02.tar.bz2
cd linux-3.4-02
cp /boot/configxxx /usr/src/linux-3.4-02/.config
make oldconfig

At this point you will be asked a bunch of questions; accept the default answers proposed unless you have a good reason not to.
Then continue typing in sequence:
Code:

make
make modules_install

Then you will have to install the new kernel in /boot and update grub (I guess, as I don't have Ubuntu installed and Slackware uses lilo instead of grub).
Waiting to hear from you.


All times are GMT -5. The time now is 04:06 AM.