diff options
author | Dmitry Torokhov <dtor_core@ameritech.net> | 2006-04-29 01:11:23 -0400 |
---|---|---|
committer | Dmitry Torokhov <dtor_core@ameritech.net> | 2006-04-29 01:11:23 -0400 |
commit | 7b7e394185014e0f3bd8989cac937003f20ef9ce (patch) | |
tree | 3beda5f979bba0aa9822534e239cf1b45f3be69c /scripts | |
parent | ddc5d3414593e4d7ad7fbd33e7f7517fcc234544 (diff) | |
parent | 693f7d362055261882659475d2ef022e32edbff1 (diff) | |
download | linux-7b7e394185014e0f3bd8989cac937003f20ef9ce.tar.gz linux-7b7e394185014e0f3bd8989cac937003f20ef9ce.tar.bz2 linux-7b7e394185014e0f3bd8989cac937003f20ef9ce.zip |
Merge rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Kbuild.include | 5 | ||||
-rw-r--r-- | scripts/Makefile.lib | 5 | ||||
-rwxr-xr-x[-rw-r--r--] | scripts/bloat-o-meter | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | scripts/checkstack.pl | 0 | ||||
-rw-r--r-- | scripts/gen_initramfs_list.sh | 225 | ||||
-rw-r--r-- | scripts/kconfig/conf.c | 24 | ||||
-rw-r--r-- | scripts/kconfig/confdata.c | 2 | ||||
-rw-r--r-- | scripts/kconfig/lxdialog/checklist.c | 19 | ||||
-rw-r--r-- | scripts/kconfig/lxdialog/menubox.c | 19 | ||||
-rw-r--r-- | scripts/mod/modpost.c | 15 | ||||
-rwxr-xr-x[-rw-r--r--] | scripts/namespace.pl | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | scripts/show_delta | 0 | ||||
-rwxr-xr-x | scripts/ver_linux | 4 |
13 files changed, 194 insertions, 124 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 59620b1554e0..b0d067be7390 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -87,6 +87,11 @@ cc-ifversion = $(shell if [ $(call cc-version, $(CC)) $(1) $(2) ]; then \ # $(Q)$(MAKE) $(build)=dir build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj +# Prefix -I with $(srctree) if it is not an absolute path +addtree = $(if $(filter-out -I/%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1))) $(1) +# Find all -I options and call addtree +flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o))) + # If quiet is set, only print short version of command cmd = @$(echo-cmd) $(cmd_$(1)) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 550798f57da5..2cb4935e85d1 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -99,11 +99,6 @@ __a_flags = $(_a_flags) __cpp_flags = $(_cpp_flags) else -# Prefix -I with $(srctree) if it is not an absolute path -addtree = $(if $(filter-out -I/%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1))) $(1) -# Find all -I options and call addtree -flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o))) - # -I$(obj) locates generated .h files # $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files # and locates generated .h files diff --git a/scripts/bloat-o-meter b/scripts/bloat-o-meter index 75f21d843c1d..75f21d843c1d 100644..100755 --- a/scripts/bloat-o-meter +++ b/scripts/bloat-o-meter diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl index dadfa20ffec0..dadfa20ffec0 100644..100755 --- a/scripts/checkstack.pl +++ b/scripts/checkstack.pl diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh index 6d411169bfa6..56b3bed1108f 100644 --- a/scripts/gen_initramfs_list.sh +++ b/scripts/gen_initramfs_list.sh @@ -1,22 +1,55 @@ #!/bin/bash # Copyright (C) Martin Schlemmer <azarah@nosferatu.za.org> -# Released under the terms of the GNU GPL -# -# Generate a newline separated list of entries from the file/directory -# supplied as an argument. -# -# If a file/directory is not supplied then generate a small dummy file. +# Copyright (c) 2006 Sam Ravnborg <sam@ravnborg.org> # -# The output is suitable for gen_init_cpio built from usr/gen_init_cpio.c. +# Released under the terms of the GNU GPL # +# Generate a cpio packed initramfs. It uses gen_init_cpio to generate +# the cpio archive, and gzip to pack it. +# The script may also be used to generate the inputfile used for gen_init_cpio +# This script assumes that gen_init_cpio is located in usr/ directory + +# error out on errors +set -e + +usage() { +cat << EOF +Usage: +$0 [-o <file>] [-u <uid>] [-g <gid>] {-d | <cpio_source>} ... + -o <file> Create gzipped initramfs file named <file> using + gen_init_cpio and gzip + -u <uid> User ID to map to user ID 0 (root). + <uid> is only meaningful if <cpio_source> + is a directory. + -g <gid> Group ID to map to group ID 0 (root). + <gid> is only meaningful if <cpio_source> + is a directory. + <cpio_source> File list or directory for cpio archive. + If <cpio_source> is a .cpio file it will be used + as direct input to initramfs. + -d Output the default cpio list. + +All options except -o and -l may be repeated and are interpreted +sequentially and immediately. -u and -g states are preserved across +<cpio_source> options so an explicit "-u 0 -g 0" is required +to reset the root/group mapping. +EOF +} + +list_default_initramfs() { + # echo usr/kinit/kinit + : +} default_initramfs() { - cat <<-EOF + cat <<-EOF >> ${output} # This is a very simple, default initramfs dir /dev 0755 0 0 nod /dev/console 0600 0 0 c 5 1 dir /root 0700 0 0 + # file /kinit usr/kinit/kinit 0755 0 0 + # slink /init kinit 0755 0 0 EOF } @@ -42,18 +75,28 @@ filetype() { return 0 } +list_print_mtime() { + : +} + print_mtime() { - local argv1="$1" local my_mtime="0" - if [ -e "${argv1}" ]; then - my_mtime=$(find "${argv1}" -printf "%T@\n" | sort -r | head -n 1) + if [ -e "$1" ]; then + my_mtime=$(find "$1" -printf "%T@\n" | sort -r | head -n 1) fi - - echo "# Last modified: ${my_mtime}" - echo + + echo "# Last modified: ${my_mtime}" >> ${output} + echo "" >> ${output} +} + +list_parse() { + echo "$1 \\" } +# for each file print a line in following format +# <filetype> <name> <path to file> <octal mode> <uid> <gid> +# for links, devices etc the format differs. See gen_init_cpio for details parse() { local location="$1" local name="${location/${srcdir}//}" @@ -99,80 +142,112 @@ parse() { ;; esac - echo "${str}" + echo "${str}" >> ${output} return 0 } -usage() { - printf "Usage:\n" - printf "$0 [ [-u <root_uid>] [-g <root_gid>] [-d | <cpio_source>] ] . . .\n" - printf "\n" - printf -- "-u <root_uid> User ID to map to user ID 0 (root).\n" - printf " <root_uid> is only meaningful if <cpio_source>\n" - printf " is a directory.\n" - printf -- "-g <root_gid> Group ID to map to group ID 0 (root).\n" - printf " <root_gid> is only meaningful if <cpio_source>\n" - printf " is a directory.\n" - printf "<cpio_source> File list or directory for cpio archive.\n" - printf " If <cpio_source> is not provided then a\n" - printf " a default list will be output.\n" - printf -- "-d Output the default cpio list. If no <cpio_source>\n" - printf " is given then the default cpio list will be output.\n" - printf "\n" - printf "All options may be repeated and are interpreted sequentially\n" - printf "and immediately. -u and -g states are preserved across\n" - printf "<cpio_source> options so an explicit \"-u 0 -g 0\" is required\n" - printf "to reset the root/group mapping.\n" +unknown_option() { + printf "ERROR: unknown option \"$arg\"\n" >&2 + printf "If the filename validly begins with '-', " >&2 + printf "then it must be prefixed\n" >&2 + printf "by './' so that it won't be interpreted as an option." >&2 + printf "\n" >&2 + usage >&2 + exit 1 +} + +list_header() { + echo "deps_initramfs := \\" +} + +header() { + printf "\n#####################\n# $1\n" >> ${output} +} + +# process one directory (incl sub-directories) +dir_filelist() { + ${dep_list}header "$1" + + srcdir=$(echo "$1" | sed -e 's://*:/:g') + dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" 2>/dev/null) + + # If $dirlist is only one line, then the directory is empty + if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then + ${dep_list}print_mtime "$1" + + echo "${dirlist}" | \ + while read x; do + ${dep_list}parse ${x} + done + fi } -build_list() { - printf "\n#####################\n# $cpio_source\n" - - if [ -f "$cpio_source" ]; then - print_mtime "$cpio_source" - cat "$cpio_source" - elif [ -d "$cpio_source" ]; then - srcdir=$(echo "$cpio_source" | sed -e 's://*:/:g') - dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" 2>/dev/null) - - # If $dirlist is only one line, then the directory is empty - if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then - print_mtime "$cpio_source" - - echo "${dirlist}" | \ - while read x; do - parse ${x} - done +# if only one file is specified and it is .cpio file then use it direct as fs +# if a directory is specified then add all files in given direcotry to fs +# if a regular file is specified assume it is in gen_initramfs format +input_file() { + source="$1" + if [ -f "$1" ]; then + ${dep_list}header "$1" + is_cpio="$(echo "$1" | sed 's/^.*\.cpio/cpio/')" + if [ $2 -eq 0 -a ${is_cpio} == "cpio" ]; then + cpio_file=$1 + [ ! -z ${dep_list} ] && echo "$1" + return 0 + fi + if [ -z ${dep_list} ]; then + print_mtime "$1" >> ${output} + cat "$1" >> ${output} else - # Failsafe in case directory is empty - default_initramfs + grep ^file "$1" | cut -d ' ' -f 3 fi + elif [ -d "$1" ]; then + dir_filelist "$1" else - echo " $0: Cannot open '$cpio_source'" >&2 + echo " ${prog}: Cannot open '$1'" >&2 exit 1 fi } - +prog=$0 root_uid=0 root_gid=0 +dep_list= +cpio_file= +cpio_list= +output="/dev/stdout" +output_file="" +arg="$1" +case "$arg" in + "-l") # files included in initramfs - used by kbuild + dep_list="list_" + shift + ;; + "-o") # generate gzipped cpio image named $1 + shift + output_file="$1" + cpio_list="$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)" + output=${cpio_list} + shift + ;; +esac while [ $# -gt 0 ]; do arg="$1" shift case "$arg" in - "-u") + "-u") # map $1 to uid=0 (root) root_uid="$1" shift ;; - "-g") + "-g") # map $1 to gid=0 (root) root_gid="$1" shift ;; - "-d") + "-d") # display default initramfs list default_list="$arg" - default_initramfs + ${dep_list}default_initramfs ;; "-h") usage @@ -181,23 +256,27 @@ while [ $# -gt 0 ]; do *) case "$arg" in "-"*) - printf "ERROR: unknown option \"$arg\"\n" >&2 - printf "If the filename validly begins with '-', then it must be prefixed\n" >&2 - printf "by './' so that it won't be interpreted as an option." >&2 - printf "\n" >&2 - usage >&2 - exit 1 + unknown_option ;; - *) - cpio_source="$arg" - build_list + *) # input file/dir - process it + input_file "$arg" "$#" ;; esac ;; esac done -# spit out the default cpio list if a source hasn't been specified -[ -z "$cpio_source" -a -z "$default_list" ] && default_initramfs - +# If output_file is set we will generate cpio archive and gzip it +# we are carefull to delete tmp files +if [ ! -z ${output_file} ]; then + if [ -z ${cpio_file} ]; then + cpio_tfile="$(mktemp ${TMPDIR:-/tmp}/cpiofile.XXXXXX)" + usr/gen_init_cpio ${cpio_list} > ${cpio_tfile} + else + cpio_tfile=${cpio_file} + fi + rm ${cpio_list} + cat ${cpio_tfile} | gzip -f -9 - > ${output_file} + [ -z ${cpio_file} ] && rm ${cpio_tfile} +fi exit 0 diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 10eeae53d827..8012d1076876 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -5,6 +5,7 @@ #include <ctype.h> #include <stdlib.h> +#include <stdio.h> #include <string.h> #include <unistd.h> #include <time.h> @@ -63,20 +64,6 @@ static void check_stdin(void) } } -static char *fgets_check_stream(char *s, int size, FILE *stream) -{ - char *ret = fgets(s, size, stream); - - if (ret == NULL && feof(stream)) { - printf(_("aborted!\n\n")); - printf(_("Console input is closed. ")); - printf(_("Run 'make oldconfig' to update configuration.\n\n")); - exit(1); - } - - return ret; -} - static void conf_askvalue(struct symbol *sym, const char *def) { enum symbol_type type = sym_get_type(sym); @@ -114,7 +101,7 @@ static void conf_askvalue(struct symbol *sym, const char *def) check_stdin(); case ask_all: fflush(stdout); - fgets_check_stream(line, 128, stdin); + fgets(line, 128, stdin); return; case set_default: printf("%s\n", def); @@ -328,8 +315,7 @@ static int conf_choice(struct menu *menu) printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu)); def_sym = sym_get_choice_value(sym); cnt = def = 0; - line[0] = '0'; - line[1] = 0; + line[0] = 0; for (child = menu->list; child; child = child->next) { if (!menu_is_visible(child)) continue; @@ -370,7 +356,7 @@ static int conf_choice(struct menu *menu) check_stdin(); case ask_all: fflush(stdout); - fgets_check_stream(line, 128, stdin); + fgets(line, 128, stdin); strip(line); if (line[0] == '?') { printf("\n%s\n", menu->sym->help ? @@ -546,7 +532,7 @@ int main(int ac, char **av) break; case 'h': case '?': - printf("%s [-o|-s] config\n", av[0]); + fprintf(stderr, "See README for usage info\n"); exit(0); } } diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 1b8882ddbc74..1b5df589f3ae 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -325,7 +325,7 @@ int conf_read(const char *name) sym->flags |= e->right.sym->flags & SYMBOL_NEW; } - sym_change_count = conf_warnings && conf_unsaved; + sym_change_count = conf_warnings || conf_unsaved; return 0; } diff --git a/scripts/kconfig/lxdialog/checklist.c b/scripts/kconfig/lxdialog/checklist.c index db07ae73e051..be0200e9cdaf 100644 --- a/scripts/kconfig/lxdialog/checklist.c +++ b/scripts/kconfig/lxdialog/checklist.c @@ -196,8 +196,8 @@ int dialog_checklist(const char *title, const char *prompt, int height, print_buttons(dialog, height, width, 0); - wnoutrefresh(list); wnoutrefresh(dialog); + wnoutrefresh(list); doupdate(); while (key != ESC) { @@ -225,12 +225,11 @@ int dialog_checklist(const char *title, const char *prompt, int height, } scroll--; print_item(list, items[scroll * 3 + 1], status[scroll], 0, TRUE); - wnoutrefresh(list); - print_arrows(dialog, choice, item_no, scroll, box_y, box_x + check_x + 5, list_height); - wrefresh(dialog); + wnoutrefresh(dialog); + wrefresh(list); continue; /* wait for another key press */ } else @@ -252,12 +251,12 @@ int dialog_checklist(const char *title, const char *prompt, int height, scroll++; print_item(list, items[(scroll + max_choice - 1) * 3 + 1], status[scroll + max_choice - 1], max_choice - 1, TRUE); - wnoutrefresh(list); print_arrows(dialog, choice, item_no, scroll, box_y, box_x + check_x + 5, list_height); - wrefresh(dialog); + wnoutrefresh(dialog); + wrefresh(list); continue; /* wait for another key press */ } else @@ -271,8 +270,8 @@ int dialog_checklist(const char *title, const char *prompt, int height, choice = i; print_item(list, items[(scroll + choice) * 3 + 1], status[scroll + choice], choice, TRUE); - wnoutrefresh(list); - wrefresh(dialog); + wnoutrefresh(dialog); + wrefresh(list); } continue; /* wait for another key press */ } @@ -306,8 +305,8 @@ int dialog_checklist(const char *title, const char *prompt, int height, print_item(list, items[(scroll + i) * 3 + 1], status[scroll + i], i, i == choice); } - wnoutrefresh(list); - wrefresh(dialog); + wnoutrefresh(dialog); + wrefresh(list); for (i = 0; i < item_no; i++) if (status[i]) diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c index 09512b544375..bf8052f4fd4a 100644 --- a/scripts/kconfig/lxdialog/menubox.c +++ b/scripts/kconfig/lxdialog/menubox.c @@ -58,8 +58,7 @@ #include "dialog.h" -#define ITEM_IDENT 1 /* Indent of menu entries. Fixed for all menus */ -static int menu_width; +static int menu_width, item_x; /* * Print menu item @@ -70,7 +69,7 @@ static void do_print_item(WINDOW * win, const char *item, int choice, int j; char *menu_item = malloc(menu_width + 1); - strncpy(menu_item, item, menu_width - ITEM_IDENT); + strncpy(menu_item, item, menu_width - item_x); menu_item[menu_width] = 0; j = first_alpha(menu_item, "YyNnMmHh"); @@ -87,13 +86,13 @@ static void do_print_item(WINDOW * win, const char *item, int choice, wclrtoeol(win); #endif wattrset(win, selected ? item_selected_attr : item_attr); - mvwaddstr(win, choice, ITEM_IDENT, menu_item); + mvwaddstr(win, choice, item_x, menu_item); if (hotkey) { wattrset(win, selected ? tag_key_selected_attr : tag_key_attr); - mvwaddch(win, choice, ITEM_IDENT + j, menu_item[j]); + mvwaddch(win, choice, item_x + j, menu_item[j]); } if (selected) { - wmove(win, choice, ITEM_IDENT + 1); + wmove(win, choice, item_x + 1); } free(menu_item); wrefresh(win); @@ -227,6 +226,8 @@ int dialog_menu(const char *title, const char *prompt, int height, int width, draw_box(dialog, box_y, box_x, menu_height + 2, menu_width + 2, menubox_border_attr, menubox_attr); + item_x = (menu_width - 70) / 2; + /* Set choice to default item */ for (i = 0; i < item_no; i++) if (strcmp(current, items[i * 2]) == 0) @@ -263,10 +264,10 @@ int dialog_menu(const char *title, const char *prompt, int height, int width, wnoutrefresh(menu); print_arrows(dialog, item_no, scroll, - box_y, box_x + ITEM_IDENT + 1, menu_height); + box_y, box_x + item_x + 1, menu_height); print_buttons(dialog, height, width, 0); - wmove(menu, choice, ITEM_IDENT + 1); + wmove(menu, choice, item_x + 1); wrefresh(menu); while (key != ESC) { @@ -349,7 +350,7 @@ int dialog_menu(const char *title, const char *prompt, int height, int width, print_item(scroll + choice, choice, TRUE); print_arrows(dialog, item_no, scroll, - box_y, box_x + ITEM_IDENT + 1, menu_height); + box_y, box_x + item_x + 1, menu_height); wnoutrefresh(dialog); wrefresh(menu); diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 0b92ddff26fd..cd00e9f07589 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -492,17 +492,19 @@ static int strrcmp(const char *s, const char *sub) * These functions may often be marked __init and we do not want to * warn here. * the pattern is identified by: - * tosec = .init.text | .exit.text + * tosec = .init.text | .exit.text | .init.data * fromsec = .data - * atsym = *_driver, *_ops, *_probe, *probe_one + * atsym = *_driver, *_template, *_sht, *_ops, *_probe, *probe_one **/ static int secref_whitelist(const char *tosec, const char *fromsec, - const char *atsym) + const char *atsym) { int f1 = 1, f2 = 1; const char **s; const char *pat2sym[] = { "_driver", + "_template", /* scsi uses *_template a lot */ + "_sht", /* scsi also used *_sht to some extent */ "_ops", "_probe", "_probe_one", @@ -522,7 +524,8 @@ static int secref_whitelist(const char *tosec, const char *fromsec, /* Check for pattern 2 */ if ((strcmp(tosec, ".init.text") != 0) && - (strcmp(tosec, ".exit.text") != 0)) + (strcmp(tosec, ".exit.text") != 0) && + (strcmp(tosec, ".init.data") != 0)) f2 = 0; if (strcmp(fromsec, ".data") != 0) f2 = 0; @@ -658,7 +661,7 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec, warn("%s - Section mismatch: reference to %s:%s from %s " "before '%s' (at offset -0x%llx)\n", modname, secname, refsymname, fromsec, - elf->strtab + before->st_name, + elf->strtab + after->st_name, (long long)r.r_offset); } else { warn("%s - Section mismatch: reference to %s:%s from %s " @@ -820,6 +823,7 @@ static int exit_section(const char *name) * For our future {in}sanity, add a comment that this is the ppc .opd * section, not the ia64 .opd section. * ia64 .opd should not point to discarded sections. + * [.rodata] like for .init.text we ignore .rodata references -same reason **/ static int exit_section_ref_ok(const char *name) { @@ -829,6 +833,7 @@ static int exit_section_ref_ok(const char *name) ".exit.text", ".exit.data", ".init.text", + ".rodata", ".opd", /* See comment [OPD] */ ".toc1", /* used by ppc64 */ ".altinstructions", diff --git a/scripts/namespace.pl b/scripts/namespace.pl index f34373853ef8..f34373853ef8 100644..100755 --- a/scripts/namespace.pl +++ b/scripts/namespace.pl diff --git a/scripts/show_delta b/scripts/show_delta index 48a706ab3d0c..48a706ab3d0c 100644..100755 --- a/scripts/show_delta +++ b/scripts/show_delta diff --git a/scripts/ver_linux b/scripts/ver_linux index beb43ef7f761..84999f69773d 100755 --- a/scripts/ver_linux +++ b/scripts/ver_linux @@ -39,10 +39,10 @@ tune2fs 2>&1 | grep "^tune2fs" | sed 's/,//' | awk \ fsck.jfs -V 2>&1 | grep version | sed 's/,//' | awk \ 'NR==1 {print "jfsutils ", $3}' -reiserfsck -V 2>&1 | grep reiserfsck | awk \ +reiserfsck -V 2>&1 | grep ^reiserfsck | awk \ 'NR==1{print "reiserfsprogs ", $2}' -fsck.reiser4 -V 2>&1 | grep fsck.reiser4 | awk \ +fsck.reiser4 -V 2>&1 | grep ^fsck.reiser4 | awk \ 'NR==1{print "reiser4progs ", $2}' xfs_db -V 2>&1 | grep version | awk \ |