Browse Source

Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-next

* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-next: (53 commits)
  .gitignore: ignore *.lzma files
  kbuild: add generic --set-str option to scripts/config
  kbuild: simplify argument loop in scripts/config
  kbuild: handle non-existing options in scripts/config
  kallsyms: generalize text region handling
  kallsyms: support kernel symbols in Blackfin on-chip memory
  documentation: make version fix
  kbuild: fix a compile warning
  gitignore: Add GNU GLOBAL files to top .gitignore
  kbuild: fix delay in setlocalversion on readonly source
  README: fix misleading pointer to the defconf directory
  vmlinux.lds.h update
  kernel-doc: cleanup perl script
  Improve vmlinux.lds.h support for arch specific linker scripts
  kbuild: fix headers_exports with boolean expression
  kbuild/headers_check: refine extern check
  kbuild: fix "Argument list too long" error for "make headers_check",
  ignore *.patch files
  Remove bashisms from scripts
  menu: fix embedded menu presentation
  ...
master
Linus Torvalds 13 years ago
parent
commit
45e3e1935e
  1. 8
      .gitignore
  2. 4
      Documentation/Changes
  3. 116
      Documentation/kbuild/kconfig.txt
  4. 2
      Documentation/kbuild/modules.txt
  5. 26
      Makefile
  6. 11
      README
  7. 241
      include/asm-generic/vmlinux.lds.h
  8. 7
      include/linux/init.h
  9. 6
      include/linux/section-names.h
  10. 16
      init/Kconfig
  11. 134
      kernel/kallsyms.c
  12. 8
      scripts/Makefile.headersinst
  13. 13
      scripts/basic/docproc.c
  14. 5
      scripts/basic/fixdep.c
  15. 87
      scripts/config
  16. 2
      scripts/gcc-version.sh
  17. 7
      scripts/headers.sh
  18. 14
      scripts/headers_check.pl
  19. 76
      scripts/kallsyms.c
  20. 3
      scripts/kconfig/.gitignore
  21. 4
      scripts/kconfig/Makefile
  22. 7
      scripts/kconfig/conf.c
  23. 20
      scripts/kconfig/confdata.c
  24. 1
      scripts/kconfig/lkc.h
  25. 3
      scripts/kconfig/lxdialog/checklist.c
  26. 10
      scripts/kconfig/mconf.c
  27. 48
      scripts/kconfig/qconf.cc
  28. 6
      scripts/kconfig/util.c
  29. 174
      scripts/kernel-doc
  30. 50
      scripts/mod/modpost.c
  31. 149
      scripts/package/builddeb
  32. 6
      scripts/setlocalversion
  33. 48
      scripts/unifdef.c
  34. 2
      scripts/ver_linux

8
.gitignore

@ -25,6 +25,8 @@
*.elf
*.bin
*.gz
*.lzma
*.patch
#
# Top-level generic files
@ -62,6 +64,12 @@ series
cscope.*
ncscope.*
# gnu global files
GPATH
GRTAGS
GSYMS
GTAGS
*.orig
*~
\#*#

4
Documentation/Changes

@ -29,7 +29,7 @@ hardware, for example, you probably needn't concern yourself with
isdn4k-utils.
o Gnu C 3.2 # gcc --version
o Gnu make 3.79.1 # make --version
o Gnu make 3.80 # make --version
o binutils 2.12 # ld -v
o util-linux 2.10o # fdformat --version
o module-init-tools 0.9.10 # depmod -V
@ -62,7 +62,7 @@ computer.
Make
----
You will need Gnu make 3.79.1 or later to build the kernel.
You will need Gnu make 3.80 or later to build the kernel.
Binutils
--------

116
Documentation/kbuild/kconfig.txt

@ -35,48 +35,26 @@ new .config files to see the differences:
(Yes, we need something better here.)
======================================================================
menuconfig
--------------------------------------------------
SEARCHING for CONFIG symbols
Searching in menuconfig:
The Search function searches for kernel configuration symbol
names, so you have to know something close to what you are
looking for.
Example:
/hotplug
This lists all config symbols that contain "hotplug",
e.g., HOTPLUG, HOTPLUG_CPU, MEMORY_HOTPLUG.
For search help, enter / followed TAB-TAB-TAB (to highlight
<Help>) and Enter. This will tell you that you can also use
regular expressions (regexes) in the search string, so if you
are not interested in MEMORY_HOTPLUG, you could try
/^hotplug
______________________________________________________________________
Color Themes for 'menuconfig'
Environment variables for '*config'
It is possible to select different color themes using the variable
MENUCONFIG_COLOR. To select a theme use:
KCONFIG_CONFIG
--------------------------------------------------
This environment variable can be used to specify a default kernel config
file name to override the default name of ".config".
make MENUCONFIG_COLOR=<theme> menuconfig
KCONFIG_OVERWRITECONFIG
--------------------------------------------------
If you set KCONFIG_OVERWRITECONFIG in the environment, Kconfig will not
break symlinks when .config is a symlink to somewhere else.
Available themes are:
mono => selects colors suitable for monochrome displays
blackbg => selects a color scheme with black background
classic => theme with blue background. The classic look
bluetitle => a LCD friendly version of classic. (default)
KCONFIG_NOTIMESTAMP
--------------------------------------------------
If this environment variable exists and is non-null, the timestamp line
in generated .config files is omitted.
______________________________________________________________________
Environment variables in 'menuconfig'
Environment variables for '{allyes/allmod/allno/rand}config'
KCONFIG_ALLCONFIG
--------------------------------------------------
@ -95,8 +73,7 @@ values.
This enables you to create "miniature" config (miniconfig) or custom
config files containing just the config symbols that you are interested
in. Then the kernel config system generates the full .config file,
including dependencies of your miniconfig file, based on the miniconfig
file.
including symbols of your miniconfig file.
This 'KCONFIG_ALLCONFIG' file is a config file which contains
(usually a subset of all) preset config symbols. These variable
@ -113,26 +90,14 @@ These examples will disable most options (allnoconfig) but enable or
disable the options that are explicitly listed in the specified
mini-config files.
______________________________________________________________________
Environment variables for 'silentoldconfig'
KCONFIG_NOSILENTUPDATE
--------------------------------------------------
If this variable has a non-blank value, it prevents silent kernel
config udpates (requires explicit updates).
KCONFIG_CONFIG
--------------------------------------------------
This environment variable can be used to specify a default kernel config
file name to override the default name of ".config".
KCONFIG_OVERWRITECONFIG
--------------------------------------------------
If you set KCONFIG_OVERWRITECONFIG in the environment, Kconfig will not
break symlinks when .config is a symlink to somewhere else.
KCONFIG_NOTIMESTAMP
--------------------------------------------------
If this environment variable exists and is non-null, the timestamp line
in generated .config files is omitted.
KCONFIG_AUTOCONFIG
--------------------------------------------------
This environment variable can be set to specify the path & name of the
@ -143,15 +108,54 @@ KCONFIG_AUTOHEADER
This environment variable can be set to specify the path & name of the
"autoconf.h" (header) file. Its default value is "include/linux/autoconf.h".
======================================================================
menuconfig
--------------------------------------------------
SEARCHING for CONFIG symbols
Searching in menuconfig:
The Search function searches for kernel configuration symbol
names, so you have to know something close to what you are
looking for.
Example:
/hotplug
This lists all config symbols that contain "hotplug",
e.g., HOTPLUG, HOTPLUG_CPU, MEMORY_HOTPLUG.
For search help, enter / followed TAB-TAB-TAB (to highlight
<Help>) and Enter. This will tell you that you can also use
regular expressions (regexes) in the search string, so if you
are not interested in MEMORY_HOTPLUG, you could try
/^hotplug
______________________________________________________________________
menuconfig User Interface Options
----------------------------------------------------------------------
User interface options for 'menuconfig'
MENUCONFIG_COLOR
--------------------------------------------------
It is possible to select different color themes using the variable
MENUCONFIG_COLOR. To select a theme use:
make MENUCONFIG_COLOR=<theme> menuconfig
Available themes are:
mono => selects colors suitable for monochrome displays
blackbg => selects a color scheme with black background
classic => theme with blue background. The classic look
bluetitle => a LCD friendly version of classic. (default)
MENUCONFIG_MODE
--------------------------------------------------
This mode shows all sub-menus in one large tree.
Example:
MENUCONFIG_MODE=single_menu make menuconfig
make MENUCONFIG_MODE=single_menu menuconfig
======================================================================
xconfig

2
Documentation/kbuild/modules.txt

@ -275,7 +275,7 @@ following files:
KERNELDIR := /lib/modules/`uname -r`/build
all::
$(MAKE) -C $KERNELDIR M=`pwd` $@
$(MAKE) -C $(KERNELDIR) M=`pwd` $@
# Module specific targets
genbin:

26
Makefile

@ -35,10 +35,8 @@ MAKEFLAGS += -rR --no-print-directory
# To put more focus on warnings, be less verbose as default
# Use 'make V=1' to see the full commands
ifdef V
ifeq ("$(origin V)", "command line")
KBUILD_VERBOSE = $(V)
endif
ifeq ("$(origin V)", "command line")
KBUILD_VERBOSE = $(V)
endif
ifndef KBUILD_VERBOSE
KBUILD_VERBOSE = 0
@ -54,10 +52,8 @@ endif
# See the file "Documentation/sparse.txt" for more details, including
# where to get the "sparse" utility.
ifdef C
ifeq ("$(origin C)", "command line")
KBUILD_CHECKSRC = $(C)
endif
ifeq ("$(origin C)", "command line")
KBUILD_CHECKSRC = $(C)
endif
ifndef KBUILD_CHECKSRC
KBUILD_CHECKSRC = 0
@ -69,12 +65,10 @@ endif
ifdef SUBDIRS
KBUILD_EXTMOD ?= $(SUBDIRS)
endif
ifdef M
ifeq ("$(origin M)", "command line")
KBUILD_EXTMOD := $(M)
endif
endif
ifeq ("$(origin M)", "command line")
KBUILD_EXTMOD := $(M)
endif
# kbuild supports saving output files in a separate directory.
# To locate output files in a separate directory two syntaxes are supported.
@ -98,10 +92,8 @@ ifeq ($(KBUILD_SRC),)
# OK, Make called in directory where kernel src resides
# Do we want to locate output files in a separate directory?
ifdef O
ifeq ("$(origin O)", "command line")
KBUILD_OUTPUT := $(O)
endif
ifeq ("$(origin O)", "command line")
KBUILD_OUTPUT := $(O)
endif
# That's our default target when none is given on the command line

11
README

@ -174,8 +174,17 @@ CONFIGURING the kernel:
"make silentoldconfig"
Like above, but avoids cluttering the screen
with questions already answered.
Additionally updates the dependencies.
"make defconfig" Create a ./.config file by using the default
symbol values from arch/$ARCH/defconfig.
symbol values from either arch/$ARCH/defconfig
or arch/$ARCH/configs/${PLATFORM}_defconfig,
depending on the architecture.
"make ${PLATFORM}_defconfig"
Create a ./.config file by using the default
symbol values from
arch/$ARCH/configs/${PLATFORM}_defconfig.
Use "make help" to get a list of all available
platforms of your architecture.
"make allyesconfig"
Create a ./.config file by setting symbol
values to 'y' as much as possible.

241
include/asm-generic/vmlinux.lds.h

@ -1,4 +1,57 @@
#include <linux/section-names.h>
/*
* Helper macros to support writing architecture specific
* linker scripts.
*
* A minimal linker scripts has following content:
* [This is a sample, architectures may have special requiriements]
*
* OUTPUT_FORMAT(...)
* OUTPUT_ARCH(...)
* ENTRY(...)
* SECTIONS
* {
* . = START;
* __init_begin = .;
* HEAD_TEXT_SECTION
* INIT_TEXT_SECTION(PAGE_SIZE)
* INIT_DATA_SECTION(...)
* PERCPU(PAGE_SIZE)
* __init_end = .;
*
* _stext = .;
* TEXT_SECTION = 0
* _etext = .;
*
* _sdata = .;
* RO_DATA_SECTION(PAGE_SIZE)
* RW_DATA_SECTION(...)
* _edata = .;
*
* EXCEPTION_TABLE(...)
* NOTES
*
* __bss_start = .;
* BSS_SECTION(0, 0)
* __bss_stop = .;
* _end = .;
*
* /DISCARD/ : {
* EXIT_TEXT
* EXIT_DATA
* EXIT_CALL
* }
* STABS_DEBUG
* DWARF_DEBUG
* }
*
* [__init_begin, __init_end] is the init section that may be freed after init
* [_stext, _etext] is the text section
* [_sdata, _edata] is the data section
*
* Some of the included output section have their own set of constants.
* Examples are: [__initramfs_start, __initramfs_end] for initramfs and
* [__nosave_begin, __nosave_end] for the nosave data
*/
#ifndef LOAD_OFFSET
#define LOAD_OFFSET 0
@ -116,7 +169,36 @@
FTRACE_EVENTS() \
TRACE_SYSCALLS()
#define RO_DATA(align) \
/*
* Data section helpers
*/
#define NOSAVE_DATA \
. = ALIGN(PAGE_SIZE); \
VMLINUX_SYMBOL(__nosave_begin) = .; \
*(.data.nosave) \
. = ALIGN(PAGE_SIZE); \
VMLINUX_SYMBOL(__nosave_end) = .;
#define PAGE_ALIGNED_DATA(page_align) \
. = ALIGN(page_align); \
*(.data.page_aligned)
#define READ_MOSTLY_DATA(align) \
. = ALIGN(align); \
*(.data.read_mostly)
#define CACHELINE_ALIGNED_DATA(align) \
. = ALIGN(align); \
*(.data.cacheline_aligned)
#define INIT_TASK(align) \
. = ALIGN(align); \
*(.data.init_task)
/*
* Read only Data
*/
#define RO_DATA_SECTION(align) \
. = ALIGN((align)); \
.rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
VMLINUX_SYMBOL(__start_rodata) = .; \
@ -270,9 +352,10 @@
} \
. = ALIGN((align));
/* RODATA provided for backward compatibility.
/* RODATA & RO_DATA provided for backward compatibility.
* All archs are supposed to use RO_DATA() */
#define RODATA RO_DATA(4096)
#define RODATA RO_DATA_SECTION(4096)
#define RO_DATA(align) RO_DATA_SECTION(align)
#define SECURITY_INIT \
.security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \
@ -330,16 +413,42 @@
#endif
/* Section used for early init (in .S files) */
#define HEAD_TEXT *(HEAD_TEXT_SECTION)
#define HEAD_TEXT *(.head.text)
#define HEAD_TEXT_SECTION \
.head.text : AT(ADDR(.head.text) - LOAD_OFFSET) { \
HEAD_TEXT \
}
/*
* Exception table
*/
#define EXCEPTION_TABLE(align) \
. = ALIGN(align); \
__ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { \
VMLINUX_SYMBOL(__start___ex_table) = .; \
*(__ex_table) \
VMLINUX_SYMBOL(__stop___ex_table) = .; \
}
/*
* Init task
*/
#define INIT_TASK_DATA(align) \
. = ALIGN(align); \
.data.init_task : { \
INIT_TASK \
}
/* init and exit section handling */
#define INIT_DATA \
*(.init.data) \
DEV_DISCARD(init.data) \
DEV_DISCARD(init.rodata) \
CPU_DISCARD(init.data) \
CPU_DISCARD(init.rodata) \
MEM_DISCARD(init.data) \
*(.init.rodata) \
DEV_DISCARD(init.rodata) \
CPU_DISCARD(init.rodata) \
MEM_DISCARD(init.rodata)
#define INIT_TEXT \
@ -363,9 +472,35 @@
CPU_DISCARD(exit.text) \
MEM_DISCARD(exit.text)
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to
the beginning of the section so we begin them at 0. */
#define EXIT_CALL \
*(.exitcall.exit)
/*
* bss (Block Started by Symbol) - uninitialized data
* zeroed during startup
*/
#define SBSS \
.sbss : AT(ADDR(.sbss) - LOAD_OFFSET) { \
*(.sbss) \
*(.scommon) \
}
#define BSS(bss_align) \
. = ALIGN(bss_align); \
.bss : AT(ADDR(.bss) - LOAD_OFFSET) { \
VMLINUX_SYMBOL(__bss_start) = .; \
*(.bss.page_aligned) \
*(.dynbss) \
*(.bss) \
*(COMMON) \
VMLINUX_SYMBOL(__bss_stop) = .; \
}
/*
* DWARF debug sections.
* Symbols in the DWARF debugging sections are relative to
* the beginning of the section so we begin them at 0.
*/
#define DWARF_DEBUG \
/* DWARF 1 */ \
.debug 0 : { *(.debug) } \
@ -432,6 +567,12 @@
VMLINUX_SYMBOL(__stop_notes) = .; \
}
#define INIT_SETUP(initsetup_align) \
. = ALIGN(initsetup_align); \
VMLINUX_SYMBOL(__setup_start) = .; \
*(.init.setup) \
VMLINUX_SYMBOL(__setup_end) = .;
#define INITCALLS \
*(.initcallearly.init) \
VMLINUX_SYMBOL(__early_initcall_end) = .; \
@ -453,6 +594,31 @@
*(.initcall7.init) \
*(.initcall7s.init)
#define INIT_CALLS \
VMLINUX_SYMBOL(__initcall_start) = .; \
INITCALLS \
VMLINUX_SYMBOL(__initcall_end) = .;
#define CON_INITCALL \
VMLINUX_SYMBOL(__con_initcall_start) = .; \
*(.con_initcall.init) \
VMLINUX_SYMBOL(__con_initcall_end) = .;
#define SECURITY_INITCALL \
VMLINUX_SYMBOL(__security_initcall_start) = .; \
*(.security_initcall.init) \
VMLINUX_SYMBOL(__security_initcall_end) = .;
#ifdef CONFIG_BLK_DEV_INITRD
#define INIT_RAM_FS \
. = ALIGN(PAGE_SIZE); \
VMLINUX_SYMBOL(__initramfs_start) = .; \
*(.init.ramfs) \
VMLINUX_SYMBOL(__initramfs_end) = .;
#else
#define INITRAMFS
#endif
/**
* PERCPU_VADDR - define output section for percpu area
* @vaddr: explicit base address (optional)
@ -509,3 +675,58 @@
*(.data.percpu.shared_aligned) \
VMLINUX_SYMBOL(__per_cpu_end) = .; \
}
/*
* Definition of the high level *_SECTION macros
* They will fit only a subset of the architectures
*/
/*
* Writeable data.
* All sections are combined in a single .data section.
* The sections following CONSTRUCTORS are arranged so their
* typical alignment matches.
* A cacheline is typical/always less than a PAGE_SIZE so
* the sections that has this restriction (or similar)
* is located before the ones requiring PAGE_SIZE alignment.
* NOSAVE_DATA starts and ends with a PAGE_SIZE alignment which
* matches the requirment of PAGE_ALIGNED_DATA.
*
* use 0 as page_align if page_aligned data is not used */
#define RW_DATA_SECTION(cacheline, nosave, pagealigned, inittask) \
. = ALIGN(PAGE_SIZE); \
.data : AT(ADDR(.data) - LOAD_OFFSET) { \
INIT_TASK(inittask) \
CACHELINE_ALIGNED_DATA(cacheline) \
READ_MOSTLY_DATA(cacheline) \
DATA_DATA \
CONSTRUCTORS \
NOSAVE_DATA(nosave) \
PAGE_ALIGNED_DATA(pagealigned) \
}
#define INIT_TEXT_SECTION(inittext_align) \
. = ALIGN(inittext_align); \
.init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { \
VMLINUX_SYMBOL(_sinittext) = .; \
INIT_TEXT \
VMLINUX_SYMBOL(_einittext) = .; \
}
#define INIT_DATA_SECTION(initsetup_align) \
.init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { \
INIT_DATA \
INIT_SETUP(initsetup_align) \
INIT_CALLS \
CON_INITCALL \
SECURITY_INITCALL \
INIT_RAM_FS \
}
#define BSS_SECTION(sbss_align, bss_align) \
SBSS \
BSS(bss_align) \
. = ALIGN(4);

7
include/linux/init.h

@ -2,8 +2,6 @@
#define _LINUX_INIT_H
#include <linux/compiler.h>
#include <linux/section-names.h>
#include <linux/stringify.h>
/* These macros are used to mark some functions or
* initialized data (doesn't apply to uninitialized data)
@ -101,7 +99,7 @@
#define __memexitconst __section(.memexit.rodata)
/* For assembly routines */
#define __HEAD .section __stringify(HEAD_TEXT_SECTION),"ax"
#define __HEAD .section ".head.text","ax"
#define __INIT .section ".init.text","ax"
#define __FINIT .previous
@ -225,7 +223,8 @@ struct obs_kernel_param {
* obs_kernel_param "array" too far apart in .init.setup.
*/
#define __setup_param(str, unique_id, fn, early) \
static char __setup_str_##unique_id[] __initdata __aligned(1) = str; \
static const char __setup_str_##unique_id[] __initconst \
__aligned(1) = str; \
static struct obs_kernel_param __setup_##unique_id \
__used __section(.init.setup) \
__attribute__((aligned((sizeof(long))))) \

6
include/linux/section-names.h

@ -1,6 +0,0 @@
#ifndef __LINUX_SECTION_NAMES_H
#define __LINUX_SECTION_NAMES_H
#define HEAD_TEXT_SECTION .head.text
#endif /* !__LINUX_SECTION_NAMES_H */

16
init/Kconfig

@ -809,14 +809,6 @@ config KALLSYMS_EXTRA_PASS
you wait for kallsyms to be fixed.
config STRIP_ASM_SYMS
bool "Strip assembler-generated symbols during link"
default n
help
Strip internal assembler-generated symbols during a link (symbols
that look like '.Lxxx') so they don't pollute the output of
get_wchan() and suchlike.
config HOTPLUG
bool "Support for hot-pluggable devices" if EMBEDDED
default y
@ -998,6 +990,14 @@ config SLUB_DEBUG
SLUB sysfs support. /sys/slab will not exist and there will be
no support for cache validation etc.
config STRIP_ASM_SYMS
bool "Strip assembler-generated symbols during link"
default n
help
Strip internal assembler-generated symbols during a link (symbols
that look like '.Lxxx') so they don't pollute the output of
get_wchan() and suchlike.
config COMPAT_BRK
bool "Disable heap randomization"
default y

134
kernel/kallsyms.c

@ -30,12 +30,16 @@
#define all_var 0
#endif
/* These will be re-linked against their real values during the second link stage */
/*
* These will be re-linked against their real values
* during the second link stage.
*/
extern const unsigned long kallsyms_addresses[] __attribute__((weak));
extern const u8 kallsyms_names[] __attribute__((weak));
/* tell the compiler that the count isn't in the small data section if the arch
* has one (eg: FRV)
/*
* Tell the compiler that the count isn't in the small data section if the arch
* has one (eg: FRV).
*/
extern const unsigned long kallsyms_num_syms
__attribute__((weak, section(".rodata")));
@ -75,31 +79,37 @@ static int is_ksym_addr(unsigned long addr)
return is_kernel_text(addr) || is_kernel_inittext(addr);
}
/* expand a compressed symbol data into the resulting uncompressed string,
given the offset to where the symbol is in the compressed stream */
/*
* Expand a compressed symbol data into the resulting uncompressed string,
* given the offset to where the symbol is in the compressed stream.
*/
static unsigned int kallsyms_expand_symbol(unsigned int off, char *result)
{
int len, skipped_first = 0;
const u8 *tptr, *data;
/* get the compressed symbol length from the first symbol byte */
/* Get the compressed symbol length from the first symbol byte. */
data = &kallsyms_names[off];
len = *data;
data++;
/* update the offset to return the offset for the next symbol on
* the compressed stream */
/*
* Update the offset to return the offset for the next symbol on
* the compressed stream.
*/
off += len + 1;
/* for every byte on the compressed symbol data, copy the table
entry for that byte */
while(len) {
tptr = &kallsyms_token_table[ kallsyms_token_index[*data] ];
/*
* For every byte on the compressed symbol data, copy the table
* entry for that byte.
*/
while (len) {
tptr = &kallsyms_token_table[kallsyms_token_index[*data]];
data++;
len--;
while (*tptr) {
if(skipped_first) {
if (skipped_first) {
*result = *tptr;
result++;
} else
@ -110,36 +120,46 @@ static unsigned int kallsyms_expand_symbol(unsigned int off, char *result)
*result = '\0';
/* return to offset to the next symbol */
/* Return to offset to the next symbol. */
return off;
}
/* get symbol type information. This is encoded as a single char at the
* begining of the symbol name */
/*
* Get symbol type information. This is encoded as a single char at the
* beginning of the symbol name.
*/
static char kallsyms_get_symbol_type(unsigned int off)
{
/* get just the first code, look it up in the token table, and return the
* first char from this token */
return kallsyms_token_table[ kallsyms_token_index[ kallsyms_names[off+1] ] ];
/*
* Get just the first code, look it up in the token table,
* and return the first char from this token.
*/
return kallsyms_token_table[kallsyms_token_index[kallsyms_names[off + 1]]];
}
/* find the offset on the compressed stream given and index in the
* kallsyms array */
/*
* Find the offset on the compressed stream given and index in the
* kallsyms array.
*/
static unsigned int get_symbol_offset(unsigned long pos)
{
const u8 *name;
int i;
/* use the closest marker we have. We have markers every 256 positions,
* so that should be close enough */
name = &kallsyms_names[ kallsyms_markers[pos>>8] ];
/*
* Use the closest marker we have. We have markers every 256 positions,
* so that should be close enough.
*/
name = &kallsyms_names[kallsyms_markers[pos >> 8]];
/* sequentially scan all the symbols up to the point we're searching for.
* Every symbol is stored in a [<len>][<len> bytes of data] format, so we
* just need to add the len to the current pointer for every symbol we
* wish to skip */
for(i = 0; i < (pos&0xFF); i++)
/*
* Sequentially scan all the symbols up to the point we're searching
* for. Every symbol is stored in a [<len>][<len> bytes of data] format,
* so we just need to add the len to the current pointer for every
* symbol we wish to skip.
*/
for (i = 0; i < (pos & 0xFF); i++)
name = name + (*name) + 1;
return name - kallsyms_names;
@ -190,7 +210,7 @@ static unsigned long get_symbol_pos(unsigned long addr,
/* This kernel should never had been booted. */
BUG_ON(!kallsyms_addresses);
/* do a binary search on the sorted kallsyms_addresses array */
/* Do a binary search on the sorted kallsyms_addresses array. */
low = 0;
high = kallsyms_num_syms;
@ -203,15 +223,15 @@ static unsigned long get_symbol_pos(unsigned long addr,
}
/*
* search for the first aliased symbol. Aliased
* symbols are symbols with the same address
* Search for the first aliased symbol. Aliased
* symbols are symbols with the same address.
*/
while (low && kallsyms_addresses[low-1] == kallsyms_addresses[low])
--low;
symbol_start = kallsyms_addresses[low];
/* Search for next non-aliased symbol */
/* Search for next non-aliased symbol. */
for (i = low + 1; i < kallsyms_num_syms; i++) {
if (kallsyms_addresses[i] > symbol_start) {
symbol_end = kallsyms_addresses[i];
@ -219,7 +239,7 @@ static unsigned long get_symbol_pos(unsigned long addr,
}
}
/* if we found no next symbol, we use the end of the section */
/* If we found no next symbol, we use the end of the section. */
if (!symbol_end) {
if (is_kernel_inittext(addr))
symbol_end = (unsigned long)_einittext;
@ -252,10 +272,10 @@ int kallsyms_lookup_size_offset(unsigned long addr, unsigned long *symbolsize,
/*
* Lookup an address
* - modname is set to NULL if it's in the kernel
* - we guarantee that the returned name is valid until we reschedule even if
* it resides in a module
* - we also guarantee that modname will be valid until rescheduled
* - modname is set to NULL if it's in the kernel.
* - We guarantee that the returned name is valid until we reschedule even if.
* It resides in a module.
* - We also guarantee that modname will be valid until rescheduled.
*/
const char *kallsyms_lookup(unsigned long addr,
unsigned long *symbolsize,
@ -276,7 +296,7 @@ const char *kallsyms_lookup(unsigned long addr,
return namebuf;
}
/* see if it's in a module */
/* See if it's in a module. */
return module_address_lookup(addr, symbolsize, offset, modname,
namebuf);
}
@ -294,7 +314,7 @@ int lookup_symbol_name(unsigned long addr, char *symname)
kallsyms_expand_symbol(get_symbol_offset(pos), symname);
return 0;
}
/* see if it's in a module */
/* See if it's in a module. */
return lookup_module_symbol_name(addr, symname);
}
@ -313,7 +333,7 @@ int lookup_symbol_attrs(unsigned long addr, unsigned long *size,
modname[0] = '\0';
return 0;
}
/* see if it's in a module */
/* See if it's in a module. */
return lookup_module_symbol_attrs(addr, size, offset, modname, name);
}
@ -342,6 +362,7 @@ int sprint_symbol(char *buffer, unsigned long address)
return len;
}
EXPORT_SYMBOL_GPL(sprint_symbol);
/* Look up a kernel symbol and print it to the kernel messages. */
void __print_symbol(const char *fmt, unsigned long address)
@ -352,13 +373,13 @@ void __print_symbol(const char *fmt, unsigned long address)
printk(fmt, buffer);
}
EXPORT_SYMBOL(__print_symbol);
/* To avoid using get_symbol_offset for every symbol, we carry prefix along. */
struct kallsym_iter
{
struct kallsym_iter {
loff_t pos;
unsigned long value;
unsigned int nameoff; /* If iterating in core kernel symbols */
unsigned int nameoff; /* If iterating in core kernel symbols. */
char type;
char name[KSYM_NAME_LEN];
char module_name[MODULE_NAME_LEN];
@ -404,7 +425,7 @@ static int update_iter(struct kallsym_iter *iter, loff_t pos)
iter->pos = pos;
return get_ksymbol_mod(iter);
}
/* If we're not on the desired position, reset to new position. */
if (pos != iter->pos)
reset_iter(iter, pos);
@ -439,23 +460,25 @@ static int s_show(struct seq_file *m, void *p)
{
struct kallsym_iter *iter = m->private;
/* Some debugging symbols have no name. Ignore them. */
/* Some debugging symbols have no name. Ignore them. */
if (!iter->name[0])
return 0;
if (iter->module_name[0]) {
char type;
/* Label it "global" if it is exported,
* "local" if not exported. */
/*
* Label it "global" if it is exported,
* "local" if not exported.
*/
type = iter->exported ? toupper(iter->type) :
tolower(iter->type);
seq_printf(m, "%0*lx %c %s\t[%s]\n",
(int)(2*sizeof(void*)),
(int)(2 * sizeof(void *)),
iter->value, type, iter->name, iter->module_name);
} else
seq_printf(m, "%0*lx %c %s\n",
(int)(2*sizeof(void*)),
(int)(2 * sizeof(void *)),
iter->value, iter->type, iter->name);
return 0;
}
@ -469,9 +492,11 @@ static const struct seq_operations kallsyms_op = {
static int kallsyms_open(struct inode *inode, struct file *file)
{
/* We keep iterator in m->private, since normal case is to
/*
* We keep iterator in m->private, since normal case is to
* s_start from where we left off, so we avoid doing
* using get_symbol_offset for every symbol */
* using get_symbol_offset for every symbol.
*/
struct kallsym_iter *iter;
int ret;
@ -500,7 +525,4 @@ static int __init kallsyms_init(void)
proc_create("kallsyms", 0444, NULL, &kallsyms_operations);
return 0;
}
__initcall(kallsyms_init);
EXPORT_SYMBOL(__print_symbol);
EXPORT_SYMBOL_GPL(sprint_symbol);
device_initcall(kallsyms_init);

8
scripts/Makefile.headersinst

@ -54,8 +54,12 @@ quiet_cmd_remove = REMOVE $(unwanted)
cmd_remove = rm -f $(unwanted-file)
quiet_cmd_check = CHECK $(printdir) ($(words $(all-files)) files)
cmd_check = $(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH) \
$(addprefix $(install)/, $(all-files)); \
# Headers list can be pretty long, xargs helps to avoid
# the "Argument list too long" error.
cmd_check = for f in $(all-files); do \
echo "$(install)/$${f}"; done \
| xargs \
$(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH); \
touch $@
PHONY += __headersinst __headerscheck

13
scripts/basic/docproc.c

@ -69,7 +69,7 @@ FILELINE * docsection;
#define NOFUNCTION "-nofunction"
#define NODOCSECTIONS "-no-doc-sections"
char *srctree;
static char *srctree, *kernsrctree;
void usage (void)
{
@ -77,7 +77,8 @@ void usage (void)
fprintf(stderr, "Input is read from file.tmpl. Output is sent to stdout\n");
fprintf(stderr, "doc: frontend when generating kernel documentation\n");
fprintf(stderr, "depend: generate list of files referenced within file\n");
fprintf(stderr, "Environment variable SRCTREE: absolute path to kernel source tree.\n");
fprintf(stderr, "Environment variable SRCTREE: absolute path to sources.\n");
fprintf(stderr, " KBUILD_SRC: absolute path to kernel source tree.\n");
}
/*
@ -96,8 +97,8 @@ void exec_kernel_doc(char **svec)
exit(1);
case 0:
memset(real_filename, 0, sizeof(real_filename));
strncat(real_filename, srctree, PATH_MAX);
strncat(real_filename, KERNELDOCPATH KERNELDOC,
strncat(real_filename, kernsrctree, PATH_MAX);
strncat(real_filename, "/" KERNELDOCPATH KERNELDOC,
PATH_MAX - strlen(real_filename));
execvp(real_filename, svec);
fprintf(stderr, "exec ");
@ -178,6 +179,7 @@ void find_export_symbols(char * filename)
char real_filename[PATH_MAX + 1];
memset(real_filename, 0, sizeof(real_filename));
strncat(real_filename, srctree, PATH_MAX);
strncat(real_filename, "/", PATH_MAX - strlen(real_filename));
strncat(real_filename, filename,
PATH_MAX - strlen(real_filename));
sym = add_new_file(filename);
@ -382,6 +384,9 @@ int main(int argc, char *argv[])
srctree = getenv("SRCTREE");
if (!srctree)
srctree = getcwd(NULL, 0);
kernsrctree = getenv("KBUILD_SRC");
if (!kernsrctree)
kernsrctree = srctree;
if (argc != 3) {
usage();
exit(1);

5
scripts/basic/fixdep.c

@ -373,10 +373,11 @@ void print_deps(void)
void traps(void)
{
static char test[] __attribute__((aligned(sizeof(int)))) = "CONF";
int *p = (int *)test;
if (*(int *)test != INT_CONF) {
if (*p != INT_CONF) {
fprintf(stderr, "fixdep: sizeof(int) != 4 or wrong endianess? %#x\n",
*(int *)test);
*p);
exit(2);
}
}

87
scripts/config

@ -9,8 +9,10 @@ config options command ...
commands:
--enable|-e option Enable option
--disable|-d option Disable option
--module|-m option Turn option into a module
--state|-s option Print state of option (n,y,m,undef)
--module|-m option Turn option into a module
--set-str option value
Set option to "value"
--state|-s option Print state of option (n,y,m,undef)
--enable-after|-E beforeopt option
Enable option directly after other option
@ -26,8 +28,6 @@ options:
config doesn't check the validity of the .config file. This is done at next
make time.
The options need to be already in the file before they can be changed,
but sometimes you can cheat with the --*-after options.
EOL
exit 1
}
@ -45,8 +45,18 @@ checkarg() {
ARG="`echo $ARG | tr a-z A-Z`"
}
replace() {
sed -i -e "$@" $FN
set_var() {
local name=$1 new=$2 before=$3
name_re="^($name=|# $name is not set)"
before_re="^($before=|# $before is not set)"
if test -n "$before" && grep -Eq "$before_re" "$FN"; then
sed -ri "/$before_re/a $new" "$FN"
elif grep -Eq "$name_re" "$FN"; then
sed -ri "s:$name_re.*:$new:" "$FN"
else
echo "$new" >>"$FN"
fi
}
if [ "$1" = "--file" ]; then
@ -54,8 +64,7 @@ if [ "$1" = "--file" ]; then
if [ "$FN" = "" ] ; then
usage
fi
shift
shift
shift 2
else
FN=.config
fi
@ -68,27 +77,39 @@ while [ "$1" != "" ] ; do
CMD="$1"
shift
case "$CMD" in
--enable|-e)
--refresh)
;;
--*-after)
checkarg "$1"
A=$ARG
checkarg "$2"
B=$ARG
shift 2
;;
--*)
checkarg "$1"
replace "s/# CONFIG_$ARG is not set/CONFIG_$ARG=y/"
shift
;;
esac
case "$CMD" in
--enable|-e)
set_var "CONFIG_$ARG" "CONFIG_$ARG=y"
;;
--disable|-d)
checkarg "$1"
replace "s/CONFIG_$ARG=[my]/# CONFIG_$ARG is not set/"
shift
set_var "CONFIG_$ARG" "# CONFIG_$ARG is not set"
;;
--module|-m)
checkarg "$1"
replace "s/CONFIG_$ARG=y/CONFIG_$ARG=m/" \
-e "s/# CONFIG_$ARG is not set/CONFIG_$ARG=m/"
set_var "CONFIG_$ARG" "CONFIG_$ARG=m"
;;
--set-str)
set_var "CONFIG_$ARG" "CONFIG_$ARG=\"$1\""
shift
;;
--state|-s)
checkarg "$1"
if grep -q "# CONFIG_$ARG is not set" $FN ; then
echo n
else
@ -101,44 +122,18 @@ while [ "$1" != "" ] ; do
echo "$V"
fi
fi
shift
;;
--enable-after|-E)
checkarg "$1"
A=$ARG
checkarg "$2"
B=$ARG
replace "/CONFIG_$A=[my]/aCONFIG_$B=y" \
-e "/# CONFIG_$ARG is not set/a/CONFIG_$ARG=y" \
-e "s/# CONFIG_$ARG is not set/CONFIG_$ARG=y/"
shift
shift
set_var "CONFIG_$B" "CONFIG_$B=y" "CONFIG_$A"
;;
--disable-after|-D)
checkarg "$1"
A=$ARG
checkarg "$2"
B=$ARG
replace "/CONFIG_$A=[my]/a# CONFIG_$B is not set" \
-e "/# CONFIG_$ARG is not set/a/# CONFIG_$ARG is not set" \
-e "s/CONFIG_$ARG=[my]/# CONFIG_$ARG is not set/"
shift
shift
set_var "CONFIG_$B" "# CONFIG_$B is not set" "CONFIG_$A"
;;
--module-after|-M)
checkarg "$1"
A=$ARG
checkarg "$2"
B=$ARG
replace "/CONFIG_$A=[my]/aCONFIG_$B=m" \
-e "/# CONFIG_$ARG is not set/a/CONFIG_$ARG=m" \
-e "s/CONFIG_$ARG=y/CONFIG_$ARG=m/" \
-e "s/# CONFIG_$ARG is not set/CONFIG_$ARG=m/"
shift
shift
set_var "CONFIG_$B" "CONFIG_$B=m" "CONFIG_$A"
;;
# undocumented because it ignores --file (fixme)

2
scripts/gcc-version.sh

@ -18,7 +18,7 @@ compiler="$*"
if [ ${#compiler} -eq 0 ]; then
echo "Error: No compiler specified."
echo -e "Usage:\n\t$0 <gcc-command>"
printf "Usage:\n\t$0 <gcc-command>\n"
exit 1
fi

7
scripts/headers.sh

@ -15,19 +15,12 @@ do_command()
fi
}
# Do not try this architecture
drop="generic um ppc sparc64 cris"
archs=$(ls ${srctree}/arch)
for arch in ${archs}; do
case ${arch} in
um) # no userspace export
;;
ppc) # headers exported by powerpc
;;
sparc64) # headers exported by sparc
;;
cris) # headers export are known broken
;;
*)

14
scripts/headers_check.pl

@ -2,7 +2,7 @@
#
# headers_check.pl execute a number of trivial consistency checks
#
# Usage: headers_check.pl dir [files...]
# Usage: headers_check.pl dir arch [files...]
# dir: dir to look for included files
# arch: architecture
# files: list of files to check
@ -37,7 +37,7 @@ foreach my $file (@files) {
&check_include();
&check_asm_types();
&check_sizetypes();
&check_prototypes();
&check_declarations();
# Dropped for now. Too much noise &check_config();
}
close FH;
@ -61,16 +61,18 @@ sub check_include
}
}
sub check_prototypes
sub check_declarations
{
if ($line =~ m/^\s*extern\b/) {
printf STDERR "$filename:$lineno: extern's make no sense in userspace\n";
if ($line =~m/^\s*extern\b/) {
printf STDERR "$filename:$lineno: " .
"userspace cannot call function or variable " .
"defined in the kernel\n";
}
}
sub check_config
{
if ($line =~ m/[^a-zA-Z0-9_]+CONFIG_([a-zA-Z0-9]+)[^a-zA-Z0-9]/) {
if ($line =~ m/[^a-zA-Z0-9_]+CONFIG_([a-zA-Z0-9_]+)[^a-zA-Z0-9_]/) {
printf STDERR "$filename:$lineno: leaks CONFIG_$1 to userspace where it is not valid\n";
}
}

76
scripts/kallsyms.c

@ -23,6 +23,10 @@
#include <string.h>
#include <ctype.h>
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
#endif
#define KSYM_NAME_LEN 128
struct sym_entry {
@ -32,9 +36,23 @@ struct sym_entry {
unsigned char *sym;
};
struct text_range {
const char *stext, *etext;
unsigned long long start, end;
};
static unsigned long long _text;
static struct text_range text_ranges[] = {
{ "_stext", "_etext" },
{ "_sinittext", "_einittext" },
{ "_stext_l1", "_etext_l1" }, /* Blackfin on-chip L1 inst SRAM */
{ "_stext_l2", "_etext_l2" }, /* Blackfin on-chip L2 SRAM */
};
#define text_range_text (&text_ranges[0])
#define text_range_inittext (&text_ranges[1])
static struct sym_entry *table;
static unsigned int table_size, table_cnt;
static unsigned long long _text, _stext, _etext, _sinittext, _einittext;
static int all_symbols = 0;
static char symbol_prefix_char = '\0';
@ -61,6 +79,26 @@ static inline int is_arm_mapping_symbol(const char *str)
&& (str[2] == '\0' || str[2] == '.');
}
static int read_symbol_tr(const char *sym, unsigned long long addr)
{
size_t i;
struct text_range *tr;
for (i = 0; i < ARRAY_SIZE(text_ranges); ++i) {
tr = &text_ranges[i];
if (strcmp(sym, tr->stext) == 0) {
tr->start = addr;
return 0;
} else if (strcmp(sym, tr->etext) == 0) {
tr->end = addr;
return 0;
}
}
return 1;
}
static int read_symbol(FILE *in, struct sym_entry *s)
{
char str[500];
@ -84,14 +122,8 @@ static int read_symbol(FILE *in, struct sym_entry *s)
/* Ignore most absolute/undefined (?) symbols. */
if (strcmp(sym, "_text") == 0)
_text = s->addr;
else if (strcmp(sym, "_stext") == 0)
_stext = s->addr;
else if (strcmp(sym, "_etext") == 0)
_etext = s->addr;
else if (strcmp(sym, "_sinittext") == 0)
_sinittext = s->addr;
else if (strcmp(sym, "_einittext") == 0)
_einittext = s->addr;
else if (read_symbol_tr(sym, s->addr) == 0)
/* nothing to do */;
else if (toupper(stype) == 'A')
{
/* Keep these useful absolute symbols */
@ -127,6 +159,21 @@ static int read_symbol(FILE *in, struct sym_entry *s)
return 0;
}
static int symbol_valid_tr(struct sym_entry *s)
{
size_t i;
struct text_range *tr;
for (i = 0; i < ARRAY_SIZE(text_ranges); ++i) {
tr = &text_ranges[i];
if (s->addr >= tr->start && s->addr < tr->end)
return 0;
}
return 1;
}
static int symbol_valid(struct sym_entry *s)
{
/* Symbols which vary between passes. Passes 1 and 2 must have
@ -156,8 +203,7 @@ static int symbol_valid(struct sym_entry *s)
/* if --all-symbols is not specified, then symbols outside the text
* and inittext sections are discarded */
if (!all_symbols) {
if ((s->addr < _stext || s->addr > _etext)
&& (s->addr < _sinittext || s->addr > _einittext))
if (symbol_valid_tr(s) == 0)
return 0;
/* Corner case. Discard any symbols with the same value as
* _etext _einittext; they can move between pass 1 and 2 when
@ -165,10 +211,10 @@ static int symbol_valid(struct sym_entry *s)
* they may get dropped in pass 2, which breaks the kallsyms
* rules.
*/
if ((s->addr == _etext &&
strcmp((char *)s->sym + offset, "_etext")) ||
(s->addr == _einittext &&
strcmp((char *)s->sym + offset, "_einittext")))
if ((s->addr == text_range_text->end &&
strcmp((char *)s->sym + offset, text_range_text->etext)) ||
(s->addr == text_range_inittext->end &&
strcmp((char *)s->sym + offset, text_range_inittext->etext)))
return 0;
}

3
scripts/kconfig/.gitignore

@ -8,6 +8,9 @@ lex.*.c
zconf.hash.c
*.moc
lkc_defs.h
gconf.glade.h
*.pot
*.mo
#
# configuration programs

4
scripts/kconfig/Makefile

@ -83,7 +83,7 @@ help:
@echo ' xconfig - Update current config utilising a QT based front-end'
@echo ' gconfig - Update current config utilising a GTK based front-end'
@echo ' oldconfig - Update current config utilising a provided .config as base'
@echo ' silentoldconfig - Same as oldconfig, but quietly'
@echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps'
@echo ' randconfig - New config with random answer to all options'
@echo ' defconfig - New config with default answer to all options'
@echo ' allmodconfig - New config selecting modules when possible'
@ -104,7 +104,7 @@ HOST_EXTRACFLAGS += -DLOCALE
# ===========================================================================
# Shared Makefile for the various kconfig executables:
# conf: Used for defconfig, oldconfig and related targets
# mconf: Used for the mconfig target.
# mconf: Used for the menuconfig target
# Utilizes the lxdialog package
# qconf: Used for the xconfig target
# Based on QT which needs to be installed to compile it

7
scripts/kconfig/conf.c

@ -498,14 +498,15 @@ int main(int ac, char **av)
conf_parse(name);
//zconfdump(stdout);
if (sync_kconfig) {
if (stat(".config", &tmpstat)) {
name = conf_get_configname();
if (stat(name, &tmpstat)) {
fprintf(stderr, _("***\n"
"*** You have not yet configured your kernel!\n"
"*** (missing kernel .config file)\n"
"*** (missing kernel config file \"%s\")\n"
"***\n"
"*** Please run some configurator (e.g. \"make oldconfig\" or\n"
"*** \"make menuconfig\" or \"make xconfig\").\n"
"***\n"));
"***\n"), name);
exit(1);
}
}

20
scripts/kconfig/confdata.c

@ -41,6 +41,13 @@ const char *conf_get_configname(void)
return name ? name : ".config";
}
const char *conf_get_autoconfig_name(void)
{
char *name = getenv("KCONFIG_AUTOCONFIG");