diff -urN linux-2.6.5.old/scripts/extract-ikpatches linux-2.6.5/scripts/extract-ikpatches --- linux-2.6.5.old/scripts/extract-ikpatches 1969-12-31 19:00:00.000000000 -0500 +++ linux-2.6.5/scripts/extract-ikpatches 2004-05-09 13:59:00.000000000 -0500 @@ -0,0 +1,66 @@ +#! /bin/bash +# extracts .packages from a [b]zImage file +# uses: binoffset (new), dd, zcat, strings, grep +# $arg1 is [b]zImage filename + +TMPFILE="" + +usage() +{ + echo " usage: extract-ikpatches [b]zImage_filename" +} + +clean_up() +{ + if [ -z $ISCOMP ] + then + rm -f $TMPFILE + fi +} + +if [ $# -lt 1 ] +then + usage + exit +fi + +image=$1 + +# There are two gzip headers, as well as arches which don't compress their +# kernel. +GZHDR="0x1f 0x8b 0x08 0x00" +if [ `binoffset $image $GZHDR >/dev/null 2>&1 ; echo $?` -ne 0 ] +then + GZHDR="0x1f 0x8b 0x08 0x08" + if [ `binoffset $image $GZHDR >/dev/null 2>&1 ; echo $?` -ne 0 ] + then + ISCOMP=0 + fi +fi + +PID=$$ + +# Extract and uncompress the kernel image if necessary +if [ -z $ISCOMP ] +then + TMPFILE="/tmp/`basename $image`.vmlin.$PID" + dd if=$image bs=1 skip=`binoffset $image $GZHDR` 2> /dev/null | zcat > $TMPFILE +else + TMPFILE=$image +fi + +# Look for strings. +strings $TMPFILE | grep "PATCHES_BEGIN" > /dev/null +if [ $? -eq 0 ] +then + strings $TMPFILE | awk "/PATCHES_BEGIN/,/PATCHES_END/" > $image.oldpatches.$PID +else + echo "ERROR: Unable to extract kernel's .patches file." + echo " This kernel image may not have the .patches info." + clean_up + exit 1 +fi + +echo "Kernel's .patches file written to $image.oldpatches.$PID" +clean_up +exit 0 diff -urN linux-2.6.5.old/scripts/mkpatches linux-2.6.5/scripts/mkpatches --- linux-2.6.5.old/scripts/mkpatches 1969-12-31 19:00:00.000000000 -0500 +++ linux-2.6.5/scripts/mkpatches 2004-05-09 14:49:58.232228440 -0500 @@ -0,0 +1,63 @@ +#!/bin/sh +# +# Copyright (C) 2004 Jon Oberheide +# Copyright (C) 2002 Khalid Aziz +# Copyright (C) 2002 Randy Dunlap +# Copyright (C) 2002 Al Stone +# Copyright (C) 2002 Hewlett-Packard Company +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# Used to generate ikpatches.h from linux/.patches: + +if [ $# -lt 1 ] +then + echo "Usage: `basename $0` " + exit 1 +fi + +patches=$1 + +echo "#ifndef _IKPATCHES_H" +echo "#define _IKPATCHES_H" +echo \ +"/* + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or + * NON INFRINGEMENT. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * + * + * This file is generated automatically by scripts/mkpatches. Do not edit. + * + */" + +echo "static char const ikpatches_patches[] __attribute__((unused)) = " +echo "\"PATCHES_BEGIN\\n\\" +echo "`cat $patches | sed 's/\"/\\\\\"/g' | awk '{ print $0 "\\\\n\\\\" }' `" +echo "PATCHES_END\\n\";" +echo "#endif /* _IKPATCHES_H */"