Linux Kernel in a Nutshell - FREE

If it doesn't relate to Debian, but you still want to share it, please do it here
Post Reply
Message
Author
User avatar
mzilikazi
Forum Ninja
Posts: 3321
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

Linux Kernel in a Nutshell - FREE

#1 Post by mzilikazi »

Nope not a joke.
http://www.kroah.com/lkn/
License
This book is available under the terms of the Creative Commons Attribution-ShareAlike 2.5 license. That means that you are free to download and redistribute it. The development of the book was made possible, however, by those who purchase a copy from O'Reilly or elsewhere.
Debian Sid Laptops:
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G

User avatar
Lost Dog
Posts: 250
Joined: 2006-08-11 21:54
Location: North of the Columbia River

Re: Linux Kernel in a Nutshell - FREE

#2 Post by Lost Dog »

mzilikazi wrote:Nope not a joke.
http://www.kroah.com/lkn/
License
This book is available under the terms of the Creative Commons Attribution-ShareAlike 2.5 license. That means that you are free to download and redistribute it. The development of the book was made possible, however, by those who purchase a copy from O'Reilly or elsewhere.
I downloaded this the other day and spent last evening trying to strip down my 2.6.19.2 kernel to the bare minimum. It has some pretty good information on customizing the kernel.

I've got everything working except CDROM support (Pioneer DVR-111). I broke that somehow and now I'm trying to track down what I need to activate in the kernel to get it working again.

One thing I never knew was using the -j modifier during "make" to specify the number of threads to use. Speeds up compiling quite a bit with my dual core chip!

For compiling kernels I use make-kpkg rather than make but make-kpkg does not have the -j modifier. Is there something similar?

User avatar
garrincha
Posts: 2340
Joined: 2006-06-02 16:38

#3 Post by garrincha »

At first I thought that it was the famed O'Reilly reference Linux in a Nutshell that I usually browse through whenever I'm in my local bookstore, but upon closer examination I was mistaken as it is about ikernel. Still, I downloaded the tarball, just read the first few chapters -- it is quite good and informative.

Thanks for the link mzilikazi.
Maurice Green on Usain Bolt's 9.58: "The Earth stopped for a second, and he went to Mars."

User avatar
mzilikazi
Forum Ninja
Posts: 3321
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

Re: Linux Kernel in a Nutshell - FREE

#4 Post by mzilikazi »

Lost Dog wrote: For compiling kernels I use make-kpkg rather than make but make-kpkg does not have the -j modifier. Is there something similar?
man make-kpkg
/snip/
CONCURRENCY_LEVEL
If defined, this environment variable sets the concurrency level of make used to compile the kernel and the modules set using
-j flags to the sub make in the build target of make-kpkg. Should be a (small) integer, if used. You can get the current num-
ber of CPUs using the command:
"grep -c '^processor' /proc/cpuinfo" WARNING: Do NOT set the -j option in MAKEFLAGS directly, this shall call the build to
fail.
So you could do:

Code: Select all

export CONCURRENCY_LEVEL=2
fakeroot make-kpkg blah blah blah
Or even add it to /etc/environment:

Code: Select all

LANG=C
CONFIG_SMP=y
CONCURRENCY_LEVEL=2
This is just what google told me. I don't even have access to a dual core machine to test on. Please report back if you don't mind.
Debian Sid Laptops:
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G

User avatar
mzilikazi
Forum Ninja
Posts: 3321
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

#5 Post by mzilikazi »

Just thought I'd toss this link in here for completeness. The Debian Linux Kernel Handbook.
Debian Sid Laptops:
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G

User avatar
Lost Dog
Posts: 250
Joined: 2006-08-11 21:54
Location: North of the Columbia River

Re: Linux Kernel in a Nutshell - FREE

#6 Post by Lost Dog »

mzilikazi wrote: So you could do:

Code: Select all

export CONCURRENCY_LEVEL=2
fakeroot make-kpkg blah blah blah
Or even add it to /etc/environment:

Code: Select all

LANG=C
CONFIG_SMP=y
CONCURRENCY_LEVEL=2
This is just what google told me. I don't even have access to a dual core machine to test on. Please report back if you don't mind.
Ok, I just gave it a try... Before when compiling a kernel my CPU load would be near 90% on one kernel and 10% on the other it would fluctuate between the two. After using export CONCURRENCY_LEVEL both cores are pegged at 100%.

I need to write a little script that will export the time, start the compile then export the time once the job is done.... I could do that and compare the two and see a difference in compile time.

ajdlinux
Posts: 2480
Joined: 2006-04-23 09:37
Location: Port Macquarie, NSW, Australia

Re: Linux Kernel in a Nutshell - FREE

#7 Post by ajdlinux »

Lost Dog wrote:I need to write a little script that will export the time, start the compile then export the time once the job is done.... I could do that and compare the two and see a difference in compile time.
i.e. something like the 'time' command?
Jabber: xmpp:ajdlinux@jabber.org.au
Spammers, email this: ajdspambucket@exemail.com.au

User avatar
Lost Dog
Posts: 250
Joined: 2006-08-11 21:54
Location: North of the Columbia River

Re: Linux Kernel in a Nutshell - FREE

#8 Post by Lost Dog »

ajdlinux wrote:
Lost Dog wrote:I need to write a little script that will export the time, start the compile then export the time once the job is done.... I could do that and compare the two and see a difference in compile time.
i.e. something like the 'time' command?
Actually, it's "date". The problem is getting the time output before and after the compile. At any rate, here are the results!

This is with a AMD X2 4400+ with 1 gig of memory.

I compiled the same kernel twice:

export CONCURRENCY_LEVEL=4
Start: 17:31:38
Finish: 17:36:02
Total time: 4 minutes, 24 seconds.

No CONCURRENCY_LEVEL set
Start: 17:37:48
Finish: 17:45:23
Total time: 7 minutes, 35 seconds.

NOT TOO BAD!

ajdlinux
Posts: 2480
Joined: 2006-04-23 09:37
Location: Port Macquarie, NSW, Australia

Re: Linux Kernel in a Nutshell - FREE

#9 Post by ajdlinux »

Lost Dog wrote:
ajdlinux wrote:
Lost Dog wrote:I need to write a little script that will export the time, start the compile then export the time once the job is done.... I could do that and compare the two and see a difference in compile time.
i.e. something like the 'time' command?
Actually, it's "date". The problem is getting the time output before and after the compile. At any rate, here are the results!
'time' actually times the command given as an argument, so you could run it like:

Code: Select all

export CONCURRENCY_LEVEL=2
time fakeroot make-kpkg kernel_image
It would output in the form 'real, user, sys' and give the times.
Jabber: xmpp:ajdlinux@jabber.org.au
Spammers, email this: ajdspambucket@exemail.com.au

User avatar
Lost Dog
Posts: 250
Joined: 2006-08-11 21:54
Location: North of the Columbia River

Re: Linux Kernel in a Nutshell - FREE

#10 Post by Lost Dog »

ajdlinux wrote:
It would output in the form 'real, user, sys' and give the times.
I guess that would have been much easier than what I did :D

I just did another compile (finally figured out my CDROM issues and got that compiled in) and the result was about the same at 5 min 25 second (but this was compiling in some SCSI stuff as well).

User avatar
michael7
Posts: 125
Joined: 2005-05-14 22:33

#11 Post by michael7 »

Thanks for the link. I downloaded the book, read it and decided I wanted a copy. So, I ordered it from amazon for about $20. Heck, chapters 7 and 8 are worth that!
Live simply so that others may simply live.
Debian Social Contract

User avatar
graysky
Posts: 495
Joined: 2008-10-10 20:58

#12 Post by graysky »

I usually don't like to bring up old threads, but for CONCURRENCY_LEVEL, it's my understanding that the number you assign should be one + "the number of cores."

For dual core chips:
# export CONCURRENCY_LEVEL=3

For quad core chips:
# export CONCURRENCY_LEVEL=5

I dunno about hyperthreading CPUs like the old P4 or new i7... maybe you'd want to treat each hyperthread as a core thus using a value of 9.

User avatar
BioTube
Posts: 7551
Joined: 2007-06-01 04:34

#13 Post by BioTube »

4 seems to work well on my machine. Brings everything else to a (usable)crawl, but definitely speeds things up. Of course, I'm not too sure the effect of running too many concurrent jobs.
Image
Ludwig von Mises wrote:The elite should be supreme by virtue of persuasion, not by the assistance of firing squads.

Post Reply