LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Kernel building (https://www.linuxquestions.org/questions/linux-newbie-8/kernel-building-918521/)

qwerty4061 12-13-2011 10:22 AM

Kernel building
 
Hi,
I was trying to build my own kernel (just for learning) from source so I downloaded v3.0.4 from kernel.org as I saw in Ubuntu site that ubuntu 11.10 (my running version of linux)is based on it. uname -a shows my running kernel as 3.0.0-12-generic-pae so I copied config-3.0.0-12-generic-pae to my kernel sources folder and renamed it as .config and typed in make oldconfig and then make. It took nearly 2 hours to compile and finally generated a vmlinux image of 168 MB. So I did make clean and did make bzImage. This time also it took 2 hrs and again generated a vmlinux image of 168 MB. So basically my doubt was:

1. Why is the kernel size so huge, my running kernel has a size of only 4.5 MB, even though both of them uses the same .config

2. Why did make bzImage generate the same vmlinux image isn't it supposed to generate a much smaller vmlinuz image.

3. Why is taking so long, the configuration of my PC is pretty decent with i5 2nd gen and 4GB RAM

4. Is there any difference between making a bzImage and stripping a vmlinux image?


Thanks

Cedrik 12-13-2011 12:42 PM

Something went wrong with your initial .config

Do you have /proc/config.gz ? (it is your running kernel config)
if yes, cd into your kernel source dir and do: zcat /proc/config.gz > .config
then make oldconfig etc...

Personnaly, I would make xconfig (or menuconfig) after oldconfig
then I would remove many stuff that I will never use

timetraveler 12-13-2011 01:29 PM

You should read the README.

1) make mrproper
2) cp config-3.0.0-12-generic-pae .config
3) make oldconfig

Don't run make clean after you've built the kernel, that removes all the objects, etc. that you just built.

4) make

Building a generic kernel takes longer as it's meant to run on just about any hardware.

5) sudo make modules_install install


You should learn what hardware you have and build a kernel just for your hardware instead of a generic kernel.

sudo lspci > hardware
sudo lsusb >> hardware

You may want to run those using verbose mode.

qwerty4061 12-14-2011 09:47 AM

Thanks Cedrik and timetraveler for your answers. I dont have /proc/config.gz. I just wanted to build the kernel in the simplest possible way before I started changing any .config option that is why I just copied from /boot. Probably there is something wrong with it. Even if it is a generic kernel I dont think it should take 2 hours to compile. I will try to generate kernel by configuring according to my hardware.

Cedrik 12-14-2011 10:40 AM

Good luck, FYI I compile kernel in about 15/20mn with my old athlon 2600+ XP barton

asipper 12-14-2011 07:32 PM

What did you run to make it? To speed up make run make -j (+1 processors so for a dual core) 3


All times are GMT -5. The time now is 01:45 AM.