Make RPM

Trevor Smith trevor at
Wed Nov 19 19:29:16 UTC 2003

On Wed, 2003-11-19 at 09:42, David C. Hart wrote:

> 1. The process seems to make both the source and installation RPMs. Is
> there any way to make an installation version only?

Go into the Makefile in the top level of the source for the kernel and
go all the way to the bottom until you find the rpm target.  there
should be a line that looks something like this
$(RPM) -ta $(TOPDIR)/../$(KERNELPATH).tar.gz ; \

change the -ta to -tb and it will build only the binary.  Maybe not the
recommended way to handle it but it works.
> 2. If I install the RPM it's not updating grub.conf like "make
> install."
> How can I fix this so that the customized kernel rpm behaves like what
> one gets from RH?

you do it via a postinstall script within rpm

something like this goes in the end of the .spec file before the

this one is from the .spec for kernel-2.4.22-1.2115.nptl.src.rpm

cd /boot
ln -sf vmlinuz-%{KVERREL} vmlinuz
ln -sf{KVERREL}
[ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade
[ -x /sbin/mkkerneldoth ] && /sbin/mkkerneldoth
[ -x /sbin/new-kernel-pkg ] && /sbin/new-kernel-pkg --mkinitrd --depmod
 --install %{KVERREL}

%{KVERREL} is defined in the spec file to produce the version and
extraversion as shown in the actual post script from the binary rpm

this is the output of:
rpm -qp --scripts kernel-2.4.22-1.2115.nptl.i686.rpm showing only %post

postinstall scriptlet (using /bin/sh):
cd /boot
ln -sf vmlinuz-2.4.22-1.2115.nptl vmlinuz
ln -sf
[ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade
[ -x /sbin/mkkerneldoth ] && /sbin/mkkerneldoth
[ -x /sbin/new-kernel-pkg ] && /sbin/new-kernel-pkg --mkinitrd --depmod
--install 2.4.22-1.2115.nptl

you will notice if you do rpm -qp --scripts on your binary rpm that was
built via make rpm that there aren't any.  thats why you don't get any
of the nice automagic grub.conf editing etc...

I recommend reading the end of the Makefile for for your kernel sources
to look at how it handles make rpm.  It provides some guidance on what
will happen in the process. Building a basic kernel rpm is easy doing
make rpm.  Editing spec and building ones that have a lot of the
niceties the fedora/redhat ones do can be a bit harder.  The spec file
from the 2.4.22-1.2115.nptl is 1691 lines itself.  So hopefully the
above info gets you a little further along and my rambling message makes
some sense.


More information about the fedora-list mailing list