#!/bin/bash
# cross-building linux-2.6 for m68k

# place with lots of space
DIR=/data/skeeve

# here lives the kernel svn
#  can be checked out ie with:
#    svn co svn+ssh://<user>@svn.debian.org/svn/kernel/
# 2.6.13 currently
SVN=$DIR/svn/kernel/dists/trunk
# released kernel, 2.6.12 currently
#SVN=$DIR/svn/kernel/dists/sid/
# this is version in trunk, if you want to build 2.6.12, the orig.tar.gz is in the archive
LVER=2.6.13

cd $DIR/kernel/
# get a local copy to mess around
echo svn export $SVN/linux-2.6 linux-$LVER
# we need the orig.tar.gz
# for unreleased versions (ie 2.6.13):
echo wget http://lophos.multibuild.org/kernel/linux-2.6/test/linux-2.6_$LVER.orig.tar.gz
# for already released versions, ie 2.6.12, this will do:
#wajig source -d linux-2.6
cd linux-$LVER

# unpack the orig.tar.gz _without_ overwriting our precious debian directory
./debian/rules orig

# the control files are autocreated by magic
./debian/rules debian/control

# ready to roll
# -B     : do not build the binary package, others will upload that
# -am68k : we want to build m68k kernels of course
# you need kernel-package from sid for this
# this used to work:
#debuild -B -am68k
# the latest(?) kernel-package requires this:
# DEB_HOST_ARCH must be set, otherwise debian/rules does not recognize we are cross-compiling
DEB_HOST_ARCH=m68k debuild -B -am68k