#!/bin/bash set -x # $1 is the name of the lilo kernel image attempt(){ logger mkkernel `pwd`: attempting $1 if [ "%$DISTCC_HOSTS%" == "%%" ] then jarg="" else jarg="-j 7 CC=distcc" fi if [ "%$1%" == "%menuconfig%" ] then make $jarg $1 else make $jarg $1 # | tee - /tmp/mkkernel-$1-$jarg fi die $? } die(){ if [ $1 -gt 0 ] then logger mkkernel `pwd`: died with exit code $1 exit $1 fi } if [ "%$1%" == "%%" ] then echo "You didn't specify a kernel image name" exit 1 fi logger mkkernel `pwd`: starting logger mkkernel `pwd`: dirty status "("$2")" if [ "%$2%" == "%dirty%" ] then echo "Skipping kernel reconfiguration" else attempt clean attempt mrproper attempt menuconfig attempt dep fi attempt "" attempt modules attempt modules_install attempt bzImage cp arch/i386/boot/bzImage /boot/vmlinuz-$1 if [ `grep "label=$1" /etc/lilo.conf | wc -l | tr -d " "` -lt 1 ] then echo "Tweaking lilo config" cp /etc/lilo.conf /etc/lilo.conf.bck echo "" >> /etc/lilo.conf echo "image=/boot/vmlinuz-$1" >> /etc/lilo.conf echo " label=$1" >> /etc/lilo.conf echo " read-only" >> /etc/lilo.conf fi /sbin/lilo echo "Installed $1" if [ -d /data/staging/kernel ] then if [ -d /data/staging/kernel/$1 ] then rm -rf /data/staging/kernel/$1 fi mkdir /data/staging/kernel/$1 echo "" >> /data/staging/kernel/$1/lilo.conf echo "image=/boot/vmlinuz-$1" >> /data/staging/kernel/$1/lilo.conf echo " label=$1" >> /data/staging/kernel/$1/lilo.conf echo " read-only" >> /data/staging/kernel/$1/lilo.conf cp /boot/vmlinuz-$1 /data/staging/kernel/$1/ kver=`echo $1 | sed 's/-.*//'` if [ -d /data/staging/kernel/$1/$kver ] then rm -rf /data/staging/kernel/$1/$kver fi cp -R /lib/modules/$kver /data/staging/kernel/$1/ fi