Michael Stucki <[EMAIL PROTECTED]> writes:
> So what do you think ???
> Possible ? Sure.
sure possible i did it something like this a while ago but not tested
a lot :
#!/usr/bin/perl -w
use strict;
unless ( -f 'arch/i386/boot/bzImage' or -f './System.map' ) {
print "You should run this script from the linux build tree\n";
print "Sound like i can't find a compiled bzImage or System.map\n";
exit(1);
}
my $version = get_version_from_dot_h();
(my $rpm_version = $version) =~ s|-.*||;
(my $rpm_release = $version) =~ s|.*-||;
my $pwd = $ENV{PWD};
my $spec = "$pwd/build-rpm/buildkernelrpm.spec";
my $rpmrc = "$pwd/rpmrc";
`rm -rf build-rpm`; mkdir 'build-rpm'; mkdir 'build-rpm/boot';
copy_files();
generate_spec();
`rpm -bb $spec`;
sub copy_files {
`cp arch/i386/boot/bzImage build-rpm/boot/vmlinuz-$version`;
`cp System.map build-rpm/boot/System.map-$version`;
`make modules_install INSTALL_MOD_PATH=$pwd/build-rpm`;
}
sub generate_spec {
local *F;
open F, ">$spec";
print F << "EOF";
%define name kernel
%define version $rpm_version
%define release $rpm_release
%define __spec_install_post /usr/lib/rpm/brp-compress || :
Summary: The Linux kernel (the core of the Linux operating system).
Name: %{name}
Version: %{version}
Release: %{release}
Copyright: GPL
Group: System/Kernel and hardware
BuildRoot: $pwd/build-rpm/
Prefix: %{_prefix}
%description
The kernel package contains the Linux kernel (vmlinuz), the core of your
Linux Mandrake operating system. The kernel handles the basic functions
of the operating system: memory allocation, process allocation, device
input and output, etc.
%prep
%files
%defattr(-,root,root)
/lib/modules/*
/boot/*
%post
cd /boot
ln -sf vmlinuz-$version vmlinuz
if [ -x /sbin/installkernel ];then
/sbin/installkernel -a -c $version
fi
depmod -a -m /boot/System.map-$version $version
%preun
/sbin/modprobe loop 2> /dev/null > /dev/null
rm -f /lib/modules/$version/modules.*
exit 0
%changelog
# end of file
EOF
close F;
}
sub get_version_from_dot_h {
`make include/linux/version.h`;
local *F;
open F, "include/linux/version.h";
while (<F>) { return $1 if /^#define UTS_RELEASE "(.*)"$/ };
close F;
}
--
MandrakeSoft Inc http://www.chmouel.org
--Chmouel