Howdy- I am maintaining a kernel for the A7N8X (nforce2) boards with Red
Hat Linux. With kernel 2.4.21pre5 I decided to try and have my kernel
rpm add the kernel to the boot loader automagically, following the
example in the Red Hat kernel rpm spec file.

I use lilo, and it does not seem to work - grubby complains:

grubby fatal error: unable to find a suitable template

The kernel is not added to lilo.
It does seem to properly add it to a grub.conf file, though.

If I install a Red Hat kernel, lilo gets properly updated.
What the hell is going on?

Here is my %post section of the rpm spec file:
%post
if [ `grep -c "i810_audio" /etc/rc.local` -eq 0 ]; then
        echo "/sbin/modprobe i810_audio" >> /etc/rc.local
fi
cd /boot
ln -sf module-info-%{patchversion} module-info
ln -sf System.map-%{patchversion} System.map
ln -sf vmlinuz-%{patchversion} vmlinuz
[ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade
[ -x /sbin/mkkerneldoth ] && /sbin/mkkerneldoth

if [ -x /sbin/new-kernel-pkg ]; then
        /sbin/new-kernel-pkg --mkinitrd --depmod --install
%{patchversion}
fi

The complete spec file is attached.
-- 
Michael A. Peters <[EMAIL PROTECTED]>
%define name nf_kernel
%define tarname linux
%define majorversion 2.4.20
%define patchversion 2.4.21-pre5
%define release 3
%define __spec_install_post /usr/lib/rpm/brp-compress || :
%define kernversion %{majorversion}-%{patchversion}

Name: %{name}
Version: %{majorversion}
Release: %release
License: GPL
Summary: Linux Kernel
Source0: %{tarname}-%{majorversion}.tar.gz
Source1: RedAthConfig-%{majorversion}-%{patchversion}
Source2: module-info
#Source3: NVIDIA_nforce-1.0-0248.tar.gz
NoSource: 0
Patch0: patch-%{patchversion}
Patch1: asusa7n8x_3com.diff
#Patch2: nforce2ide.diff
Patch3: 2.4.21-pre5.mtd.chips.Makefile.patch
Patch4: ieee1394.patch-2.4.21-pre5.patch
Patch5: 2.4.21-pre5.auermain.patch
Group: System Environment/Kernel
URL: http://homepage.mac.com/mpeters/A7N8X/
Packager: Michael A. Peters <[EMAIL PROTECTED]>
BuildRoot: %{_tmppath}/%{name}-%{kernversion}-root
BuildArch: athlon
Requires: redhat-release = 8.0

%description
A patched kernel to provide better support for nforc2 chipset

%prep
#%setup -n nforce_kernel -c -a0 -a3
%setup -n nforce_kernel -c -a0
cd %{tarname}-%{majorversion}
%patch0 -p1
%patch1 -p1
#%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
cd ..
mkdir -p $RPM_BUILD_ROOT/boot
mkdir -p $RPM_BUILD_ROOT/lib/modules
mkdir -p $RPM_BUILD_ROOT/var/kernelsource

%build
%{__mv} linux-%{majorversion} linux-%{kernversion}
cd linux-%{kernversion}
%{__make} mrproper
%{__cp} %{_sourcedir}/RedAthConfig-%{majorversion}-%{patchversion} ./.config
%{__make} oldconfig
%{__make} dep
%{__make} bzImage
%{__make} modules

%install
cd linux-%{kernversion}
install -m755 vmlinux $RPM_BUILD_ROOT/boot/vmlinux-%{patchversion}
%{__cp} arch/i386/boot/bzImage $RPM_BUILD_ROOT/boot/vmlinuz-%{patchversion}
chmod 644 $RPM_BUILD_ROOT/boot/vmlinuz-%{patchversion}
%{__install} -m644 System.map %{buildroot}/boot/System.map-%{patchversion}
%{__cp} %{_sourcedir}/module-info %{buildroot}/boot/module-info-%{patchversion}
%{__make} -s INSTALL_MOD_PATH=%{buildroot} modules_install
%{__make} clean
%{__cp} %{_sourcedir}/RedAthConfig-%{majorversion}-%{patchversion} ./.config
cd ..

mv linux-%{kernversion} $RPM_BUILD_ROOT/var/kernelsource/

#fix build symlink
#cd %{buildroot}/lib/modules/%{kernversion}
cd %{buildroot}/lib/modules/%{patchversion}
rm -f build
ln -sf /var/kernelsource/linux-%{majorversion}-%{patchversion} build

#generate filelist
echo "%defattr(-,root,root)" > /tmp/files.list
for a in `find %{buildroot} -print`; do
if [ ! -d $a ]; then
        echo $a |%{__sed} -e s?"^%{buildroot}"?""? >> /tmp/files.list
fi
done;
#echo "/lib/modules/%{kernversion}/build" >> /tmp/files.list
echo "/lib/modules/%{patchversion}/build" >> /tmp/files.list
echo "/var/kernelsource/linux-%{kernversion}/include/asm" >> /tmp/files.list

%clean
rm -rf %{buildroot}
rm -f /tmp/files.list

%pre
/sbin/modprobe loop 2> /dev/null > /dev/null || :
exit 0

%post
if [ `grep -c "i810_audio" /etc/rc.local` -eq 0 ]; then
        echo "/sbin/modprobe i810_audio" >> /etc/rc.local
fi
cd /boot
ln -sf module-info-%{patchversion} module-info
ln -sf System.map-%{patchversion} System.map
ln -sf vmlinuz-%{patchversion} vmlinuz
[ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade
[ -x /sbin/mkkerneldoth ] && /sbin/mkkerneldoth

if [ -x /sbin/new-kernel-pkg ]; then
        /sbin/new-kernel-pkg --mkinitrd --depmod --install %{patchversion}
fi

%preun
/sbin/modprobe loop 2> /dev/null > /dev/null || :
if [ -x /sbin/new-kernel-pkg ]; then
        /sbin/new-kernel-pkg --rminitrd --rmmoddep --remove %{patchversion}
fi

%files -f /tmp/files.list

%changelog
* Sat Feb 28 2003 Michael A. Peters <[EMAIL PROTECTED]>
- updated to 2.4.21-pre5, added ntfs read module, kernel gets added to
- boot loader, added FireWire patch

* Thu Jan 31 2003 Michael A. Peters <[EMAIL PROTECTED]>
- updated to 2.4.21-pre4

* Wed Jan 29 2003 Michael A. Peters <[EMAIL PROTECTED]>
- created initial spec file

Reply via email to