This looks great to me, I just tested it.
Will you add this to a separate package ?
Here are some things you could improve:

- Include the build-procedure (user will just have to do "cd /usr/src/linux; 
make xconfig; makekernel.pl")

- With LM72, the depmod-command will fail, because:
        1 Version is returned as "1" instead of "2.2.17-21mdk"
        2 System.map is specified with "-F", not "-m"

Thanks
Michael

Am Samstag, 27. Januar 2001 20.08 schrieben Sie:
> 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;
> }

Reply via email to