diff options
author | Linus Torvalds <torvalds@home.osdl.org> | 2003-07-31 07:11:39 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@home.osdl.org> | 2003-07-31 07:11:39 -0700 |
commit | 7c4bd5fb7eda7c00afea84e892963b351cc01cbd (patch) | |
tree | 34611b4ed8432c495bc1c83f72f18c8aefca5513 /scripts | |
parent | eaa380db0c4f4a9506457db08a0371e23f028dfd (diff) | |
parent | a63365ea9a3bfead09b544e31087063d800494d0 (diff) | |
download | history-7c4bd5fb7eda7c00afea84e892963b351cc01cbd.tar.gz |
Merge http://linux-isdn.bkbits.net/linux-2.5.make
into home.osdl.org:/home/torvalds/v2.5/linux
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/MAKEDEV.snd | 161 | ||||
-rw-r--r-- | scripts/binoffset.c | 163 | ||||
-rw-r--r-- | scripts/extract-ikconfig | 66 | ||||
-rwxr-xr-x | scripts/mkcompile_h | 2 | ||||
-rw-r--r-- | scripts/mkconfigs | 81 | ||||
-rw-r--r-- | scripts/modpost.c | 2 |
6 files changed, 474 insertions, 1 deletions
diff --git a/scripts/MAKEDEV.snd b/scripts/MAKEDEV.snd new file mode 100755 index 00000000000000..586973289206bd --- /dev/null +++ b/scripts/MAKEDEV.snd @@ -0,0 +1,161 @@ +#!/bin/bash +# +# This script creates the proper /dev/ entries for ALSA devices. +# See ../Documentation/sound/alsa/ALSA-Configuration.txt for more +# information. + +MAJOR=116 +OSSMAJOR=14 +MAX_CARDS=4 +PERM=666 +OWNER=root.root + +if [ "`grep -w -E "^audio" /etc/group`x" != x ]; then + PERM=660 + OWNER=root.audio +fi + +function create_odevice () { + rm -f $1 + echo -n "Creating $1..." + mknod -m $PERM $1 c $OSSMAJOR $2 + chown $OWNER $1 + echo " done" +} + +function create_odevices () { + tmp=0 + tmp1=0 + rm -f $1 $1? + echo -n "Creating $1?..." + while [ $tmp1 -lt $MAX_CARDS ]; do + minor=$[ $2 + $tmp ] + mknod -m $PERM $1$tmp1 c $OSSMAJOR $minor + chown $OWNER $1$tmp1 + tmp=$[ $tmp + 16 ] + tmp1=$[ $tmp1 + 1 ] + done + echo " done" +} + +function create_device1 () { + rm -f $1 + minor=$2 + echo -n "Creating $1..." + mknod -m $PERM $1 c $MAJOR $minor + chown $OWNER $1 + echo " done" +} + +function create_devices () { + tmp=0 + rm -f $1 $1? + echo -n "Creating $1?..." + while [ $tmp -lt $MAX_CARDS ]; do + minor=$[ $tmp * 32 ] + minor=$[ $2 + $minor ] + mknod -m $PERM "${1}C${tmp}" c $MAJOR $minor + chown $OWNER "${1}C${tmp}" + tmp=$[ $tmp + 1 ] + done + echo " done" +} + +function create_devices2 () { + tmp=0 + rm -f $1 $1? + echo -n "Creating $1??..." + while [ $tmp -lt $MAX_CARDS ]; do + tmp1=0 + while [ $tmp1 -lt $3 ]; do + minor=$[ $tmp * 32 ] + minor=$[ $2 + $minor + $tmp1 ] + mknod -m $PERM "${1}C${tmp}D${tmp1}" c $MAJOR $minor + chown $OWNER "${1}C${tmp}D${tmp1}" + tmp1=$[ $tmp1 + 1 ] + done + tmp=$[ $tmp + 1 ] + done + echo " done" +} + +function create_devices3 () { + tmp=0 + rm -f $1 $1? + echo -n "Creating $1??$4..." + while [ $tmp -lt $MAX_CARDS ]; do + tmp1=0 + while [ $tmp1 -lt $3 ]; do + minor=$[ $tmp * 32 ] + minor=$[ $2 + $minor + $tmp1 ] + mknod -m $PERM "${1}C${tmp}D${tmp1}${4}" c $MAJOR $minor + chown $OWNER "${1}C${tmp}D${tmp1}${4}" + tmp1=$[ $tmp1 + 1 ] + done + tmp=$[ $tmp + 1 ] + done + echo " done" +} + +if test "$1" = "-?" || test "$1" = "-h" || test "$1" = "--help"; then + echo "Usage: snddevices [max]" + exit +fi + +if test "$1" = "max"; then + DSP_MINOR=19 +fi + +# OSS (Lite) compatible devices... + +if test $OSSMAJOR -eq 14; then + create_odevices /dev/mixer 0 + create_odevice /dev/sequencer 1 + create_odevices /dev/midi 2 + create_odevices /dev/dsp 3 + create_odevices /dev/audio 4 + create_odevice /dev/sndstat 6 + create_odevice /dev/music 8 + create_odevices /dev/dmmidi 9 + create_odevices /dev/dmfm 10 + create_odevices /dev/amixer 11 # alternate mixer + create_odevices /dev/adsp 12 # alternate dsp + create_odevices /dev/amidi 13 # alternate midi + create_odevices /dev/admmidi 14 # alternate direct midi + # create symlinks + ln -svf /dev/mixer0 /dev/mixer + ln -svf /dev/midi0 /dev/midi + ln -svf /dev/dsp0 /dev/dsp + ln -svf /dev/audio0 /dev/audio + ln -svf /dev/music /dev/sequencer2 + ln -svf /dev/adsp0 /dev/adsp + ln -svf /dev/amidi0 /dev/amidi +fi + +# Remove old devices + +mv -f /dev/sndstat /dev/1sndstat +rm -f /dev/snd* +mv -f /dev/1sndstat /dev/sndstat +if [ -d /dev/snd ]; then + rm -f /dev/snd/* + rmdir /dev/snd +fi + +# Create new ones + +mkdir -p /dev/snd +create_devices /dev/snd/control 0 +create_device1 /dev/snd/seq 1 +create_device1 /dev/snd/timer 33 +create_devices2 /dev/snd/hw 4 4 +create_devices2 /dev/snd/midi 8 8 +create_devices3 /dev/snd/pcm 16 8 p +create_devices3 /dev/snd/pcm 24 8 c + +# Loader devices + +echo "ALSA loader devices" +rm -f /dev/aload* +create_devices /dev/aload 0 +create_device1 /dev/aloadSEQ 1 diff --git a/scripts/binoffset.c b/scripts/binoffset.c new file mode 100644 index 00000000000000..7b8100d8e10660 --- /dev/null +++ b/scripts/binoffset.c @@ -0,0 +1,163 @@ +/*************************************************************************** + * binoffset.c + * (C) 2002 Randy Dunlap <rddunlap@osdl.org> + +# 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. + +# binoffset.c: +# - searches a (binary) file for a specified (binary) pattern +# - returns the offset of the located pattern or ~0 if not found +# - exits with exit status 0 normally or non-0 if pattern is not found +# or any other error occurs. + +****************************************************************/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <unistd.h> +#include <fcntl.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/mman.h> + +#define VERSION "0.1" +#define BUF_SIZE (16 * 1024) +#define PAT_SIZE 100 + +char *progname; +char *inputname; +int inputfd; +int bix; /* buf index */ +unsigned char patterns [PAT_SIZE] = {0}; /* byte-sized pattern array */ +int pat_len; /* actual number of pattern bytes */ +unsigned char *madr; /* mmap address */ +size_t filesize; +int num_matches = 0; +off_t firstloc = 0; + +void usage (void) +{ + fprintf (stderr, "%s ver. %s\n", progname, VERSION); + fprintf (stderr, "usage: %s filename pattern_bytes\n", + progname); + fprintf (stderr, " [prints location of pattern_bytes in file]\n"); + exit (1); +} + +int get_pattern (int pat_count, char *pats []) +{ + int ix, err, tmp; + +#ifdef DEBUG + fprintf (stderr,"get_pattern: count = %d\n", pat_count); + for (ix = 0; ix < pat_count; ix++) + fprintf (stderr, " pat # %d: [%s]\n", ix, pats[ix]); +#endif + + for (ix = 0; ix < pat_count; ix++) { + tmp = 0; + err = sscanf (pats[ix], "%5i", &tmp); + if (err != 1 || tmp > 0xff) { + fprintf (stderr, "pattern or value error in pattern # %d [%s]\n", + ix, pats[ix]); + usage (); + } + patterns [ix] = tmp; + } + pat_len = pat_count; +} + +int search_pattern (void) +{ + for (bix = 0; bix < filesize; bix++) { + if (madr[bix] == patterns[0]) { + if (memcmp (&madr[bix], patterns, pat_len) == 0) { + if (num_matches == 0) + firstloc = bix; + num_matches++; + } + } + } +} + +#ifdef NOTDEF +size_t get_filesize (int fd) +{ + off_t end_off = lseek (fd, 0, SEEK_END); + lseek (fd, 0, SEEK_SET); + return (size_t) end_off; +} +#endif + +size_t get_filesize (int fd) +{ + int err; + struct stat stat; + + err = fstat (fd, &stat); + fprintf (stderr, "filesize: %d\n", err < 0 ? err : stat.st_size); + if (err < 0) + return err; + return (size_t) stat.st_size; +} + +int main (int argc, char *argv []) +{ + progname = argv[0]; + + if (argc < 3) + usage (); + + get_pattern (argc - 2, argv + 2); + + inputname = argv[1]; + + inputfd = open (inputname, O_RDONLY); + if (inputfd == -1) { + fprintf (stderr, "%s: cannot open '%s'\n", + progname, inputname); + exit (3); + } + + filesize = get_filesize (inputfd); + + madr = mmap (0, filesize, PROT_READ, MAP_PRIVATE, inputfd, 0); + if (madr == MAP_FAILED) { + fprintf (stderr, "mmap error = %d\n", errno); + close (inputfd); + exit (4); + } + + search_pattern (); + + if (munmap (madr, filesize)) + fprintf (stderr, "munmap error = %d\n", errno); + + if (close (inputfd)) + fprintf (stderr, "%s: error %d closing '%s'\n", + progname, errno, inputname); + + fprintf (stderr, "number of pattern matches = %d\n", num_matches); + if (num_matches == 0) + firstloc = ~0; + printf ("%d\n", firstloc); + fprintf (stderr, "%d\n", firstloc); + + exit (num_matches ? 0 : 2); +} + +/* end binoffset.c */ diff --git a/scripts/extract-ikconfig b/scripts/extract-ikconfig new file mode 100644 index 00000000000000..8e526d3709660c --- /dev/null +++ b/scripts/extract-ikconfig @@ -0,0 +1,66 @@ +#! /bin/bash +# extracts .config info from a [b]zImage file +# uses: binoffset (new), dd, zcat, strings, grep +# $arg1 is [b]zImage filename + +TMPFILE="" + +usage() +{ + echo " usage: extract-ikconfig [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 "CONFIG_BEGIN=n" > /dev/null +if [ $? -eq 0 ] +then + strings $TMPFILE | awk "/CONFIG_BEGIN=n/,/CONFIG_END=n/" > $image.oldconfig.$PID +else + echo "ERROR: Unable to extract kernel configuration information." + echo " This kernel image may not have the config info." + clean_up + exit 1 +fi + +echo "Kernel configuration written to $image.oldconfig.$PID" +clean_up +exit 0 diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h index 85f6a6f94aa9db..71d75141c40abd 100755 --- a/scripts/mkcompile_h +++ b/scripts/mkcompile_h @@ -54,7 +54,7 @@ UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/" echo \#define LINUX_COMPILE_DOMAIN fi - echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | tail -1`\" + echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | tail -n 1`\" ) > .tmpcompile # Only replace the real compile.h if the new one is different, diff --git a/scripts/mkconfigs b/scripts/mkconfigs new file mode 100644 index 00000000000000..1a926178a74456 --- /dev/null +++ b/scripts/mkconfigs @@ -0,0 +1,81 @@ +#!/bin/sh +# +# Copyright (C) 2002 Khalid Aziz <khalid_aziz@hp.com> +# Copyright (C) 2002 Randy Dunlap <rddunlap@osdl.org> +# Copyright (C) 2002 Al Stone <ahs3@fc.hp.com> +# 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. +# +# +# Rules to generate ikconfig.h from linux/.config: +# - Retain lines that begin with "CONFIG_" +# - Retain lines that begin with "# CONFIG_" +# - lines that use double-quotes must \\-escape-quote them + + +kernel_version() +{ + KERNVER="`grep VERSION $1 | head -1 | cut -f3 -d' '`.`grep PATCHLEVEL $1 | head -1 | cut -f3 -d' '`.`grep SUBLEVEL $1 | head -1 | cut -f3 -d' '``grep EXTRAVERSION $1 | head -1 | cut -f3 -d' '`" +} + +if [ $# -lt 2 ] +then + echo "Usage: `basename $0` <configuration_file> <Makefile>" + exit 1 +fi + +config=$1 +makefile=$2 + +echo "#ifndef _IKCONFIG_H" +echo "#define _IKCONFIG_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/mkconfigs. Do not edit. + * + */" + +echo "static char *ikconfig_built_with =" +echo " \"`uname -s` `uname -r` `uname -v` `uname -m`\";" +echo +kernel_version $makefile +echo "#ifdef CONFIG_IKCONFIG_PROC" +echo "static char *ikconfig_config = " +echo "#else" +echo "static char *ikconfig_config __initdata __attribute__((unused)) = " +echo "#endif" +echo "\"CONFIG_BEGIN=n\\n\\" +echo "`cat $config | sed 's/\"/\\\\\"/g' | grep "^#\? \?CONFIG_" | awk '{ print $0, "\\\\n\\\\" }' `" +echo "CONFIG_END=n\";" +echo "#endif /* _IKCONFIG_H */" diff --git a/scripts/modpost.c b/scripts/modpost.c index 13c33ccca090e5..05369df84c02ea 100644 --- a/scripts/modpost.c +++ b/scripts/modpost.c @@ -296,12 +296,14 @@ handle_modversions(struct module *mod, struct elf_info *info, /* ignore global offset table */ if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0) break; +#ifdef STT_REGISTER if (info->hdr->e_machine == EM_SPARC || info->hdr->e_machine == EM_SPARCV9) { /* Ignore register directives. */ if (ELF_ST_TYPE(sym->st_info) == STT_REGISTER) break; } +#endif if (memcmp(symname, MODULE_SYMBOL_PREFIX, strlen(MODULE_SYMBOL_PREFIX)) == 0) { |