Building .ko from from SRPM, what reduces .ko file size between 'make' and RPM?

David bouncingcats at gmail.com
Fri Feb 27 06:11:55 UTC 2009


Hello. I'm attempting a newbie skill building exercise rather than
solving a particular problem, but I'm missing something obvious.
Searching hasnt helped me on this specific point.

I imagine that 'make' of the entire kernel source RPM (at the exact
version as my Fedora 9 precompiled kernels) should closely duplicate
my precompiled kernel modules, for example my ALSA driver module
snd-intel8x0.ko

However as shown by 'ls' at the last paragraph of this email, I notice
that the snd-intel8x0.ko I build using 'make' is 230265 bytes but the
precompiled operational one is *much* smaller at 39592 bytes.

I am afraid to proceed to 'make install' until these files look
similar/identical.

Also I notice that if I build the kernel.rpm and then 'rpm -qp --dump'
it, then these file sizes *are* identical.

So I am wondering what affects the size of the .ko file between 'make'
and the built RPM. As a newbie in this area I am far from
comprehending the entire kernel.spec or Makefiles system. So it would
greatly assist me if someone could give me a pointer what to look at
next.

Please note that my aim is not to build an rpm. My aim is to become
knowledgable enough extract a kernel source tree from a srpm, to be
able to 'make' it, and ultimately to be able to 'make' subsections of
it, in particular make and install an individual module, without
building an rpm. I understand the consequences for my rpm database.

Using diff on the output from 'modinfo' on each file gives only these
differences
< filename:
/BIG/HOME/david/rpmbuild/BUILD/kernel-2.6.25/linux-2.6.25.i686/sound/pci/snd-intel8x0.ko
> filename:       /lib/modules/2.6.25-14.fc9.i686/kernel/sound/pci/snd-intel8x0.ko
< vermagic:       2.6.25 SMP mod_unload 686 4KSTACKS
> vermagic:       2.6.25-14.fc9.i686 SMP mod_unload 686 4KSTACKS

I'm using the reference
http://www.tldp.org/LDP/lkmpg/2.6/html/x380.html ("Linux Kernel Module
Programming Guide: Building modules for a precompiled kernel").

My complete approach is reproduced below. Probably you can skip the
first 3 paragraphs that just show my rpmbuild targets. ~/rpmbuild is a
symlink due to insufficient free space on my home drive.

By the way, I live in a remote location with poor quality dialup
internet so sadly I cannot possibly keep my installation at the latest
update of all packages between DVD releases.

I'll be really grateful for any tips on the above, thanks. David

---------------------------------------------------------------------

[~]$ uname -a
Linux kablamm.localdomain 2.6.25-14.fc9.i686 #1 SMP Thu May 1 06:28:41
EDT 2008 i686 i686 i386 GNU/Linux

[~]$ ln -v -s -f -T "/BIG/HOME/david/rpmbuild" "/home/david/rpmbuild"
`/home/david/rpmbuild' -> `/BIG/HOME/david/rpmbuild'

[~]$ cat .rpmmacros
%_topdir      %(echo $HOME)/rpmbuild
%_smp_mflags  -j3
%__arch_install_post   /usr/lib/rpm/check-rpaths   /usr/lib/rpm/check-buildroot
%packager	David
%distribution	Fedora %(tr -dc [0-9] </etc/fedora-release)
%vendor		David
%_home		%(echo $HOME)
%_signature	gpg
%_gpg_path	%{_home}/.gnupg
%_gpgbin	/usr/bin/gpg
%_gpg_name	%( gpg --list-keys | sed -n "s/^uid *//p" | head -1 )
%_rpmdir	%{_topdir}/RPM
%_srcrpmdir	%{_topdir}/RPM
%_rpmtopdir	%{_topdir}/%{name}-%{version}-%{release}
%_specdir	%{_rpmtopdir}
%_sourcedir	%{_rpmtopdir}
%_tmppath	%{_topdir}/TMP
%_builddir	%{_topdir}/BUILD

[~]$                          rpm -Uvh kernel-2.6.25-14.fc9.src.rpm

[~]$                          cd ~/rpmbuild/kernel-2.6.25-14.fc9

[kernel-2.6.25-14.fc9]$       rpmbuild -bp "--target=$(uname -m)" kernel.spec

[kernel-2.6.25-14.fc9]$       cd
~/rpmbuild/BUILD/kernel-2.6.25/linux-2.6.25.i686/

[linux-2.6.25.i686]$          cp /boot/config-2.6.25-14.fc9.i686 .config

[linux-2.6.25.i686]$          make

[linux-2.6.25.i686]$          find ~/rpmbuild/BUILD/kernel-2.6.25/
-name snd-intel8x0.ko
/BIG/HOME/david/rpmbuild/BUILD/kernel-2.6.25/linux-2.6.25.i686/sound/pci/snd-intel8x0.ko

[linux-2.6.25.i686]$          ls -l
~/rpmbuild/BUILD/kernel-2.6.25/linux-2.6.25.i686/sound/pci/snd-intel8x0.ko
/lib/modules/2.6.25-14.fc9.i686/kernel/sound/pci/snd-intel8x0.ko
-rw-rw---- 1 david david 230265 2009-02-26 20:24
/home/david/rpmbuild/BUILD/kernel-2.6.25/linux-2.6.25.i686/sound/pci/snd-intel8x0.ko
-rwxr--r-- 1 root  root   39592 2008-05-01 20:49
/lib/modules/2.6.25-14.fc9.i686/kernel/sound/pci/snd-intel8x0.ko




More information about the fedora-list mailing list