[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Mini-Howto: Build linux-kbuild-3.5



Hi,

today, I was discussing with Michael and at some point he was
complaining about the missing linux-kbuild-3.5 package in the Debian
software archives.
He was not able to install linux-headers-3.5 Debian package as it depends on it.

So, this is for you, Michael.

Hope this helps others as well.

Regards,
- Sedat -
#!/bin/sh

#####     Filename: Mini-Howto_Build_linux-kbuild-3-5.txt
#####       Author: Sedat Dilek <sedat.dilek@gmail.com>
#####      Created: 17-Aug-2012
##### Last Changed: 17-Aug-2012

#####  NOTE-1: Source for linux-kbuild-3.5 Debian binaries is linux-tools!
#####  NOTE-2: linux-headers-3.5 package depends on linux-kbuild-3.5 (1st exists in the archives 2nd not)
#####          ( Known problem: "Same procedure as with every linux-trunk release, Mrs. Sophie?" )

##### WARNING: firebird-dev breaks perf compilation due to sh*t shipped within "/usr/include/perf.h" !
#####     XXX: Workaround: Deinstall firebird-dev package!

##### EXPORTS

export LANG=C
export LC_ALL=C

##### SOME USEFUL VARIABLES

### Package names
PKG_NAME="linux-tools"
PKG_NAME_LATEST="${PKG_NAME}-latest"

### Version strings
PKG_VER="3.5"
KERNEL_VERSION="$PKG_VER"
KERNEL_VERSION_REPACKED="${PKG_VER}.0"
PKG_VER_LATEST="3.4-1~experimental.1"

### Tarballs
KERNEL_TARBALL="linux-${KERNEL_VERSION}.tar.xz"
DEBIAN_TARBALL="${PKG_NAME}_${PKG_VER}.orig.tar.gz"
# XXX: Workaround for new naming-scheme (tarball: 2 digits VS. Makefile: 3 digits)
KERNEL_TARBALL_REPACKED="linux-${KERNEL_VERSION_REPACKED}.tar.gz"

### URLs
KERNEL_FTP_URL="http://ftp.kernel.org/pub/linux/kernel/v3.x";
DEBIAN_SVN_URL="svn://svn.debian.org/kernel/releases/${PKG_NAME}"

### Working and build directorie
WORK_DIR="${HOME}/src/${PKG_NAME}"
BUILD_DIR="${WORK_DIR}/${PKG_NAME}-${PKG_VER}"

##### PREPARE DEBIAN PACKAGE

### Create and enter working directory
[ -d $WORK_DIR ] || mkdir $WORK_DIR
cd $WORK_DIR

### Download Linux vanilla source file
wget $KERNEL_FTP_URL/$KERNEL_TARBALL

### Checkout $PKG_NAME_LATEST from $DEBIAN_SVN_URL
svn co $DEBIAN_SVN_URL/$PKG_VER_LATEST $PKG_NAME_LATEST

### Enter the arena
cd $PKG_NAME_LATEST

### Remove unwanted SVN-repository related files and dirs
rm -v -rf $(find ./ -name .svn)

### Generate missing debian/control file to satisfy dch (included in devscripts package)
make -f debian/rules debian/control-real

### Bump package-name and debian-version
dch -i

### Re-create and check debian/control file for "linux-kbuild" (should contain $PKG_VER)
make -f debian/rules debian/control-real
grep linux-kbuild debian/control

### XXX: Workaround: Repack Linux vanilla tarball
cd $WORK_DIR
tar -xf $KERNEL_TARBALL
mv linux-${KERNEL_VERSION} linux-${KERNEL_VERSION_REPACKED}
tar -c --gzip -f $KERNEL_TARBALL_REPACKED linux-${KERNEL_VERSION_REPACKED}
rm -rf linux-${KERNEL_VERSION_REPACKED}

### Generate DFSG-pruned $DEBIAN_TARBALL
cd $PKG_NAME_LATEST
./debian/bin/genorig.py ../$KERNEL_TARBALL_REPACKED

### Unpack $DEBIAN_TARBALL
cd $WORK_DIR
tar -xf orig/$DEBIAN_TARBALL

# Copy debian-dir from SVN checkout
cp -av ${PKG_NAME_LATEST}/debian $BUILD_DIR

### Delete symlink to orig/$DEBIAN_TARBALL, move the real file and delete orig-dir
rm -v -f $DEBIAN_TARBALL
mv -v orig/$DEBIAN_TARBALL ./
rm -v -rf orig/

##### BUILD DEBIAN PACKAGE

### Enter build-dir
cd $BUILD_DIR

### Check build-dependencies (run 'apt-get build-dep linux-tools' to satisfy build-deps)
dpkg-checkbuilddeps

### Start the build (alternatively: run 'dpkg-buildpackage -us -uc')
debuild

##### CLEAN-UP

cd $WORK_DIR

### Remove kernel tarballs
rm -v -f $KERNEL_TARBALL
rm -v -f $KERNEL_TARBALL_REPACKED

### Remove directory from SVN checkout
rm -v -rf $PKG_NAME_LATEST

### Remove build-dir
rm -v -rf $BUILD_DIR

##### INSTALL DEBIAN PACKAGE

### Install linux-kbuild package manually
dpkg -i linux-kbuild-${PKG_VER}_*.deb


Reply to: