Kernel build tree -- how to trim down

Neil Cherry ncherry at comcast.net
Sun Apr 9 16:36:05 UTC 2006


Paul Howarth wrote:
> On Sun, 2006-04-09 at 17:39 +0200, Mostafa Afgani wrote:
>> On 4/9/06, Paul Howarth <paul at city-fan.org> wrote:
>>> Is there some problem that needs the kernel to look exactly like the
>>> stock one for yum?
>> Well, if I want to use the kernel modules from livna/extras, I need
>> the version # to be identical. Just  a change in the SMP flag
>> shouldn't break anything right? I'm leaving the rest of the
>> configuration untouched.
> 
> Not sure; some of the modules might build differently with the SMP flag
> set/not set. I'd be very wary of doing this. Could you not rebuild the
> modules you need from the SRPMs, as you're doing with the kernel itself?

I haven't had a chance to look at the link yet but if you only
need to rebuild the modules you only need the Kernel development
package, if you need to turn on/off other features you need the
Kernel source (such as with NDISWrapper and the 4K -> 8K stack
change). One other thing to note, we're used to seeing the
kernel version (uname -r) look like this:

2.6.15-1.2-54_FC5

Well it breaks down like this:

	- Version: 2
	- Patch level: 6
	- Sublevel: 15
	- Extra version: -1.2054
	- Local Version: _FC5

That info can be found in the following places:

Makefile

VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 15
#EXTRAVERSION = -prep
EXTRAVERSION = -1.2054
NAME=Sliding Snow Leopard

.config
CONFIG_LOCALVERSION="_FC5a"

I added the EXTRAVERION (was -prep) and CONFIG_LOCALVERSION (was "")
to make my kernel more compatible with upgrades. Also I don't use
a .rpmacro (sp?) file so I keep everything under /usr/src/redhat/BUILD.
Here's what I use;

1	wget 
ftp://ftp.mirror.edu/pub/fedora/linux/core/updates/4/SRPMS/kernel-2.6.12-1.1390_FC5.src.rpm
2	rpm -ihv kernel-2.6.12-1.1390_FC5.src.rpm
3	cd /usr/src/redhat/SPECS/
4	rpmbuild -bp --target=i686 kernel-2.6.spec
5	cd ../BUILD/kernel-2.6.12/linux-2.6.12/
6	cp configs/kernel-2.6.12-i586.config config.bak
7	cat config.bak | sed -e 's/CONFIG_LOCALVERSION=""/ 
CONFIG_LOCALVERSION="_FC5"/' | 	sed -e 's/\(CONFIG_4KSTACKS\).*/# \1 is 
not set/' > .config
8	cp Makefile Makefile.bak
9	sed -e 's/^EXTRAVERSION = - prep.*/EXTRAVERSION = -1.1390/' < 
Makefile.bak >Makefile
10	make oldconfig
11	make rpm
12	cd /usr/src/redhat/RPMS/i386/
13	rpm -ivh kernel-2.6.12prep-1.i386.rpm
14	cd /boot
15	mkinitrd initrd-2.6.12-1.1390_FC5.img 2.6.12-1.1390_FC5
16	cd grub/

Note that you can replace #6 with:

  cp configs/kernel-2.6.12-i586.config .config

and #7 can be removed. I don't know how useful this information is
but I'm using it in a book.

-- 
Linux Home Automation         Neil Cherry       ncherry at linuxha.com
http://www.linuxha.com/                         Main site
http://linuxha.blogspot.com/                    My HA Blog
http://home.comcast.net/~ncherry/               Backup site




More information about the fedora-list mailing list