diff options
| author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-04-12 02:21:00 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-04-12 02:21:00 -0700 |
| commit | 0d61fc5ea78015def4d2fcf9b598ecfe25210cdd (patch) | |
| tree | a45aa0f67c6bbd200dc2a328e560042810307b1b /scripts | |
| parent | f2eb250f07ba4695c2474cb8b6edbf64b5457d65 (diff) | |
| parent | eb880e5457f8b4a61ff7fd36d47dd14fe51cb030 (diff) | |
Merge bk://bk.arm.linux.org.uk/linux-2.6-rmk
into ppc970.osdl.org:/home/torvalds/v2.6/linux
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/MAKEDEV.ide | 49 | ||||
| -rwxr-xr-x | scripts/MAKEDEV.snd | 161 | ||||
| -rw-r--r-- | scripts/Makefile.modpost | 14 | ||||
| -rw-r--r-- | scripts/genksyms/parse.y | 2 | ||||
| -rwxr-xr-x | scripts/kernel-doc | 1 | ||||
| -rw-r--r-- | scripts/modpost.c | 176 | ||||
| -rw-r--r-- | scripts/modpost.h | 1 | ||||
| -rwxr-xr-x | scripts/ver_linux | 3 |
8 files changed, 158 insertions, 249 deletions
diff --git a/scripts/MAKEDEV.ide b/scripts/MAKEDEV.ide deleted file mode 100755 index feecb99bb865..000000000000 --- a/scripts/MAKEDEV.ide +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -# -# This script creates the proper /dev/ entries for IDE devices -# on the primary, secondary, tertiary, and quaternary interfaces. -# See ../Documentation/ide.txt for more information. -# -makedev () { - rm -f /dev/$1 - echo mknod /dev/$1 $2 $3 $4 - mknod /dev/$1 $2 $3 $4 - chown root:disk /dev/$1 - chmod 660 /dev/$1 -} - -makedevs () { - rm -f /dev/$1* - makedev $1 b $2 $3 - for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 - do - makedev $1$part b $2 `expr $3 + $part` - done -} - -makedevs hda 3 0 -makedevs hdb 3 64 -makedevs hdc 22 0 -makedevs hdd 22 64 -makedevs hde 33 0 -makedevs hdf 33 64 -makedevs hdg 34 0 -makedevs hdh 34 64 -makedevs hdi 56 0 -makedevs hdj 56 64 -makedevs hdk 57 0 -makedevs hdl 57 64 -makedevs hdm 88 0 -makedevs hdn 88 64 -makedevs hdo 89 0 -makedevs hdp 89 64 -makedevs hdq 90 0 -makedevs hdr 90 64 -makedevs hds 91 0 -makedevs hdt 91 64 - -for tape in 0 1 2 3 4 5 6 7 -do - makedev ht$tape c 37 $tape - makedev nht$tape c 37 `expr $tape + 128` -done diff --git a/scripts/MAKEDEV.snd b/scripts/MAKEDEV.snd deleted file mode 100755 index 586973289206..000000000000 --- a/scripts/MAKEDEV.snd +++ /dev/null @@ -1,161 +0,0 @@ -#!/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/Makefile.modpost b/scripts/Makefile.modpost index cd716ece8976..777b1a111ab5 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -13,12 +13,6 @@ include scripts/Makefile.lib __modules := $(shell head -q -n1 /dev/null $(wildcard $(MODVERDIR)/*.mod)) modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o))) -ifneq ($(filter-out $(modules),$(__modules)),) - $(warning Trouble: $(filter-out $(modules),$(__modules))) - $(warning *** Uh-oh, you have stale module entries. You messed with SUBDIRS,) - $(warning do not complain if something goes wrong.) -endif - __modversions: $(modules) @: @@ -35,6 +29,8 @@ targets += $(modules) # Compile version info for unresolved symbols +modname = $(*F) + quiet_cmd_cc_o_c = CC $@ cmd_cc_o_c = $(CC) $(c_flags) $(CFLAGS_MODULE) \ -c -o $@ $< @@ -53,9 +49,11 @@ $(modules:.ko=.mod.c): __modpost ; # Extract all checksums for all exported symbols quiet_cmd_modpost = MODPOST - cmd_modpost = scripts/modpost $(filter-out FORCE,$^) + cmd_modpost = scripts/modpost \ + $(if $(filter vmlinux,$^),-o,-i) $(objtree)/Module.symvers \ + $(filter-out FORCE,$^) -__modpost: $(wildcard vmlinux) $(modules:.ko=.o) FORCE +__modpost: $(if $(KBUILD_EXTMOD),,$(wildcard vmlinux)) $(modules:.ko=.o) FORCE $(call if_changed,modpost) targets += __modpost diff --git a/scripts/genksyms/parse.y b/scripts/genksyms/parse.y index 386189f4d108..099043713db4 100644 --- a/scripts/genksyms/parse.y +++ b/scripts/genksyms/parse.y @@ -197,7 +197,7 @@ storage_class_specifier: type_specifier: simple_type_specifier | cvar_qualifier - | TYPEOF_KEYW '(' type_specifier ')' + | TYPEOF_KEYW '(' decl_specifier_seq ')' /* References to s/u/e's defined elsewhere. Rearrange things so that it is easier to expand the definition fully later. */ diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 3c02ef90abc8..945a28bdedbd 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -1376,6 +1376,7 @@ sub dump_function($$) { $prototype =~ s/^inline +//; $prototype =~ s/^__inline__ +//; $prototype =~ s/^#define +//; #ak added + $prototype =~ s/__attribute__ \(\([a-z,]*\)\)//; # Yes, this truly is vile. We are looking for: # 1. Return type (may be nothing if we're looking at a macro) diff --git a/scripts/modpost.c b/scripts/modpost.c index a0976fcb9982..523e302cf89e 100644 --- a/scripts/modpost.c +++ b/scripts/modpost.c @@ -16,7 +16,7 @@ /* Are we using CONFIG_MODVERSIONS? */ int modversions = 0; -/* Do we have vmlinux? */ +/* Warn about undefined symbols? (do so if we have vmlinux) */ int have_vmlinux = 0; void @@ -59,6 +59,17 @@ void *do_nofail(void *ptr, const char *file, int line, const char *expr) static struct module *modules; struct module * +find_module(char *modname) +{ + struct module *mod; + + for (mod = modules; mod; mod = mod->next) + if (strcmp(mod->name, modname) == 0) + break; + return mod; +} + +struct module * new_module(char *modname) { struct module *mod; @@ -113,12 +124,13 @@ static inline unsigned int tdb_hash(const char *name) * the list of unresolved symbols per module */ struct symbol * -alloc_symbol(const char *name) +alloc_symbol(const char *name, struct symbol *next) { struct symbol *s = NOFAIL(malloc(sizeof(*s) + strlen(name) + 1)); memset(s, 0, sizeof(*s)); strcpy(s->name, name); + s->next = next; return s; } @@ -128,17 +140,15 @@ void new_symbol(const char *name, struct module *module, unsigned int *crc) { unsigned int hash; - struct symbol *new = alloc_symbol(name); + struct symbol *new; + hash = tdb_hash(name) % SYMBOL_HASH_SIZE; + new = symbolhash[hash] = alloc_symbol(name, symbolhash[hash]); new->module = module; if (crc) { new->crc = *crc; new->crc_valid = 1; } - - hash = tdb_hash(name) % SYMBOL_HASH_SIZE; - new->next = symbolhash[hash]; - symbolhash[hash] = new; } struct symbol * @@ -165,7 +175,7 @@ add_exported_symbol(const char *name, struct module *module, unsigned int *crc) struct symbol *s = find_symbol(name); if (!s) { - new_symbol(name, modules, crc); + new_symbol(name, module, crc); return; } if (crc) { @@ -182,7 +192,7 @@ grab_file(const char *filename, unsigned long *size) int fd; fd = open(filename, O_RDONLY); - if (fstat(fd, &st) != 0) + if (fd < 0 || fstat(fd, &st) != 0) return NULL; *size = st.st_size; @@ -319,7 +329,6 @@ void handle_modversions(struct module *mod, struct elf_info *info, Elf_Sym *sym, const char *symname) { - struct symbol *s; unsigned int crc; switch (sym->st_shndx) { @@ -343,6 +352,9 @@ handle_modversions(struct module *mod, struct elf_info *info, /* ignore global offset table */ if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0) break; + /* ignore __this_module, it will be resolved shortly */ + if (strcmp(symname, MODULE_SYMBOL_PREFIX "__this_module") == 0) + break; #ifdef STT_REGISTER if (info->hdr->e_machine == EM_SPARC || info->hdr->e_machine == EM_SPARCV9) { @@ -353,13 +365,10 @@ handle_modversions(struct module *mod, struct elf_info *info, #endif if (memcmp(symname, MODULE_SYMBOL_PREFIX, - strlen(MODULE_SYMBOL_PREFIX)) == 0) { - s = alloc_symbol(symname + - strlen(MODULE_SYMBOL_PREFIX)); - /* add to list */ - s->next = mod->unres; - mod->unres = s; - } + strlen(MODULE_SYMBOL_PREFIX)) == 0) + mod->unres = alloc_symbol(symname + + strlen(MODULE_SYMBOL_PREFIX), + mod->unres); break; default: /* All exported symbols */ @@ -390,17 +399,24 @@ read_symbols(char *modname) const char *symname; struct module *mod; struct elf_info info = { }; - struct symbol *s; Elf_Sym *sym; - /* When there's no vmlinux, don't print warnings about - * unresolved symbols (since there'll be too many ;) */ - have_vmlinux = is_vmlinux(modname); - parse_elf(&info, modname); mod = new_module(modname); + /* When there's no vmlinux, don't print warnings about + * unresolved symbols (since there'll be too many ;) */ + if (is_vmlinux(modname)) { + unsigned int fake_crc = 0; + have_vmlinux = 1; + /* May not have this if !CONFIG_MODULE_UNLOAD: fake it. + If it appears, we'll get the real CRC. */ + add_exported_symbol("cleanup_module", mod, &fake_crc); + add_exported_symbol("struct_module", mod, &fake_crc); + mod->skip = 1; + } + for (sym = info.symtab_start; sym < info.symtab_stop; sym++) { symname = info.strtab + sym->st_name; @@ -416,10 +432,12 @@ read_symbols(char *modname) * the automatic versioning doesn't pick it up, but it's really * important anyhow */ if (modversions) { - s = alloc_symbol("struct_module"); - /* add to list */ - s->next = mod->unres; - mod->unres = s; + mod->unres = alloc_symbol("struct_module", mod->unres); + + /* Always version init_module and cleanup_module, in + * case module doesn't have its own. */ + mod->unres = alloc_symbol("init_module", mod->unres); + mod->unres = alloc_symbol("cleanup_module", mod->unres); } } @@ -468,6 +486,15 @@ add_header(struct buffer *b) buf_printf(b, "#include <linux/compiler.h>\n"); buf_printf(b, "\n"); buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n"); + buf_printf(b, "\n"); + buf_printf(b, "struct module __this_module\n"); + buf_printf(b, "__attribute__((section(\".gnu.linkonce.this_module\"))) = {\n"); + buf_printf(b, " .name = __stringify(KBUILD_MODNAME),\n"); + buf_printf(b, " .init = init_module,\n"); + buf_printf(b, "#ifdef CONFIG_MODULE_UNLOAD\n"); + buf_printf(b, " .exit = cleanup_module,\n"); + buf_printf(b, "#endif\n"); + buf_printf(b, "};\n"); } /* Record CRCs for unresolved symbols */ @@ -590,19 +617,106 @@ write_if_changed(struct buffer *b, const char *fname) fclose(file); } +void +read_dump(const char *fname) +{ + unsigned long size, pos = 0; + void *file = grab_file(fname, &size); + char *line; + + if (!file) { + perror(fname); + abort(); + } + + while ((line = get_next_line(&pos, file, size))) { + char *symname, *modname, *d; + unsigned int crc; + struct module *mod; + + if (!(symname = strchr(line, '\t'))) + goto fail; + *symname++ = '\0'; + if (!(modname = strchr(symname, '\t'))) + goto fail; + *modname++ = '\0'; + if (strchr(modname, '\t')) + goto fail; + crc = strtoul(line, &d, 16); + if (*symname == '\0' || *modname == '\0' || *d != '\0') + goto fail; + + if (!(mod = find_module(modname))) { + if (is_vmlinux(modname)) { + modversions = 1; + have_vmlinux = 1; + } + mod = new_module(NOFAIL(strdup(modname))); + mod->skip = 1; + } + add_exported_symbol(symname, mod, &crc); + } + return; +fail: + fatal("parse error in symbol dump file\n"); +} + +void +write_dump(const char *fname) +{ + struct buffer buf = { }; + struct symbol *symbol; + int n; + + for (n = 0; n < SYMBOL_HASH_SIZE ; n++) { + symbol = symbolhash[n]; + while (symbol) { + symbol = symbol->next; + } + } + + for (n = 0; n < SYMBOL_HASH_SIZE ; n++) { + symbol = symbolhash[n]; + while (symbol) { + buf_printf(&buf, "0x%08x\t%s\t%s\n", symbol->crc, + symbol->name, symbol->module->name); + symbol = symbol->next; + } + } + write_if_changed(&buf, fname); +} + int main(int argc, char **argv) { struct module *mod; struct buffer buf = { }; char fname[SZ]; + char *dump_read = NULL, *dump_write = NULL; + int opt; + + while ((opt = getopt(argc, argv, "i:o:")) != -1) { + switch(opt) { + case 'i': + dump_read = optarg; + break; + case 'o': + dump_write = optarg; + break; + default: + exit(1); + } + } - for (; argv[1]; argv++) { - read_symbols(argv[1]); + if (dump_read) + read_dump(dump_read); + + while (optind < argc) { + read_symbols(argv[optind++]); } for (mod = modules; mod; mod = mod->next) { - if (is_vmlinux(mod->name)) + if (mod->skip) continue; buf.pos = 0; @@ -615,6 +729,10 @@ main(int argc, char **argv) sprintf(fname, "%s.mod.c", mod->name); write_if_changed(&buf, fname); } + + if (dump_write) + write_dump(dump_write); + return 0; } diff --git a/scripts/modpost.h b/scripts/modpost.h index 0b18b4192a63..ddb013d9fd98 100644 --- a/scripts/modpost.h +++ b/scripts/modpost.h @@ -73,6 +73,7 @@ struct module { const char *name; struct symbol *unres; int seen; + int skip; struct buffer dev_table_buf; }; diff --git a/scripts/ver_linux b/scripts/ver_linux index bec902b2f7c0..47f14cbac39e 100755 --- a/scripts/ver_linux +++ b/scripts/ver_linux @@ -68,7 +68,8 @@ ldd -v > /dev/null 2>&1 && ldd -v || ldd --version |head -n 1 | awk \ ls -l /usr/lib/lib{g,stdc}++.so 2>/dev/null | awk -F. \ '{print "Linux C++ Library " $4"."$5"."$6}' -ps --version 2>&1 | awk 'NR==1{print "Procps ", $NF}' +ps --version 2>&1 | grep version | awk \ +'NR==1{print "Procps ", $NF}' ifconfig --version 2>&1 | grep tools | awk \ 'NR==1{print "Net-tools ", $NF}' |
