LinuxQuestions.org

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

miykle 05-21-2012 04: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 04: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 08: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 12: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 12: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 03: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 05: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 08: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 08: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 08: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 11:18 AM

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 04: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 06: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 06: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 07: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.

miykle 05-23-2012 06:28 AM

Well there you go simple when you know how; just the know how that takes an expert, can't thank you enough for persisting with me.

I'm sorry I couldn't reply earlier, I had to go to town, 60 Km round trip, then try the things you said, which worked fine.
will purge the kernel and all documents related to it then do it again for practice, then the next step is to learn to modify the kernel to suite me needs
that should be worth a laugh or two ...lol.
I really enjoy Linux because it can be tailored to suite your needs, a real peoples OS.
I'll be getting back on the road tomorrow, I retired to the highway, heading north for the winter, so I won't have my PC for a while until I go to ground
somewhere and hook up to mains power again, will post to let you know how I got on with the next kernel.

If I wanted to make .deb packages would this code do it ??
code;

make-kpkg clean
(or just rm -rf ./debian)
$Get_Root make-kpkg --revision=3:2.0.custom kernel_image

Kind Regards and many blessings Miykel

Didier Spaier 05-23-2012 07:07 AM

I'm happy you succeeded.

For your question about .deb package, sorry I know nothing about Debian packages, but hopefully some other people will answer you.

Best regards

miykle 05-23-2012 07:14 AM

that's ok mate, something for the future,
How's this for irony, just learned to compile the kernel and the
next dist-upgrade the kernel was upgraded, from the ppa's, from 4.3.0-2.6 to 4.3.0-2.7
damn...blast...gotta laugh.
Regards Miykel

Cyanobacteriophage 01-12-2013 11:55 AM

Not solved then, solved now....
 
I just ran into this same exact error message while compiling kernel 3.7.1. I knew it wasn't any of the above answers since I had successfully compiled kernels 4 or 5 times now. What happened it that I had been using SUDO to get root privileges and not a genuine root shell with su. So, I switched to su - "make " etc and the problem is now resolved. I am not certain this is precisely the cause of the original posters problem, but it seemed like the thread was left in suspence. So, I hope this might help someone. :)

Cyanobacteriophage 01-12-2013 11:59 AM

Quote:

Originally Posted by Cyanobacteriophage (Post 4868470)
I just ran into this same exact error message while compiling kernel 3.7.1. I knew it wasn't any of the above answers since I had successfully compiled kernels 4 or 5 times now. What happened it that I had been using SUDO to get root privileges and not a genuine root shell with su. So, I switched to su - "make " etc and the problem is now resolved. I am not certain this is precisely the cause of the original posters problem, but it seemed like the thread was left in suspence. So, I hope this might help someone. :)


OOPS.. I apologize. I honestly did not see there was a second page of the thread where it was resolved. I keep doing that on here. Excuse me! Sorry to revive this...


All times are GMT -5. The time now is 07:29 PM.