#!/bin/sh # $Id: update-kernel,v 1.9.2.7 2010/07/01 17:22:27 mikpe Exp $ # usage: # cd ${kernelsrcdir} # ${perfctrsrcdir}/update-kernel perfctr= patch= patchtype= nopatch= dryrun= sym= backup= maybe_redhat= maybe_suse= VERSION= PATCHLEVEL= SUBLEVEL= EXTRAVERSION= kernel= usage() { echo 'Usage: cd ${kernelsrcdir}; ${perfctrsrcdir}/update-kernel [options]' echo 'Available options:' echo '--patch=version force use of patch for particular kernel version' echo '-p version ditto' echo '--nopatch do not apply patch, only install new files' echo '-n ditto' echo '--test apply the patch but do not change any files' echo '-t ditto' exit 1 } get_perfctr_srcdir() { # XXX: use dirname instead? perfctr=`echo $0 | sed 's+/update-kernel$++'` } get_arch() { if [ -z "$ARCH" ]; then OLDARCH=`uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/` ARCH=`echo $OLDARCH | sed -e s/i386/x86/ -e s/x86_64/x86/ -e s/ppc.*/powerpc/` fi } get_options() { while [ $# -gt 0 ]; do case "$1" in --patch=*) patch=`echo "$1" | sed s/--patch=//` ;; -p) shift if [ $# -eq 0 ]; then echo Error: option "'-p'" requires an argument usage fi patch="$1" ;; --nopatch|-n) nopatch=1 ;; --test|-t) dryrun="--dry-run" ;; --sym) # not for general use sym=1 ;; --backup) # not for general use backup=1 ;; *) echo Error: unknown option "$1" usage ;; esac shift done } check_pwd_is_kernel_srcdir() { if [ ! -f drivers/Makefile -o \( ! -f "arch/$ARCH/kernel/Makefile" -a ! -f "arch/$OLDARCH/kernel/Makefile" \) ]; then echo "Error: `pwd` does not appear to be the top-level kernel source directory" usage fi } check_kernel_srcdir_is_clean() { if [ -f System.map -o -f .version ]; then echo 'Error: kernel source is not clean; please do a "make mrproper"' exit 1 fi } get_makefile_variable() { eval `grep "^$1 *=" Makefile | head -n 1 | sed 's/ *= */=/'` } get_extra_version() { EXTRAVERSION=`grep "^EXTRAVERSION *=" Makefile | head -n 1 | sed 's/ *= */=/'` case "$EXTRAVERSION" in 'EXTRAVERSION=-$(shell echo $(CONFIG_RELEASE)-$(CONFIG_CFGNAME))') maybe_suse=1 EXTRAVERSION='EXTRAVERSION=-$(shell echo $(CONFIG_RELEASE))' ;; esac MKF=`cat <