Re: make-kpkg and uImage/cuImage.*
Hi, Gerhard.
On Jul 31 2009, Gerhard Pircher wrote:
> I'm trying to build a Debian kernel package for my AmigaOne which uses
> "cuImage" kernel images. Unfortunately make-kpkg doesn't seem to support
> U-boot images yet. Thus I would like to know, if somebody is working on/
> or has a concept for implementing uImage support in make-kpkg.
Yes, I miss support for that too.
I have already filed a bug against kernel-package, but I'm not sure if
Manoj is working on it (or if he has already included hooks for
that---if that's the case, I would love to know about the
functionality).
Anyway, here is a quick'n'dirty script that I've built for cross
compiling kernels and generating uimages. Please notice that you will
need to install uboot-mkimage for the script to work.
If you make some improvements, please let me know and share the code.
Thanks, Rogério Brito.
--
Rogério Brito : rbrito@{mackenzie,ime.usp}.br : GPG key 1024D/7C2CAEB8
http://www.ime.usp.br/~rbrito : http://meusite.mackenzie.com.br/rbrito
Projects: algorithms.berlios.de : lame.sf.net : vrms.alioth.debian.org
#!/bin/sh
#
# Quick'n'dirty script for compilation of kernel for Kurobox.
# $Id: kernel-kuro,v 1.4 2009/05/16 23:52:58 rbrito Exp rbrito $
#
set -e
#################################################################
# User-defined variables
#################################################################
ROOT_CROSSCOMP=/usr/local/media/cross-compile
LINUXPATH=$ROOT_CROSSCOMP/linux
BUILT_ROOT=/tmp/kernel
CONCUR="-j 2"
#################################################################
# Auxiliary Functions
#################################################################
# Environment preparation to create a Debian package
prepare_environment () {
rm -rf $BUILT_ROOT
mkdir -p $BUILT_ROOT/boot || true
mkdir -p $BUILT_ROOT/DEBIAN || true
}
# Generate postinst
#################################################################
# Main script
#################################################################
prepare_environment;
# Setting environment variables
export ROOT_CROSSCOMP LINUXPATH BUILT_ROOT
export PATH=$PATH:${ROOT_CROSSCOMP}/bin:${ROOT_CROSSCOMP}/powerpc-linux/bin
#### No user serviceable parts below here ####
cd $LINUXPATH
INSTALL_MOD_PATH=$BUILT_ROOT ARCH=powerpc CROSS_COMPILE=powerpc-linux- make clean
INSTALL_MOD_PATH=$BUILT_ROOT ARCH=powerpc CROSS_COMPILE=powerpc-linux- make oldconfig
INSTALL_MOD_PATH=$BUILT_ROOT ARCH=powerpc CROSS_COMPILE=powerpc-linux- make menuconfig
INSTALL_MOD_PATH=$BUILT_ROOT ARCH=powerpc CROSS_COMPILE=powerpc-linux- make $CONCUR all modules
INSTALL_MOD_PATH=$BUILT_ROOT ARCH=powerpc CROSS_COMPILE=powerpc-linux- make modules_install
# Preparation for the kernel files
VERSION=$(cat include/config/kernel.release)
./scripts/dtc/dtc -I dts -O dtb -V 16 -o $BUILT_ROOT/boot/kuroboxHD.dtb-$VERSION ./arch/powerpc/boot/dts/kuroboxHD.dts
./scripts/dtc/dtc -I dts -O dtb -V 16 -o $BUILT_ROOT/boot/kuroboxHG.dtb-$VERSION ./arch/powerpc/boot/dts/kuroboxHG.dts
cd $BUILT_ROOT/boot
cp $LINUXPATH/System.map System.map-$VERSION
cp $LINUXPATH/arch/powerpc/boot/uImage uImage-$VERSION
cp $LINUXPATH/.config config-$VERSION
#ln -sf uImage-$VERSION uImage
SIZE=$(du -s /tmp/kernel | cut -f 1)
cat <<EOF > $BUILT_ROOT/DEBIAN/control
Package: linux-image-$VERSION
Priority: optional
Section: kernel
Installed-Size: $SIZE
Maintainer: Rogério Brito <rbrito@ime.usp.br>
Architecture: powerpc
Source: linux-source-$VERSION
Version: $VERSION
Provides: linux-image, linux-image-2.6
Homepage: http://www.kernel.org/
Description: Linux kernel binary image for version $VERSION
This package contains the Linux kernel image for version
${VERSION}.
.
It also contains the corresponding System.map file, and the modules
built. It also contains scripts that try to ensure that the system is
not left in a unbootable state after an update.
EOF
cat <<EOF2 > $BUILT_ROOT/DEBIAN/postinst
#! /bin/sh
set -e
# for details of how this script can be called, see:
# http://www.debian.org/doc/debian-policy/ch-maintainerscripts.html
case "\$1" in
configure)
cd /boot
ln -sf uImage-$VERSION uImage
depmod -a
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo postinst called with unknown argument "\$1" >&2
exit 0
;;
esac
exit 0
EOF2
# fix permissions of postinst
chmod a+x $BUILT_ROOT/DEBIAN/postinst || true
# generate md5sums
cd $BUILT_ROOT
find boot/ lib/ -type f -print0 | xargs -0 md5sum > DEBIAN/md5sums
# create the final deb package
fakeroot dpkg-deb -b $BUILT_ROOT $ROOT_CROSSCOMP
Reply to: