Re: Maintaining kernel source in sarge
Hello
On Sun, May 18, 2003 at 04:52:54PM +0200, Martin Schulze wrote:
*SNIP*
> Removing one kernel version and including another without rebuilding
> all modules packages will break several installations. Not removing
> the old packages will make the archive grow through time which will
> cause problems with CD build scripts.
>
> Hence, it is important that when a new kernel is added (e.g. for
> security reasons) an older package is removed *and* all relevant
> modules packages are rebuilt and included as well.
Rebuilding module pacakges is not always trivial. I hope that code
can help some. The reason is that most of them depend on a kernel-tree
that is already compiled. The following code fixes that (at least for my situations).
I use it to compile modules for custom kernels. If you want me to make a command
line tool, just tell me. :)
Modify it as you wish.
----
# This file should be sourced by a file that sets the following variables.
#revision=01
#kernver=2.4.19
#arch=686
#append=freeswan+vlan+mppe+ctx+netboot+raid
#clean=no
#prepmods=
# Reasonable defaults
#E=${revision:=01}
# Some other settings.
srcdir=/usr/src
kernbdir=kernel-source-$kernver
curdir=`pwd`
modsrcdir=modules
kernsrcdir=$curdir/$kernbdir
FAKE=
if [ "$UID" != "0" ] ; then
FAKE=fakeroot
fi
if [ -z "$maint" ] ; then
I="[^:][^:]*"
maint=$(grep "^$USER:" /etc/passwd | \
sed "s|$I:$I:$I:$I:||;s|[,:].*||;")
fi
if [ -z "$email" ] ; then
email="$EMAIL"
fi
if [ "$cleanall" = "yes" -a -d "$modsrcdir" ] ; then
for d in $(find $modsrcdir -type d -mindepth 1 -maxdepth 1) ; do
rm -Rf $d
done
fi
if [ ! -d $kernbdir ] ; then
echo "Unpacking source kernel-source-$kernver.tar.bz2"
tar xfj $srcdir/kernel-source-$kernver.tar.bz2
else
echo "CD $kernbdir"
cd $kernbdir
if [ -d "debian" ] ; then
$FAKE debian/rules clean <<EOF
n
n
n
EOF
elif [ -f Makefile ] ; then
$FAKE make clean
fi
echo "CD .."
cd ..
fi
if [ -n "$prepmods" ] ; then
if ! echo "$prepmods" | grep -q "pcmcia-cs" ; then
prepmods="$prepmods pcmcia-cs"
fi
fi
for p in $prepmods ; do
echo "PREPARE $p."
echo "CD $curdir"
cd $curdir
if [ "$clean" = "yes" -a -d "$modsrcdir/$p" ] ; then
rm -Rf "$modsrcdir/$p"
fi
if [ ! -d "$modsrcdir/$p" ] ; then
echo "Uncompressing $p module."
if [ -r $p.tar.gz ] ; then
tar xfz $p.tar.gz
elif [ -r $p.tar.bz2 ] ; then
tar xfj $p.tar.bz2
elif [ -r $srcdir/$p.tar.gz ] ; then
tar xfz $srcdir/$p.tar.gz
elif [ -r $srcdir/$p.tar.bz2 ] ; then
tar xfj $srcdir/$p.tar.bz2
else
echo "ERROR no source for preparing $p in '$srcdir' or '.'."
exit 1
fi
MODNAME=$(echo "$d" | sed -e "s|.*/||;")
echo "CD $modsrcdir/$p"
cd $modsrcdir/$p
if [ -r "../$p.patch" ] ; then
echo "PATCHING $p source using ../$p.patch."
patch --forward -p1 --force < "../$p.patch"
fi
fi
done
echo "CD $curdir"
cd $curdir
if [ ! -d "$modsrcdir" ] ; then
echo "A modules source directory is required! A directory for each modules source."
exit 1
fi
compilemods=$(find $modsrcdir -type d -mindepth 1 -maxdepth 1)
if [ -z "$compilemods" ] ; then
echo "No modules to create in $modsrcdir dir."
exit 1
fi
for arch in $archs ; do
VNAME=$kernver-$append-$arch
KERNSRC=/usr/src/kernel-headers-$VNAME
echo "COPY kernel headers to kernel build tree."
cp -a $KERNSRC/* $kernsrcdir
for d in $compilemods ; do
MODNAME=$(echo "$d" | sed -e "s|.*/||;")
echo "CD $curdir"
cd $curdir
echo "CD $modsrcdir"
cd $modsrcdir
echo "CD $MODNAME"
cd $MODNAME
#OPTS="KSRC=$KERNSRC KVERS=$VNAME"
#OPTS="KSRC=$KERNSRC KVERS=$VNAME"
OPTS="KSRC=$kernsrcdir KVERS=$VNAME"
echo "CLEAN before build."
$FAKE debian/rules clean $OPTS
echo "BUILD"
$FAKE debian/rules kdist $OPTS \
#$FAKE debian/rules binary-modules $OPTS \
KMAINT="$maint" KEMAIL="$email" DEST=../..
#KPATH=$KERNSRC:$kernsrcdir
done
done
--------
Regards
// Ola
> I would be glad if somebody could investigate the modules situation
> and describe which modules packages require which kernel versions
> (and/or depend on which other packages).
>
> I also wonder if there are efforts in progress to unify the kernel
> source through more than two architectures? This would require a
> group or architecture maintainers (current kernel package mantainers)
> to work collaboratively towards this goal.
A policy for kernel, kernel-patcha and kernel-module packages should be
great.
I'll start here:
Kernel package policy:
----------------------
* It should only exist one kernel-source package.
* Every modification to the kernel should be added as a patch package.
* Modifications may be separated to make it easier to administrate and
for other people/packages to use it.
Kernel module policy:
---------------------
* Kernel modules must be provided as a "binary source" package.
* Module source packages should provide a debian/rules file.
* The debian/rules file must compile the module if KSRC=kernelsourcedir
and KVERS=versionname is priovided.
* The debian/rules file may fail if an unsupported version of the kernel is
provided by the environment.
* The debian/rules file may fail if no kernel-headers is in that location.
* The debian/rules file should handke KMAINT and KEMAIL env variables.
What do you think?
Regards,
// Ola
> Regards,
>
> Joey
>
> --
> Ten years and still binary compatible. -- XFree86
>
> Please always Cc to me when replying to me on the lists.
>
>
> --
> To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
>
--
--------------------- Ola Lundqvist ---------------------------
/ opal@debian.org Annebergsslingan 37 \
| opal@lysator.liu.se 654 65 KARLSTAD |
| +46 (0)54-10 14 30 +46 (0)70-332 1551 |
| http://www.opal.dhs.org UIN/icq: 4912500 |
\ gpg/f.p.: 7090 A92B 18FE 7994 0C36 4FE4 18A1 B1CF 0FE5 3DD9 /
---------------------------------------------------------------
Reply to: