2001-07-29 00:19:10

by Alan

[permalink] [raw]
Subject: make rpm

I've been meaning to do this one for a while and I now have it working so
that with my current -ac kernel working tree I can type

make rpm

and out puts kernel-2.4.7ac3-1.i386.rpm

All this took was the pieces below.

Anyone care to knock up a "make dpkg" to go with it ?

Alan

---

#
# RPM target
#
# If you do a make spec before packing the tarball you can rpm -ta it
#
spec:
. scripts/mkspec >kernel.spec

#
# Build a tar ball , generate an rpm from it and pack the result
# There arw two bits of magic here
# 1) The use of /. to avoid tar packing just the symlink
# 2) Removing the .dep files as they have source paths in them that
# will become invalid
#
rpm: clean newversion spec
find . \( -size 0 -o -name .depend \) -type f -print | xargs rm -f
cd $(TOPDIR)/.. ; \
ln -s $(TOPDIR) $(KERNELPATH) ; \
tar cvfz $(KERNELPATH).tar.gz $(KERNELPATH)/. ; \
rpm -ta $(TOPDIR)/../$(KERNELPATH).tar.gz


--

scripts/mkspec


#!/bin/sh
#
# Output a simple RPM spec file that uses no fancy features requring
# RPM v4. This is intended to work with any RPM distro.
#
# The only gothic bit here is redefining install_post to avoid
# stripping the symbols from files in the kernel which we want
#
echo "Name: kernel"
echo "Summary: The Linux Kernel"
echo "Version: "$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION | sed -e "s/-//"
echo -n "Release: "
cat .version
echo "Copyright: GPL"
echo "Group: System Environment/Kernel"
echo "Vendor: The Linux Community"
echo "URL: http://www.kernel.org"
echo -n "Source: kernel-$VERSION.$PATCHLEVEL.$SUBLEVEL"
echo "$EXTRAVERSION.tar.gz" | sed -e "s/-//"
echo "BuildRoot: /var/tmp/%{name}-%{PACKAGE_VERSION}-root"
echo "%define __spec_install_post /usr/lib/rpm/brp-compress || :"
echo ""
echo "%description"
echo "The Linux Kernel, the operating system core itself"
echo ""
echo "%prep"
echo "%setup -q"
echo ""
echo "%build"
echo "make oldconfig dep clean bzImage modules"
echo ""
echo "%install"
echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib
$RPM_BUILD_ROOT/lib/modules'
echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make modules_install'
echo 'cp arch/i386/boot/bzImage
$RPM_BUILD_ROOT'"/boot/vmlinuz-$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION"
echo ""
echo "%clean"
echo '#echo -rf $RPM_BUILD_ROOT'
echo ""
echo "%files"
echo '%defattr (-, root, root)'
echo "%dir /lib/modules"
echo "/lib/modules/$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION"
echo ""


2001-07-29 00:37:16

by Alan

[permalink] [raw]
Subject: Re: make rpm

> Alan Cox <[email protected]> said:
> > I've been meaning to do this one for a while and I now have it working so
> > that with my current -ac kernel working tree I can type
> >
> > make rpm
> >
> > and out puts kernel-2.4.7ac3-1.i386.rpm
>
> Great idea!
>
> Just the bunch of "echo this or that" is ugly as sin... why not a
> kernel.spec template that gets its version &c substituted by sed(1) or
> something?

Well for one because its easier to hack on at the moment. I still need to
finish up packing the right pieces, and also checking if the user
has an /sbin/installkernel and also if they are not using GRUB need to then
rerun lilo

Alan

2001-07-29 00:34:46

by Horst von Brand

[permalink] [raw]
Subject: Re: make rpm

Alan Cox <[email protected]> said:
> I've been meaning to do this one for a while and I now have it working so
> that with my current -ac kernel working tree I can type
>
> make rpm
>
> and out puts kernel-2.4.7ac3-1.i386.rpm

Great idea!

Just the bunch of "echo this or that" is ugly as sin... why not a
kernel.spec template that gets its version &c substituted by sed(1) or
something?
--
Horst von Brand [email protected]
Casilla 9G, Vin~a del Mar, Chile +56 32 672616

2001-07-29 01:06:56

by Ben Pfaff

[permalink] [raw]
Subject: Re: make rpm

Alan Cox <[email protected]> writes:

> I've been meaning to do this one for a while and I now have it working so
> that with my current -ac kernel working tree I can type
>
> make rpm
>
> and out puts kernel-2.4.7ac3-1.i386.rpm
>
> All this took was the pieces below.
>
> Anyone care to knock up a "make dpkg" to go with it ?

Debian has had a package that does this for years now. It's
called `kernel-package' and works through a program called
`make-kpkg' that does all sorts of nice things. Using
kernel-package, you could implement `make dpkg' as a single
command: `make-kpkg kernel_image'.

Here's some more about kernel-package in the program's own words:

blp:~(0)$ make-kpkg --targets
Known Targets are:
===============================================================================
| Targets | Automatically builds |
===============================================================================
| clean | |
| buildpackage | Builds the whole package |
| binary | Builds kernel_{source,headers,image,doc} |
| binary-indep | |
| kernel_source | |
| kernel_doc | |
| binary-arch | |
| kernel_headers | |
| kernel_image | Builds build |
| build | |
| modules | |
| modules_image | |
| modules_config | |
| modules_clean | |
| configure | If you wish to edit files |
| debian | generated by make config |
| debian | Creates ./debian dir, and |
| | optionally patches the source |
===============================================================================
See /usr/share/kernel-package/rules for details.
blp:~(0)$ make-kpkg --help
This program should be run in a linux kernel source top level directory.
/usr/share/doc/kernel-package/Problems.gz contains a list of known problems.

usage: make-kpkg [options] target [target ...]
where options are:
--help This message.
--revision number The debian revision number. ([a-zA-Z.+0-9]) (Must
have digit, no hyphen allowed)
--flavour foo an additional kernel sub-version. ([-a-z.+0-9])
OBSOLETE
--append-to-version foo
--append_to_version foo an additional kernel sub-version. ([-a-z.+0-9])
Does not require editing the kernel Makefile
over rides env var APPEND_TO_VERSION.
requires a make-kpg clean
--added-modules foo
--added_modules foo Comma/space separated list of add on modules
affected by the modules_<blah> targets
--added-patches bar
--added_patches bar Comma/space separated list of patches applicable
when patch_the_kernel is turned on
--arch foo architecture
--cross-compile
--cross_compile target string
--subarch bar Set the subarch for the image being compiled
(have to be on a compatible machine).
--arch-in-name
--arch_in_name Embed the subarch in the image package name
--initrd Create a image package suitable for initrd
--pgpsign name An ID used to sign the changes file using pgp.
--targets Lists the known targets.
--zimage Create a kernel using zImage rather than bzImage
--bzimage Create a kernel using bzImage (in case the site
wide default is zimage, as set in
/etc/kernel-pkg.conf)
--rootcmd method A command that provides a means of gaining
superuser access (for example, `sudo' or
`fakeroot') as needed by dpkg-buildpackages'
-r option. This is only relevant for the
buildpackage target.
--us This option is passed to dpkg-buildpackage, and
directs that package not to sign the
source. This is only relevant for the
buildpackage target.
--uc This option is passed to dpkg-buildpackage, and
directs that package not to sign the
changelog. This is only relevant for the
buildpackage target.

Use one of --zimage or --bzimage, or none, but not both.

Option Format: The options may be shortened to the smallest unique
string, and may be entered with either a - or a -- prefix, and you may
use a space between an option string and a value. Please refer to man
Getopt::Long for details on how the options may be entered.

Version: $Revision: 1.60 $
Manoj Srivastava <[email protected]>
blp:~(0)$


2001-07-29 02:53:16

by Mike Touloumtzis

[permalink] [raw]
Subject: Re: make rpm

On Sat, Jul 28, 2001 at 09:05:46PM -0400, Ben Pfaff wrote:
>
> Debian has had a package that does this for years now. It's
> called `kernel-package' and works through a program called
> `make-kpkg' that does all sorts of nice things. Using
> kernel-package, you could implement `make dpkg' as a single
> command: `make-kpkg kernel_image'.

I suggest '$(FAKEROOT) make-kpkg kernel_image'

miket

2001-07-29 11:58:44

by Jean Charles Delepine

[permalink] [raw]
Subject: Re: make rpm

Alan Cox <[email protected]> ?crivait (wrote) :

> I've been meaning to do this one for a while and I now have it working so
> that with my current -ac kernel working tree I can type
>
> make rpm
>
> and out puts kernel-2.4.7ac3-1.i386.rpm
>
> All this took was the pieces below.
>
> Anyone care to knock up a "make dpkg" to go with it ?

Maybe Herbert Xu, the actual developper of the Debian kernel package or
Manoj Srivastava, for the Debian Linux kernel package build scripts can
do that.

debian-devel, Herbert and Manoj are Cc-ed.

For those cc-ed who don't read linux-kernel, the entire thread can be read on
http://groups.google.com/groups?hl=en&safe=off&th=228bf616886d8b69,5&seekm=linux.kernel.E15Qeav-0008P4-00%40the-village.bc.nu#p

Jean Charles
--
Jean Charles Del?pine - ?quipe R?seaux T?l?coms - Universit? de Picardie

2001-07-29 12:20:22

by Wichert Akkerman

[permalink] [raw]
Subject: Re: make rpm

Previously Jean Charles Delepine wrote:
> Maybe Herbert Xu, the actual developper of the Debian kernel package or
> Manoj Srivastava, for the Debian Linux kernel package build scripts can
> do that.

We've had that option for years, just call "make-kpkg kernel_image".
It would be trivial to add a rule to the Makefile in the kernel tree
that calls that if you do "make deb".

Wichert.

--
_________________________________________________________________
/ Nothing is fool-proof to a sufficiently talented fool \
| [email protected] http://www.liacs.nl/~wichert/ |
| 1024D/2FA3BC2D 576E 100B 518D 2F16 36B0 2805 3CB8 9250 2FA3 BC2D |

2001-07-29 13:48:08

by kaih

[permalink] [raw]
Subject: Re: make rpm

[email protected] (Ben Pfaff) wrote on 28.07.01 in <[email protected]>:

> Alan Cox <[email protected]> writes:
>
> > I've been meaning to do this one for a while and I now have it working so
> > that with my current -ac kernel working tree I can type
> >
> > make rpm
> >
> > and out puts kernel-2.4.7ac3-1.i386.rpm
> >
> > All this took was the pieces below.
> >
> > Anyone care to knock up a "make dpkg" to go with it ?
>
> Debian has had a package that does this for years now. It's
> called `kernel-package' and works through a program called
> `make-kpkg' that does all sorts of nice things. Using
> kernel-package, you could implement `make dpkg' as a single
> command: `make-kpkg kernel_image'.

Well, kernel-package certainly could do with more publicity. There are
still many Debian users who don't know about it.

MfG Kai

2001-07-29 14:49:49

by Steve Kowalik

[permalink] [raw]
Subject: Re: make rpm

On Sun, Jul 29, 2001 at 02:19:59PM +0200, Wichert Akkerman uttered:
> Previously Jean Charles Delepine wrote:
> > Maybe Herbert Xu, the actual developper of the Debian kernel package or
> > Manoj Srivastava, for the Debian Linux kernel package build scripts can
> > do that.
>
> We've had that option for years, just call "make-kpkg kernel_image".
> It would be trivial to add a rule to the Makefile in the kernel tree
> that calls that if you do "make deb".
>
make-kpkg --revision=${KERNELRELEASE} kernel_image",surely?

--
Steve
Synthetic Transforming Entity Viable for Exploration and Nocturnal Killing


Attachments:
(No filename) (662.00 B)
(No filename) (232.00 B)
Download all attachments

2001-07-29 15:26:45

by Wichert Akkerman

[permalink] [raw]
Subject: Re: make rpm

Previously Steve Kowalik wrote:
> make-kpkg --revision=${KERNELRELEASE} kernel_image",surely?

No, the package revision is completely seperate from the kernel
release version.

Wichert.



--
_________________________________________________________________
/ Nothing is fool-proof to a sufficiently talented fool \
| [email protected] http://www.liacs.nl/~wichert/ |
| 1024D/2FA3BC2D 576E 100B 518D 2F16 36B0 2805 3CB8 9250 2FA3 BC2D |

2001-07-29 21:23:43

by Dominik Kubla

[permalink] [raw]
Subject: Re: make rpm

On Sun, Jul 29, 2001 at 05:26:30PM +0200, Wichert Akkerman wrote:
> Previously Steve Kowalik wrote:
> > make-kpkg --revision=${KERNELRELEASE} kernel_image",surely?
>
> No, the package revision is completely seperate from the kernel
> release version.
>
> Wichert.

Perhaps one should use:
make-kpkg --revision=$(shell cat .version) kernel_image

Like the "Build" number used by a certain software from Redmond, WA.

Dominik
--
ScioByte GmbH, Zum Schiersteiner Grund 2, 55127 Mainz (Germany)
Phone: +49 6131 550 117 Fax: +49 6131 610 99 16

GnuPG: 717F16BB / A384 F5F1 F566 5716 5485 27EF 3B00 C007 717F 16BB

2001-07-30 19:35:44

by Andreas Dilger

[permalink] [raw]
Subject: Re: make rpm

Alan writes:
> scripts/mkspec

Probably clearer to make it a "here" document (untested). EXTRASHORT could
have been left inline (inside ``), but it is a bit clearer this way, I think.

#!/bin/sh
#
# Output a simple RPM spec file that uses no fancy features requring
# RPM v4. This is intended to work with any RPM distro.
#
# The only gothic bit here is redefining install_post to avoid
# stripping the symbols from files in the kernel which we want
#
EXTRASHORT=`echo $EXTRAVERSION | sed -e "s/-//"`

cat - << EOT
Name: kernel
Summary: The Linux Kernel
Version: $VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRASHORT
Release: `cat .version`
Copyright: GPL
Group: System Environment/Kernel
Vendor: The Linux Community
URL: http://www.kernel.org
Source: kernel-$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRASHORT.tar.gz
BuildRoot: /var/tmp/%{name}-%{PACKAGE_VERSION}-root
%define __spec_install_post /usr/lib/rpm/brp-compress || :

%description
The Linux Kernel, the operating system core itself

%prep
%setup -q

%build
make oldconfig dep clean bzImage modules

%install
mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib $RPM_BUILD_ROOT/lib/modules
INSTALL_MOD_PATH=$RPM_BUILD_ROOT make modules_install
cp arch/i386/boot/bzImage $RPM_BUILD_ROOT/boot/vmlinuz-$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION

%clean
#echo -rf $RPM_BUILD_ROOT

%files
%defattr (-, root, root)
%dir /lib/modules
lib/modules/$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION

EOT

--
Andreas Dilger \ "If a man ate a pound of pasta and a pound of antipasto,
\ would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/ -- Dogbert