aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Kbuild.include84
-rw-r--r--scripts/gen_initramfs_list.sh43
-rw-r--r--scripts/kconfig/qconf.cc18
-rwxr-xr-xscripts/kernel-doc55
-rwxr-xr-xscripts/makelst34
-rwxr-xr-xscripts/mkcompile_h2
-rwxr-xr-xscripts/mkuboot.sh11
-rw-r--r--scripts/mod/modpost.c46
8 files changed, 180 insertions, 113 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index f01f8c072852..06c1a377c4c5 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -1,7 +1,7 @@
1#### 1####
2# kbuild: Generic definitions 2# kbuild: Generic definitions
3 3
4# Convinient variables 4# Convenient variables
5comma := , 5comma := ,
6squote := ' 6squote := '
7empty := 7empty :=
@@ -59,32 +59,40 @@ endef
59# output directory for tests below 59# output directory for tests below
60TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/) 60TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/)
61 61
62# try-run
63# Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
64# Exit code chooses option. "$$TMP" is can be used as temporary file and
65# is automatically cleaned up.
66try-run = $(shell set -e; \
67 TMP="$(TMPOUT).$$$$.tmp"; \
68 if ($(1)) >/dev/null 2>&1; \
69 then echo "$(2)"; \
70 else echo "$(3)"; \
71 fi; \
72 rm -f "$$TMP")
73
62# as-option 74# as-option
63# Usage: cflags-y += $(call as-option, -Wa$(comma)-isa=foo,) 75# Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
64 76
65as-option = $(shell if $(CC) $(CFLAGS) $(1) -Wa,-Z -c -o /dev/null \ 77as-option = $(call try-run,\
66 -xassembler /dev/null > /dev/null 2>&1; then echo "$(1)"; \ 78 $(CC) $(CFLAGS) $(1) -c -xassembler /dev/null -o "$$TMP",$(1),$(2))
67 else echo "$(2)"; fi ;)
68 79
69# as-instr 80# as-instr
70# Usage: cflags-y += $(call as-instr, instr, option1, option2) 81# Usage: cflags-y += $(call as-instr,instr,option1,option2)
71 82
72as-instr = $(shell if echo -e "$(1)" | \ 83as-instr = $(call try-run,\
73 $(CC) $(AFLAGS) -c -xassembler - \ 84 echo -e "$(1)" | $(CC) $(AFLAGS) -c -xassembler -o "$$TMP" -,$(2),$(3))
74 -o $(TMPOUT)astest$$$$.out > /dev/null 2>&1; \
75 then rm $(TMPOUT)astest$$$$.out; echo "$(2)"; \
76 else echo "$(3)"; fi)
77 85
78# cc-option 86# cc-option
79# Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586) 87# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
80 88
81cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ 89cc-option = $(call try-run,\
82 > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) 90 $(CC) $(CFLAGS) $(1) -S -xc /dev/null -o "$$TMP",$(1),$(2))
83 91
84# cc-option-yn 92# cc-option-yn
85# Usage: flag := $(call cc-option-yn, -march=winchip-c6) 93# Usage: flag := $(call cc-option-yn,-march=winchip-c6)
86cc-option-yn = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ 94cc-option-yn = $(call try-run,\
87 > /dev/null 2>&1; then echo "y"; else echo "n"; fi;) 95 $(CC) $(CFLAGS) $(1) -S -xc /dev/null -o "$$TMP",y,n)
88 96
89# cc-option-align 97# cc-option-align
90# Prefix align with either -falign or -malign 98# Prefix align with either -falign or -malign
@@ -92,20 +100,19 @@ cc-option-align = $(subst -functions=0,,\
92 $(call cc-option,-falign-functions=0,-malign-functions=0)) 100 $(call cc-option,-falign-functions=0,-malign-functions=0))
93 101
94# cc-version 102# cc-version
95# Usage gcc-ver := $(call cc-version, $(CC)) 103# Usage gcc-ver := $(call cc-version,$(CC))
96cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC)) 104cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))
97 105
98# cc-ifversion 106# cc-ifversion
99# Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) 107# Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1)
100cc-ifversion = $(shell if [ $(call cc-version, $(CC)) $(1) $(2) ]; then \ 108cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3))
101 echo $(3); fi;)
102 109
103# ld-option 110# ld-option
104# Usage: ldflags += $(call ld-option, -Wl$(comma)--hash-style=both) 111# Usage: ldflags += $(call ld-option, -Wl$(comma)--hash-style=both)
105ld-option = $(shell if $(CC) $(1) -nostdlib -xc /dev/null \ 112ld-option = $(call try-run,\
106 -o $(TMPOUT)ldtest$$$$.out > /dev/null 2>&1; \ 113 $(CC) $(1) -nostdlib -xc /dev/null -o "$$TMP",$(1),$(2))
107 then rm $(TMPOUT)ldtest$$$$.out; echo "$(1)"; \ 114
108 else echo "$(2)"; fi) 115######
109 116
110### 117###
111# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj= 118# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=
@@ -113,19 +120,25 @@ ld-option = $(shell if $(CC) $(1) -nostdlib -xc /dev/null \
113# $(Q)$(MAKE) $(build)=dir 120# $(Q)$(MAKE) $(build)=dir
114build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj 121build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
115 122
116# Prefix -I with $(srctree) if it is not an absolute path 123# Prefix -I with $(srctree) if it is not an absolute path.
117addtree = $(if $(filter-out -I/%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1))) $(1) 124addtree = $(if $(filter-out -I/%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1))) $(1)
125
118# Find all -I options and call addtree 126# Find all -I options and call addtree
119flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o))) 127flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o)))
120 128
121# If quiet is set, only print short version of command 129# echo command.
130# Short version is used, if $(quiet) equals `quiet_', otherwise full one.
131echo-cmd = $(if $($(quiet)cmd_$(1)),\
132 echo ' $(call escsq,$($(quiet)cmd_$(1)))$(echo-why)';)
133
134# printing commands
122cmd = @$(echo-cmd) $(cmd_$(1)) 135cmd = @$(echo-cmd) $(cmd_$(1))
123 136
124# Add $(obj)/ for paths that is not absolute 137# Add $(obj)/ for paths that are not absolute
125objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o))) 138objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o)))
126 139
127### 140###
128# if_changed - execute command if any prerequisite is newer than 141# if_changed - execute command if any prerequisite is newer than
129# target, or command line has changed 142# target, or command line has changed
130# if_changed_dep - as if_changed, but uses fixdep to reveal dependencies 143# if_changed_dep - as if_changed, but uses fixdep to reveal dependencies
131# including used config symbols 144# including used config symbols
@@ -133,16 +146,12 @@ objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o)))
133# See Documentation/kbuild/makefiles.txt for more info 146# See Documentation/kbuild/makefiles.txt for more info
134 147
135ifneq ($(KBUILD_NOCMDDEP),1) 148ifneq ($(KBUILD_NOCMDDEP),1)
136# Check if both arguments has same arguments. Result in empty string if equal 149# Check if both arguments has same arguments. Result is empty string if equal.
137# User may override this check using make KBUILD_NOCMDDEP=1 150# User may override this check using make KBUILD_NOCMDDEP=1
138arg-check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \ 151arg-check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \
139 $(filter-out $(cmd_$@), $(cmd_$(1))) ) 152 $(filter-out $(cmd_$@), $(cmd_$(1))) )
140endif 153endif
141 154
142# echo command. Short version is $(quiet) equals quiet, otherwise full command
143echo-cmd = $(if $($(quiet)cmd_$(1)), \
144 echo ' $(call escsq,$($(quiet)cmd_$(1)))$(echo-why)';)
145
146# >'< substitution is for echo to work, 155# >'< substitution is for echo to work,
147# >$< substitution to preserve $ when reloading .cmd file 156# >$< substitution to preserve $ when reloading .cmd file
148# note: when using inline perl scripts [perl -e '...$$t=1;...'] 157# note: when using inline perl scripts [perl -e '...$$t=1;...']
@@ -153,15 +162,14 @@ make-cmd = $(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1)))))
153# PHONY targets skipped in both cases. 162# PHONY targets skipped in both cases.
154any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^) 163any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^)
155 164
156# Execute command if command has changed or prerequisitei(s) are updated 165# Execute command if command has changed or prerequisite(s) are updated.
157# 166#
158if_changed = $(if $(strip $(any-prereq) $(arg-check)), \ 167if_changed = $(if $(strip $(any-prereq) $(arg-check)), \
159 @set -e; \ 168 @set -e; \
160 $(echo-cmd) $(cmd_$(1)); \ 169 $(echo-cmd) $(cmd_$(1)); \
161 echo 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd) 170 echo 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd)
162 171
163# execute the command and also postprocess generated .d dependencies 172# Execute the command and also postprocess generated .d dependencies file.
164# file
165if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ), \ 173if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ), \
166 @set -e; \ 174 @set -e; \
167 $(echo-cmd) $(cmd_$(1)); \ 175 $(echo-cmd) $(cmd_$(1)); \
@@ -170,8 +178,8 @@ if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ), \
170 mv -f $(dot-target).tmp $(dot-target).cmd) 178 mv -f $(dot-target).tmp $(dot-target).cmd)
171 179
172# Usage: $(call if_changed_rule,foo) 180# Usage: $(call if_changed_rule,foo)
173# will check if $(cmd_foo) changed, or any of the prequisites changed, 181# Will check if $(cmd_foo) or any of the prerequisites changed,
174# and if so will execute $(rule_foo) 182# and if so will execute $(rule_foo).
175if_changed_rule = $(if $(strip $(any-prereq) $(arg-check) ), \ 183if_changed_rule = $(if $(strip $(any-prereq) $(arg-check) ), \
176 @set -e; \ 184 @set -e; \
177 $(rule_$(1))) 185 $(rule_$(1)))
diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh
index 4c723fd18648..43f75d6e4d96 100644
--- a/scripts/gen_initramfs_list.sh
+++ b/scripts/gen_initramfs_list.sh
@@ -1,6 +1,6 @@
1#!/bin/bash 1#!/bin/bash
2# Copyright (C) Martin Schlemmer <azarah@nosferatu.za.org> 2# Copyright (C) Martin Schlemmer <azarah@nosferatu.za.org>
3# Copyright (c) 2006 Sam Ravnborg <sam@ravnborg.org> 3# Copyright (C) 2006 Sam Ravnborg <sam@ravnborg.org>
4# 4#
5# Released under the terms of the GNU GPL 5# Released under the terms of the GNU GPL
6# 6#
@@ -17,15 +17,15 @@ cat << EOF
17Usage: 17Usage:
18$0 [-o <file>] [-u <uid>] [-g <gid>] {-d | <cpio_source>} ... 18$0 [-o <file>] [-u <uid>] [-g <gid>] {-d | <cpio_source>} ...
19 -o <file> Create gzipped initramfs file named <file> using 19 -o <file> Create gzipped initramfs file named <file> using
20 gen_init_cpio and gzip 20 gen_init_cpio and gzip
21 -u <uid> User ID to map to user ID 0 (root). 21 -u <uid> User ID to map to user ID 0 (root).
22 <uid> is only meaningful if <cpio_source> 22 <uid> is only meaningful if <cpio_source>
23 is a directory. 23 is a directory.
24 -g <gid> Group ID to map to group ID 0 (root). 24 -g <gid> Group ID to map to group ID 0 (root).
25 <gid> is only meaningful if <cpio_source> 25 <gid> is only meaningful if <cpio_source>
26 is a directory. 26 is a directory.
27 <cpio_source> File list or directory for cpio archive. 27 <cpio_source> File list or directory for cpio archive.
28 If <cpio_source> is a .cpio file it will be used 28 If <cpio_source> is a .cpio file it will be used
29 as direct input to initramfs. 29 as direct input to initramfs.
30 -d Output the default cpio list. 30 -d Output the default cpio list.
31 31
@@ -36,6 +36,12 @@ to reset the root/group mapping.
36EOF 36EOF
37} 37}
38 38
39# awk style field access
40# $1 - field number; rest is argument string
41field() {
42 shift $1 ; echo $1
43}
44
39list_default_initramfs() { 45list_default_initramfs() {
40 # echo usr/kinit/kinit 46 # echo usr/kinit/kinit
41 : 47 :
@@ -119,22 +125,17 @@ parse() {
119 str="${ftype} ${name} ${location} ${str}" 125 str="${ftype} ${name} ${location} ${str}"
120 ;; 126 ;;
121 "nod") 127 "nod")
122 local dev_type= 128 local dev=`LC_ALL=C ls -l "${location}"`
123 local maj=$(LC_ALL=C ls -l "${location}" | \ 129 local maj=`field 5 ${dev}`
124 gawk '{sub(/,/, "", $5); print $5}') 130 local min=`field 6 ${dev}`
125 local min=$(LC_ALL=C ls -l "${location}" | \ 131 maj=${maj%,}
126 gawk '{print $6}') 132
127 133 [ -b "${location}" ] && dev="b" || dev="c"
128 if [ -b "${location}" ]; then 134
129 dev_type="b" 135 str="${ftype} ${name} ${str} ${dev} ${maj} ${min}"
130 else
131 dev_type="c"
132 fi
133 str="${ftype} ${name} ${str} ${dev_type} ${maj} ${min}"
134 ;; 136 ;;
135 "slink") 137 "slink")
136 local target=$(LC_ALL=C ls -l "${location}" | \ 138 local target=`field 11 $(LC_ALL=C ls -l "${location}")`
137 gawk '{print $11}')
138 str="${ftype} ${name} ${target} ${str}" 139 str="${ftype} ${name} ${target} ${str}"
139 ;; 140 ;;
140 *) 141 *)
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index c0ae0a7ddb42..512c2f5c341d 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -89,6 +89,7 @@ void ConfigItem::okRename(int col)
89{ 89{
90 Parent::okRename(col); 90 Parent::okRename(col);
91 sym_set_string_value(menu->sym, text(dataColIdx).latin1()); 91 sym_set_string_value(menu->sym, text(dataColIdx).latin1());
92 listView()->updateList(this);
92} 93}
93#endif 94#endif
94 95
@@ -605,6 +606,8 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu)
605 606
606 visible = menu_is_visible(child); 607 visible = menu_is_visible(child);
607 if (showAll || visible) { 608 if (showAll || visible) {
609 if (!child->sym && !child->list && !child->prompt)
610 continue;
608 if (!item || item->menu != child) 611 if (!item || item->menu != child)
609 item = new ConfigItem(parent, last, child, visible); 612 item = new ConfigItem(parent, last, child, visible);
610 else 613 else
@@ -1247,6 +1250,7 @@ void ConfigSearchWindow::search(void)
1247 1250
1248 free(result); 1251 free(result);
1249 list->list->clear(); 1252 list->list->clear();
1253 info->clear();
1250 1254
1251 result = sym_re_search(editField->text().latin1()); 1255 result = sym_re_search(editField->text().latin1());
1252 if (!result) 1256 if (!result)
@@ -1316,7 +1320,7 @@ ConfigMainWindow::ConfigMainWindow(void)
1316 conf_changed(); 1320 conf_changed();
1317 QAction *saveAsAction = new QAction("Save As...", "Save &As...", 0, this); 1321 QAction *saveAsAction = new QAction("Save As...", "Save &As...", 0, this);
1318 connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); 1322 connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs()));
1319 QAction *searchAction = new QAction("Search", "&Search", CTRL+Key_F, this); 1323 QAction *searchAction = new QAction("Find", "&Find", CTRL+Key_F, this);
1320 connect(searchAction, SIGNAL(activated()), SLOT(searchConfig())); 1324 connect(searchAction, SIGNAL(activated()), SLOT(searchConfig()));
1321 QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), "Split View", 0, this); 1325 QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), "Split View", 0, this);
1322 connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); 1326 connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView()));
@@ -1373,10 +1377,13 @@ ConfigMainWindow::ConfigMainWindow(void)
1373 saveAction->addTo(config); 1377 saveAction->addTo(config);
1374 saveAsAction->addTo(config); 1378 saveAsAction->addTo(config);
1375 config->insertSeparator(); 1379 config->insertSeparator();
1376 searchAction->addTo(config);
1377 config->insertSeparator();
1378 quitAction->addTo(config); 1380 quitAction->addTo(config);
1379 1381
1382 // create edit menu
1383 QPopupMenu* editMenu = new QPopupMenu(this);
1384 menu->insertItem("&Edit", editMenu);
1385 searchAction->addTo(editMenu);
1386
1380 // create options menu 1387 // create options menu
1381 QPopupMenu* optionMenu = new QPopupMenu(this); 1388 QPopupMenu* optionMenu = new QPopupMenu(this);
1382 menu->insertItem("&Option", optionMenu); 1389 menu->insertItem("&Option", optionMenu);
@@ -1467,7 +1474,10 @@ void ConfigMainWindow::searchConfig(void)
1467void ConfigMainWindow::changeMenu(struct menu *menu) 1474void ConfigMainWindow::changeMenu(struct menu *menu)
1468{ 1475{
1469 configList->setRootMenu(menu); 1476 configList->setRootMenu(menu);
1470 backAction->setEnabled(TRUE); 1477 if (configList->rootEntry->parent == &rootmenu)
1478 backAction->setEnabled(FALSE);
1479 else
1480 backAction->setEnabled(TRUE);
1471} 1481}
1472 1482
1473void ConfigMainWindow::setMenuLink(struct menu *menu) 1483void ConfigMainWindow::setMenuLink(struct menu *menu)
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index f50a70f550b3..fb43c6440e54 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -83,7 +83,7 @@ use strict;
83# * my_function 83# * my_function
84# **/ 84# **/
85# 85#
86# If the Description: header tag is ommitted, then there must be a blank line 86# If the Description: header tag is omitted, then there must be a blank line
87# after the last parameter specification. 87# after the last parameter specification.
88# e.g. 88# e.g.
89# /** 89# /**
@@ -265,7 +265,7 @@ my $doc_start = '^/\*\*\s*$'; # Allow whitespace at end of comment start.
265my $doc_end = '\*/'; 265my $doc_end = '\*/';
266my $doc_com = '\s*\*\s*'; 266my $doc_com = '\s*\*\s*';
267my $doc_decl = $doc_com.'(\w+)'; 267my $doc_decl = $doc_com.'(\w+)';
268my $doc_sect = $doc_com.'(['.$doc_special.']?[\w ]+):(.*)'; 268my $doc_sect = $doc_com.'(['.$doc_special.']?[\w\s]+):(.*)';
269my $doc_content = $doc_com.'(.*)'; 269my $doc_content = $doc_com.'(.*)';
270my $doc_block = $doc_com.'DOC:\s*(.*)?'; 270my $doc_block = $doc_com.'DOC:\s*(.*)?';
271 271
@@ -365,7 +365,7 @@ sub dump_section {
365# parameterlist => @list of parameters 365# parameterlist => @list of parameters
366# parameterdescs => %parameter descriptions 366# parameterdescs => %parameter descriptions
367# sectionlist => @list of sections 367# sectionlist => @list of sections
368# sections => %descriont descriptions 368# sections => %section descriptions
369# 369#
370 370
371sub output_highlight { 371sub output_highlight {
@@ -452,7 +452,7 @@ sub output_struct_html(%) {
452 my %args = %{$_[0]}; 452 my %args = %{$_[0]};
453 my ($parameter); 453 my ($parameter);
454 454
455 print "<h2>".$args{'type'}." ".$args{'struct'}."</h2>\n"; 455 print "<h2>".$args{'type'}." ".$args{'struct'}. " - " .$args{'purpose'}."</h2>\n";
456 print "<b>".$args{'type'}." ".$args{'struct'}."</b> {<br>\n"; 456 print "<b>".$args{'type'}." ".$args{'struct'}."</b> {<br>\n";
457 foreach $parameter (@{$args{'parameterlist'}}) { 457 foreach $parameter (@{$args{'parameterlist'}}) {
458 if ($parameter =~ /^#/) { 458 if ($parameter =~ /^#/) {
@@ -498,8 +498,8 @@ sub output_function_html(%) {
498 my %args = %{$_[0]}; 498 my %args = %{$_[0]};
499 my ($parameter, $section); 499 my ($parameter, $section);
500 my $count; 500 my $count;
501 print "<h2>Function</h2>\n";
502 501
502 print "<h2>" .$args{'function'}." - ".$args{'purpose'}."</h2>\n";
503 print "<i>".$args{'functiontype'}."</i>\n"; 503 print "<i>".$args{'functiontype'}."</i>\n";
504 print "<b>".$args{'function'}."</b>\n"; 504 print "<b>".$args{'function'}."</b>\n";
505 print "("; 505 print "(";
@@ -583,14 +583,14 @@ sub output_function_xml(%) {
583 $id = "API-".$args{'function'}; 583 $id = "API-".$args{'function'};
584 $id =~ s/[^A-Za-z0-9]/-/g; 584 $id =~ s/[^A-Za-z0-9]/-/g;
585 585
586 print "<refentry>\n"; 586 print "<refentry id=\"$id\">\n";
587 print "<refentryinfo>\n"; 587 print "<refentryinfo>\n";
588 print " <title>LINUX</title>\n"; 588 print " <title>LINUX</title>\n";
589 print " <productname>Kernel Hackers Manual</productname>\n"; 589 print " <productname>Kernel Hackers Manual</productname>\n";
590 print " <date>$man_date</date>\n"; 590 print " <date>$man_date</date>\n";
591 print "</refentryinfo>\n"; 591 print "</refentryinfo>\n";
592 print "<refmeta>\n"; 592 print "<refmeta>\n";
593 print " <refentrytitle><phrase id=\"$id\">".$args{'function'}."</phrase></refentrytitle>\n"; 593 print " <refentrytitle><phrase>".$args{'function'}."</phrase></refentrytitle>\n";
594 print " <manvolnum>9</manvolnum>\n"; 594 print " <manvolnum>9</manvolnum>\n";
595 print "</refmeta>\n"; 595 print "</refmeta>\n";
596 print "<refnamediv>\n"; 596 print "<refnamediv>\n";
@@ -659,14 +659,14 @@ sub output_struct_xml(%) {
659 $id = "API-struct-".$args{'struct'}; 659 $id = "API-struct-".$args{'struct'};
660 $id =~ s/[^A-Za-z0-9]/-/g; 660 $id =~ s/[^A-Za-z0-9]/-/g;
661 661
662 print "<refentry>\n"; 662 print "<refentry id=\"$id\">\n";
663 print "<refentryinfo>\n"; 663 print "<refentryinfo>\n";
664 print " <title>LINUX</title>\n"; 664 print " <title>LINUX</title>\n";
665 print " <productname>Kernel Hackers Manual</productname>\n"; 665 print " <productname>Kernel Hackers Manual</productname>\n";
666 print " <date>$man_date</date>\n"; 666 print " <date>$man_date</date>\n";
667 print "</refentryinfo>\n"; 667 print "</refentryinfo>\n";
668 print "<refmeta>\n"; 668 print "<refmeta>\n";
669 print " <refentrytitle><phrase id=\"$id\">".$args{'type'}." ".$args{'struct'}."</phrase></refentrytitle>\n"; 669 print " <refentrytitle><phrase>".$args{'type'}." ".$args{'struct'}."</phrase></refentrytitle>\n";
670 print " <manvolnum>9</manvolnum>\n"; 670 print " <manvolnum>9</manvolnum>\n";
671 print "</refmeta>\n"; 671 print "</refmeta>\n";
672 print "<refnamediv>\n"; 672 print "<refnamediv>\n";
@@ -743,14 +743,14 @@ sub output_enum_xml(%) {
743 $id = "API-enum-".$args{'enum'}; 743 $id = "API-enum-".$args{'enum'};
744 $id =~ s/[^A-Za-z0-9]/-/g; 744 $id =~ s/[^A-Za-z0-9]/-/g;
745 745
746 print "<refentry>\n"; 746 print "<refentry id=\"$id\">\n";
747 print "<refentryinfo>\n"; 747 print "<refentryinfo>\n";
748 print " <title>LINUX</title>\n"; 748 print " <title>LINUX</title>\n";
749 print " <productname>Kernel Hackers Manual</productname>\n"; 749 print " <productname>Kernel Hackers Manual</productname>\n";
750 print " <date>$man_date</date>\n"; 750 print " <date>$man_date</date>\n";
751 print "</refentryinfo>\n"; 751 print "</refentryinfo>\n";
752 print "<refmeta>\n"; 752 print "<refmeta>\n";
753 print " <refentrytitle><phrase id=\"$id\">enum ".$args{'enum'}."</phrase></refentrytitle>\n"; 753 print " <refentrytitle><phrase>enum ".$args{'enum'}."</phrase></refentrytitle>\n";
754 print " <manvolnum>9</manvolnum>\n"; 754 print " <manvolnum>9</manvolnum>\n";
755 print "</refmeta>\n"; 755 print "</refmeta>\n";
756 print "<refnamediv>\n"; 756 print "<refnamediv>\n";
@@ -809,14 +809,14 @@ sub output_typedef_xml(%) {
809 $id = "API-typedef-".$args{'typedef'}; 809 $id = "API-typedef-".$args{'typedef'};
810 $id =~ s/[^A-Za-z0-9]/-/g; 810 $id =~ s/[^A-Za-z0-9]/-/g;
811 811
812 print "<refentry>\n"; 812 print "<refentry id=\"$id\">\n";
813 print "<refentryinfo>\n"; 813 print "<refentryinfo>\n";
814 print " <title>LINUX</title>\n"; 814 print " <title>LINUX</title>\n";
815 print " <productname>Kernel Hackers Manual</productname>\n"; 815 print " <productname>Kernel Hackers Manual</productname>\n";
816 print " <date>$man_date</date>\n"; 816 print " <date>$man_date</date>\n";
817 print "</refentryinfo>\n"; 817 print "</refentryinfo>\n";
818 print "<refmeta>\n"; 818 print "<refmeta>\n";
819 print " <refentrytitle><phrase id=\"$id\">typedef ".$args{'typedef'}."</phrase></refentrytitle>\n"; 819 print " <refentrytitle><phrase>typedef ".$args{'typedef'}."</phrase></refentrytitle>\n";
820 print " <manvolnum>9</manvolnum>\n"; 820 print " <manvolnum>9</manvolnum>\n";
821 print "</refmeta>\n"; 821 print "</refmeta>\n";
822 print "<refnamediv>\n"; 822 print "<refnamediv>\n";
@@ -953,7 +953,11 @@ sub output_function_man(%) {
953 print $args{'function'}." \\- ".$args{'purpose'}."\n"; 953 print $args{'function'}." \\- ".$args{'purpose'}."\n";
954 954
955 print ".SH SYNOPSIS\n"; 955 print ".SH SYNOPSIS\n";
956 print ".B \"".$args{'functiontype'}."\" ".$args{'function'}."\n"; 956 if ($args{'functiontype'} ne "") {
957 print ".B \"".$args{'functiontype'}."\" ".$args{'function'}."\n";
958 } else {
959 print ".B \"".$args{'function'}."\n";
960 }
957 $count = 0; 961 $count = 0;
958 my $parenth = "("; 962 my $parenth = "(";
959 my $post = ","; 963 my $post = ",";
@@ -1118,13 +1122,19 @@ sub output_intro_man(%) {
1118sub output_function_text(%) { 1122sub output_function_text(%) {
1119 my %args = %{$_[0]}; 1123 my %args = %{$_[0]};
1120 my ($parameter, $section); 1124 my ($parameter, $section);
1125 my $start;
1121 1126
1122 print "Name:\n\n"; 1127 print "Name:\n\n";
1123 print $args{'function'}." - ".$args{'purpose'}."\n"; 1128 print $args{'function'}." - ".$args{'purpose'}."\n";
1124 1129
1125 print "\nSynopsis:\n\n"; 1130 print "\nSynopsis:\n\n";
1126 my $start=$args{'functiontype'}." ".$args{'function'}." ("; 1131 if ($args{'functiontype'} ne "") {
1132 $start = $args{'functiontype'}." ".$args{'function'}." (";
1133 } else {
1134 $start = $args{'function'}." (";
1135 }
1127 print $start; 1136 print $start;
1137
1128 my $count = 0; 1138 my $count = 0;
1129 foreach my $parameter (@{$args{'parameterlist'}}) { 1139 foreach my $parameter (@{$args{'parameterlist'}}) {
1130 $type = $args{'parametertypes'}{$parameter}; 1140 $type = $args{'parametertypes'}{$parameter};
@@ -1433,7 +1443,7 @@ sub create_parameterlist($$$) {
1433 } elsif ($arg =~ m/\(.*\*/) { 1443 } elsif ($arg =~ m/\(.*\*/) {
1434 # pointer-to-function 1444 # pointer-to-function
1435 $arg =~ tr/#/,/; 1445 $arg =~ tr/#/,/;
1436 $arg =~ m/[^\(]+\(\*([^\)]+)\)/; 1446 $arg =~ m/[^\(]+\(\*\s*([^\)]+)\)/;
1437 $param = $1; 1447 $param = $1;
1438 $type = $arg; 1448 $type = $arg;
1439 $type =~ s/([^\(]+\(\*)$param/$1/; 1449 $type =~ s/([^\(]+\(\*)$param/$1/;
@@ -1536,7 +1546,7 @@ sub dump_function($$) {
1536 $prototype =~ s/^__always_inline +//; 1546 $prototype =~ s/^__always_inline +//;
1537 $prototype =~ s/^noinline +//; 1547 $prototype =~ s/^noinline +//;
1538 $prototype =~ s/__devinit +//; 1548 $prototype =~ s/__devinit +//;
1539 $prototype =~ s/^#define +//; #ak added 1549 $prototype =~ s/^#define\s+//; #ak added
1540 $prototype =~ s/__attribute__ \(\([a-z,]*\)\)//; 1550 $prototype =~ s/__attribute__ \(\([a-z,]*\)\)//;
1541 1551
1542 # Yes, this truly is vile. We are looking for: 1552 # Yes, this truly is vile. We are looking for:
@@ -1570,7 +1580,8 @@ sub dump_function($$) {
1570 $prototype =~ m/^(\w+\s+\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ || 1580 $prototype =~ m/^(\w+\s+\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
1571 $prototype =~ m/^(\w+\s+\w+\s+\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ || 1581 $prototype =~ m/^(\w+\s+\w+\s+\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
1572 $prototype =~ m/^(\w+\s+\w+\s+\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ || 1582 $prototype =~ m/^(\w+\s+\w+\s+\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
1573 $prototype =~ m/^(\w+\s+\w+\s+\w+\s+\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/) { 1583 $prototype =~ m/^(\w+\s+\w+\s+\w+\s+\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
1584 $prototype =~ m/^(\w+\s+\w+\s*\*\s*\w+\s*\*\s*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/) {
1574 $return_type = $1; 1585 $return_type = $1;
1575 $declaration_name = $2; 1586 $declaration_name = $2;
1576 my $args = $3; 1587 my $args = $3;
@@ -1710,6 +1721,7 @@ sub process_file($) {
1710 my $file; 1721 my $file;
1711 my $identifier; 1722 my $identifier;
1712 my $func; 1723 my $func;
1724 my $descr;
1713 my $initial_section_counter = $section_counter; 1725 my $initial_section_counter = $section_counter;
1714 1726
1715 if (defined($ENV{'SRCTREE'})) { 1727 if (defined($ENV{'SRCTREE'})) {
@@ -1753,7 +1765,12 @@ sub process_file($) {
1753 1765
1754 $state = 2; 1766 $state = 2;
1755 if (/-(.*)/) { 1767 if (/-(.*)/) {
1756 $declaration_purpose = xml_escape($1); 1768 # strip leading/trailing/multiple spaces #RDD:T:
1769 $descr= $1;
1770 $descr =~ s/^\s*//;
1771 $descr =~ s/\s*$//;
1772 $descr =~ s/\s+/ /;
1773 $declaration_purpose = xml_escape($descr);
1757 } else { 1774 } else {
1758 $declaration_purpose = ""; 1775 $declaration_purpose = "";
1759 } 1776 }
diff --git a/scripts/makelst b/scripts/makelst
index 34bd72391238..4fc80f2b7e19 100755
--- a/scripts/makelst
+++ b/scripts/makelst
@@ -1,31 +1,31 @@
1#!/bin/bash 1#!/bin/sh
2# A script to dump mixed source code & assembly 2# A script to dump mixed source code & assembly
3# with correct relocations from System.map 3# with correct relocations from System.map
4# Requires the following lines in Rules.make. 4# Requires the following lines in makefile:
5# Author(s): DJ Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
6# William Stearns <wstearns@pobox.com>
7#%.lst: %.c 5#%.lst: %.c
8# $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -g -c -o $*.o $< 6# $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -g -c -o $*.o $<
9# $(TOPDIR)/scripts/makelst $*.o $(TOPDIR)/System.map $(OBJDUMP) 7# $(srctree)/scripts/makelst $*.o $(objtree)/System.map $(OBJDUMP)
10# 8#
11# Copyright (C) 2000 IBM Corporation 9# Copyright (C) 2000 IBM Corporation
12# Author(s): DJ Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) 10# Author(s): DJ Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
11# William Stearns <wstearns@pobox.com>
13# 12#
14 13
15t1=`$3 --syms $1 | grep .text | grep " F " | head -n 1` 14# awk style field access
15field() {
16 shift $1 ; echo $1
17}
18
19t1=`$3 --syms $1 | grep .text | grep -m1 " F "`
16if [ -n "$t1" ]; then 20if [ -n "$t1" ]; then
17 t2=`echo $t1 | gawk '{ print $6 }'` 21 t2=`field 6 $t1`
18 if [ ! -r $2 ]; then 22 if [ ! -r $2 ]; then
19 echo "No System.map" >&2 23 echo "No System.map" >&2
20 t7=0
21 else 24 else
22 t3=`grep $t2 $2` 25 t3=`grep $t2 $2`
23 t4=`echo $t3 | gawk '{ print $1 }'` 26 t4=`field 1 $t3`
24 t5=`echo $t1 | gawk '{ print $1 }'` 27 t5=`field 1 $t1`
25 t6=`echo $t4 - $t5 | tr a-f A-F` 28 t6=`printf "%lu" $((0x$t4 - 0x$t5))`
26 t7=`( echo ibase=16 ; echo $t6 ) | bc`
27 fi 29 fi
28else
29 t7=0
30fi 30fi
31$3 -r --source --adjust-vma=$t7 $1 31$3 -r --source --adjust-vma=${t6:-0} $1
diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h
index d7b8a384b4a7..82d0af46f0ef 100755
--- a/scripts/mkcompile_h
+++ b/scripts/mkcompile_h
@@ -58,7 +58,7 @@ UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/"
58 echo \#define LINUX_COMPILE_DOMAIN 58 echo \#define LINUX_COMPILE_DOMAIN
59 fi 59 fi
60 60
61 echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | tail -n 1`\" 61 echo \#define LINUX_COMPILER \"`LC_ALL=C LANG=C $CC -v 2>&1 | tail -n 1`\"
62) > .tmpcompile 62) > .tmpcompile
63 63
64# Only replace the real compile.h if the new one is different, 64# Only replace the real compile.h if the new one is different,
diff --git a/scripts/mkuboot.sh b/scripts/mkuboot.sh
index 52a17ab97eb0..4b06c5eea728 100755
--- a/scripts/mkuboot.sh
+++ b/scripts/mkuboot.sh
@@ -4,12 +4,15 @@
4# Build U-Boot image when `mkimage' tool is available. 4# Build U-Boot image when `mkimage' tool is available.
5# 5#
6 6
7MKIMAGE=$(type -path mkimage) 7MKIMAGE=$(type -path ${CROSS_COMPILE}mkimage)
8 8
9if [ -z "${MKIMAGE}" ]; then 9if [ -z "${MKIMAGE}" ]; then
10 # Doesn't exist 10 MKIMAGE=$(type -path mkimage)
11 echo '"mkimage" command not found - U-Boot images will not be built' >&2 11 if [ -z "${MKIMAGE}" ]; then
12 exit 0; 12 # Doesn't exist
13 echo '"mkimage" command not found - U-Boot images will not be built' >&2
14 exit 0;
15 fi
13fi 16fi
14 17
15# Call "mkimage" to create U-Boot image 18# Call "mkimage" to create U-Boot image
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 47bef62eecd7..65bdfdb56877 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -641,12 +641,20 @@ static int secref_whitelist(const char *modname, const char *tosec,
641 if (f1 && f2) 641 if (f1 && f2)
642 return 1; 642 return 1;
643 643
644 /* Whitelist all references from .pci_fixup section if vmlinux */ 644 /* Whitelist all references from .pci_fixup section if vmlinux
645 * Whitelist all refereces from .text.head to .init.data if vmlinux
646 * Whitelist all refereces from .text.head to .init.text if vmlinux
647 */
645 if (is_vmlinux(modname)) { 648 if (is_vmlinux(modname)) {
646 if ((strcmp(fromsec, ".pci_fixup") == 0) && 649 if ((strcmp(fromsec, ".pci_fixup") == 0) &&
647 (strcmp(tosec, ".init.text") == 0)) 650 (strcmp(tosec, ".init.text") == 0))
648 return 1; 651 return 1;
649 652
653 if ((strcmp(fromsec, ".text.head") == 0) &&
654 ((strcmp(tosec, ".init.data") == 0) ||
655 (strcmp(tosec, ".init.text") == 0)))
656 return 1;
657
650 /* Check for pattern 3 */ 658 /* Check for pattern 3 */
651 for (s = pat3refsym; *s; s++) 659 for (s = pat3refsym; *s; s++)
652 if (strcmp(refsymname, *s) == 0) 660 if (strcmp(refsymname, *s) == 0)
@@ -678,6 +686,30 @@ static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf_Addr addr,
678 return NULL; 686 return NULL;
679} 687}
680 688
689static inline int is_arm_mapping_symbol(const char *str)
690{
691 return str[0] == '$' && strchr("atd", str[1])
692 && (str[2] == '\0' || str[2] == '.');
693}
694
695/*
696 * If there's no name there, ignore it; likewise, ignore it if it's
697 * one of the magic symbols emitted used by current ARM tools.
698 *
699 * Otherwise if find_symbols_between() returns those symbols, they'll
700 * fail the whitelist tests and cause lots of false alarms ... fixable
701 * only by merging __exit and __init sections into __text, bloating
702 * the kernel (which is especially evil on embedded platforms).
703 */
704static inline int is_valid_name(struct elf_info *elf, Elf_Sym *sym)
705{
706 const char *name = elf->strtab + sym->st_name;
707
708 if (!name || !strlen(name))
709 return 0;
710 return !is_arm_mapping_symbol(name);
711}
712
681/* 713/*
682 * Find symbols before or equal addr and after addr - in the section sec. 714 * Find symbols before or equal addr and after addr - in the section sec.
683 * If we find two symbols with equal offset prefer one with a valid name. 715 * If we find two symbols with equal offset prefer one with a valid name.
@@ -706,16 +738,15 @@ static void find_symbols_between(struct elf_info *elf, Elf_Addr addr,
706 symsec = secstrings + elf->sechdrs[sym->st_shndx].sh_name; 738 symsec = secstrings + elf->sechdrs[sym->st_shndx].sh_name;
707 if (strcmp(symsec, sec) != 0) 739 if (strcmp(symsec, sec) != 0)
708 continue; 740 continue;
741 if (!is_valid_name(elf, sym))
742 continue;
709 if (sym->st_value <= addr) { 743 if (sym->st_value <= addr) {
710 if ((addr - sym->st_value) < beforediff) { 744 if ((addr - sym->st_value) < beforediff) {
711 beforediff = addr - sym->st_value; 745 beforediff = addr - sym->st_value;
712 *before = sym; 746 *before = sym;
713 } 747 }
714 else if ((addr - sym->st_value) == beforediff) { 748 else if ((addr - sym->st_value) == beforediff) {
715 /* equal offset, valid name? */ 749 *before = sym;
716 const char *name = elf->strtab + sym->st_name;
717 if (name && strlen(name))
718 *before = sym;
719 } 750 }
720 } 751 }
721 else 752 else
@@ -725,10 +756,7 @@ static void find_symbols_between(struct elf_info *elf, Elf_Addr addr,
725 *after = sym; 756 *after = sym;
726 } 757 }
727 else if ((sym->st_value - addr) == afterdiff) { 758 else if ((sym->st_value - addr) == afterdiff) {
728 /* equal offset, valid name? */ 759 *after = sym;
729 const char *name = elf->strtab + sym->st_name;
730 if (name && strlen(name))
731 *after = sym;
732 } 760 }
733 } 761 }
734 } 762 }