LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Anyone have a link to a really good, easy to follow, kernel compile guide? (http://www.linuxquestions.org/questions/linux-general-1/anyone-have-a-link-to-a-really-good-easy-to-follow-kernel-compile-guide-530010/)

johngreenwood 02-17-2007 07:08 PM

Anyone have a link to a really good, easy to follow, kernel compile guide?
 
I have tried many times to compile a kernel so I can move off the generic one I am using now, and failed miserably almost every time, my latest, most successful attempt was the 2.6.20 kernel, I spent a considerable amount of time configuring it, adding what I think I need, and removing what I don't. After I installed it, I did a reboot and the computer booted within seconds, to which I was pleasantly surprised and extremely pleased with myself. I did notice, however during boot there were a couple of "FATAL" error messages, but I couldn't see what they were as they went by too fast. This didn't seem to make much of a difference, as it still booted to an X session and I could use it as normal. The problem is, when I wa using the generic kernel, my cpu usage hovered around 3-5% when idle, with the new kernel this figure is now in the 20s. So I think to myself, "I've done something wrong, again." It is really annoying because I spend so much time configuring and compiling, only to have to do it again. Any help would be appreciated, thanks.

John

justwantin 02-18-2007 12:18 AM

You didn't mention what distro you are using.

Here are some random things I'd ask you first.

Are you sure that it is your kernel that is causing extra cpu usage. Most distro default kernels will have some things compiled into the kernel and all other things are modules which will load/unload as required.

Could it be that you are running a distro that starts off with allot of services running. Services mean servers or daemons running in the background and I have found with some distros there are way more enabled by default than I really need.

Try figuring out what might be running that is causing that 5%. Have you run "ps -A" or "top" as root?

As for compiling there's heaps of how to's out there, and there's docs in the kernel souce too. There might be others, but I know for sure that there is a 2.6 compile howto with pages of thread at the slackware forum on right here on linuxquestions

bigrigdriver 02-18-2007 02:03 AM

There is a utility that's been around for a few years, that helps with building new kernels. It's called buildkernel. You can keep the current working kernel and /lib/modules, and build a new kernel with a new /lib/modules for that kernel. If anything goes wrong, you can still boot the working kernel. After compiling a new kernel with buildkernel, it's simply a matter of copying the compressed kernel image to /boot (with an appropriate name so that it isn't confused with vmlinuz), and editing the bootloader config file to add the new image to the boot menu.

You can then test the new kernel, but still have the original as fallback until the new kernel is proven, before deleting the old one.

introuble 02-18-2007 04:15 AM

Right. The thread title is not suggested by your post. Kernel compile guide? Sure:

Code:

cd /usr/src/linux && make menuconfig && make && make modules_install
Your distribution seems to be Slackware.

I'd say try again, perhaps even from scratch, this time being extra careful. Read the help on everything. It's time consuming.. that's that. Also take a look at the `dmesg` utility (see what it does).

XavierP 02-18-2007 06:35 AM

http://www.kroah.com/lkn/ - link to the free O'Reilly Book "Linux Kernel in a Nutshell". It's a guide aimed at users for compiling their kernel.

johngreenwood 02-18-2007 12:43 PM

To introuble, you are correct in assuming my distro is Slackware, I play with others, but this is my main one because I like it more than the rest. Also, don't I have to do make modules before make modules_install? This is what I have read in many of the places I have looked.

To justwantin, there are quite a lot of processes running when I use ps -A, and when I run top, the process which takes up most cpu is X. The rest take up hardly anything.

to XavierP, thanks for the lik, I'm gonna check it out right now.

Thank you all for responding.

John

johngreenwood 02-18-2007 01:33 PM

I have just run top with the 2.6.20 kernel I have already compiled, and X is now around 10% and kicker around 15% although I can't understand why.

The book says NOT to compile in /usr/src and this is where I have been doing it. Perhaps this is why some of my shared library objects have gone missing.

justwantin 02-18-2007 02:23 PM

Linus has posted many times about not compiling kernels in /usr/src but5 I'd venture to say that most people still do probably because until memory became relatively cheap most linux users didn't want to keep 50-60 mb of kernel source in in one part of their hd and copy it somewhere else just to do a compile. Old habits die hard especially if the old habit causes no problem.

The rest of this may be a bit tedious for most readers but john might find it helpful for a comparison with his computer.

I am pasting in the output of top and ps -A on my box with 1 konsole (2 sessions), 1 konqueror, kmail and 2 kedits open. This is on a 2.6.17.13 kernel from slack-2.11 install disk, running kde-3.5.6 acquired from linuxpackages.net. Note that some of the things running in my box are sitting in the panel, e.g. kweather,amorak and not opened up. I'll also give you an ls -l /etc/rc.d so that you can see what services are set to run by being executable.

top - 06:04:26 up 47 min, 1 user, load average: 0.00, 0.00, 0.00
Tasks: 79 total, 1 running, 78 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.3%us, 0.3%sy, 0.0%ni, 98.3%id, 0.0%wa, 0.7%hi, 0.3%si, 0.0%st
Mem: 1035948k total, 499348k used, 536600k free, 49392k buffers
Swap: 1100412k total, 0k used, 1100412k free, 287732k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2627 rick 15 0 58444 38m 19m S 0.0 3.8 0:10.43 konqueror
2618 rick 15 0 110m 37m 23m S 0.0 3.7 0:04.47 amarokapp
2898 rick 15 0 91764 33m 20m S 0.0 3.3 0:01.88 kmail
2569 rick 15 0 47716 25m 15m S 0.0 2.5 0:01.19 kicker
2557 rick 15 0 40688 22m 12m S 0.0 2.2 0:01.34 kded
2567 rick 15 0 39012 21m 12m S 0.0 2.2 0:00.94 kdesktop
2492 root 15 0 36432 21m 3924 S 0.0 2.1 0:18.79 X
3074 rick 15 0 39388 20m 11m S 0.0 2.0 0:00.73 konsole
2617 rick 15 0 37288 20m 11m S 0.0 2.0 0:00.17 kmix
2635 rick 15 0 36680 20m 11m S 0.0 2.0 0:00.25 kedit
2601 rick 15 0 37072 19m 10m S 0.0 1.9 0:00.18 kio_uiserver
2565 rick 15 0 36216 19m 10m S 0.0 1.9 0:00.62 kwin
2912 rick 15 0 34500 18m 10m S 0.0 1.9 0:00.21 kwalletmanager
2900 rick 15 0 40252 18m 9940 S 0.0 1.8 0:00.10 knotify
2640 rick 15 0 34884 17m 9376 S 0.0 1.7 0:00.09 klipper
2573 rick 15 0 33652 17m 9496 S 0.0 1.7 0:01.51 kweatherservice
2564 rick 16 0 33428 15m 8056 S 0.0 1.6 0:00.06 ksmserver
2613 rick 15 0 33416 15m 7920 S 0.0 1.6 0:00.04 kaccess
3018 rick 15 0 59480 15m 7388 S 0.0 1.5 0:00.05 kio_http
3025 rick 15 0 59480 15m 7380 S 0.0 1.5 0:00.02 kio_http
3037 rick 15 0 59480 15m 7380 S 0.0 1.5 0:00.02 kio_http
3023 rick 15 0 59480 15m 7376 S 0.0 1.5 0:00.02 kio_http
3024 rick 15 0 59480 15m 7380 S 0.0 1.5 0:00.02 kio_http


bash-3.1$ ps -A
PID TTY TIME CMD
1 ? 00:00:01 init
2 ? 00:00:00 ksoftirqd/0
3 ? 00:00:00 events/0
4 ? 00:00:00 khelper
5 ? 00:00:00 kthread
7 ? 00:00:00 kblockd/0
8 ? 00:00:00 kacpid
77 ? 00:00:00 khubd
79 ? 00:00:00 kseriod
122 ? 00:00:00 pdflush
123 ? 00:00:00 pdflush
124 ? 00:00:00 kswapd0
125 ? 00:00:00 aio/0
789 ? 00:00:00 ata/0
841 ? 00:00:00 reiserfs/0
1007 ? 00:00:00 udevd
1746 ? 00:00:00 kgameportd
1762 ? 00:00:00 shpchpd
2069 ? 00:00:00 kpsmoused
2125 ? 00:00:00 jfsIO
2127 ? 00:00:00 jfsCommit
2128 ? 00:00:00 jfsSync
2189 ? 00:00:00 syslogd
2192 ? 00:00:00 klogd
2350 ? 00:00:00 rpc.portmap
2359 ? 00:00:00 rpc.statd
2377 ? 00:00:00 inetd
2385 ? 00:00:00 sshd
2402 ? 00:00:00 cupsd
2448 ? 00:00:00 crond
2450 ? 00:00:00 atd
2453 ? 00:00:00 sendmail
2456 ? 00:00:00 sendmail
2459 ? 00:00:00 acpid
2485 ? 00:00:00 gpm
2487 tty6 00:00:00 agetty
2488 ? 00:00:00 kdm
2492 tty7 00:00:26 X
2493 ? 00:00:00 kdm
2508 ? 00:00:00 startkde
2549 ? 00:00:00 start_kdeinit
2550 ? 00:00:00 kdeinit
2553 ? 00:00:00 dcopserver
2555 ? 00:00:00 klauncher
2557 ? 00:00:01 kded
2562 ? 00:00:00 kwrapper
2564 ? 00:00:00 ksmserver
2565 ? 00:00:00 kwin
2567 ? 00:00:01 kdesktop
2569 ? 00:00:01 kicker
2571 ? 00:00:00 kio_file
2573 ? 00:00:01 kweatherservice
2601 ? 00:00:00 kio_uiserver
2611 ? 00:00:00 artsd
2613 ? 00:00:00 kaccess
2617 ? 00:00:00 kmix
2618 ? 00:00:05 amarokapp
2627 ? 00:00:17 konqueror
2635 ? 00:00:00 kedit
2638 ? 00:00:12 perl
2640 ? 00:00:00 klipper
2679 ? 00:00:00 ruby
2898 ? 00:00:01 kmail
2900 ? 00:00:00 knotify
2912 ? 00:00:00 kwalletmanager
2974 ? 00:00:00 mouseup
3074 ? 00:00:00 konsole
3075 pts/2 00:00:00 bash
3097 ? 00:00:00 kedit
3177 ? 00:00:00 ispell
3223 ? 00:00:00 sleep
3232 pts/2 00:00:00 ps

bash-3.1$ ls -l /etc/rc.d
total 276
lrwxrwxrwx 1 root root 4 2007-02-13 14:26 rc.0 -> rc.6
-rwxr-xr-x 1 root root 1160 2006-09-25 18:33 rc.4
-rwxr-xr-x 1 root root 6782 2006-09-25 18:33 rc.6
-rwxr-xr-x 1 root root 2322 2006-09-25 18:33 rc.K
-rwxr-xr-x 1 root root 10022 2006-09-25 18:33 rc.M
-rwxr-xr-x 1 root root 14408 2006-09-25 18:33 rc.S
-rwxr-xr-x 1 root root 466 2004-11-05 19:20 rc.acpid
-rwxr-xr-x 1 root root 1614 2006-08-05 12:50 rc.alsa
-rw-r--r-- 1 root root 1032 2003-02-02 14:47 rc.atalk
-rw-r--r-- 1 root root 4178 2006-05-04 09:31 rc.bind
-rwxr-xr-x 1 root root 3942 2006-08-17 15:19 rc.cups
-rw-r--r-- 1 root root 512 2006-08-08 14:02 rc.dnsmasq
-rwxr-xr-x 1 root root 139 2007-02-13 14:40 rc.font
-rwxr-xr-x 1 root root 119 2004-05-30 14:19 rc.font.new
-rwxr-xr-x 1 root root 1148 2007-02-13 14:38 rc.gpm
-rwxr-xr-x 1 root root 1675 2006-09-06 18:44 rc.hal
-rwxr-xr-x 1 root root 2243 2006-09-21 09:50 rc.hotplug
-rw-r--r-- 1 root root 401 2003-03-06 08:28 rc.httpd
-rwxr-xr-x 1 root root 8325 2006-09-21 12:48 rc.inet1
-rw-r--r-- 1 root root 3575 2007-02-13 14:39 rc.inet1.conf
-rwxr-xr-x 1 root root 4477 2006-09-21 12:44 rc.inet2
-rwxr-xr-x 1 root root 497 2003-09-12 13:27 rc.inetd
-rw-r--r-- 1 root root 1924 2003-09-14 09:10 rc.ip_forward
-rwxr-xr-x 1 root root 272 2006-09-25 18:33 rc.local
-rwxr-xr-x 1 root root 1755 2007-01-24 03:56 rc.messagebus
lrwxrwxrwx 1 root root 19 2007-02-13 14:26 rc.modules -> rc.modules-2.4.33.3
-rwxr-xr-x 1 root root 25553 2006-09-01 18:31 rc.modules-2.4.33.3
-rwxr-xr-x 1 root root 28472 2006-09-09 16:33 rc.modules-2.6.17.13
-rw-r--r-- 1 root root 2300 2006-09-02 12:15 rc.mysqld
-rwxr-xr-x 1 root root 2444 2006-09-21 13:05 rc.nfsd
-rwxr-xr-x 1 root root 5090 2006-08-17 06:48 rc.pcmcia
-rwxr-xr-x 1 root root 2000 2006-09-22 08:07 rc.rpc
-rw-r--r-- 1 root root 791 2006-09-02 16:14 rc.samba
-rw-r--r-- 1 root root 1169 2006-05-28 06:24 rc.saslauthd
-rwxr-xr-x 1 root root 967 2006-09-25 18:33 rc.scanluns
-rwxr-xr-x 1 root root 687 2002-06-05 07:09 rc.sendmail
-rw-r--r-- 1 root root 2895 2006-09-25 18:47 rc.serial
-rwxr-xr-x 1 root root 1222 2006-09-29 07:17 rc.sshd
-rwxr-xr-x 1 root root 860 2004-05-03 08:07 rc.syslog
-rwxr-xr-x 1 root root 1740 2006-09-25 18:33 rc.sysvinit
-rwxr-xr-x 1 root root 4711 2006-09-14 10:11 rc.udev
-rwxr-xr-x 1 root root 9453 2006-08-17 06:20 rc.wireless
-rw------- 1 root root 7320 2006-08-17 06:20 rc.wireless.conf
-rwxr-xr-x 1 root root 2323 2005-08-01 09:56 rc.yp

johngreenwood 02-18-2007 03:46 PM

Wow, thanks for that. But am I supposed to run those commands with the generic kernel distributed as Slackware's default, or the compiled one? Your cpu usage is much lower than mine, could this be a result of my cpu clock speed being a mere 700Mhz? I need to upgrade, but I can't afford it right now.

justwantin 02-18-2007 06:35 PM

I wouldn't worry about different cpus or ram the difference between my box and yours can't be explained there. Each revision of kde seems more efficient than the last but that won't matter much here either

The above command output came off a 2 week old install. I always install with Pat's default (2.4 in this case) and then upgrade by installing Pat's 2.6. I always use bare.i and haven't had to compile my own for awhile now.

If you were to do any comparison with what I posted you'd need to have an fairly unmodified install with 2.6.17.13 bare.i kernel and the same permissions as in my /etc/rc.d.

If X seems to be the hog. Have you booted up without X? What is your cpu usage then? If its back down then maybe it is something to do with your X configuration, driver, or video card. I don't know too much about these things but if you have lost some of your video (card) memory, could you be taking it from you system?

Do you have important files and /home on their own partition? If so why not reinstall? I know its a bit wondowsish but it may tell you whether this is something do to something you did or if a clean install has this problem then it may not be kernel/software related, but rather hardware.

Have you checked your ram with memtest?

johngreenwood 02-18-2007 07:07 PM

I will try booting to runlevel 3, and check it then. I think I'll check out bare.i too, can I take it from the cd and use it straight away?

memtest seems to show no problems with ram, I checked it a few weeks ago and left it running for about 6 hours.

My /home directory is on a separate partition on my second hard disk so re-installing wouldn't be a problem. I would really prefer not to re-install though, as I have been using Linux for a few months now and started with Slackware. During that time I have messed up and had to re-install countless times. It's been frustrating, but I have learned a lot. The main reason I would like to keep the install I have is because of all the programs I have compiled and installed, and I recently got Bluetooth set up, which was a huge pain and would not like to have to do it again.

#######################

I just rebooted without X and cpu usage stayed at a steady 0.3%

justwantin 02-18-2007 08:32 PM

I've noted your cpu usage. Now what's not running in runlevel 3 that would be running in runlevel 4?

Process of elimination, What runs in the background other than X? Anything that is not stock slack-11? This is also what I was getting at with the permissions in my /etc/rc.d, if it isn't set to execute it isn't running. You've gotten bluetooth going, what does that run in the background if anything? Anything else?

Here's some examples of things that can go wrong. I was have the symptoms of memory loss. It turned out the audacity was not shutting down when gui was closed. 4 audacity processes going behind the scenes, 45 % cpu with the aps running feral. Also I tried to view dvb-t but had forgotten to install nvidia driver first. Default slack xorg config was ok but not good enough for dvb-t and memory buffering/whatever gave jerky display. Never checked the memory use though.

One was a software problem and the other just plain forgetfullness on my part.

Probably too late to tell you. When I compile I make my own slackpacs using checkinstall instead of make install. I also make notes on the tweeks and configurations I do for future reference. My / /usr /usr/local /home and /opt all get there own partitions so install only wipes / and /usr when moving up a version

My first linux was suse preinstalled on a box I purchased in 2000. By the time I switched to Mdk the same year I probably held the Guiness record for reinstalls. Mdk wasn't much better and eventually I switched to Slack in 2001. still did allot of installs but I was learning all the time. Took sme time but I learned a bit more each time. This box with the two week old install was a reinstall just because I had fiddled around a bit and probably had installed some stuff I didn't need since oct 06. I figured I'd start from scratch again and pay a little more attention to what I install this time. That being said I never mess with my daughter's box or the server (both slack) they just keep chugging along after initial install and config with only tweeks as required. I only crash and burn my own.

johngreenwood 02-18-2007 08:53 PM

All the bluetooth stuff runs in runlevel 3 too (except kbluetoothd), I made a script which does everything I need to start bluetooth and then call that from the startup scripts. As for other prcesses not in 3, but in 4. There are quite a few, I will reboot, make a list of everything that shows up in ps -A in both runlevels. But for a start I know of a few, yakuake, superkaramba, kbluetoothd, kbfx.

I don't suppose you happen to know what "msp3410 [auto]" is?

justwantin 02-18-2007 09:02 PM

wwww.google.com/linux is your friend. Haven't read any but there are heaps


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