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
  ...
This commit is contained in:
Linus Torvalds 2009-06-14 14:12:18 -07:00
commit 45e3e1935e
34 changed files with 890 additions and 460 deletions

8
.gitignore vendored
View File

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

View File

@ -29,7 +29,7 @@ hardware, for example, you probably needn't concern yourself with
isdn4k-utils. isdn4k-utils.
o Gnu C 3.2 # gcc --version 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 binutils 2.12 # ld -v
o util-linux 2.10o # fdformat --version o util-linux 2.10o # fdformat --version
o module-init-tools 0.9.10 # depmod -V o module-init-tools 0.9.10 # depmod -V
@ -62,7 +62,7 @@ computer.
Make 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 Binutils
-------- --------

View File

@ -35,6 +35,79 @@ new .config files to see the differences:
(Yes, we need something better here.) (Yes, we need something better here.)
______________________________________________________________________
Environment variables for '*config'
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.
______________________________________________________________________
Environment variables for '{allyes/allmod/allno/rand}config'
KCONFIG_ALLCONFIG
--------------------------------------------------
(partially based on lkml email from/by Rob Landley, re: miniconfig)
--------------------------------------------------
The allyesconfig/allmodconfig/allnoconfig/randconfig variants can
also use the environment variable KCONFIG_ALLCONFIG as a flag or a
filename that contains config symbols that the user requires to be
set to a specific value. If KCONFIG_ALLCONFIG is used without a
filename, "make *config" checks for a file named
"all{yes/mod/no/random}.config" (corresponding to the *config command
that was used) for symbol values that are to be forced. If this file
is not found, it checks for a file named "all.config" to contain forced
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 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
settings are still subject to normal dependency checks.
Examples:
KCONFIG_ALLCONFIG=custom-notebook.config make allnoconfig
or
KCONFIG_ALLCONFIG=mini.config make allnoconfig
or
make KCONFIG_ALLCONFIG=mini.config allnoconfig
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_AUTOCONFIG
--------------------------------------------------
This environment variable can be set to specify the path & name of the
"auto.conf" file. Its default value is "include/config/auto.conf".
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 menuconfig
@ -60,10 +133,11 @@ Searching in menuconfig:
/^hotplug /^hotplug
______________________________________________________________________ ______________________________________________________________________
Color Themes for 'menuconfig' User interface options for 'menuconfig'
MENUCONFIG_COLOR
--------------------------------------------------
It is possible to select different color themes using the variable It is possible to select different color themes using the variable
MENUCONFIG_COLOR. To select a theme use: MENUCONFIG_COLOR. To select a theme use:
@ -75,83 +149,13 @@ Available themes are:
classic => theme with blue background. The classic look classic => theme with blue background. The classic look
bluetitle => a LCD friendly version of classic. (default) bluetitle => a LCD friendly version of classic. (default)
______________________________________________________________________
Environment variables in 'menuconfig'
KCONFIG_ALLCONFIG
--------------------------------------------------
(partially based on lkml email from/by Rob Landley, re: miniconfig)
--------------------------------------------------
The allyesconfig/allmodconfig/allnoconfig/randconfig variants can
also use the environment variable KCONFIG_ALLCONFIG as a flag or a
filename that contains config symbols that the user requires to be
set to a specific value. If KCONFIG_ALLCONFIG is used without a
filename, "make *config" checks for a file named
"all{yes/mod/no/random}.config" (corresponding to the *config command
that was used) for symbol values that are to be forced. If this file
is not found, it checks for a file named "all.config" to contain forced
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.
This 'KCONFIG_ALLCONFIG' file is a config file which contains
(usually a subset of all) preset config symbols. These variable
settings are still subject to normal dependency checks.
Examples:
KCONFIG_ALLCONFIG=custom-notebook.config make allnoconfig
or
KCONFIG_ALLCONFIG=mini.config make allnoconfig
or
make KCONFIG_ALLCONFIG=mini.config allnoconfig
These examples will disable most options (allnoconfig) but enable or
disable the options that are explicitly listed in the specified
mini-config files.
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
"auto.conf" file. Its default value is "include/config/auto.conf".
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 User Interface Options
----------------------------------------------------------------------
MENUCONFIG_MODE MENUCONFIG_MODE
-------------------------------------------------- --------------------------------------------------
This mode shows all sub-menus in one large tree. This mode shows all sub-menus in one large tree.
Example: Example:
MENUCONFIG_MODE=single_menu make menuconfig make MENUCONFIG_MODE=single_menu menuconfig
====================================================================== ======================================================================
xconfig xconfig

View File

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

View File

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

11
README
View File

@ -174,8 +174,17 @@ CONFIGURING the kernel:
"make silentoldconfig" "make silentoldconfig"
Like above, but avoids cluttering the screen Like above, but avoids cluttering the screen
with questions already answered. with questions already answered.
Additionally updates the dependencies.
"make defconfig" Create a ./.config file by using the default "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" "make allyesconfig"
Create a ./.config file by setting symbol Create a ./.config file by setting symbol
values to 'y' as much as possible. values to 'y' as much as possible.

View File

@ -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 #ifndef LOAD_OFFSET
#define LOAD_OFFSET 0 #define LOAD_OFFSET 0
@ -116,7 +169,36 @@
FTRACE_EVENTS() \ FTRACE_EVENTS() \
TRACE_SYSCALLS() 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)); \ . = ALIGN((align)); \
.rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \ .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
VMLINUX_SYMBOL(__start_rodata) = .; \ VMLINUX_SYMBOL(__start_rodata) = .; \
@ -270,9 +352,10 @@
} \ } \
. = ALIGN((align)); . = ALIGN((align));
/* RODATA provided for backward compatibility. /* RODATA & RO_DATA provided for backward compatibility.
* All archs are supposed to use RO_DATA() */ * 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 \ #define SECURITY_INIT \
.security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \ .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \
@ -330,16 +413,42 @@
#endif #endif
/* Section used for early init (in .S files) */ /* 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 */ /* init and exit section handling */
#define INIT_DATA \ #define INIT_DATA \
*(.init.data) \ *(.init.data) \
DEV_DISCARD(init.data) \ DEV_DISCARD(init.data) \
DEV_DISCARD(init.rodata) \
CPU_DISCARD(init.data) \ CPU_DISCARD(init.data) \
CPU_DISCARD(init.rodata) \
MEM_DISCARD(init.data) \ MEM_DISCARD(init.data) \
*(.init.rodata) \
DEV_DISCARD(init.rodata) \
CPU_DISCARD(init.rodata) \
MEM_DISCARD(init.rodata) MEM_DISCARD(init.rodata)
#define INIT_TEXT \ #define INIT_TEXT \
@ -363,9 +472,35 @@
CPU_DISCARD(exit.text) \ CPU_DISCARD(exit.text) \
MEM_DISCARD(exit.text) MEM_DISCARD(exit.text)
/* DWARF debug sections. #define EXIT_CALL \
Symbols in the DWARF debugging sections are relative to *(.exitcall.exit)
the beginning of the section so we begin them at 0. */
/*
* 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 \ #define DWARF_DEBUG \
/* DWARF 1 */ \ /* DWARF 1 */ \
.debug 0 : { *(.debug) } \ .debug 0 : { *(.debug) } \
@ -432,6 +567,12 @@
VMLINUX_SYMBOL(__stop_notes) = .; \ VMLINUX_SYMBOL(__stop_notes) = .; \
} }
#define INIT_SETUP(initsetup_align) \
. = ALIGN(initsetup_align); \
VMLINUX_SYMBOL(__setup_start) = .; \
*(.init.setup) \
VMLINUX_SYMBOL(__setup_end) = .;
#define INITCALLS \ #define INITCALLS \
*(.initcallearly.init) \ *(.initcallearly.init) \
VMLINUX_SYMBOL(__early_initcall_end) = .; \ VMLINUX_SYMBOL(__early_initcall_end) = .; \
@ -453,6 +594,31 @@
*(.initcall7.init) \ *(.initcall7.init) \
*(.initcall7s.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 * PERCPU_VADDR - define output section for percpu area
* @vaddr: explicit base address (optional) * @vaddr: explicit base address (optional)
@ -509,3 +675,58 @@
*(.data.percpu.shared_aligned) \ *(.data.percpu.shared_aligned) \
VMLINUX_SYMBOL(__per_cpu_end) = .; \ 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);

View File

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

View File

@ -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 */

View File

@ -809,14 +809,6 @@ config KALLSYMS_EXTRA_PASS
you wait for kallsyms to be fixed. 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 config HOTPLUG
bool "Support for hot-pluggable devices" if EMBEDDED bool "Support for hot-pluggable devices" if EMBEDDED
default y default y
@ -998,6 +990,14 @@ config SLUB_DEBUG
SLUB sysfs support. /sys/slab will not exist and there will be SLUB sysfs support. /sys/slab will not exist and there will be
no support for cache validation etc. 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 config COMPAT_BRK
bool "Disable heap randomization" bool "Disable heap randomization"
default y default y

View File

@ -30,12 +30,16 @@
#define all_var 0 #define all_var 0
#endif #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 unsigned long kallsyms_addresses[] __attribute__((weak));
extern const u8 kallsyms_names[] __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 extern const unsigned long kallsyms_num_syms
__attribute__((weak, section(".rodata"))); __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); 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) static unsigned int kallsyms_expand_symbol(unsigned int off, char *result)
{ {
int len, skipped_first = 0; int len, skipped_first = 0;
const u8 *tptr, *data; 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]; data = &kallsyms_names[off];
len = *data; len = *data;
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; off += len + 1;
/* for every byte on the compressed symbol data, copy the table /*
entry for that byte */ * For every byte on the compressed symbol data, copy the table
while(len) { * entry for that byte.
tptr = &kallsyms_token_table[ kallsyms_token_index[*data] ]; */
while (len) {
tptr = &kallsyms_token_table[kallsyms_token_index[*data]];
data++; data++;
len--; len--;
while (*tptr) { while (*tptr) {
if(skipped_first) { if (skipped_first) {
*result = *tptr; *result = *tptr;
result++; result++;
} else } else
@ -110,36 +120,46 @@ static unsigned int kallsyms_expand_symbol(unsigned int off, char *result)
*result = '\0'; *result = '\0';
/* return to offset to the next symbol */ /* Return to offset to the next symbol. */
return off; 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) 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 */ * Get just the first code, look it up in the token table,
return kallsyms_token_table[ kallsyms_token_index[ kallsyms_names[off+1] ] ]; * 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) static unsigned int get_symbol_offset(unsigned long pos)
{ {
const u8 *name; const u8 *name;
int i; int i;
/* use the closest marker we have. We have markers every 256 positions, /*
* so that should be close enough */ * Use the closest marker we have. We have markers every 256 positions,
name = &kallsyms_names[ kallsyms_markers[pos>>8] ]; * 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 * Sequentially scan all the symbols up to the point we're searching
* just need to add the len to the current pointer for every symbol we * for. Every symbol is stored in a [<len>][<len> bytes of data] format,
* wish to skip */ * so we just need to add the len to the current pointer for every
for(i = 0; i < (pos&0xFF); i++) * symbol we wish to skip.
*/
for (i = 0; i < (pos & 0xFF); i++)
name = name + (*name) + 1; name = name + (*name) + 1;
return name - kallsyms_names; return name - kallsyms_names;
@ -190,7 +210,7 @@ static unsigned long get_symbol_pos(unsigned long addr,
/* This kernel should never had been booted. */ /* This kernel should never had been booted. */
BUG_ON(!kallsyms_addresses); 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; low = 0;
high = kallsyms_num_syms; high = kallsyms_num_syms;
@ -203,15 +223,15 @@ static unsigned long get_symbol_pos(unsigned long addr,
} }
/* /*
* search for the first aliased symbol. Aliased * Search for the first aliased symbol. Aliased
* symbols are symbols with the same address * symbols are symbols with the same address.
*/ */
while (low && kallsyms_addresses[low-1] == kallsyms_addresses[low]) while (low && kallsyms_addresses[low-1] == kallsyms_addresses[low])
--low; --low;
symbol_start = kallsyms_addresses[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++) { for (i = low + 1; i < kallsyms_num_syms; i++) {
if (kallsyms_addresses[i] > symbol_start) { if (kallsyms_addresses[i] > symbol_start) {
symbol_end = kallsyms_addresses[i]; 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 (!symbol_end) {
if (is_kernel_inittext(addr)) if (is_kernel_inittext(addr))
symbol_end = (unsigned long)_einittext; symbol_end = (unsigned long)_einittext;
@ -252,10 +272,10 @@ int kallsyms_lookup_size_offset(unsigned long addr, unsigned long *symbolsize,
/* /*
* Lookup an address * Lookup an address
* - modname is set to NULL if it's in the kernel * - modname is set to NULL if it's in the kernel.
* - we guarantee that the returned name is valid until we reschedule even if * - We guarantee that the returned name is valid until we reschedule even if.
* it resides in a module * It resides in a module.
* - we also guarantee that modname will be valid until rescheduled * - We also guarantee that modname will be valid until rescheduled.
*/ */
const char *kallsyms_lookup(unsigned long addr, const char *kallsyms_lookup(unsigned long addr,
unsigned long *symbolsize, unsigned long *symbolsize,
@ -276,7 +296,7 @@ const char *kallsyms_lookup(unsigned long addr,
return namebuf; return namebuf;
} }
/* see if it's in a module */ /* See if it's in a module. */
return module_address_lookup(addr, symbolsize, offset, modname, return module_address_lookup(addr, symbolsize, offset, modname,
namebuf); namebuf);
} }
@ -294,7 +314,7 @@ int lookup_symbol_name(unsigned long addr, char *symname)
kallsyms_expand_symbol(get_symbol_offset(pos), symname); kallsyms_expand_symbol(get_symbol_offset(pos), symname);
return 0; return 0;
} }
/* see if it's in a module */ /* See if it's in a module. */
return lookup_module_symbol_name(addr, symname); return lookup_module_symbol_name(addr, symname);
} }
@ -313,7 +333,7 @@ int lookup_symbol_attrs(unsigned long addr, unsigned long *size,
modname[0] = '\0'; modname[0] = '\0';
return 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); return lookup_module_symbol_attrs(addr, size, offset, modname, name);
} }
@ -342,6 +362,7 @@ int sprint_symbol(char *buffer, unsigned long address)
return len; return len;
} }
EXPORT_SYMBOL_GPL(sprint_symbol);
/* Look up a kernel symbol and print it to the kernel messages. */ /* Look up a kernel symbol and print it to the kernel messages. */
void __print_symbol(const char *fmt, unsigned long address) 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); printk(fmt, buffer);
} }
EXPORT_SYMBOL(__print_symbol);
/* To avoid using get_symbol_offset for every symbol, we carry prefix along. */ /* To avoid using get_symbol_offset for every symbol, we carry prefix along. */
struct kallsym_iter struct kallsym_iter {
{
loff_t pos; loff_t pos;
unsigned long value; unsigned long value;
unsigned int nameoff; /* If iterating in core kernel symbols */ unsigned int nameoff; /* If iterating in core kernel symbols. */
char type; char type;
char name[KSYM_NAME_LEN]; char name[KSYM_NAME_LEN];
char module_name[MODULE_NAME_LEN]; char module_name[MODULE_NAME_LEN];
@ -446,16 +467,18 @@ static int s_show(struct seq_file *m, void *p)
if (iter->module_name[0]) { if (iter->module_name[0]) {
char type; 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) : type = iter->exported ? toupper(iter->type) :
tolower(iter->type); tolower(iter->type);
seq_printf(m, "%0*lx %c %s\t[%s]\n", 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); iter->value, type, iter->name, iter->module_name);
} else } else
seq_printf(m, "%0*lx %c %s\n", seq_printf(m, "%0*lx %c %s\n",
(int)(2*sizeof(void*)), (int)(2 * sizeof(void *)),
iter->value, iter->type, iter->name); iter->value, iter->type, iter->name);
return 0; return 0;
} }
@ -469,9 +492,11 @@ static const struct seq_operations kallsyms_op = {
static int kallsyms_open(struct inode *inode, struct file *file) 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 * 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; struct kallsym_iter *iter;
int ret; int ret;
@ -500,7 +525,4 @@ static int __init kallsyms_init(void)
proc_create("kallsyms", 0444, NULL, &kallsyms_operations); proc_create("kallsyms", 0444, NULL, &kallsyms_operations);
return 0; return 0;
} }
__initcall(kallsyms_init); device_initcall(kallsyms_init);
EXPORT_SYMBOL(__print_symbol);
EXPORT_SYMBOL_GPL(sprint_symbol);

View File

@ -54,8 +54,12 @@ quiet_cmd_remove = REMOVE $(unwanted)
cmd_remove = rm -f $(unwanted-file) cmd_remove = rm -f $(unwanted-file)
quiet_cmd_check = CHECK $(printdir) ($(words $(all-files)) files) quiet_cmd_check = CHECK $(printdir) ($(words $(all-files)) files)
cmd_check = $(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH) \ # Headers list can be pretty long, xargs helps to avoid
$(addprefix $(install)/, $(all-files)); \ # 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 $@ touch $@
PHONY += __headersinst __headerscheck PHONY += __headersinst __headerscheck

View File

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

View File

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

View File

@ -10,6 +10,8 @@ commands:
--enable|-e option Enable option --enable|-e option Enable option
--disable|-d option Disable option --disable|-d option Disable option
--module|-m option Turn option into a module --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) --state|-s option Print state of option (n,y,m,undef)
--enable-after|-E beforeopt option --enable-after|-E beforeopt option
@ -26,8 +28,6 @@ options:
config doesn't check the validity of the .config file. This is done at next config doesn't check the validity of the .config file. This is done at next
make time. 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 EOL
exit 1 exit 1
} }
@ -45,8 +45,18 @@ checkarg() {
ARG="`echo $ARG | tr a-z A-Z`" ARG="`echo $ARG | tr a-z A-Z`"
} }
replace() { set_var() {
sed -i -e "$@" $FN 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 if [ "$1" = "--file" ]; then
@ -54,8 +64,7 @@ if [ "$1" = "--file" ]; then
if [ "$FN" = "" ] ; then if [ "$FN" = "" ] ; then
usage usage
fi fi
shift shift 2
shift
else else
FN=.config FN=.config
fi fi
@ -68,27 +77,39 @@ while [ "$1" != "" ] ; do
CMD="$1" CMD="$1"
shift shift
case "$CMD" in case "$CMD" in
--enable|-e) --refresh)
;;
--*-after)
checkarg "$1"
A=$ARG
checkarg "$2"
B=$ARG
shift 2
;;
--*)
checkarg "$1" checkarg "$1"
replace "s/# CONFIG_$ARG is not set/CONFIG_$ARG=y/"
shift shift
;; ;;
esac
case "$CMD" in
--enable|-e)
set_var "CONFIG_$ARG" "CONFIG_$ARG=y"
;;
--disable|-d) --disable|-d)
checkarg "$1" set_var "CONFIG_$ARG" "# CONFIG_$ARG is not set"
replace "s/CONFIG_$ARG=[my]/# CONFIG_$ARG is not set/"
shift
;; ;;
--module|-m) --module|-m)
checkarg "$1" set_var "CONFIG_$ARG" "CONFIG_$ARG=m"
replace "s/CONFIG_$ARG=y/CONFIG_$ARG=m/" \ ;;
-e "s/# CONFIG_$ARG is not set/CONFIG_$ARG=m/"
--set-str)
set_var "CONFIG_$ARG" "CONFIG_$ARG=\"$1\""
shift shift
;; ;;
--state|-s) --state|-s)
checkarg "$1"
if grep -q "# CONFIG_$ARG is not set" $FN ; then if grep -q "# CONFIG_$ARG is not set" $FN ; then
echo n echo n
else else
@ -101,44 +122,18 @@ while [ "$1" != "" ] ; do
echo "$V" echo "$V"
fi fi
fi fi
shift
;; ;;
--enable-after|-E) --enable-after|-E)
checkarg "$1" set_var "CONFIG_$B" "CONFIG_$B=y" "CONFIG_$A"
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
;; ;;
--disable-after|-D) --disable-after|-D)
checkarg "$1" set_var "CONFIG_$B" "# CONFIG_$B is not set" "CONFIG_$A"
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
;; ;;
--module-after|-M) --module-after|-M)
checkarg "$1" set_var "CONFIG_$B" "CONFIG_$B=m" "CONFIG_$A"
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
;; ;;
# undocumented because it ignores --file (fixme) # undocumented because it ignores --file (fixme)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -41,6 +41,13 @@ const char *conf_get_configname(void)
return name ? name : ".config"; return name ? name : ".config";
} }
const char *conf_get_autoconfig_name(void)
{
char *name = getenv("KCONFIG_AUTOCONFIG");
return name ? name : "include/config/auto.conf";
}
static char *conf_expand_value(const char *in) static char *conf_expand_value(const char *in)
{ {
struct symbol *sym; struct symbol *sym;
@ -555,15 +562,14 @@ int conf_write(const char *name)
int conf_split_config(void) int conf_split_config(void)
{ {
char *name, path[128]; const char *name;
char path[128];
char *s, *d, c; char *s, *d, c;
struct symbol *sym; struct symbol *sym;
struct stat sb; struct stat sb;
int res, i, fd; int res, i, fd;
name = getenv("KCONFIG_AUTOCONFIG"); name = conf_get_autoconfig_name();
if (!name)
name = "include/config/auto.conf";
conf_read_simple(name, S_DEF_AUTO); conf_read_simple(name, S_DEF_AUTO);
if (chdir("include/config")) if (chdir("include/config"))
@ -670,7 +676,7 @@ int conf_write_autoconf(void)
{ {
struct symbol *sym; struct symbol *sym;
const char *str; const char *str;
char *name; const char *name;
FILE *out, *out_h; FILE *out, *out_h;
time_t now; time_t now;
int i, l; int i, l;
@ -773,9 +779,7 @@ int conf_write_autoconf(void)
name = "include/linux/autoconf.h"; name = "include/linux/autoconf.h";
if (rename(".tmpconfig.h", name)) if (rename(".tmpconfig.h", name))
return 1; return 1;
name = getenv("KCONFIG_AUTOCONFIG"); name = conf_get_autoconfig_name();
if (!name)
name = "include/config/auto.conf";
/* /*
* This must be the last step, kbuild has a dependency on auto.conf * This must be the last step, kbuild has a dependency on auto.conf
* and this marks the successful completion of the previous steps. * and this marks the successful completion of the previous steps.

View File

@ -74,6 +74,7 @@ char *zconf_curname(void);
/* confdata.c */ /* confdata.c */
const char *conf_get_configname(void); const char *conf_get_configname(void);
const char *conf_get_autoconfig_name(void);
char *conf_get_default_confname(void); char *conf_get_default_confname(void);
void sym_set_change_count(int count); void sym_set_change_count(int count);
void sym_add_change_count(int count); void sym_add_change_count(int count);

View File

@ -41,6 +41,7 @@ static void print_item(WINDOW * win, int choice, int selected)
wmove(win, choice, check_x); wmove(win, choice, check_x);
wattrset(win, selected ? dlg.check_selected.atr wattrset(win, selected ? dlg.check_selected.atr
: dlg.check.atr); : dlg.check.atr);
if (!item_is_tag(':'))
wprintw(win, "(%c)", item_is_tag('X') ? 'X' : ' '); wprintw(win, "(%c)", item_is_tag('X') ? 'X' : ' ');
wattrset(win, selected ? dlg.tag_selected.atr : dlg.tag.atr); wattrset(win, selected ? dlg.tag_selected.atr : dlg.tag.atr);

View File

@ -732,7 +732,12 @@ static void conf_choice(struct menu *menu)
for (child = menu->list; child; child = child->next) { for (child = menu->list; child; child = child->next) {
if (!menu_is_visible(child)) if (!menu_is_visible(child))
continue; continue;
if (child->sym)
item_make("%s", _(menu_get_prompt(child))); item_make("%s", _(menu_get_prompt(child)));
else {
item_make("*** %s ***", _(menu_get_prompt(child)));
item_set_tag(':');
}
item_set_data(child); item_set_data(child);
if (child->sym == active) if (child->sym == active)
item_set_selected(1); item_set_selected(1);
@ -748,6 +753,9 @@ static void conf_choice(struct menu *menu)
case 0: case 0:
if (selected) { if (selected) {
child = item_data(); child = item_data();
if (!child->sym)
break;
sym_set_tristate_value(child->sym, yes); sym_set_tristate_value(child->sym, yes);
} }
return; return;

View File

@ -5,6 +5,7 @@
#include <qapplication.h> #include <qapplication.h>
#include <qmainwindow.h> #include <qmainwindow.h>
#include <qdesktopwidget.h>
#include <qtoolbar.h> #include <qtoolbar.h>
#include <qlayout.h> #include <qlayout.h>
#include <qvbox.h> #include <qvbox.h>
@ -297,10 +298,10 @@ void ConfigLineEdit::show(ConfigItem* i)
void ConfigLineEdit::keyPressEvent(QKeyEvent* e) void ConfigLineEdit::keyPressEvent(QKeyEvent* e)
{ {
switch (e->key()) { switch (e->key()) {
case Key_Escape: case Qt::Key_Escape:
break; break;
case Key_Return: case Qt::Key_Return:
case Key_Enter: case Qt::Key_Enter:
sym_set_string_value(item->menu->sym, text().latin1()); sym_set_string_value(item->menu->sym, text().latin1());
parent()->updateList(item); parent()->updateList(item);
break; break;
@ -639,7 +640,7 @@ void ConfigList::keyPressEvent(QKeyEvent* ev)
struct menu *menu; struct menu *menu;
enum prop_type type; enum prop_type type;
if (ev->key() == Key_Escape && mode != fullMode && mode != listMode) { if (ev->key() == Qt::Key_Escape && mode != fullMode && mode != listMode) {
emit parentSelected(); emit parentSelected();
ev->accept(); ev->accept();
return; return;
@ -652,8 +653,8 @@ void ConfigList::keyPressEvent(QKeyEvent* ev)
item = (ConfigItem*)i; item = (ConfigItem*)i;
switch (ev->key()) { switch (ev->key()) {
case Key_Return: case Qt::Key_Return:
case Key_Enter: case Qt::Key_Enter:
if (item->goParent) { if (item->goParent) {
emit parentSelected(); emit parentSelected();
break; break;
@ -667,16 +668,16 @@ void ConfigList::keyPressEvent(QKeyEvent* ev)
emit menuSelected(menu); emit menuSelected(menu);
break; break;
} }
case Key_Space: case Qt::Key_Space:
changeValue(item); changeValue(item);
break; break;
case Key_N: case Qt::Key_N:
setValue(item, no); setValue(item, no);
break; break;
case Key_M: case Qt::Key_M:
setValue(item, mod); setValue(item, mod);
break; break;
case Key_Y: case Qt::Key_Y:
setValue(item, yes); setValue(item, yes);
break; break;
default: default:
@ -920,7 +921,7 @@ void ConfigView::updateListAll(void)
} }
ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
: Parent(parent, name), menu(0), sym(0) : Parent(parent, name), sym(0), menu(0)
{ {
if (name) { if (name) {
configSettings->beginGroup(name); configSettings->beginGroup(name);
@ -1199,7 +1200,7 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
layout1->addLayout(layout2); layout1->addLayout(layout2);
split = new QSplitter(this); split = new QSplitter(this);
split->setOrientation(QSplitter::Vertical); split->setOrientation(Qt::Vertical);
list = new ConfigView(split, name); list = new ConfigView(split, name);
list->list->mode = listMode; list->list->mode = listMode;
info = new ConfigInfoView(split, name); info = new ConfigInfoView(split, name);
@ -1275,7 +1276,7 @@ ConfigMainWindow::ConfigMainWindow(void)
int x, y, width, height; int x, y, width, height;
char title[256]; char title[256];
QWidget *d = configApp->desktop(); QDesktopWidget *d = configApp->desktop();
snprintf(title, sizeof(title), _("Linux Kernel v%s Configuration"), snprintf(title, sizeof(title), _("Linux Kernel v%s Configuration"),
getenv("KERNELVERSION")); getenv("KERNELVERSION"));
setCaption(title); setCaption(title);
@ -1290,14 +1291,14 @@ ConfigMainWindow::ConfigMainWindow(void)
move(x, y); move(x, y);
split1 = new QSplitter(this); split1 = new QSplitter(this);
split1->setOrientation(QSplitter::Horizontal); split1->setOrientation(Qt::Horizontal);
setCentralWidget(split1); setCentralWidget(split1);
menuView = new ConfigView(split1, "menu"); menuView = new ConfigView(split1, "menu");
menuList = menuView->list; menuList = menuView->list;
split2 = new QSplitter(split1); split2 = new QSplitter(split1);
split2->setOrientation(QSplitter::Vertical); split2->setOrientation(Qt::Vertical);
// create config tree // create config tree
configView = new ConfigView(split2, "config"); configView = new ConfigView(split2, "config");
@ -1315,18 +1316,18 @@ ConfigMainWindow::ConfigMainWindow(void)
backAction = new QAction("Back", QPixmap(xpm_back), _("Back"), 0, this); backAction = new QAction("Back", QPixmap(xpm_back), _("Back"), 0, this);
connect(backAction, SIGNAL(activated()), SLOT(goBack())); connect(backAction, SIGNAL(activated()), SLOT(goBack()));
backAction->setEnabled(FALSE); backAction->setEnabled(FALSE);
QAction *quitAction = new QAction("Quit", _("&Quit"), CTRL+Key_Q, this); QAction *quitAction = new QAction("Quit", _("&Quit"), Qt::CTRL + Qt::Key_Q, this);
connect(quitAction, SIGNAL(activated()), SLOT(close())); connect(quitAction, SIGNAL(activated()), SLOT(close()));
QAction *loadAction = new QAction("Load", QPixmap(xpm_load), _("&Load"), CTRL+Key_L, this); QAction *loadAction = new QAction("Load", QPixmap(xpm_load), _("&Load"), Qt::CTRL + Qt::Key_L, this);
connect(loadAction, SIGNAL(activated()), SLOT(loadConfig())); connect(loadAction, SIGNAL(activated()), SLOT(loadConfig()));
saveAction = new QAction("Save", QPixmap(xpm_save), _("&Save"), CTRL+Key_S, this); saveAction = new QAction("Save", QPixmap(xpm_save), _("&Save"), Qt::CTRL + Qt::Key_S, this);
connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); connect(saveAction, SIGNAL(activated()), SLOT(saveConfig()));
conf_set_changed_callback(conf_changed); conf_set_changed_callback(conf_changed);
// Set saveAction's initial state // Set saveAction's initial state
conf_changed(); conf_changed();
QAction *saveAsAction = new QAction("Save As...", _("Save &As..."), 0, this); QAction *saveAsAction = new QAction("Save As...", _("Save &As..."), 0, this);
connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs()));
QAction *searchAction = new QAction("Find", _("&Find"), CTRL+Key_F, this); QAction *searchAction = new QAction("Find", _("&Find"), Qt::CTRL + Qt::Key_F, this);
connect(searchAction, SIGNAL(activated()), SLOT(searchConfig())); connect(searchAction, SIGNAL(activated()), SLOT(searchConfig()));
QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), _("Single View"), 0, this); QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), _("Single View"), 0, this);
connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView()));
@ -1447,7 +1448,7 @@ ConfigMainWindow::ConfigMainWindow(void)
void ConfigMainWindow::loadConfig(void) void ConfigMainWindow::loadConfig(void)
{ {
QString s = QFileDialog::getOpenFileName(".config", NULL, this); QString s = QFileDialog::getOpenFileName(conf_get_configname(), NULL, this);
if (s.isNull()) if (s.isNull())
return; return;
if (conf_read(QFile::encodeName(s))) if (conf_read(QFile::encodeName(s)))
@ -1463,7 +1464,7 @@ void ConfigMainWindow::saveConfig(void)
void ConfigMainWindow::saveConfigAs(void) void ConfigMainWindow::saveConfigAs(void)
{ {
QString s = QFileDialog::getSaveFileName(".config", NULL, this); QString s = QFileDialog::getSaveFileName(conf_get_configname(), NULL, this);
if (s.isNull()) if (s.isNull())
return; return;
if (conf_write(QFile::encodeName(s))) if (conf_write(QFile::encodeName(s)))
@ -1524,6 +1525,8 @@ void ConfigMainWindow::setMenuLink(struct menu *menu)
case fullMode: case fullMode:
list = configList; list = configList;
break; break;
default:
break;
} }
if (list) { if (list) {
@ -1673,6 +1676,9 @@ void ConfigMainWindow::saveSettings(void)
case fullMode : case fullMode :
entry = "full"; entry = "full";
break; break;
default:
break;
} }
configSettings->writeEntry("/listMode", entry); configSettings->writeEntry("/listMode", entry);

View File

@ -46,8 +46,8 @@ int file_write_dep(const char *name)
else else
fprintf(out, "\t%s\n", file->name); fprintf(out, "\t%s\n", file->name);
} }
fprintf(out, "\ninclude/config/auto.conf: \\\n" fprintf(out, "\n%s: \\\n"
"\t$(deps_config)\n\n"); "\t$(deps_config)\n\n", conf_get_autoconfig_name());
expr_list_for_each_sym(sym_env_list, e, sym) { expr_list_for_each_sym(sym_env_list, e, sym) {
struct property *prop; struct property *prop;
@ -61,7 +61,7 @@ int file_write_dep(const char *name)
if (!value) if (!value)
value = ""; value = "";
fprintf(out, "ifneq \"$(%s)\" \"%s\"\n", env_sym->name, value); fprintf(out, "ifneq \"$(%s)\" \"%s\"\n", env_sym->name, value);
fprintf(out, "include/config/auto.conf: FORCE\n"); fprintf(out, "%s: FORCE\n", conf_get_autoconfig_name());
fprintf(out, "endif\n"); fprintf(out, "endif\n");
} }

View File

@ -5,7 +5,7 @@ use strict;
## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ## ## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ##
## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ## ## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ##
## Copyright (C) 2001 Simon Huggins ## ## Copyright (C) 2001 Simon Huggins ##
## Copyright (C) 2005-2008 Randy Dunlap ## ## Copyright (C) 2005-2009 Randy Dunlap ##
## ## ## ##
## #define enhancements by Armin Kuster <akuster@mvista.com> ## ## #define enhancements by Armin Kuster <akuster@mvista.com> ##
## Copyright (c) 2000 MontaVista Software, Inc. ## ## Copyright (c) 2000 MontaVista Software, Inc. ##
@ -85,7 +85,7 @@ use strict;
# #
# /** # /**
# * my_function # * my_function
# **/ # */
# #
# If the Description: header tag is omitted, then there must be a blank line # If the Description: header tag is omitted, then there must be a blank line
# after the last parameter specification. # after the last parameter specification.
@ -105,7 +105,7 @@ use strict;
# */ # */
# etc. # etc.
# #
# Beside functions you can also write documentation for structs, unions, # Besides functions you can also write documentation for structs, unions,
# enums and typedefs. Instead of the function name you must write the name # enums and typedefs. Instead of the function name you must write the name
# of the declaration; the struct/union/enum/typedef must always precede # of the declaration; the struct/union/enum/typedef must always precede
# the name. Nesting of declarations is not supported. # the name. Nesting of declarations is not supported.
@ -223,7 +223,7 @@ sub usage {
} }
# read arguments # read arguments
if ($#ARGV==-1) { if ($#ARGV == -1) {
usage(); usage();
} }
@ -240,12 +240,12 @@ my $man_date = ('January', 'February', 'March', 'April', 'May', 'June',
" " . ((localtime)[5]+1900); " " . ((localtime)[5]+1900);
# Essentially these are globals # Essentially these are globals
# They probably want to be tidied up made more localised or summat. # They probably want to be tidied up, made more localised or something.
# CAVEAT EMPTOR! Some of the others I localised may not want to be which # CAVEAT EMPTOR! Some of the others I localised may not want to be, which
# could cause "use of undefined value" or other bugs. # could cause "use of undefined value" or other bugs.
my ($function, %function_table,%parametertypes,$declaration_purpose); my ($function, %function_table, %parametertypes, $declaration_purpose);
my ($type,$declaration_name,$return_type); my ($type, $declaration_name, $return_type);
my ($newsection,$newcontents,$prototype,$filelist, $brcount, %source_map); my ($newsection, $newcontents, $prototype, $filelist, $brcount, %source_map);
if (defined($ENV{'KBUILD_VERBOSE'})) { if (defined($ENV{'KBUILD_VERBOSE'})) {
$verbose = "$ENV{'KBUILD_VERBOSE'}"; $verbose = "$ENV{'KBUILD_VERBOSE'}";
@ -279,10 +279,10 @@ my $doc_special = "\@\%\$\&";
my $doc_start = '^/\*\*\s*$'; # Allow whitespace at end of comment start. my $doc_start = '^/\*\*\s*$'; # Allow whitespace at end of comment start.
my $doc_end = '\*/'; my $doc_end = '\*/';
my $doc_com = '\s*\*\s*'; my $doc_com = '\s*\*\s*';
my $doc_decl = $doc_com.'(\w+)'; my $doc_decl = $doc_com . '(\w+)';
my $doc_sect = $doc_com.'(['.$doc_special.']?[\w\s]+):(.*)'; my $doc_sect = $doc_com . '([' . $doc_special . ']?[\w\s]+):(.*)';
my $doc_content = $doc_com.'(.*)'; my $doc_content = $doc_com . '(.*)';
my $doc_block = $doc_com.'DOC:\s*(.*)?'; my $doc_block = $doc_com . 'DOC:\s*(.*)?';
my %constants; my %constants;
my %parameterdescs; my %parameterdescs;
@ -485,12 +485,12 @@ sub output_enum_html(%) {
my %args = %{$_[0]}; my %args = %{$_[0]};
my ($parameter); my ($parameter);
my $count; my $count;
print "<h2>enum ".$args{'enum'}."</h2>\n"; print "<h2>enum " . $args{'enum'} . "</h2>\n";
print "<b>enum ".$args{'enum'}."</b> {<br>\n"; print "<b>enum " . $args{'enum'} . "</b> {<br>\n";
$count = 0; $count = 0;
foreach $parameter (@{$args{'parameterlist'}}) { foreach $parameter (@{$args{'parameterlist'}}) {
print " <b>".$parameter."</b>"; print " <b>" . $parameter . "</b>";
if ($count != $#{$args{'parameterlist'}}) { if ($count != $#{$args{'parameterlist'}}) {
$count++; $count++;
print ",\n"; print ",\n";
@ -502,7 +502,7 @@ sub output_enum_html(%) {
print "<h3>Constants</h3>\n"; print "<h3>Constants</h3>\n";
print "<dl>\n"; print "<dl>\n";
foreach $parameter (@{$args{'parameterlist'}}) { foreach $parameter (@{$args{'parameterlist'}}) {
print "<dt><b>".$parameter."</b>\n"; print "<dt><b>" . $parameter . "</b>\n";
print "<dd>"; print "<dd>";
output_highlight($args{'parameterdescs'}{$parameter}); output_highlight($args{'parameterdescs'}{$parameter});
} }
@ -516,9 +516,9 @@ sub output_typedef_html(%) {
my %args = %{$_[0]}; my %args = %{$_[0]};
my ($parameter); my ($parameter);
my $count; my $count;
print "<h2>typedef ".$args{'typedef'}."</h2>\n"; print "<h2>typedef " . $args{'typedef'} . "</h2>\n";
print "<b>typedef ".$args{'typedef'}."</b>\n"; print "<b>typedef " . $args{'typedef'} . "</b>\n";
output_section_html(@_); output_section_html(@_);
print "<hr>\n"; print "<hr>\n";
} }
@ -528,8 +528,8 @@ sub output_struct_html(%) {
my %args = %{$_[0]}; my %args = %{$_[0]};
my ($parameter); my ($parameter);
print "<h2>".$args{'type'}." ".$args{'struct'}. " - " .$args{'purpose'}."</h2>\n"; print "<h2>" . $args{'type'} . " " . $args{'struct'} . " - " . $args{'purpose'} . "</h2>\n";
print "<b>".$args{'type'}." ".$args{'struct'}."</b> {<br>\n"; print "<b>" . $args{'type'} . " " . $args{'struct'} . "</b> {<br>\n";
foreach $parameter (@{$args{'parameterlist'}}) { foreach $parameter (@{$args{'parameterlist'}}) {
if ($parameter =~ /^#/) { if ($parameter =~ /^#/) {
print "$parameter<br>\n"; print "$parameter<br>\n";
@ -561,7 +561,7 @@ sub output_struct_html(%) {
$parameter_name =~ s/\[.*//; $parameter_name =~ s/\[.*//;
($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
print "<dt><b>".$parameter."</b>\n"; print "<dt><b>" . $parameter . "</b>\n";
print "<dd>"; print "<dd>";
output_highlight($args{'parameterdescs'}{$parameter_name}); output_highlight($args{'parameterdescs'}{$parameter_name});
} }
@ -576,9 +576,9 @@ sub output_function_html(%) {
my ($parameter, $section); my ($parameter, $section);
my $count; my $count;
print "<h2>" .$args{'function'}." - ".$args{'purpose'}."</h2>\n"; print "<h2>" . $args{'function'} . " - " . $args{'purpose'} . "</h2>\n";
print "<i>".$args{'functiontype'}."</i>\n"; print "<i>" . $args{'functiontype'} . "</i>\n";
print "<b>".$args{'function'}."</b>\n"; print "<b>" . $args{'function'} . "</b>\n";
print "("; print "(";
$count = 0; $count = 0;
foreach $parameter (@{$args{'parameterlist'}}) { foreach $parameter (@{$args{'parameterlist'}}) {
@ -587,7 +587,7 @@ sub output_function_html(%) {
# pointer-to-function # pointer-to-function
print "<i>$1</i><b>$parameter</b>) <i>($2)</i>"; print "<i>$1</i><b>$parameter</b>) <i>($2)</i>";
} else { } else {
print "<i>".$type."</i> <b>".$parameter."</b>"; print "<i>" . $type . "</i> <b>" . $parameter . "</b>";
} }
if ($count != $#{$args{'parameterlist'}}) { if ($count != $#{$args{'parameterlist'}}) {
$count++; $count++;
@ -603,7 +603,7 @@ sub output_function_html(%) {
$parameter_name =~ s/\[.*//; $parameter_name =~ s/\[.*//;
($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
print "<dt><b>".$parameter."</b>\n"; print "<dt><b>" . $parameter . "</b>\n";
print "<dd>"; print "<dd>";
output_highlight($args{'parameterdescs'}{$parameter_name}); output_highlight($args{'parameterdescs'}{$parameter_name});
} }
@ -657,7 +657,7 @@ sub output_function_xml(%) {
my $count; my $count;
my $id; my $id;
$id = "API-".$args{'function'}; $id = "API-" . $args{'function'};
$id =~ s/[^A-Za-z0-9]/-/g; $id =~ s/[^A-Za-z0-9]/-/g;
print "<refentry id=\"$id\">\n"; print "<refentry id=\"$id\">\n";
@ -667,12 +667,12 @@ sub output_function_xml(%) {
print " <date>$man_date</date>\n"; print " <date>$man_date</date>\n";
print "</refentryinfo>\n"; print "</refentryinfo>\n";
print "<refmeta>\n"; print "<refmeta>\n";
print " <refentrytitle><phrase>".$args{'function'}."</phrase></refentrytitle>\n"; print " <refentrytitle><phrase>" . $args{'function'} . "</phrase></refentrytitle>\n";
print " <manvolnum>9</manvolnum>\n"; print " <manvolnum>9</manvolnum>\n";
print " <refmiscinfo class=\"version\">" . $kernelversion . "</refmiscinfo>\n"; print " <refmiscinfo class=\"version\">" . $kernelversion . "</refmiscinfo>\n";
print "</refmeta>\n"; print "</refmeta>\n";
print "<refnamediv>\n"; print "<refnamediv>\n";
print " <refname>".$args{'function'}."</refname>\n"; print " <refname>" . $args{'function'} . "</refname>\n";
print " <refpurpose>\n"; print " <refpurpose>\n";
print " "; print " ";
output_highlight ($args{'purpose'}); output_highlight ($args{'purpose'});
@ -682,8 +682,8 @@ sub output_function_xml(%) {
print "<refsynopsisdiv>\n"; print "<refsynopsisdiv>\n";
print " <title>Synopsis</title>\n"; print " <title>Synopsis</title>\n";
print " <funcsynopsis><funcprototype>\n"; print " <funcsynopsis><funcprototype>\n";
print " <funcdef>".$args{'functiontype'}." "; print " <funcdef>" . $args{'functiontype'} . " ";
print "<function>".$args{'function'}." </function></funcdef>\n"; print "<function>" . $args{'function'} . " </function></funcdef>\n";
$count = 0; $count = 0;
if ($#{$args{'parameterlist'}} >= 0) { if ($#{$args{'parameterlist'}} >= 0) {
@ -694,7 +694,7 @@ sub output_function_xml(%) {
print " <paramdef>$1<parameter>$parameter</parameter>)\n"; print " <paramdef>$1<parameter>$parameter</parameter>)\n";
print " <funcparams>$2</funcparams></paramdef>\n"; print " <funcparams>$2</funcparams></paramdef>\n";
} else { } else {
print " <paramdef>".$type; print " <paramdef>" . $type;
print " <parameter>$parameter</parameter></paramdef>\n"; print " <parameter>$parameter</parameter></paramdef>\n";
} }
} }
@ -734,7 +734,7 @@ sub output_struct_xml(%) {
my ($parameter, $section); my ($parameter, $section);
my $id; my $id;
$id = "API-struct-".$args{'struct'}; $id = "API-struct-" . $args{'struct'};
$id =~ s/[^A-Za-z0-9]/-/g; $id =~ s/[^A-Za-z0-9]/-/g;
print "<refentry id=\"$id\">\n"; print "<refentry id=\"$id\">\n";
@ -744,12 +744,12 @@ sub output_struct_xml(%) {
print " <date>$man_date</date>\n"; print " <date>$man_date</date>\n";
print "</refentryinfo>\n"; print "</refentryinfo>\n";
print "<refmeta>\n"; print "<refmeta>\n";
print " <refentrytitle><phrase>".$args{'type'}." ".$args{'struct'}."</phrase></refentrytitle>\n"; print " <refentrytitle><phrase>" . $args{'type'} . " " . $args{'struct'} . "</phrase></refentrytitle>\n";
print " <manvolnum>9</manvolnum>\n"; print " <manvolnum>9</manvolnum>\n";
print " <refmiscinfo class=\"version\">" . $kernelversion . "</refmiscinfo>\n"; print " <refmiscinfo class=\"version\">" . $kernelversion . "</refmiscinfo>\n";
print "</refmeta>\n"; print "</refmeta>\n";
print "<refnamediv>\n"; print "<refnamediv>\n";
print " <refname>".$args{'type'}." ".$args{'struct'}."</refname>\n"; print " <refname>" . $args{'type'} . " " . $args{'struct'} . "</refname>\n";
print " <refpurpose>\n"; print " <refpurpose>\n";
print " "; print " ";
output_highlight ($args{'purpose'}); output_highlight ($args{'purpose'});
@ -759,7 +759,7 @@ sub output_struct_xml(%) {
print "<refsynopsisdiv>\n"; print "<refsynopsisdiv>\n";
print " <title>Synopsis</title>\n"; print " <title>Synopsis</title>\n";
print " <programlisting>\n"; print " <programlisting>\n";
print $args{'type'}." ".$args{'struct'}." {\n"; print $args{'type'} . " " . $args{'struct'} . " {\n";
foreach $parameter (@{$args{'parameterlist'}}) { foreach $parameter (@{$args{'parameterlist'}}) {
if ($parameter =~ /^#/) { if ($parameter =~ /^#/) {
print "$parameter\n"; print "$parameter\n";
@ -779,7 +779,7 @@ sub output_struct_xml(%) {
# bitfield # bitfield
print " $1 $parameter$2;\n"; print " $1 $parameter$2;\n";
} else { } else {
print " ".$type." ".$parameter.";\n"; print " " . $type . " " . $parameter . ";\n";
} }
} }
print "};"; print "};";
@ -824,7 +824,7 @@ sub output_enum_xml(%) {
my $count; my $count;
my $id; my $id;
$id = "API-enum-".$args{'enum'}; $id = "API-enum-" . $args{'enum'};
$id =~ s/[^A-Za-z0-9]/-/g; $id =~ s/[^A-Za-z0-9]/-/g;
print "<refentry id=\"$id\">\n"; print "<refentry id=\"$id\">\n";
@ -834,12 +834,12 @@ sub output_enum_xml(%) {
print " <date>$man_date</date>\n"; print " <date>$man_date</date>\n";
print "</refentryinfo>\n"; print "</refentryinfo>\n";
print "<refmeta>\n"; print "<refmeta>\n";
print " <refentrytitle><phrase>enum ".$args{'enum'}."</phrase></refentrytitle>\n"; print " <refentrytitle><phrase>enum " . $args{'enum'} . "</phrase></refentrytitle>\n";
print " <manvolnum>9</manvolnum>\n"; print " <manvolnum>9</manvolnum>\n";
print " <refmiscinfo class=\"version\">" . $kernelversion . "</refmiscinfo>\n"; print " <refmiscinfo class=\"version\">" . $kernelversion . "</refmiscinfo>\n";
print "</refmeta>\n"; print "</refmeta>\n";
print "<refnamediv>\n"; print "<refnamediv>\n";
print " <refname>enum ".$args{'enum'}."</refname>\n"; print " <refname>enum " . $args{'enum'} . "</refname>\n";
print " <refpurpose>\n"; print " <refpurpose>\n";
print " "; print " ";
output_highlight ($args{'purpose'}); output_highlight ($args{'purpose'});
@ -849,7 +849,7 @@ sub output_enum_xml(%) {
print "<refsynopsisdiv>\n"; print "<refsynopsisdiv>\n";
print " <title>Synopsis</title>\n"; print " <title>Synopsis</title>\n";
print " <programlisting>\n"; print " <programlisting>\n";
print "enum ".$args{'enum'}." {\n"; print "enum " . $args{'enum'} . " {\n";
$count = 0; $count = 0;
foreach $parameter (@{$args{'parameterlist'}}) { foreach $parameter (@{$args{'parameterlist'}}) {
print " $parameter"; print " $parameter";
@ -891,7 +891,7 @@ sub output_typedef_xml(%) {
my ($parameter, $section); my ($parameter, $section);
my $id; my $id;
$id = "API-typedef-".$args{'typedef'}; $id = "API-typedef-" . $args{'typedef'};
$id =~ s/[^A-Za-z0-9]/-/g; $id =~ s/[^A-Za-z0-9]/-/g;
print "<refentry id=\"$id\">\n"; print "<refentry id=\"$id\">\n";
@ -901,11 +901,11 @@ sub output_typedef_xml(%) {
print " <date>$man_date</date>\n"; print " <date>$man_date</date>\n";
print "</refentryinfo>\n"; print "</refentryinfo>\n";
print "<refmeta>\n"; print "<refmeta>\n";
print " <refentrytitle><phrase>typedef ".$args{'typedef'}."</phrase></refentrytitle>\n"; print " <refentrytitle><phrase>typedef " . $args{'typedef'} . "</phrase></refentrytitle>\n";
print " <manvolnum>9</manvolnum>\n"; print " <manvolnum>9</manvolnum>\n";
print "</refmeta>\n"; print "</refmeta>\n";
print "<refnamediv>\n"; print "<refnamediv>\n";
print " <refname>typedef ".$args{'typedef'}."</refname>\n"; print " <refname>typedef " . $args{'typedef'} . "</refname>\n";
print " <refpurpose>\n"; print " <refpurpose>\n";
print " "; print " ";
output_highlight ($args{'purpose'}); output_highlight ($args{'purpose'});
@ -914,7 +914,7 @@ sub output_typedef_xml(%) {
print "<refsynopsisdiv>\n"; print "<refsynopsisdiv>\n";
print " <title>Synopsis</title>\n"; print " <title>Synopsis</title>\n";
print " <synopsis>typedef ".$args{'typedef'}.";</synopsis>\n"; print " <synopsis>typedef " . $args{'typedef'} . ";</synopsis>\n";
print "</refsynopsisdiv>\n"; print "</refsynopsisdiv>\n";
output_section_xml(@_); output_section_xml(@_);
@ -963,15 +963,15 @@ sub output_function_gnome {
my $count; my $count;
my $id; my $id;
$id = $args{'module'}."-".$args{'function'}; $id = $args{'module'} . "-" . $args{'function'};
$id =~ s/[^A-Za-z0-9]/-/g; $id =~ s/[^A-Za-z0-9]/-/g;
print "<sect2>\n"; print "<sect2>\n";
print " <title id=\"$id\">".$args{'function'}."</title>\n"; print " <title id=\"$id\">" . $args{'function'} . "</title>\n";
print " <funcsynopsis>\n"; print " <funcsynopsis>\n";
print " <funcdef>".$args{'functiontype'}." "; print " <funcdef>" . $args{'functiontype'} . " ";
print "<function>".$args{'function'}." "; print "<function>" . $args{'function'} . " ";
print "</function></funcdef>\n"; print "</function></funcdef>\n";
$count = 0; $count = 0;
@ -983,7 +983,7 @@ sub output_function_gnome {
print " <paramdef>$1 <parameter>$parameter</parameter>)\n"; print " <paramdef>$1 <parameter>$parameter</parameter>)\n";
print " <funcparams>$2</funcparams></paramdef>\n"; print " <funcparams>$2</funcparams></paramdef>\n";
} else { } else {
print " <paramdef>".$type; print " <paramdef>" . $type;
print " <parameter>$parameter</parameter></paramdef>\n"; print " <parameter>$parameter</parameter></paramdef>\n";
} }
} }
@ -1043,13 +1043,13 @@ sub output_function_man(%) {
print ".TH \"$args{'function'}\" 9 \"$args{'function'}\" \"$man_date\" \"Kernel Hacker's Manual\" LINUX\n"; print ".TH \"$args{'function'}\" 9 \"$args{'function'}\" \"$man_date\" \"Kernel Hacker's Manual\" LINUX\n";
print ".SH NAME\n"; print ".SH NAME\n";
print $args{'function'}." \\- ".$args{'purpose'}."\n"; print $args{'function'} . " \\- " . $args{'purpose'} . "\n";
print ".SH SYNOPSIS\n"; print ".SH SYNOPSIS\n";
if ($args{'functiontype'} ne "") { if ($args{'functiontype'} ne "") {
print ".B \"".$args{'functiontype'}."\" ".$args{'function'}."\n"; print ".B \"" . $args{'functiontype'} . "\" " . $args{'function'} . "\n";
} else { } else {
print ".B \"".$args{'function'}."\n"; print ".B \"" . $args{'function'} . "\n";
} }
$count = 0; $count = 0;
my $parenth = "("; my $parenth = "(";
@ -1061,10 +1061,10 @@ sub output_function_man(%) {
$type = $args{'parametertypes'}{$parameter}; $type = $args{'parametertypes'}{$parameter};
if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
# pointer-to-function # pointer-to-function
print ".BI \"".$parenth.$1."\" ".$parameter." \") (".$2.")".$post."\"\n"; print ".BI \"" . $parenth . $1 . "\" " . $parameter . " \") (" . $2 . ")" . $post . "\"\n";
} else { } else {
$type =~ s/([^\*])$/$1 /; $type =~ s/([^\*])$/$1 /;
print ".BI \"".$parenth.$type."\" ".$parameter." \"".$post."\"\n"; print ".BI \"" . $parenth . $type . "\" " . $parameter . " \"" . $post . "\"\n";
} }
$count++; $count++;
$parenth = ""; $parenth = "";
@ -1075,7 +1075,7 @@ sub output_function_man(%) {
my $parameter_name = $parameter; my $parameter_name = $parameter;
$parameter_name =~ s/\[.*//; $parameter_name =~ s/\[.*//;
print ".IP \"".$parameter."\" 12\n"; print ".IP \"" . $parameter . "\" 12\n";
output_highlight($args{'parameterdescs'}{$parameter_name}); output_highlight($args{'parameterdescs'}{$parameter_name});
} }
foreach $section (@{$args{'sectionlist'}}) { foreach $section (@{$args{'sectionlist'}}) {
@ -1094,10 +1094,10 @@ sub output_enum_man(%) {
print ".TH \"$args{'module'}\" 9 \"enum $args{'enum'}\" \"$man_date\" \"API Manual\" LINUX\n"; print ".TH \"$args{'module'}\" 9 \"enum $args{'enum'}\" \"$man_date\" \"API Manual\" LINUX\n";
print ".SH NAME\n"; print ".SH NAME\n";
print "enum ".$args{'enum'}." \\- ".$args{'purpose'}."\n"; print "enum " . $args{'enum'} . " \\- " . $args{'purpose'} . "\n";
print ".SH SYNOPSIS\n"; print ".SH SYNOPSIS\n";
print "enum ".$args{'enum'}." {\n"; print "enum " . $args{'enum'} . " {\n";
$count = 0; $count = 0;
foreach my $parameter (@{$args{'parameterlist'}}) { foreach my $parameter (@{$args{'parameterlist'}}) {
print ".br\n.BI \" $parameter\"\n"; print ".br\n.BI \" $parameter\"\n";
@ -1116,7 +1116,7 @@ sub output_enum_man(%) {
my $parameter_name = $parameter; my $parameter_name = $parameter;
$parameter_name =~ s/\[.*//; $parameter_name =~ s/\[.*//;
print ".IP \"".$parameter."\" 12\n"; print ".IP \"" . $parameter . "\" 12\n";
output_highlight($args{'parameterdescs'}{$parameter_name}); output_highlight($args{'parameterdescs'}{$parameter_name});
} }
foreach $section (@{$args{'sectionlist'}}) { foreach $section (@{$args{'sectionlist'}}) {
@ -1131,13 +1131,13 @@ sub output_struct_man(%) {
my %args = %{$_[0]}; my %args = %{$_[0]};
my ($parameter, $section); my ($parameter, $section);
print ".TH \"$args{'module'}\" 9 \"".$args{'type'}." ".$args{'struct'}."\" \"$man_date\" \"API Manual\" LINUX\n"; print ".TH \"$args{'module'}\" 9 \"" . $args{'type'} . " " . $args{'struct'} . "\" \"$man_date\" \"API Manual\" LINUX\n";
print ".SH NAME\n"; print ".SH NAME\n";
print $args{'type'}." ".$args{'struct'}." \\- ".$args{'purpose'}."\n"; print $args{'type'} . " " . $args{'struct'} . " \\- " . $args{'purpose'} . "\n";
print ".SH SYNOPSIS\n"; print ".SH SYNOPSIS\n";
print $args{'type'}." ".$args{'struct'}." {\n.br\n"; print $args{'type'} . " " . $args{'struct'} . " {\n.br\n";
foreach my $parameter (@{$args{'parameterlist'}}) { foreach my $parameter (@{$args{'parameterlist'}}) {
if ($parameter =~ /^#/) { if ($parameter =~ /^#/) {
@ -1151,13 +1151,13 @@ sub output_struct_man(%) {
$type = $args{'parametertypes'}{$parameter}; $type = $args{'parametertypes'}{$parameter};
if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
# pointer-to-function # pointer-to-function
print ".BI \" ".$1."\" ".$parameter." \") (".$2.")"."\"\n;\n"; print ".BI \" " . $1 . "\" " . $parameter . " \") (" . $2 . ")" . "\"\n;\n";
} elsif ($type =~ m/^(.*?)\s*(:.*)/) { } elsif ($type =~ m/^(.*?)\s*(:.*)/) {
# bitfield # bitfield
print ".BI \" ".$1."\ \" ".$parameter.$2." \""."\"\n;\n"; print ".BI \" " . $1 . "\ \" " . $parameter . $2 . " \"" . "\"\n;\n";
} else { } else {
$type =~ s/([^\*])$/$1 /; $type =~ s/([^\*])$/$1 /;
print ".BI \" ".$type."\" ".$parameter." \""."\"\n;\n"; print ".BI \" " . $type . "\" " . $parameter . " \"" . "\"\n;\n";
} }
print "\n.br\n"; print "\n.br\n";
} }
@ -1171,7 +1171,7 @@ sub output_struct_man(%) {
$parameter_name =~ s/\[.*//; $parameter_name =~ s/\[.*//;
($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
print ".IP \"".$parameter."\" 12\n"; print ".IP \"" . $parameter . "\" 12\n";
output_highlight($args{'parameterdescs'}{$parameter_name}); output_highlight($args{'parameterdescs'}{$parameter_name});
} }
foreach $section (@{$args{'sectionlist'}}) { foreach $section (@{$args{'sectionlist'}}) {
@ -1189,7 +1189,7 @@ sub output_typedef_man(%) {
print ".TH \"$args{'module'}\" 9 \"$args{'typedef'}\" \"$man_date\" \"API Manual\" LINUX\n"; print ".TH \"$args{'module'}\" 9 \"$args{'typedef'}\" \"$man_date\" \"API Manual\" LINUX\n";
print ".SH NAME\n"; print ".SH NAME\n";
print "typedef ".$args{'typedef'}." \\- ".$args{'purpose'}."\n"; print "typedef " . $args{'typedef'} . " \\- " . $args{'purpose'} . "\n";
foreach $section (@{$args{'sectionlist'}}) { foreach $section (@{$args{'sectionlist'}}) {
print ".SH \"$section\"\n"; print ".SH \"$section\"\n";
@ -1218,13 +1218,13 @@ sub output_function_text(%) {
my $start; my $start;
print "Name:\n\n"; print "Name:\n\n";
print $args{'function'}." - ".$args{'purpose'}."\n"; print $args{'function'} . " - " . $args{'purpose'} . "\n";
print "\nSynopsis:\n\n"; print "\nSynopsis:\n\n";
if ($args{'functiontype'} ne "") { if ($args{'functiontype'} ne "") {
$start = $args{'functiontype'}." ".$args{'function'}." ("; $start = $args{'functiontype'} . " " . $args{'function'} . " (";
} else { } else {
$start = $args{'function'}." ("; $start = $args{'function'} . " (";
} }
print $start; print $start;
@ -1233,9 +1233,9 @@ sub output_function_text(%) {
$type = $args{'parametertypes'}{$parameter}; $type = $args{'parametertypes'}{$parameter};
if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
# pointer-to-function # pointer-to-function
print $1.$parameter.") (".$2; print $1 . $parameter . ") (" . $2;
} else { } else {
print $type." ".$parameter; print $type . " " . $parameter;
} }
if ($count != $#{$args{'parameterlist'}}) { if ($count != $#{$args{'parameterlist'}}) {
$count++; $count++;
@ -1251,7 +1251,7 @@ sub output_function_text(%) {
my $parameter_name = $parameter; my $parameter_name = $parameter;
$parameter_name =~ s/\[.*//; $parameter_name =~ s/\[.*//;
print $parameter."\n\t".$args{'parameterdescs'}{$parameter_name}."\n"; print $parameter . "\n\t" . $args{'parameterdescs'}{$parameter_name} . "\n";
} }
output_section_text(@_); output_section_text(@_);
} }
@ -1276,8 +1276,8 @@ sub output_enum_text(%) {
my $count; my $count;
print "Enum:\n\n"; print "Enum:\n\n";
print "enum ".$args{'enum'}." - ".$args{'purpose'}."\n\n"; print "enum " . $args{'enum'} . " - " . $args{'purpose'} . "\n\n";
print "enum ".$args{'enum'}." {\n"; print "enum " . $args{'enum'} . " {\n";
$count = 0; $count = 0;
foreach $parameter (@{$args{'parameterlist'}}) { foreach $parameter (@{$args{'parameterlist'}}) {
print "\t$parameter"; print "\t$parameter";
@ -1292,7 +1292,7 @@ sub output_enum_text(%) {
print "Constants:\n\n"; print "Constants:\n\n";
foreach $parameter (@{$args{'parameterlist'}}) { foreach $parameter (@{$args{'parameterlist'}}) {
print "$parameter\n\t"; print "$parameter\n\t";
print $args{'parameterdescs'}{$parameter}."\n"; print $args{'parameterdescs'}{$parameter} . "\n";
} }
output_section_text(@_); output_section_text(@_);
@ -1305,7 +1305,7 @@ sub output_typedef_text(%) {
my $count; my $count;
print "Typedef:\n\n"; print "Typedef:\n\n";
print "typedef ".$args{'typedef'}." - ".$args{'purpose'}."\n"; print "typedef " . $args{'typedef'} . " - " . $args{'purpose'} . "\n";
output_section_text(@_); output_section_text(@_);
} }
@ -1314,8 +1314,8 @@ sub output_struct_text(%) {
my %args = %{$_[0]}; my %args = %{$_[0]};
my ($parameter); my ($parameter);
print $args{'type'}." ".$args{'struct'}." - ".$args{'purpose'}."\n\n"; print $args{'type'} . " " . $args{'struct'} . " - " . $args{'purpose'} . "\n\n";
print $args{'type'}." ".$args{'struct'}." {\n"; print $args{'type'} . " " . $args{'struct'} . " {\n";
foreach $parameter (@{$args{'parameterlist'}}) { foreach $parameter (@{$args{'parameterlist'}}) {
if ($parameter =~ /^#/) { if ($parameter =~ /^#/) {
print "$parameter\n"; print "$parameter\n";
@ -1334,7 +1334,7 @@ sub output_struct_text(%) {
# bitfield # bitfield
print "\t$1 $parameter$2;\n"; print "\t$1 $parameter$2;\n";
} else { } else {
print "\t".$type." ".$parameter.";\n"; print "\t" . $type . " " . $parameter . ";\n";
} }
} }
print "};\n\n"; print "};\n\n";
@ -1348,7 +1348,7 @@ sub output_struct_text(%) {
($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
print "$parameter\n\t"; print "$parameter\n\t";
print $args{'parameterdescs'}{$parameter_name}."\n"; print $args{'parameterdescs'}{$parameter_name} . "\n";
} }
print "\n"; print "\n";
output_section_text(@_); output_section_text(@_);
@ -1387,7 +1387,7 @@ sub output_declaration {
# generic output function - calls the right one based on current output mode. # generic output function - calls the right one based on current output mode.
sub output_blockhead { sub output_blockhead {
no strict 'refs'; no strict 'refs';
my $func = "output_blockhead_".$output_mode; my $func = "output_blockhead_" . $output_mode;
&$func(@_); &$func(@_);
$section_counter++; $section_counter++;
} }
@ -1398,7 +1398,7 @@ sub output_blockhead {
sub dump_declaration($$) { sub dump_declaration($$) {
no strict 'refs'; no strict 'refs';
my ($prototype, $file) = @_; my ($prototype, $file) = @_;
my $func = "dump_".$decl_type; my $func = "dump_" . $decl_type;
&$func(@_); &$func(@_);
} }
@ -1645,7 +1645,7 @@ sub push_parameter($$$) {
"or member '$param' not " . "or member '$param' not " .
"described in '$declaration_name'\n"; "described in '$declaration_name'\n";
} }
print STDERR "Warning(${file}:$.):". print STDERR "Warning(${file}:$.):" .
" No description found for parameter '$param'\n"; " No description found for parameter '$param'\n";
++$warnings; ++$warnings;
} }
@ -1929,7 +1929,7 @@ sub process_state3_type($$) {
($2 eq '{') && $brcount++; ($2 eq '{') && $brcount++;
($2 eq '}') && $brcount--; ($2 eq '}') && $brcount--;
if (($2 eq ';') && ($brcount == 0)) { if (($2 eq ';') && ($brcount == 0)) {
dump_declaration($prototype,$file); dump_declaration($prototype, $file);
reset_state(); reset_state();
last; last;
} }
@ -2106,7 +2106,7 @@ sub process_file($) {
$section = $section_default; $section = $section_default;
$contents = ""; $contents = "";
} else { } else {
$contents .= $1."\n"; $contents .= $1 . "\n";
} }
} else { } else {
# i dont know - bad line? ignore. # i dont know - bad line? ignore.

View File

@ -763,6 +763,8 @@ static void check_section(const char *modname, struct elf_info *elf,
#define ALL_INIT_DATA_SECTIONS \ #define ALL_INIT_DATA_SECTIONS \
".init.setup$", ".init.rodata$", \
".devinit.rodata$", ".cpuinit.rodata$", ".meminit.rodata$" \
".init.data$", ".devinit.data$", ".cpuinit.data$", ".meminit.data$" ".init.data$", ".devinit.data$", ".cpuinit.data$", ".meminit.data$"
#define ALL_EXIT_DATA_SECTIONS \ #define ALL_EXIT_DATA_SECTIONS \
".exit.data$", ".devexit.data$", ".cpuexit.data$", ".memexit.data$" ".exit.data$", ".devexit.data$", ".cpuexit.data$", ".memexit.data$"
@ -772,21 +774,23 @@ static void check_section(const char *modname, struct elf_info *elf,
#define ALL_EXIT_TEXT_SECTIONS \ #define ALL_EXIT_TEXT_SECTIONS \
".exit.text$", ".devexit.text$", ".cpuexit.text$", ".memexit.text$" ".exit.text$", ".devexit.text$", ".cpuexit.text$", ".memexit.text$"
#define ALL_INIT_SECTIONS ALL_INIT_DATA_SECTIONS, ALL_INIT_TEXT_SECTIONS #define ALL_INIT_SECTIONS INIT_SECTIONS, DEV_INIT_SECTIONS, \
#define ALL_EXIT_SECTIONS ALL_EXIT_DATA_SECTIONS, ALL_EXIT_TEXT_SECTIONS CPU_INIT_SECTIONS, MEM_INIT_SECTIONS
#define ALL_EXIT_SECTIONS EXIT_SECTIONS, DEV_EXIT_SECTIONS, \
CPU_EXIT_SECTIONS, MEM_EXIT_SECTIONS
#define DATA_SECTIONS ".data$", ".data.rel$" #define DATA_SECTIONS ".data$", ".data.rel$"
#define TEXT_SECTIONS ".text$" #define TEXT_SECTIONS ".text$"
#define INIT_SECTIONS ".init.data$", ".init.text$" #define INIT_SECTIONS ".init.*"
#define DEV_INIT_SECTIONS ".devinit.data$", ".devinit.text$" #define DEV_INIT_SECTIONS ".devinit.*"
#define CPU_INIT_SECTIONS ".cpuinit.data$", ".cpuinit.text$" #define CPU_INIT_SECTIONS ".cpuinit.*"
#define MEM_INIT_SECTIONS ".meminit.data$", ".meminit.text$" #define MEM_INIT_SECTIONS ".meminit.*"
#define EXIT_SECTIONS ".exit.data$", ".exit.text$" #define EXIT_SECTIONS ".exit.*"
#define DEV_EXIT_SECTIONS ".devexit.data$", ".devexit.text$" #define DEV_EXIT_SECTIONS ".devexit.*"
#define CPU_EXIT_SECTIONS ".cpuexit.data$", ".cpuexit.text$" #define CPU_EXIT_SECTIONS ".cpuexit.*"
#define MEM_EXIT_SECTIONS ".memexit.data$", ".memexit.text$" #define MEM_EXIT_SECTIONS ".memexit.*"
/* init data sections */ /* init data sections */
static const char *init_data_sections[] = { ALL_INIT_DATA_SECTIONS, NULL }; static const char *init_data_sections[] = { ALL_INIT_DATA_SECTIONS, NULL };
@ -869,12 +873,36 @@ const struct sectioncheck sectioncheck[] = {
.tosec = { INIT_SECTIONS, NULL }, .tosec = { INIT_SECTIONS, NULL },
.mismatch = XXXINIT_TO_INIT, .mismatch = XXXINIT_TO_INIT,
}, },
/* Do not reference cpuinit code/data from meminit code/data */
{
.fromsec = { MEM_INIT_SECTIONS, NULL },
.tosec = { CPU_INIT_SECTIONS, NULL },
.mismatch = XXXINIT_TO_INIT,
},
/* Do not reference meminit code/data from cpuinit code/data */
{
.fromsec = { CPU_INIT_SECTIONS, NULL },
.tosec = { MEM_INIT_SECTIONS, NULL },
.mismatch = XXXINIT_TO_INIT,
},
/* Do not reference exit code/data from devexit/cpuexit/memexit code/data */ /* Do not reference exit code/data from devexit/cpuexit/memexit code/data */
{ {
.fromsec = { DEV_EXIT_SECTIONS, CPU_EXIT_SECTIONS, MEM_EXIT_SECTIONS, NULL }, .fromsec = { DEV_EXIT_SECTIONS, CPU_EXIT_SECTIONS, MEM_EXIT_SECTIONS, NULL },
.tosec = { EXIT_SECTIONS, NULL }, .tosec = { EXIT_SECTIONS, NULL },
.mismatch = XXXEXIT_TO_EXIT, .mismatch = XXXEXIT_TO_EXIT,
}, },
/* Do not reference cpuexit code/data from memexit code/data */
{
.fromsec = { MEM_EXIT_SECTIONS, NULL },
.tosec = { CPU_EXIT_SECTIONS, NULL },
.mismatch = XXXEXIT_TO_EXIT,
},
/* Do not reference memexit code/data from cpuexit code/data */
{
.fromsec = { CPU_EXIT_SECTIONS, NULL },
.tosec = { MEM_EXIT_SECTIONS, NULL },
.mismatch = XXXEXIT_TO_EXIT,
},
/* Do not use exit code/data from init code */ /* Do not use exit code/data from init code */
{ {
.fromsec = { ALL_INIT_SECTIONS, NULL }, .fromsec = { ALL_INIT_SECTIONS, NULL },
@ -1168,7 +1196,7 @@ static void report_sec_mismatch(const char *modname, enum mismatch mismatch,
"The variable %s references\n" "The variable %s references\n"
"the %s %s%s%s\n" "the %s %s%s%s\n"
"If the reference is valid then annotate the\n" "If the reference is valid then annotate the\n"
"variable with __init* (see linux/init.h) " "variable with __init* or __refdata (see linux/init.h) "
"or name the variable:\n", "or name the variable:\n",
fromsym, to, sec2annotation(tosec), tosym, to_p); fromsym, to, sec2annotation(tosec), tosym, to_p);
while (*s) while (*s)

View File

@ -1,38 +1,58 @@
#!/bin/sh #!/bin/sh
# #
# builddeb 1.2 # builddeb 1.3
# Copyright 2003 Wichert Akkerman <wichert@wiggy.net> # Copyright 2003 Wichert Akkerman <wichert@wiggy.net>
# #
# Simple script to generate a deb package for a Linux kernel. All the # Simple script to generate a deb package for a Linux kernel. All the
# complexity of what to do with a kernel after it is installer or removed # complexity of what to do with a kernel after it is installed or removed
# is left to other scripts and packages: they can install scripts in the # is left to other scripts and packages: they can install scripts in the
# /etc/kernel/{pre,post}{inst,rm}.d/ directories that will be called on # /etc/kernel/{pre,post}{inst,rm}.d/ directories (or an alternative location
# package install and removal. # specified in KDEB_HOOKDIR) that will be called on package install and
# removal.
set -e set -e
create_package() {
local pname="$1" pdir="$2"
cp debian/copyright "$pdir/usr/share/doc/$pname/"
# Fix ownership and permissions
chown -R root:root "$pdir"
chmod -R go-w "$pdir"
# Create the package
dpkg-gencontrol -isp -p$pname -P"$pdir"
dpkg --build "$pdir" ..
}
# Some variables and settings used throughout the script # Some variables and settings used throughout the script
version=$KERNELRELEASE version=$KERNELRELEASE
revision=`cat .version` revision=$(cat .version)
if [ -n "$KDEB_PKGVERSION" ]; then
packageversion=$KDEB_PKGVERSION
else
packageversion=$version-$revision
fi
tmpdir="$objtree/debian/tmp" tmpdir="$objtree/debian/tmp"
fwdir="$objtree/debian/fwtmp" fwdir="$objtree/debian/fwtmp"
packagename=linux-$version packagename=linux-image-$version
fwpackagename=linux-firmware-image fwpackagename=linux-firmware-image
if [ "$ARCH" == "um" ] ; then if [ "$ARCH" = "um" ] ; then
packagename=user-mode-linux-$version packagename=user-mode-linux-$version
fi fi
# Setup the directory structure # Setup the directory structure
rm -rf "$tmpdir" "$fwdir" rm -rf "$tmpdir" "$fwdir"
mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot" mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename"
mkdir -p "$fwdir/DEBIAN" "$fwdir/lib" mkdir -p "$fwdir/DEBIAN" "$fwdir/lib" "$fwdir/usr/share/doc/$fwpackagename"
if [ "$ARCH" == "um" ] ; then if [ "$ARCH" = "um" ] ; then
mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/share/doc/$packagename" "$tmpdir/usr/bin" mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin"
fi fi
# Build and install the kernel # Build and install the kernel
if [ "$ARCH" == "um" ] ; then if [ "$ARCH" = "um" ] ; then
$MAKE linux $MAKE linux
cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map" cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map"
cp .config "$tmpdir/usr/share/doc/$packagename/config" cp .config "$tmpdir/usr/share/doc/$packagename/config"
@ -41,53 +61,100 @@ if [ "$ARCH" == "um" ] ; then
else else
cp System.map "$tmpdir/boot/System.map-$version" cp System.map "$tmpdir/boot/System.map-$version"
cp .config "$tmpdir/boot/config-$version" cp .config "$tmpdir/boot/config-$version"
cp $KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version" # Not all arches include the boot path in KBUILD_IMAGE
if ! cp $KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version"; then
cp arch/$ARCH/boot/$KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version"
fi
fi fi
if grep -q '^CONFIG_MODULES=y' .config ; then if grep -q '^CONFIG_MODULES=y' .config ; then
INSTALL_MOD_PATH="$tmpdir" make KBUILD_SRC= modules_install INSTALL_MOD_PATH="$tmpdir" make KBUILD_SRC= modules_install
if [ "$ARCH" == "um" ] ; then if [ "$ARCH" = "um" ] ; then
mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/" mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/"
rmdir "$tmpdir/lib/modules/$version" rmdir "$tmpdir/lib/modules/$version"
fi fi
fi fi
# Install the maintainer scripts # Install the maintainer scripts
# Note: hook scripts under /etc/kernel are also executed by official Debian
# kernel packages, as well as kernel packages built using make-kpkg
debhookdir=${KDEB_HOOKDIR:-/etc/kernel}
for script in postinst postrm preinst prerm ; do for script in postinst postrm preinst prerm ; do
mkdir -p "$tmpdir/etc/kernel/$script.d" mkdir -p "$tmpdir$debhookdir/$script.d"
cat <<EOF > "$tmpdir/DEBIAN/$script" cat <<EOF > "$tmpdir/DEBIAN/$script"
#!/bin/sh #!/bin/sh
set -e set -e
test -d /etc/kernel/$script.d && run-parts --arg="$version" /etc/kernel/$script.d # Pass maintainer script parameters to hook scripts
export DEB_MAINT_PARAMS="\$@"
test -d $debhookdir/$script.d && run-parts --arg="$version" $debhookdir/$script.d
exit 0 exit 0
EOF EOF
chmod 755 "$tmpdir/DEBIAN/$script" chmod 755 "$tmpdir/DEBIAN/$script"
done done
name="Kernel Compiler <$(id -nu)@$(hostname -f)>" # Try to determine maintainer and email values
if [ -n "$DEBEMAIL" ]; then
email=$DEBEMAIL
elif [ -n "$EMAIL" ]; then
email=$EMAIL
else
email=$(id -nu)@$(hostname -f)
fi
if [ -n "$DEBFULLNAME" ]; then
name=$DEBFULLNAME
elif [ -n "$NAME" ]; then
name=$NAME
else
name="Anonymous"
fi
maintainer="$name <$email>"
# Generate a simple changelog template # Generate a simple changelog template
cat <<EOF > debian/changelog cat <<EOF > debian/changelog
linux ($version-$revision) unstable; urgency=low linux-upstream ($packageversion) unstable; urgency=low
* A standard release * Custom built Linux kernel.
-- $name $(date -R) -- $maintainer $(date -R)
EOF
# Generate copyright file
cat <<EOF > debian/copyright
This is a packacked upstream version of the Linux kernel.
The sources may be found at most Linux ftp sites, including:
ftp://ftp.kernel.org/pub/linux/kernel
Copyright: 1991 - 2009 Linus Torvalds and others.
The git repository for mainline kernel development is at:
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 dated June, 1991.
On Debian GNU/Linux systems, the complete text of the GNU General Public
License version 2 can be found in \`/usr/share/common-licenses/GPL-2'.
EOF EOF
# Generate a control file # Generate a control file
if [ "$ARCH" == "um" ]; then
cat <<EOF > debian/control cat <<EOF > debian/control
Source: linux Source: linux-upstream
Section: base Section: admin
Priority: optional Priority: optional
Maintainer: $name Maintainer: $maintainer
Standards-Version: 3.6.1 Standards-Version: 3.8.1
EOF
if [ "$ARCH" = "um" ]; then
cat <<EOF >> debian/control
Package: $packagename Package: $packagename
Provides: kernel-image-$version, linux-image-$version Provides: linux-image, linux-image-2.6, linux-modules-$version
Architecture: any Architecture: any
Description: User Mode Linux kernel, version $version Description: User Mode Linux kernel, version $version
User-mode Linux is a port of the Linux kernel to its own system call User-mode Linux is a port of the Linux kernel to its own system call
@ -97,30 +164,22 @@ Description: User Mode Linux kernel, version $version
many other things. many other things.
. .
This package contains the Linux kernel, modules and corresponding other This package contains the Linux kernel, modules and corresponding other
files version $version files, version: $version.
EOF EOF
else else
cat <<EOF > debian/control cat <<EOF >> debian/control
Source: linux
Section: base
Priority: optional
Maintainer: $name
Standards-Version: 3.6.1
Package: $packagename Package: $packagename
Provides: kernel-image-$version, linux-image-$version Provides: linux-image, linux-image-2.6, linux-modules-$version
Suggests: $fwpackagename Suggests: $fwpackagename
Architecture: any Architecture: any
Description: Linux kernel, version $version Description: Linux kernel, version $version
This package contains the Linux kernel, modules and corresponding other This package contains the Linux kernel, modules and corresponding other
files version $version files, version: $version.
EOF EOF
fi
# Fix some ownership and permissions fi
chown -R root:root "$tmpdir"
chmod -R go-w "$tmpdir"
# Do we have firmware? Move it out of the way and build it into a package. # Do we have firmware? Move it out of the way and build it into a package.
if [ -e "$tmpdir/lib/firmware" ]; then if [ -e "$tmpdir/lib/firmware" ]; then
@ -131,16 +190,12 @@ if [ -e "$tmpdir/lib/firmware" ]; then
Package: $fwpackagename Package: $fwpackagename
Architecture: all Architecture: all
Description: Linux kernel firmware, version $version Description: Linux kernel firmware, version $version
This package contains firmware from the Linux kernel, version $version This package contains firmware from the Linux kernel, version $version.
EOF EOF
dpkg-gencontrol -isp -p$fwpackagename -P"$fwdir" create_package "$fwpackagename" "$fwdir"
dpkg --build "$fwdir" ..
fi fi
# Perform the final magic create_package "$packagename" "$tmpdir"
dpkg-gencontrol -isp -p$packagename
dpkg --build "$tmpdir" ..
exit 0 exit 0

View File

@ -39,8 +39,10 @@ if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
printf -- '-svn%s' "`git svn find-rev $head`" printf -- '-svn%s' "`git svn find-rev $head`"
fi fi
# Are there uncommitted changes? # Update index only on r/w media
git update-index --refresh --unmerged > /dev/null [ -w . ] && git update-index --refresh --unmerged > /dev/null
# Check for uncommitted changes
if git diff-index --name-only HEAD | grep -v "^scripts/package" \ if git diff-index --name-only HEAD | grep -v "^scripts/package" \
| read dummy; then | read dummy; then
printf '%s' -dirty printf '%s' -dirty

View File

@ -678,8 +678,10 @@ eval_unary(const struct ops *ops, int *valp, const char **cpp)
if (*cp == '!') { if (*cp == '!') {
debug("eval%d !", ops - eval_ops); debug("eval%d !", ops - eval_ops);
cp++; cp++;
if (eval_unary(ops, valp, &cp) == LT_IF) if (eval_unary(ops, valp, &cp) == LT_IF) {
*cpp = cp;
return (LT_IF); return (LT_IF);
}
*valp = !*valp; *valp = !*valp;
} else if (*cp == '(') { } else if (*cp == '(') {
cp++; cp++;
@ -700,13 +702,16 @@ eval_unary(const struct ops *ops, int *valp, const char **cpp)
return (LT_IF); return (LT_IF);
cp = skipcomment(cp); cp = skipcomment(cp);
sym = findsym(cp); sym = findsym(cp);
if (sym < 0)
return (LT_IF);
*valp = (value[sym] != NULL);
cp = skipsym(cp); cp = skipsym(cp);
cp = skipcomment(cp); cp = skipcomment(cp);
if (*cp++ != ')') if (*cp++ != ')')
return (LT_IF); return (LT_IF);
if (sym >= 0)
*valp = (value[sym] != NULL);
else {
*cpp = cp;
return (LT_IF);
}
keepthis = false; keepthis = false;
} else if (!endsym(*cp)) { } else if (!endsym(*cp)) {
debug("eval%d symbol", ops - eval_ops); debug("eval%d symbol", ops - eval_ops);
@ -741,11 +746,11 @@ eval_table(const struct ops *ops, int *valp, const char **cpp)
const struct op *op; const struct op *op;
const char *cp; const char *cp;
int val; int val;
Linetype lhs, rhs;
debug("eval%d", ops - eval_ops); debug("eval%d", ops - eval_ops);
cp = *cpp; cp = *cpp;
if (ops->inner(ops+1, valp, &cp) == LT_IF) lhs = ops->inner(ops+1, valp, &cp);
return (LT_IF);
for (;;) { for (;;) {
cp = skipcomment(cp); cp = skipcomment(cp);
for (op = ops->op; op->str != NULL; op++) for (op = ops->op; op->str != NULL; op++)
@ -755,14 +760,32 @@ eval_table(const struct ops *ops, int *valp, const char **cpp)
break; break;
cp += strlen(op->str); cp += strlen(op->str);
debug("eval%d %s", ops - eval_ops, op->str); debug("eval%d %s", ops - eval_ops, op->str);
if (ops->inner(ops+1, &val, &cp) == LT_IF) rhs = ops->inner(ops+1, &val, &cp);
return (LT_IF); if (op->fn == op_and && (lhs == LT_FALSE || rhs == LT_FALSE)) {
debug("eval%d: and always false", ops - eval_ops);
if (lhs == LT_IF)
*valp = val;
lhs = LT_FALSE;
continue;
}
if (op->fn == op_or && (lhs == LT_TRUE || rhs == LT_TRUE)) {
debug("eval%d: or always true", ops - eval_ops);
if (lhs == LT_IF)
*valp = val;
lhs = LT_TRUE;
continue;
}
if (rhs == LT_IF)
lhs = LT_IF;
if (lhs != LT_IF)
*valp = op->fn(*valp, val); *valp = op->fn(*valp, val);
} }
*cpp = cp; *cpp = cp;
debug("eval%d = %d", ops - eval_ops, *valp); debug("eval%d = %d", ops - eval_ops, *valp);
return (*valp ? LT_TRUE : LT_FALSE); if (lhs != LT_IF)
lhs = (*valp ? LT_TRUE : LT_FALSE);
return lhs;
} }
/* /*
@ -773,12 +796,15 @@ eval_table(const struct ops *ops, int *valp, const char **cpp)
static Linetype static Linetype
ifeval(const char **cpp) ifeval(const char **cpp)
{ {
const char *cp = *cpp;
int ret; int ret;
int val; int val;
debug("eval %s", *cpp); debug("eval %s", *cpp);
keepthis = killconsts ? false : true; keepthis = killconsts ? false : true;
ret = eval_table(eval_ops, &val, cpp); ret = eval_table(eval_ops, &val, &cp);
if (ret != LT_IF)
*cpp = cp;
debug("eval = %d", val); debug("eval = %d", val);
return (keepthis ? LT_IF : ret); return (keepthis ? LT_IF : ret);
} }

View File

@ -65,7 +65,7 @@ sed -n -e '/^.*\/libc-\([^/]*\)\.so$/{s//\1/;p;q}' < /proc/self/maps
ldd -v > /dev/null 2>&1 && ldd -v || ldd --version |head -n 1 | awk \ ldd -v > /dev/null 2>&1 && ldd -v || ldd --version |head -n 1 | awk \
'NR==1{print "Dynamic linker (ldd) ", $NF}' 'NR==1{print "Dynamic linker (ldd) ", $NF}'
ls -l /usr/lib/lib{g,stdc}++.so 2>/dev/null | awk -F. \ ls -l /usr/lib/libg++.so /usr/lib/libstdc++.so 2>/dev/null | awk -F. \
'{print "Linux C++ Library " $4"."$5"."$6}' '{print "Linux C++ Library " $4"."$5"."$6}'
ps --version 2>&1 | grep version | awk \ ps --version 2>&1 | grep version | awk \