Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild

* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild: (79 commits)
  Remove references to "make dep"
  kconfig: document use of HAVE_*
  Introduce new section reference annotations tags: __ref, __refdata, __refconst
  kbuild: warn about ld added unique sections
  kbuild: add verbose option to Section mismatch reporting in modpost
  kconfig: tristate choices with mixed tristate and boolean values
  asm-generic/vmlix.lds.h: simplify __mem{init,exit}* dependencies
  remove __attribute_used__
  kbuild: support ARCH=x86 in buildtar
  kconfig: remove "enable"
  kbuild: simplified warning report in modpost
  kbuild: introduce a few helpers in modpost
  kbuild: use simpler section mismatch warnings in modpost
  kbuild: link vmlinux.o before kallsyms passes
  kbuild: introduce new option to enhance section mismatch analysis
  Use separate sections for __dev/__cpu/__mem code/data
  compiler.h: introduce __section()
  all archs: consolidate init and exit sections in vmlinux.lds.h
  kbuild: check section names consistently in modpost
  kbuild: introduce blacklisting in modpost
  ...
This commit is contained in:
Linus Torvalds 2008-01-29 22:46:14 +11:00
commit 5ea293a904
110 changed files with 1843 additions and 1153 deletions

1
.gitignore vendored
View File

@ -17,6 +17,7 @@
*.i
*.lst
*.symtypes
*.order
#
# Top-level generic files

View File

@ -24,7 +24,7 @@ visible if its parent entry is also visible.
Menu entries
------------
Most entries define a config option, all other entries help to organize
Most entries define a config option; all other entries help to organize
them. A single configuration option is defined like this:
config MODVERSIONS
@ -50,7 +50,7 @@ applicable everywhere (see syntax).
- type definition: "bool"/"tristate"/"string"/"hex"/"int"
Every config option must have a type. There are only two basic types:
tristate and string, the other types are based on these two. The type
tristate and string; the other types are based on these two. The type
definition optionally accepts an input prompt, so these two examples
are equivalent:
@ -108,7 +108,7 @@ applicable everywhere (see syntax).
equal to 'y' without visiting the dependencies. So abusing
select you are able to select a symbol FOO even if FOO depends
on BAR that is not set. In general use select only for
non-visible symbols (no promts anywhere) and for symbols with
non-visible symbols (no prompts anywhere) and for symbols with
no dependencies. That will limit the usefulness but on the
other hand avoid the illegal configurations all over. kconfig
should one day warn about such things.
@ -127,6 +127,27 @@ applicable everywhere (see syntax).
used to help visually separate configuration logic from help within
the file as an aid to developers.
- misc options: "option" <symbol>[=<value>]
Various less common options can be defined via this option syntax,
which can modify the behaviour of the menu entry and its config
symbol. These options are currently possible:
- "defconfig_list"
This declares a list of default entries which can be used when
looking for the default configuration (which is used when the main
.config doesn't exists yet.)
- "modules"
This declares the symbol to be used as the MODULES symbol, which
enables the third modular state for all config symbols.
- "env"=<value>
This imports the environment variable into Kconfig. It behaves like
a default, except that the value comes from the environment, this
also means that the behaviour when mixing it with normal defaults is
undefined at this point. The symbol is currently not exported back
to the build environment (if this is desired, it can be done via
another symbol).
Menu dependencies
-----------------
@ -162,9 +183,9 @@ An expression can have a value of 'n', 'm' or 'y' (or 0, 1, 2
respectively for calculations). A menu entry becomes visible when it's
expression evaluates to 'm' or 'y'.
There are two types of symbols: constant and nonconstant symbols.
Nonconstant symbols are the most common ones and are defined with the
'config' statement. Nonconstant symbols consist entirely of alphanumeric
There are two types of symbols: constant and non-constant symbols.
Non-constant symbols are the most common ones and are defined with the
'config' statement. Non-constant symbols consist entirely of alphanumeric
characters or underscores.
Constant symbols are only part of expressions. Constant symbols are
always surrounded by single or double quotes. Within the quote, any
@ -301,3 +322,81 @@ mainmenu:
This sets the config program's title bar if the config program chooses
to use it.
Kconfig hints
-------------
This is a collection of Kconfig tips, most of which aren't obvious at
first glance and most of which have become idioms in several Kconfig
files.
Adding common features and make the usage configurable
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It is a common idiom to implement a feature/functionality that are
relevant for some architectures but not all.
The recommended way to do so is to use a config variable named HAVE_*
that is defined in a common Kconfig file and selected by the relevant
architectures.
An example is the generic IOMAP functionality.
We would in lib/Kconfig see:
# Generic IOMAP is used to ...
config HAVE_GENERIC_IOMAP
config GENERIC_IOMAP
depends on HAVE_GENERIC_IOMAP && FOO
And in lib/Makefile we would see:
obj-$(CONFIG_GENERIC_IOMAP) += iomap.o
For each architecture using the generic IOMAP functionality we would see:
config X86
select ...
select HAVE_GENERIC_IOMAP
select ...
Note: we use the existing config option and avoid creating a new
config variable to select HAVE_GENERIC_IOMAP.
Note: the use of the internal config variable HAVE_GENERIC_IOMAP, it is
introduced to overcome the limitation of select which will force a
config option to 'y' no matter the dependencies.
The dependencies are moved to the symbol GENERIC_IOMAP and we avoid the
situation where select forces a symbol equals to 'y'.
Build as module only
~~~~~~~~~~~~~~~~~~~~
To restrict a component build to module-only, qualify its config symbol
with "depends on m". E.g.:
config FOO
depends on BAR && m
limits FOO to module (=m) or disabled (=n).
Build limited by a third config symbol which may be =y or =m
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A common idiom that we see (and sometimes have problems with) is this:
When option C in B (module or subsystem) uses interfaces from A (module
or subsystem), and both A and B are tristate (could be =y or =m if they
were independent of each other, but they aren't), then we need to limit
C such that it cannot be built statically if A is built as a loadable
module. (C already depends on B, so there is no dependency issue to
take care of here.)
If A is linked statically into the kernel image, C can be built
statically or as loadable module(s). However, if A is built as loadable
module(s), then C must be restricted to loadable module(s) also. This
can be expressed in kconfig language as:
config C
depends on A = y || A = B
or for real examples, use this command in a kernel tree:
$ find . -name Kconfig\* | xargs grep -ns "depends on.*=.*||.*=" | grep -v orig

View File

@ -520,6 +520,11 @@ KBUILD_CFLAGS += -g
KBUILD_AFLAGS += -gdwarf-2
endif
# We trigger additional mismatches with less inlining
ifdef CONFIG_DEBUG_SECTION_MISMATCH
KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once)
endif
# Force gcc to behave correct even for buggy distributions
KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
@ -793,7 +798,7 @@ define rule_vmlinux-modpost
endef
# vmlinux image - including updated kernel symbols
vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) vmlinux.o FORCE
vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) vmlinux.o $(kallsyms.o) FORCE
ifdef CONFIG_HEADERS_CHECK
$(Q)$(MAKE) -f $(srctree)/Makefile headers_check
endif
@ -804,7 +809,9 @@ endif
$(call if_changed_rule,vmlinux__)
$(Q)rm -f .old_version
vmlinux.o: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE
# build vmlinux.o first to catch section mismatch errors early
$(kallsyms.o): vmlinux.o
vmlinux.o: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) FORCE
$(call if_changed_rule,vmlinux-modpost)
# The actual objects are generated when descending,
@ -1021,9 +1028,14 @@ ifdef CONFIG_MODULES
all: modules
# Build modules
#
# A module can be listed more than once in obj-m resulting in
# duplicate lines in modules.order files. Those are removed
# using awk while concatenating to the final file.
PHONY += modules
modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)
$(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order
@echo ' Building modules, stage 2.';
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
@ -1051,6 +1063,7 @@ _modinst_:
rm -f $(MODLIB)/build ; \
ln -s $(objtree) $(MODLIB)/build ; \
fi
@cp -f $(objtree)/modules.order $(MODLIB)/
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
# This depmod is only for convenience to give the initial
@ -1110,7 +1123,7 @@ clean: archclean $(clean-dirs)
@find . $(RCS_FIND_IGNORE) \
\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
-o -name '*.symtypes' \) \
-o -name '*.symtypes' -o -name 'modules.order' \) \
-type f -print | xargs rm -f
# mrproper - Delete all generated files, including .config
@ -1175,7 +1188,7 @@ help:
@echo ' dir/ - Build all files in dir and below'
@echo ' dir/file.[ois] - Build specified target only'
@echo ' dir/file.ko - Build module including final link'
@echo ' rpm - Build a kernel as an RPM package'
@echo ' prepare - Set up for building external modules'
@echo ' tags/TAGS - Generate tags file for editors'
@echo ' cscope - Generate cscope index'
@echo ' kernelrelease - Output the release version string'
@ -1188,6 +1201,8 @@ help:
@echo 'Static analysers'
@echo ' checkstack - Generate a list of stack hogs'
@echo ' namespacecheck - Name space analysis on compiled kernel'
@echo ' versioncheck - Sanity check on version.h usage'
@echo ' includecheck - Check for duplicate included header files'
@echo ' export_report - List the usages of all exported symbols'
@if [ -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \
echo ' headers_check - Sanity check on exported headers'; \
@ -1371,6 +1386,7 @@ define xtags
if $1 --version 2>&1 | grep -iq exuberant; then \
$(all-sources) | xargs $1 -a \
-I __initdata,__exitdata,__acquires,__releases \
-I __read_mostly,____cacheline_aligned,____cacheline_aligned_in_smp,____cacheline_internodealigned_in_smp \
-I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \
--extra=+f --c-kinds=+px \
--regex-asm='/^ENTRY\(([^)]*)\).*/\1/'; \
@ -1428,12 +1444,12 @@ tags: FORCE
includecheck:
find * $(RCS_FIND_IGNORE) \
-name '*.[hcS]' -type f -print | sort \
| xargs $(PERL) -w scripts/checkincludes.pl
| xargs $(PERL) -w $(srctree)/scripts/checkincludes.pl
versioncheck:
find * $(RCS_FIND_IGNORE) \
-name '*.[hcS]' -type f -print | sort \
| xargs $(PERL) -w scripts/checkversion.pl
| xargs $(PERL) -w $(srctree)/scripts/checkversion.pl
namespacecheck:
$(PERL) $(srctree)/scripts/namespace.pl

View File

@ -46,11 +46,11 @@ SECTIONS
__init_begin = .;
.init.text : {
_sinittext = .;
*(.init.text)
INIT_TEXT
_einittext = .;
}
.init.data : {
*(.init.data)
INIT_DATA
}
. = ALIGN(16);
@ -136,8 +136,8 @@ SECTIONS
/* Sections to be discarded */
/DISCARD/ : {
*(.exit.text)
*(.exit.data)
EXIT_TEXT
EXIT_DATA
*(.exitcall.exit)
}

View File

@ -30,8 +30,7 @@ _atomic_dec_and_lock: \n\
.previous \n\
.end _atomic_dec_and_lock");
static int __attribute_used__
atomic_dec_and_lock_1(atomic_t *atomic, spinlock_t *lock)
static int __used atomic_dec_and_lock_1(atomic_t *atomic, spinlock_t *lock)
{
/* Slow path */
spin_lock(lock);

View File

@ -30,7 +30,7 @@ SECTIONS
}
.init : { /* Init code and data */
*(.init.text)
INIT_TEXT
_einittext = .;
__proc_info_begin = .;
*(.proc.info.init)
@ -70,15 +70,15 @@ SECTIONS
__per_cpu_end = .;
#ifndef CONFIG_XIP_KERNEL
__init_begin = _stext;
*(.init.data)
INIT_DATA
. = ALIGN(4096);
__init_end = .;
#endif
}
/DISCARD/ : { /* Exit code and data */
*(.exit.text)
*(.exit.data)
EXIT_TEXT
EXIT_DATA
*(.exitcall.exit)
#ifndef CONFIG_MMU
*(.fixup)
@ -130,7 +130,7 @@ SECTIONS
#ifdef CONFIG_XIP_KERNEL
. = ALIGN(4096);
__init_begin = .;
*(.init.data)
INIT_DATA
. = ALIGN(4096);
__init_end = .;
#endif

View File

@ -1,9 +1,6 @@
#
# Makefile for the linux kernel.
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
# Object file lists.

View File

@ -1,9 +1,6 @@
#
# Makefile for the linux kernel.
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
# Object file lists.

View File

@ -27,19 +27,19 @@ SECTIONS
__init_begin = .;
_sinittext = .;
*(.text.reset)
*(.init.text)
INIT_TEXT
/*
* .exit.text is discarded at runtime, not
* link time, to deal with references from
* __bug_table
*/
*(.exit.text)
EXIT_TEXT
_einittext = .;
. = ALIGN(4);
__tagtable_begin = .;
*(.taglist.init)
__tagtable_end = .;
*(.init.data)
INIT_DATA
. = ALIGN(16);
__setup_start = .;
*(.init.setup)
@ -135,7 +135,7 @@ SECTIONS
* thrown away, as cleanup code is never called unless it's a module.
*/
/DISCARD/ : {
*(.exit.data)
EXIT_DATA
*(.exitcall.exit)
}

View File

@ -91,13 +91,13 @@ SECTIONS
{
. = ALIGN(PAGE_SIZE);
__sinittext = .;
*(.init.text)
INIT_TEXT
__einittext = .;
}
.init.data :
{
. = ALIGN(16);
*(.init.data)
INIT_DATA
}
.init.setup :
{
@ -198,8 +198,8 @@ SECTIONS
/DISCARD/ :
{
*(.exit.text)
*(.exit.data)
EXIT_TEXT
EXIT_DATA
*(.exitcall.exit)
}
}

View File

@ -57,10 +57,10 @@ SECTIONS
__init_begin = .;
.init.text : {
_sinittext = .;
*(.init.text)
INIT_TEXT
_einittext = .;
}
.init.data : { *(.init.data) }
.init.data : { INIT_DATA }
. = ALIGN(16);
__setup_start = .;
.init.setup : { *(.init.setup) }
@ -109,8 +109,8 @@ SECTIONS
/* Sections to be discarded */
/DISCARD/ : {
*(.text.exit)
*(.data.exit)
EXIT_TEXT
EXIT_DATA
*(.exitcall.exit)
}

View File

@ -7,7 +7,7 @@
target = $(target_compressed_dir)
src = $(src_compressed_dir)
CC = gcc-cris -mlinux -march=v32 -I $(TOPDIR)/include
CC = gcc-cris -mlinux -march=v32 $(LINUXINCLUDE)
CFLAGS = -O2
LD = gcc-cris -mlinux -march=v32 -nostdlib
OBJCOPY = objcopy-cris

View File

@ -61,10 +61,10 @@ SECTIONS
__init_begin = .;
.init.text : {
_sinittext = .;
*(.init.text)
INIT_TEXT
_einittext = .;
}
.init.data : { *(.init.data) }
.init.data : { INIT_DATA }
. = ALIGN(16);
__setup_start = .;
.init.setup : { *(.init.setup) }
@ -124,8 +124,8 @@ SECTIONS
/* Sections to be discarded */
/DISCARD/ : {
*(.text.exit)
*(.data.exit)
EXIT_TEXT
EXIT_DATA
*(.exitcall.exit)
}

View File

@ -10,7 +10,7 @@
targets := Image zImage bootpImage
SYSTEM =$(TOPDIR)/$(LINUX)
SYSTEM =$(LINUX)
ZTEXTADDR = 0x02080000
PARAMS_PHYS = 0x0207c000
@ -45,7 +45,7 @@ zImage: $(CONFIGURE) compressed/$(LINUX)
bootpImage: bootp/bootp
$(OBJCOPY) -O binary -R .note -R .comment -S bootp/bootp $@
compressed/$(LINUX): $(TOPDIR)/$(LINUX) dep
compressed/$(LINUX): $(LINUX) dep
@$(MAKE) -C compressed $(LINUX)
bootp/bootp: zImage initrd
@ -59,10 +59,10 @@ initrd:
# installation
#
install: $(CONFIGURE) Image
sh ./install.sh $(KERNELRELEASE) Image $(TOPDIR)/System.map "$(INSTALL_PATH)"
sh ./install.sh $(KERNELRELEASE) Image System.map "$(INSTALL_PATH)"
zinstall: $(CONFIGURE) zImage
sh ./install.sh $(KERNELRELEASE) zImage $(TOPDIR)/System.map "$(INSTALL_PATH)"
sh ./install.sh $(KERNELRELEASE) zImage System.map "$(INSTALL_PATH)"
#
# miscellany

View File

@ -87,7 +87,7 @@
* Example:
* $ cd ~/linux
* $ make menuconfig <go to "Kernel Hacking" and turn on remote debugging>
* $ make dep; make vmlinux
* $ make vmlinux
*
* Step 3:
* Download the kernel to the remote target and start

View File

@ -28,14 +28,14 @@ SECTIONS
.init.text : {
*(.text.head)
#ifndef CONFIG_DEBUG_INFO
*(.init.text)
*(.exit.text)
*(.exit.data)
INIT_TEXT
EXIT_TEXT
EXIT_DATA
*(.exitcall.exit)
#endif
}
_einittext = .;
.init.data : { *(.init.data) }
.init.data : { INIT_DATA }
. = ALIGN(8);
__setup_start = .;
@ -106,8 +106,8 @@ SECTIONS
LOCK_TEXT
#ifdef CONFIG_DEBUG_INFO
*(
.init.text
.exit.text
INIT_TEXT
EXIT_TEXT
.exitcall.exit
)
#endif
@ -138,7 +138,7 @@ SECTIONS
.data : { /* Data */
DATA_DATA
*(.data.*)
*(.exit.data)
EXIT_DATA
CONSTRUCTORS
}

View File

@ -110,9 +110,9 @@ SECTIONS
. = ALIGN(0x4) ;
___init_begin = .;
__sinittext = .;
*(.init.text)
INIT_TEXT
__einittext = .;
*(.init.data)
INIT_DATA
. = ALIGN(0x4) ;
___setup_start = .;
*(.init.setup)
@ -124,8 +124,8 @@ SECTIONS
___con_initcall_start = .;
*(.con_initcall.init)
___con_initcall_end = .;
*(.exit.text)
*(.exit.data)
EXIT_TEXT
EXIT_DATA
#if defined(CONFIG_BLK_DEV_INITRD)
. = ALIGN(4);
___initramfs_start = .;

View File

@ -27,8 +27,8 @@ SECTIONS
{
/* Sections to be discarded */
/DISCARD/ : {
*(.exit.text)
*(.exit.data)
EXIT_TEXT
EXIT_DATA
*(.exitcall.exit)
*(.IA_64.unwind.exit.text)
*(.IA_64.unwind_info.exit.text)
@ -119,12 +119,12 @@ SECTIONS
.init.text : AT(ADDR(.init.text) - LOAD_OFFSET)
{
_sinittext = .;
*(.init.text)
INIT_TEXT
_einittext = .;
}
.init.data : AT(ADDR(.init.data) - LOAD_OFFSET)
{ *(.init.data) }
{ INIT_DATA }
#ifdef CONFIG_BLK_DEV_INITRD
.init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET)

View File

@ -76,10 +76,10 @@ SECTIONS
__init_begin = .;
.init.text : {
_sinittext = .;
*(.init.text)
INIT_TEXT
_einittext = .;
}
.init.data : { *(.init.data) }
.init.data : { INIT_DATA }
. = ALIGN(16);
__setup_start = .;
.init.setup : { *(.init.setup) }
@ -100,8 +100,8 @@ SECTIONS
.altinstr_replacement : { *(.altinstr_replacement) }
/* .exit.text is discard at runtime, not link time, to deal with references
from .altinstructions and .eh_frame */
.exit.text : { *(.exit.text) }
.exit.data : { *(.exit.data) }
.exit.text : { EXIT_TEXT }
.exit.data : { EXIT_DATA }
#ifdef CONFIG_BLK_DEV_INITRD
. = ALIGN(4096);
@ -124,8 +124,8 @@ SECTIONS
/* Sections to be discarded */
/DISCARD/ : {
*(.exit.text)
*(.exit.data)
EXIT_TEXT
EXIT_DATA
*(.exitcall.exit)
}

View File

@ -45,10 +45,10 @@ SECTIONS
__init_begin = .;
.init.text : {
_sinittext = .;
*(.init.text)
INIT_TEXT
_einittext = .;
}
.init.data : { *(.init.data) }
.init.data : { INIT_DATA }
. = ALIGN(16);
__setup_start = .;
.init.setup : { *(.init.setup) }
@ -82,8 +82,8 @@ SECTIONS
/* Sections to be discarded */
/DISCARD/ : {
*(.exit.text)
*(.exit.data)
EXIT_TEXT
EXIT_DATA
*(.exitcall.exit)
}

View File

@ -38,10 +38,10 @@ SECTIONS
__init_begin = .;
.init.text : {
_sinittext = .;
*(.init.text)
INIT_TEXT
_einittext = .;
}
.init.data : { *(.init.data) }
.init.data : { INIT_DATA }
. = ALIGN(16);
__setup_start = .;
.init.setup : { *(.init.setup) }
@ -77,8 +77,8 @@ __init_begin = .;
/* Sections to be discarded */
/DISCARD/ : {
*(.exit.text)
*(.exit.data)
EXIT_TEXT
EXIT_DATA
*(.exitcall.exit)
}

View File

@ -143,9 +143,9 @@ SECTIONS {
. = ALIGN(4096);
__init_begin = .;
_sinittext = .;
*(.init.text)
INIT_TEXT
_einittext = .;
*(.init.data)
INIT_DATA
. = ALIGN(16);
__setup_start = .;
*(.init.setup)
@ -170,8 +170,8 @@ SECTIONS {
} > INIT
/DISCARD/ : {
*(.exit.text)
*(.exit.data)
EXIT_TEXT
EXIT_DATA
*(.exitcall.exit)
}

View File

@ -114,11 +114,11 @@ SECTIONS
__init_begin = .;
.init.text : {
_sinittext = .;
*(.init.text)
INIT_TEXT
_einittext = .;
}
.init.data : {
*(.init.data)
INIT_DATA
}
. = ALIGN(16);
.init.setup : {
@ -144,10 +144,10 @@ SECTIONS
* references from .rodata
*/
.exit.text : {
*(.exit.text)
EXIT_TEXT
}
.exit.data : {
*(.exit.data)
EXIT_DATA
}
#if defined(CONFIG_BLK_DEV_INITRD)
. = ALIGN(_PAGE_SIZE);

View File

@ -1,10 +1,6 @@
#
# Makefile for common code for Toshiba TX4927 based systems
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
#
obj-y += tx4927_prom.o tx4927_setup.o tx4927_irq.o

View File

@ -1,10 +1,6 @@
#
# Makefile for common code for Toshiba TX4927 based systems
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
#
obj-y += prom.o setup.o irq.o
obj-$(CONFIG_KGDB) += dbgio.o

View File

@ -1,10 +1,6 @@
#
# Makefile for common code for Toshiba TX4927 based systems
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
#
obj-y += prom.o setup.o irq.o spi_eeprom.o

View File

@ -172,11 +172,11 @@ SECTIONS
__init_begin = .;
.init.text : {
_sinittext = .;
*(.init.text)
INIT_TEXT
_einittext = .;
}
.init.data : {
*(.init.data)
INIT_DATA
}
. = ALIGN(16);
.init.setup : {
@ -215,10 +215,10 @@ SECTIONS
* from .altinstructions and .eh_frame
*/
.exit.text : {
*(.exit.text)
EXIT_TEXT
}
.exit.data : {
*(.exit.data)
EXIT_DATA
}
#ifdef CONFIG_BLK_DEV_INITRD
. = ALIGN(PAGE_SIZE);

View File

@ -65,7 +65,7 @@ obj-wlib := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-wlib))))
obj-plat := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-plat))))
quiet_cmd_copy_zlib = COPY $@
cmd_copy_zlib = sed "s@__attribute_used__@@;s@<linux/\([^>]*\).*@\"\1\"@" $< > $@
cmd_copy_zlib = sed "s@__used@@;s@<linux/\([^>]*\).*@\"\1\"@" $< > $@
quiet_cmd_copy_zlibheader = COPY $@
cmd_copy_zlibheader = sed "s@<linux/\([^>]*\).*@\"\1\"@" $< > $@

View File

@ -158,7 +158,7 @@ static ssize_t show_##NAME(struct sys_device *dev, char *buf) \
unsigned long val = run_on_cpu(cpu->sysdev.id, read_##NAME, 0); \
return sprintf(buf, "%lx\n", val); \
} \
static ssize_t __attribute_used__ \
static ssize_t __used \
store_##NAME(struct sys_device *dev, const char *buf, size_t count) \
{ \
struct cpu *cpu = container_of(dev, struct cpu, sysdev); \

View File

@ -23,7 +23,7 @@ SECTIONS
/* Sections to be discarded. */
/DISCARD/ : {
*(.exitcall.exit)
*(.exit.data)
EXIT_DATA
}
. = KERNELBASE;
@ -76,17 +76,19 @@ SECTIONS
.init.text : {
_sinittext = .;
*(.init.text)
INIT_TEXT
_einittext = .;
}
/* .exit.text is discarded at runtime, not link time,
* to deal with references from __bug_table
*/
.exit.text : { *(.exit.text) }
.exit.text : {
EXIT_TEXT
}
.init.data : {
*(.init.data);
INIT_DATA
__vtop_table_begin = .;
*(.vtop_fixup);
__vtop_table_end = .;

View File

@ -172,15 +172,15 @@ static void power4_stop(void)
}
/* Fake functions used by canonicalize_pc */
static void __attribute_used__ hypervisor_bucket(void)
static void __used hypervisor_bucket(void)
{
}
static void __attribute_used__ rtas_bucket(void)
static void __used rtas_bucket(void)
{
}
static void __attribute_used__ kernel_unknown_bucket(void)
static void __used kernel_unknown_bucket(void)
{
}

View File

@ -97,14 +97,14 @@ SECTIONS
__init_begin = .;
.init.text : {
_sinittext = .;
*(.init.text)
INIT_TEXT
_einittext = .;
}
/* .exit.text is discarded at runtime, not link time,
to deal with references from __bug_table */
.exit.text : { *(.exit.text) }
.exit.text : { EXIT_TEXT }
.init.data : {
*(.init.data);
INIT_DATA
__vtop_table_begin = .;
*(.vtop_fixup);
__vtop_table_end = .;
@ -164,6 +164,6 @@ SECTIONS
/* Sections to be discarded. */
/DISCARD/ : {
*(.exitcall.exit)
*(.exit.data)
EXIT_DATA
}
}

View File

@ -97,7 +97,7 @@ SECTIONS
__init_begin = .;
.init.text : {
_sinittext = .;
*(.init.text)
INIT_TEXT
_einittext = .;
}
/*
@ -105,11 +105,11 @@ SECTIONS
* to deal with references from __bug_table
*/
.exit.text : {
*(.exit.text)
EXIT_TEXT
}
.init.data : {
*(.init.data)
INIT_DATA
}
. = ALIGN(0x100);
.init.setup : {
@ -156,7 +156,7 @@ SECTIONS
/* Sections to be discarded */
/DISCARD/ : {
*(.exit.data)
EXIT_DATA
*(.exitcall.exit)
}

View File

@ -84,9 +84,9 @@ SECTIONS
. = ALIGN(PAGE_SIZE); /* Init code and data */
__init_begin = .;
_sinittext = .;
.init.text : { *(.init.text) }
.init.text : { INIT_TEXT }
_einittext = .;
.init.data : { *(.init.data) }
.init.data : { INIT_DATA }
. = ALIGN(16);
__setup_start = .;
@ -122,8 +122,8 @@ SECTIONS
* .exit.text is discarded at runtime, not link time, to deal with
* references from __bug_table
*/
.exit.text : { *(.exit.text) }
.exit.data : { *(.exit.data) }
.exit.text : { EXIT_TEXT }
.exit.data : { EXIT_DATA }
. = ALIGN(PAGE_SIZE);
.bss : {

View File

@ -96,9 +96,9 @@ SECTIONS
. = ALIGN(PAGE_SIZE); /* Init code and data */
__init_begin = .;
_sinittext = .;
.init.text : C_PHYS(.init.text) { *(.init.text) }
.init.text : C_PHYS(.init.text) { INIT_TEXT }
_einittext = .;
.init.data : C_PHYS(.init.data) { *(.init.data) }
.init.data : C_PHYS(.init.data) { INIT_DATA }
. = ALIGN(L1_CACHE_BYTES); /* Better if Cache Line aligned */
__setup_start = .;
.init.setup : C_PHYS(.init.setup) { *(.init.setup) }
@ -134,8 +134,8 @@ SECTIONS
* .exit.text is discarded at runtime, not link time, to deal with
* references from __bug_table
*/
.exit.text : C_PHYS(.exit.text) { *(.exit.text) }
.exit.data : C_PHYS(.exit.data) { *(.exit.data) }
.exit.text : C_PHYS(.exit.text) { EXIT_TEXT }
.exit.data : C_PHYS(.exit.data) { EXIT_DATA }
. = ALIGN(PAGE_SIZE);
.bss : C_PHYS(.bss) {

View File

@ -48,12 +48,12 @@ SECTIONS
__init_begin = .;
.init.text : {
_sinittext = .;
*(.init.text)
INIT_TEXT
_einittext = .;
}
__init_text_end = .;
.init.data : {
*(.init.data)
INIT_DATA
}
. = ALIGN(16);
.init.setup : {
@ -102,8 +102,8 @@ SECTIONS
_end = . ;
PROVIDE (end = .);
/DISCARD/ : {
*(.exit.text)
*(.exit.data)
EXIT_TEXT
EXIT_DATA
*(.exitcall.exit)
}

View File

@ -175,7 +175,7 @@ unsigned long compute_effective_address(struct pt_regs *regs,
}
/* This is just to make gcc think die_if_kernel does return... */
static void __attribute_used__ unaligned_panic(char *str, struct pt_regs *regs)
static void __used unaligned_panic(char *str, struct pt_regs *regs)
{
die_if_kernel(str, regs);
}

View File

@ -56,11 +56,11 @@ SECTIONS
.init.text : {
__init_begin = .;
_sinittext = .;
*(.init.text)
INIT_TEXT
_einittext = .;
}
.init.data : {
*(.init.data)
INIT_DATA
}
. = ALIGN(16);
.init.setup : {
@ -137,8 +137,8 @@ SECTIONS
PROVIDE (end = .);
/DISCARD/ : {
*(.exit.text)
*(.exit.data)
EXIT_TEXT
EXIT_DATA
*(.exitcall.exit)
}

View File

@ -42,15 +42,15 @@ typedef void (*exitcall_t)(void);
/* These are for everybody (although not all archs will actually
discard it in modules) */
#define __init __attribute__ ((__section__ (".init.text")))
#define __initdata __attribute__ ((__section__ (".init.data")))
#define __exitdata __attribute__ ((__section__(".exit.data")))
#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))
#define __init __section(.init.text)
#define __initdata __section(.init.data)
#define __exitdata __section(.exit.data)
#define __exit_call __used __section(.exitcall.exit)
#ifdef MODULE
#define __exit __attribute__ ((__section__(".exit.text")))
#define __exit __section(.exit.text)
#else
#define __exit __attribute_used__ __attribute__ ((__section__(".exit.text")))
#define __exit __used __section(.exit.text)
#endif
#endif
@ -103,16 +103,16 @@ extern struct uml_param __uml_setup_start, __uml_setup_end;
* Mark functions and data as being only used at initialization
* or exit time.
*/
#define __uml_init_setup __attribute_used__ __attribute__ ((__section__ (".uml.setup.init")))
#define __uml_setup_help __attribute_used__ __attribute__ ((__section__ (".uml.help.init")))
#define __uml_init_call __attribute_used__ __attribute__ ((__section__ (".uml.initcall.init")))
#define __uml_postsetup_call __attribute_used__ __attribute__ ((__section__ (".uml.postsetup.init")))
#define __uml_exit_call __attribute_used__ __attribute__ ((__section__ (".uml.exitcall.exit")))
#define __uml_init_setup __used __section(.uml.setup.init)
#define __uml_setup_help __used __section(.uml.help.init)
#define __uml_init_call __used __section(.uml.initcall.init)
#define __uml_postsetup_call __used __section(.uml.postsetup.init)
#define __uml_exit_call __used __section(.uml.exitcall.exit)
#ifndef __KERNEL__
#define __define_initcall(level,fn) \
static initcall_t __initcall_##fn __attribute_used__ \
static initcall_t __initcall_##fn __used \
__attribute__((__section__(".initcall" level ".init"))) = fn
/* Userspace initcalls shouldn't depend on anything in the kernel, so we'll
@ -122,7 +122,7 @@ extern struct uml_param __uml_setup_start, __uml_setup_end;
#define __exitcall(fn) static exitcall_t __exitcall_##fn __exit_call = fn
#define __init_call __attribute_used__ __attribute__ ((__section__ (".initcall.init")))
#define __init_call __used __section(.initcall.init)
#endif

View File

@ -17,7 +17,7 @@ SECTIONS
__init_begin = .;
.init.text : {
_sinittext = .;
*(.init.text)
INIT_TEXT
_einittext = .;
}
@ -84,7 +84,7 @@ SECTIONS
#include "asm/common.lds.S"
init.data : { *(.init.data) }
init.data : { INIT_DATA }
/* Ensure the __preinit_array_start label is properly aligned. We
could instead move the label definition inside the section, but

View File

@ -23,7 +23,7 @@ SECTIONS
__init_begin = .;
.init.text : {
_sinittext = .;
*(.init.text)
INIT_TEXT
_einittext = .;
}
. = ALIGN(4096);
@ -48,7 +48,7 @@ SECTIONS
#include "asm/common.lds.S"
init.data : { *(init.data) }
init.data : { INIT_DATA }
.data :
{
. = ALIGN(KERNEL_STACK_SIZE); /* init_task */

View File

@ -114,7 +114,7 @@
#define DATA_CONTENTS \
__sdata = . ; \
DATA_DATA \
*(.exit.data) /* 2.5 convention */ \
EXIT_DATA /* 2.5 convention */ \
*(.data.exit) /* 2.4 convention */ \
. = ALIGN (16) ; \
*(.data.cacheline_aligned) \
@ -157,9 +157,9 @@
. = ALIGN (4096) ; \
__init_start = . ; \
__sinittext = .; \
*(.init.text) /* 2.5 convention */ \
INIT_TEXT /* 2.5 convention */ \
__einittext = .; \
*(.init.data) \
INIT_DATA \
*(.text.init) /* 2.4 convention */ \
*(.data.init) \
INITCALL_CONTENTS \
@ -170,7 +170,7 @@
#define ROMK_INIT_RAM_CONTENTS \
. = ALIGN (4096) ; \
__init_start = . ; \
*(.init.data) /* 2.5 convention */ \
INIT_DATA /* 2.5 convention */ \
*(.data.init) /* 2.4 convention */ \
__init_end = . ; \
. = ALIGN (4096) ;
@ -179,7 +179,7 @@
should go into ROM. */
#define ROMK_INIT_ROM_CONTENTS \
_sinittext = .; \
*(.init.text) /* 2.5 convention */ \
INIT_TEXT /* 2.5 convention */ \
_einittext = .; \
*(.text.init) /* 2.4 convention */ \
INITCALL_CONTENTS \

View File

@ -131,10 +131,12 @@ SECTIONS
.init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
__init_begin = .;
_sinittext = .;
*(.init.text)
INIT_TEXT
_einittext = .;
}
.init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) }
.init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {
INIT_DATA
}
. = ALIGN(16);
.init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) {
__setup_start = .;
@ -169,8 +171,12 @@ SECTIONS
}
/* .exit.text is discard at runtime, not link time, to deal with references
from .altinstructions and .eh_frame */
.exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) }
.exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) }
.exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) {
EXIT_TEXT
}
.exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) {
EXIT_DATA
}
#if defined(CONFIG_BLK_DEV_INITRD)
. = ALIGN(4096);
.init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {

View File

@ -155,12 +155,15 @@ SECTIONS
__init_begin = .;
.init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
_sinittext = .;
*(.init.text)
INIT_TEXT
_einittext = .;
}
__initdata_begin = .;
.init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) }
__initdata_end = .;
.init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {
__initdata_begin = .;
INIT_DATA
__initdata_end = .;
}
. = ALIGN(16);
__setup_start = .;
.init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { *(.init.setup) }
@ -187,8 +190,12 @@ SECTIONS
}
/* .exit.text is discard at runtime, not link time, to deal with references
from .altinstructions and .eh_frame */
.exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) }
.exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) }
.exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) {
EXIT_TEXT
}
.exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) {
EXIT_DATA
}
/* vdso blob that is mapped into user space */
vdso_start = . ;

View File

@ -136,13 +136,13 @@ SECTIONS
__init_begin = .;
.init.text : {
_sinittext = .;
*(.init.literal) *(.init.text)
*(.init.literal) INIT_TEXT
_einittext = .;
}
.init.data :
{
*(.init.data)
INIT_DATA
. = ALIGN(0x4);
__tagtable_begin = .;
*(.taglist)
@ -278,8 +278,9 @@ SECTIONS
/* Sections to be discarded */
/DISCARD/ :
{
*(.exit.literal .exit.text)
*(.exit.data)
*(.exit.literal)
EXIT_TEXT
EXIT_DATA
*(.exitcall.exit)
}

View File

@ -1,9 +1,5 @@
#
# Makefile for the Linux/Xtensa-specific parts of the memory manager.
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
#
obj-y := init.o fault.o tlb.o misc.o cache.o

View File

@ -3,11 +3,6 @@
# Makefile for the Xtensa Instruction Set Simulator (ISS)
# "prom monitor" library routines under Linux.
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
#
# Note 2! The CFLAGS definitions are in the main makefile...
obj-y = io.o console.o setup.o network.o

View File

@ -2,9 +2,5 @@ obj-$(CONFIG_PM) += sysfs.o
obj-$(CONFIG_PM_SLEEP) += main.o
obj-$(CONFIG_PM_TRACE) += trace.o
ifeq ($(CONFIG_DEBUG_DRIVER),y)
EXTRA_CFLAGS += -DDEBUG
endif
ifeq ($(CONFIG_PM_VERBOSE),y)
EXTRA_CFLAGS += -DDEBUG
endif
ccflags-$(CONFIG_DEBUG_DRIVER) := -DDEBUG
ccflags-$(CONFIG_PM_VERBOSE) += -DDEBUG

View File

@ -1,5 +1,4 @@
EXTRA_CFLAGS += -I$(TOPDIR)/drivers/net/cxgb3 \
-I$(TOPDIR)/drivers/infiniband/hw/cxgb3/core
EXTRA_CFLAGS += -Idrivers/net/cxgb3
obj-$(CONFIG_INFINIBAND_CXGB3) += iw_cxgb3.o

View File

@ -31,8 +31,8 @@ extern struct rio_route_ops __end_rio_route_ops[];
/* Helpers internal to the RIO core code */
#define DECLARE_RIO_ROUTE_SECTION(section, vid, did, add_hook, get_hook) \
static struct rio_route_ops __rio_route_ops __attribute_used__ \
__attribute__((__section__(#section))) = { vid, did, add_hook, get_hook };
static struct rio_route_ops __rio_route_ops __used \
__section(section)= { vid, did, add_hook, get_hook };
/**
* DECLARE_RIO_ROUTE_OPS - Registers switch routing operations

View File

@ -1376,7 +1376,7 @@ static int do_atm_ioctl(unsigned int fd, unsigned int cmd32, unsigned long arg)
return -EINVAL;
}
static __attribute_used__ int
static __used int
ret_einval(unsigned int fd, unsigned int cmd, unsigned long arg)
{
return -EINVAL;

View File

@ -16,23 +16,3 @@ EXTRA_CFLAGS += -DSMBFS_PARANOIA
#EXTRA_CFLAGS += -DDEBUG_SMB_TIMESTAMP
#EXTRA_CFLAGS += -Werror
#
# Maintainer rules
#
# getopt.c not included. It is intentionally separate
SRC = proc.c dir.c cache.c sock.c inode.c file.c ioctl.c smbiod.c request.c \
symlink.c
proto:
-rm -f proto.h
@echo > proto2.h "/*"
@echo >> proto2.h " * Autogenerated with cproto on: " `date`
@echo >> proto2.h " */"
@echo >> proto2.h ""
@echo >> proto2.h "struct smb_request;"
@echo >> proto2.h "struct sock;"
@echo >> proto2.h "struct statfs;"
@echo >> proto2.h ""
cproto -E "gcc -E" -e -v -I $(TOPDIR)/include -DMAKING_PROTO -D__KERNEL__ $(SRC) >> proto2.h
mv proto2.h proto.h

View File

@ -110,7 +110,7 @@ struct tagtable {
int (*parse)(struct tag *);
};
#define __tag __attribute_used__ __attribute__((__section__(".taglist.init")))
#define __tag __used __attribute__((__section__(".taglist.init")))
#define __tagtable(tag, fn) \
static struct tagtable __tagtable_##fn __tag = { tag, fn }

View File

@ -9,10 +9,46 @@
/* Align . to a 8 byte boundary equals to maximum function alignment. */
#define ALIGN_FUNCTION() . = ALIGN(8)
/* The actual configuration determine if the init/exit sections
* are handled as text/data or they can be discarded (which
* often happens at runtime)
*/
#ifdef CONFIG_HOTPLUG
#define DEV_KEEP(sec) *(.dev##sec)
#define DEV_DISCARD(sec)
#else
#define DEV_KEEP(sec)
#define DEV_DISCARD(sec) *(.dev##sec)
#endif
#ifdef CONFIG_HOTPLUG_CPU
#define CPU_KEEP(sec) *(.cpu##sec)
#define CPU_DISCARD(sec)
#else
#define CPU_KEEP(sec)
#define CPU_DISCARD(sec) *(.cpu##sec)
#endif
#if defined(CONFIG_MEMORY_HOTPLUG)
#define MEM_KEEP(sec) *(.mem##sec)
#define MEM_DISCARD(sec)
#else
#define MEM_KEEP(sec)
#define MEM_DISCARD(sec) *(.mem##sec)
#endif
/* .data section */
#define DATA_DATA \
*(.data) \
*(.data.init.refok) \
*(.ref.data) \
DEV_KEEP(init.data) \
DEV_KEEP(exit.data) \
CPU_KEEP(init.data) \
CPU_KEEP(exit.data) \
MEM_KEEP(init.data) \
MEM_KEEP(exit.data) \
. = ALIGN(8); \
VMLINUX_SYMBOL(__start___markers) = .; \
*(__markers) \
@ -132,6 +168,17 @@
*(__ksymtab_strings) \
} \
\
/* __*init sections */ \
__init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) { \
*(.ref.rodata) \
DEV_KEEP(init.rodata) \
DEV_KEEP(exit.rodata) \
CPU_KEEP(init.rodata) \
CPU_KEEP(exit.rodata) \
MEM_KEEP(init.rodata) \
MEM_KEEP(exit.rodata) \
} \
\
/* Built-in module parameters. */ \
__param : AT(ADDR(__param) - LOAD_OFFSET) { \
VMLINUX_SYMBOL(__start___param) = .; \
@ -139,7 +186,6 @@
VMLINUX_SYMBOL(__stop___param) = .; \
VMLINUX_SYMBOL(__end_rodata) = .; \
} \
\
. = ALIGN((align));
/* RODATA provided for backward compatibility.
@ -158,8 +204,16 @@
#define TEXT_TEXT \
ALIGN_FUNCTION(); \
*(.text) \
*(.ref.text) \
*(.text.init.refok) \
*(.exit.text.refok)
*(.exit.text.refok) \
DEV_KEEP(init.text) \
DEV_KEEP(exit.text) \
CPU_KEEP(init.text) \
CPU_KEEP(exit.text) \
MEM_KEEP(init.text) \
MEM_KEEP(exit.text)
/* sched.text is aling to function alignment to secure we have same
* address even at second ld pass when generating System.map */
@ -183,6 +237,37 @@
*(.kprobes.text) \
VMLINUX_SYMBOL(__kprobes_text_end) = .;
/* init and exit section handling */
#define INIT_DATA \
*(.init.data) \
DEV_DISCARD(init.data) \
DEV_DISCARD(init.rodata) \
CPU_DISCARD(init.data) \
CPU_DISCARD(init.rodata) \
MEM_DISCARD(init.data) \
MEM_DISCARD(init.rodata)
#define INIT_TEXT \
*(.init.text) \
DEV_DISCARD(init.text) \
CPU_DISCARD(init.text) \
MEM_DISCARD(init.text)
#define EXIT_DATA \
*(.exit.data) \
DEV_DISCARD(exit.data) \
DEV_DISCARD(exit.rodata) \
CPU_DISCARD(exit.data) \
CPU_DISCARD(exit.rodata) \
MEM_DISCARD(exit.data) \
MEM_DISCARD(exit.rodata)
#define EXIT_TEXT \
*(.exit.text) \
DEV_DISCARD(exit.text) \
CPU_DISCARD(exit.text) \
MEM_DISCARD(exit.text)
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to
the beginning of the section so we begin them at 0. */

View File

@ -24,7 +24,7 @@
extern void ia64_bad_param_for_setreg (void);
extern void ia64_bad_param_for_getreg (void);
register unsigned long ia64_r13 asm ("r13") __attribute_used__;
register unsigned long ia64_r13 asm ("r13") __used;
#define ia64_setreg(regnum, val) \
({ \

View File

@ -65,6 +65,6 @@ extern struct sh_machine_vector sh_mv;
#define get_system_type() sh_mv.mv_name
#define __initmv \
__attribute_used__ __attribute__((__section__ (".machvec.init")))
__used __section(.machvec.init)
#endif /* _ASM_SH_MACHVEC_H */

View File

@ -68,7 +68,7 @@ struct thread_info {
#define init_stack (init_thread_union.stack)
/* how to get the current stack pointer from C */
register unsigned long current_stack_pointer asm("r15") __attribute_used__;
register unsigned long current_stack_pointer asm("r15") __used;
/* how to get the thread information struct from C */
static inline struct thread_info *current_thread_info(void)

View File

@ -85,7 +85,7 @@ struct thread_info {
/* how to get the current stack pointer from C */
register unsigned long current_stack_pointer asm("esp") __attribute_used__;
register unsigned long current_stack_pointer asm("esp") __used;
/* how to get the thread information struct from C */
static inline struct thread_info *current_thread_info(void)

View File

@ -34,7 +34,6 @@ header-y += atmsap.h
header-y += atmsvc.h
header-y += atm_zatm.h
header-y += auto_fs4.h
header-y += auxvec.h
header-y += ax25.h
header-y += b1lli.h
header-y += baycom.h
@ -73,7 +72,7 @@ header-y += gen_stats.h
header-y += gigaset_dev.h
header-y += hdsmart.h
header-y += hysdn_if.h
header-y += i2c-dev.h
header-y += i2o-dev.h
header-y += i8k.h
header-y += if_arcnet.h
header-y += if_bonding.h
@ -158,7 +157,6 @@ header-y += veth.h
header-y += video_decoder.h
header-y += video_encoder.h
header-y += videotext.h
header-y += vt.h
header-y += x25.h
unifdef-y += acct.h
@ -173,6 +171,7 @@ unifdef-y += atm.h
unifdef-y += atm_tcp.h
unifdef-y += audit.h
unifdef-y += auto_fs.h
unifdef-y += auxvec.h
unifdef-y += binfmts.h
unifdef-y += capability.h
unifdef-y += capi.h
@ -214,7 +213,7 @@ unifdef-y += hdreg.h
unifdef-y += hiddev.h
unifdef-y += hpet.h
unifdef-y += i2c.h
unifdef-y += i2o-dev.h
unifdef-y += i2c-dev.h
unifdef-y += icmp.h
unifdef-y += icmpv6.h
unifdef-y += if_addr.h
@ -349,6 +348,7 @@ unifdef-y += videodev.h
unifdef-y += virtio_config.h
unifdef-y += virtio_blk.h
unifdef-y += virtio_net.h
unifdef-y += vt.h
unifdef-y += wait.h
unifdef-y += wanrouter.h
unifdef-y += watchdog.h

View File

@ -7,10 +7,8 @@
#if __GNUC_MINOR__ >= 3
# define __used __attribute__((__used__))
# define __attribute_used__ __used /* deprecated */
#else
# define __used __attribute__((__unused__))
# define __attribute_used__ __used /* deprecated */
#endif
#if __GNUC_MINOR__ >= 4

View File

@ -15,7 +15,6 @@
#endif
#define __used __attribute__((__used__))
#define __attribute_used__ __used /* deprecated */
#define __must_check __attribute__((warn_unused_result))
#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
#define __always_inline inline __attribute__((always_inline))

View File

@ -126,10 +126,6 @@ extern void __chk_io_ptr(const volatile void __iomem *);
* Mark functions that are referenced only in inline assembly as __used so
* the code is emitted even though it appears to be unreferenced.
*/
#ifndef __attribute_used__
# define __attribute_used__ /* deprecated */
#endif
#ifndef __used
# define __used /* unimplemented */
#endif
@ -175,4 +171,9 @@ extern void __chk_io_ptr(const volatile void __iomem *);
#define __cold
#endif
/* Simple shorthand for a section definition */
#ifndef __section
# define __section(S) __attribute__ ((__section__(#S)))
#endif
#endif /* __LINUX_COMPILER_H */

View File

@ -76,7 +76,7 @@
typeof(desc) _desc \
__attribute__((aligned(sizeof(Elf##size##_Word)))); \
} _ELFNOTE_PASTE(_note_, unique) \
__attribute_used__ \
__used \
__attribute__((section(".note." name), \
aligned(sizeof(Elf##size##_Word)), \
unused)) = { \

View File

@ -40,10 +40,10 @@
/* These are for everybody (although not all archs will actually
discard it in modules) */
#define __init __attribute__ ((__section__ (".init.text"))) __cold
#define __initdata __attribute__ ((__section__ (".init.data")))
#define __exitdata __attribute__ ((__section__(".exit.data")))
#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))
#define __init __section(.init.text) __cold
#define __initdata __section(.init.data)
#define __exitdata __section(.exit.data)
#define __exit_call __used __section(.exitcall.exit)
/* modpost check for section mismatches during the kernel build.
* A section mismatch happens when there are references from a
@ -52,25 +52,81 @@
* when early init has completed so all such references are potential bugs.
* For exit sections the same issue exists.
* The following markers are used for the cases where the reference to
* the init/exit section (code or data) is valid and will teach modpost
* not to issue a warning.
* the *init / *exit section (code or data) is valid and will teach
* modpost not to issue a warning.
* The markers follow same syntax rules as __init / __initdata. */
#define __init_refok noinline __attribute__ ((__section__ (".text.init.refok")))
#define __initdata_refok __attribute__ ((__section__ (".data.init.refok")))
#define __exit_refok noinline __attribute__ ((__section__ (".exit.text.refok")))
#define __ref __section(.ref.text) noinline
#define __refdata __section(.ref.data)
#define __refconst __section(.ref.rodata)
/* backward compatibility note
* A few places hardcode the old section names:
* .text.init.refok
* .data.init.refok
* .exit.text.refok
* They should be converted to use the defines from this file
*/
/* compatibility defines */
#define __init_refok __ref
#define __initdata_refok __refdata
#define __exit_refok __ref
#ifdef MODULE
#define __exit __attribute__ ((__section__(".exit.text"))) __cold
#define __exitused
#else
#define __exit __attribute_used__ __attribute__ ((__section__(".exit.text"))) __cold
#define __exitused __used
#endif
#define __exit __section(.exit.text) __exitused __cold
/* Used for HOTPLUG */
#define __devinit __section(.devinit.text) __cold
#define __devinitdata __section(.devinit.data)
#define __devinitconst __section(.devinit.rodata)
#define __devexit __section(.devexit.text) __exitused __cold
#define __devexitdata __section(.devexit.data)
#define __devexitconst __section(.devexit.rodata)
/* Used for HOTPLUG_CPU */
#define __cpuinit __section(.cpuinit.text) __cold
#define __cpuinitdata __section(.cpuinit.data)
#define __cpuinitconst __section(.cpuinit.rodata)
#define __cpuexit __section(.cpuexit.text) __exitused __cold
#define __cpuexitdata __section(.cpuexit.data)
#define __cpuexitconst __section(.cpuexit.rodata)
/* Used for MEMORY_HOTPLUG */
#define __meminit __section(.meminit.text) __cold
#define __meminitdata __section(.meminit.data)
#define __meminitconst __section(.meminit.rodata)
#define __memexit __section(.memexit.text) __exitused __cold
#define __memexitdata __section(.memexit.data)
#define __memexitconst __section(.memexit.rodata)
/* For assembly routines */
#define __INIT .section ".init.text","ax"
#define __INIT_REFOK .section ".text.init.refok","ax"
#define __FINIT .previous
#define __INITDATA .section ".init.data","aw"
#define __INITDATA_REFOK .section ".data.init.refok","aw"
#define __DEVINIT .section ".devinit.text", "ax"
#define __DEVINITDATA .section ".devinit.data", "aw"
#define __CPUINIT .section ".cpuinit.text", "ax"
#define __CPUINITDATA .section ".cpuinit.data", "aw"
#define __MEMINIT .section ".meminit.text", "ax"
#define __MEMINITDATA .section ".meminit.data", "aw"
/* silence warnings when references are OK */
#define __REF .section ".ref.text", "ax"
#define __REFDATA .section ".ref.data", "aw"
#define __REFCONST .section ".ref.rodata", "aw"
/* backward compatibility */
#define __INIT_REFOK .section __REF
#define __INITDATA_REFOK .section __REFDATA
#ifndef __ASSEMBLY__
/*
@ -108,7 +164,7 @@ void prepare_namespace(void);
*/
#define __define_initcall(level,fn,id) \
static initcall_t __initcall_##fn##id __attribute_used__ \
static initcall_t __initcall_##fn##id __used \
__attribute__((__section__(".initcall" level ".init"))) = fn
/*
@ -142,11 +198,11 @@ void prepare_namespace(void);
#define console_initcall(fn) \
static initcall_t __initcall_##fn \
__attribute_used__ __attribute__((__section__(".con_initcall.init")))=fn
__used __section(.con_initcall.init) = fn
#define security_initcall(fn) \
static initcall_t __initcall_##fn \
__attribute_used__ __attribute__((__section__(".security_initcall.init"))) = fn
__used __section(.security_initcall.init) = fn
struct obs_kernel_param {
const char *str;
@ -163,8 +219,7 @@ struct obs_kernel_param {
#define __setup_param(str, unique_id, fn, early) \
static char __setup_str_##unique_id[] __initdata __aligned(1) = str; \
static struct obs_kernel_param __setup_##unique_id \
__attribute_used__ \
__attribute__((__section__(".init.setup"))) \
__used __section(.init.setup) \
__attribute__((aligned((sizeof(long))))) \
= { __setup_str_##unique_id, fn, early }
@ -242,7 +297,7 @@ void __init parse_early_param(void);
#endif
/* Data marked not to be saved by software suspend */
#define __nosavedata __attribute__ ((__section__ (".data.nosave")))
#define __nosavedata __section(.data.nosave)
/* This means "can be init if no module support, otherwise module load
may call it." */
@ -254,43 +309,6 @@ void __init parse_early_param(void);
#define __initdata_or_module __initdata
#endif /*CONFIG_MODULES*/
#ifdef CONFIG_HOTPLUG
#define __devinit
#define __devinitdata
#define __devexit
#define __devexitdata
#else
#define __devinit __init
#define __devinitdata __initdata
#define __devexit __exit
#define __devexitdata __exitdata
#endif
#ifdef CONFIG_HOTPLUG_CPU
#define __cpuinit
#define __cpuinitdata
#define __cpuexit
#define __cpuexitdata
#else
#define __cpuinit __init
#define __cpuinitdata __initdata
#define __cpuexit __exit
#define __cpuexitdata __exitdata
#endif
#if defined(CONFIG_MEMORY_HOTPLUG) || defined(CONFIG_ACPI_HOTPLUG_MEMORY) \
|| defined(CONFIG_ACPI_HOTPLUG_MEMORY_MODULE)
#define __meminit
#define __meminitdata
#define __memexit
#define __memexitdata
#else
#define __meminit __init
#define __meminitdata __initdata
#define __memexit __exit
#define __memexitdata __exitdata
#endif
/* Functions marked as __devexit may be discarded at kernel link time, depending
on config options. Newer versions of binutils detect references from
retained sections to discarded sections and flag an error. Pointers to

View File

@ -178,7 +178,7 @@ void *__symbol_get_gpl(const char *symbol);
#define __CRC_SYMBOL(sym, sec) \
extern void *__crc_##sym __attribute__((weak)); \
static const unsigned long __kcrctab_##sym \
__attribute_used__ \
__used \
__attribute__((section("__kcrctab" sec), unused)) \
= (unsigned long) &__crc_##sym;
#else
@ -193,7 +193,7 @@ void *__symbol_get_gpl(const char *symbol);
__attribute__((section("__ksymtab_strings"))) \
= MODULE_SYMBOL_PREFIX #sym; \
static const struct kernel_symbol __ksymtab_##sym \
__attribute_used__ \
__used \
__attribute__((section("__ksymtab" sec), unused)) \
= { (unsigned long)&sym, __kstrtab_##sym }

View File

@ -18,7 +18,7 @@
#define __module_cat(a,b) ___module_cat(a,b)
#define __MODULE_INFO(tag, name, info) \
static const char __module_cat(name,__LINE__)[] \
__attribute_used__ \
__used \
__attribute__((section(".modinfo"),unused)) = __stringify(tag) "=" info
#else /* !MODULE */
#define __MODULE_INFO(tag, name, info)
@ -72,7 +72,7 @@ struct kparam_array
BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)); \
static const char __param_str_##name[] = prefix #name; \
static struct kernel_param const __param_##name \
__attribute_used__ \
__used \
__attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
= { __param_str_##name, perm, set, get, { arg } }

View File

@ -867,7 +867,7 @@ enum pci_fixup_pass {
/* Anonymous variables would be nice... */
#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, hook) \
static const struct pci_fixup __pci_fixup_##name __attribute_used__ \
static const struct pci_fixup __pci_fixup_##name __used \
__attribute__((__section__(#section))) = { vendor, device, hook };
#define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \
DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \

View File

@ -1,3 +1,11 @@
config ARCH
string
option env="ARCH"
config KERNELVERSION
string
option env="KERNELVERSION"
config DEFCONFIG_LIST
string
depends on !UML

View File

@ -79,6 +79,38 @@ config HEADERS_CHECK
exported to $(INSTALL_HDR_PATH) (usually 'usr/include' in
your build tree), to make sure they're suitable.
config DEBUG_SECTION_MISMATCH
bool "Enable full Section mismatch analysis"
default n
help
The section mismatch analysis checks if there are illegal
references from one section to another section.
Linux will during link or during runtime drop some sections
and any use of code/data previously in these sections will
most likely result in an oops.
In the code functions and variables are annotated with
__init, __devinit etc. (see full list in include/linux/init.h)
which result in the code/data being placed in specific sections.
The section mismatch anaylsis are always done after a full
kernel build but enabling this options will in addition
do the following:
- Add the option -fno-inline-functions-called-once to gcc
When inlining a function annotated __init in a non-init
function we would loose the section information and thus
the analysis would not catch the illegal reference.
This options tell gcc to inline less but will also
result in a larger kernel.
- Run the section mismatch analysis for each module/built-in.o
When we run the section mismatch analysis on vmlinux.o we
looses valueable information about where the mismatch was
introduced.
Running the analysis for each module/built-in.o file
will tell where the mismatch happens much closer to the
source. The drawback is that we will report the same
mismatch at least twice.
- Enable verbose reporting from modpost to help solving
the section mismatches reported.
config DEBUG_KERNEL
bool "Kernel debugging"
help

View File

@ -83,10 +83,12 @@ ifneq ($(strip $(obj-y) $(obj-m) $(obj-n) $(obj-) $(lib-target)),)
builtin-target := $(obj)/built-in.o
endif
modorder-target := $(obj)/modules.order
# We keep a list of all modules in $(MODVERDIR)
__build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \
$(if $(KBUILD_MODULES),$(obj-m)) \
$(if $(KBUILD_MODULES),$(obj-m) $(modorder-target)) \
$(subdir-ym) $(always)
@:
@ -101,6 +103,10 @@ ifneq ($(KBUILD_CHECKSRC),0)
endif
endif
# Do section mismatch analysis for each module/built-in.o
ifdef CONFIG_DEBUG_SECTION_MISMATCH
cmd_secanalysis = ; scripts/mod/modpost $@
endif
# Compile C sources (.c)
# ---------------------------------------------------------------------------
@ -266,7 +272,8 @@ ifdef builtin-target
quiet_cmd_link_o_target = LD $@
# If the list of objects to link is empty, just create an empty built-in.o
cmd_link_o_target = $(if $(strip $(obj-y)),\
$(LD) $(ld_flags) -r -o $@ $(filter $(obj-y), $^),\
$(LD) $(ld_flags) -r -o $@ $(filter $(obj-y), $^) \
$(cmd_secanalysis),\
rm -f $@; $(AR) rcs $@)
$(builtin-target): $(obj-y) FORCE
@ -275,6 +282,19 @@ $(builtin-target): $(obj-y) FORCE
targets += $(builtin-target)
endif # builtin-target
#
# Rule to create modules.order file
#
# Create commands to either record .ko file or cat modules.order from
# a subdirectory
modorder-cmds = \
$(foreach m, $(modorder), \
$(if $(filter %/modules.order, $m), \
cat $m;, echo kernel/$m;))
$(modorder-target): $(subdir-ym) FORCE
$(Q)(cat /dev/null; $(modorder-cmds)) > $@
#
# Rule to compile a set of .o files into one .a file
#
@ -301,7 +321,7 @@ $($(subst $(obj)/,,$(@:.o=-objs))) \
$($(subst $(obj)/,,$(@:.o=-y)))), $^)
quiet_cmd_link_multi-y = LD $@
cmd_link_multi-y = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps)
cmd_link_multi-y = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalysis)
quiet_cmd_link_multi-m = LD [M] $@
cmd_link_multi-m = $(cmd_link_multi-y)

View File

@ -25,6 +25,11 @@ lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m)))
# o if we encounter foo/ in $(obj-m), remove it from $(obj-m)
# and add the directory to the list of dirs to descend into: $(subdir-m)
# Determine modorder.
# Unfortunately, we don't have information about ordering between -y
# and -m subdirs. Just put -y's first.
modorder := $(patsubst %/,%/modules.order, $(filter %/, $(obj-y)) $(obj-m:.o=.ko))
__subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y)))
subdir-y += $(__subdir-y)
__subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m)))
@ -64,6 +69,7 @@ real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)
extra-y := $(addprefix $(obj)/,$(extra-y))
always := $(addprefix $(obj)/,$(always))
targets := $(addprefix $(obj)/,$(targets))
modorder := $(addprefix $(obj)/,$(modorder))
obj-y := $(addprefix $(obj)/,$(obj-y))
obj-m := $(addprefix $(obj)/,$(obj-m))
lib-y := $(addprefix $(obj)/,$(lib-y))

View File

@ -21,7 +21,7 @@ quiet_cmd_modules_install = INSTALL $@
# Modules built outside the kernel source tree go into extra by default
INSTALL_MOD_DIR ?= extra
ext-mod-dir = $(INSTALL_MOD_DIR)$(subst $(KBUILD_EXTMOD),,$(@D))
ext-mod-dir = $(INSTALL_MOD_DIR)$(subst $(patsubst %/,%,$(KBUILD_EXTMOD)),,$(@D))
modinst_dir = $(if $(KBUILD_EXTMOD),$(ext-mod-dir),kernel/$(@D))

View File

@ -62,6 +62,7 @@ modpost = scripts/mod/modpost \
$(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \
$(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \
$(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
$(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \
$(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w)
quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules

View File

@ -30,6 +30,7 @@
* !Ifilename
* !Dfilename
* !Ffilename
* !Pfilename
*
*/
@ -57,6 +58,7 @@ FILEONLY *symbolsonly;
typedef void FILELINE(char * file, char * line);
FILELINE * singlefunctions;
FILELINE * entity_system;
FILELINE * docsection;
#define MAXLINESZ 2048
#define MAXFILES 250
@ -65,6 +67,7 @@ FILELINE * entity_system;
#define DOCBOOK "-docbook"
#define FUNCTION "-function"
#define NOFUNCTION "-nofunction"
#define NODOCSECTIONS "-no-doc-sections"
char *srctree;
@ -231,13 +234,14 @@ void docfunctions(char * filename, char * type)
for (i=0; i <= symfilecnt; i++)
symcnt += symfilelist[i].symbolcnt;
vec = malloc((2 + 2 * symcnt + 2) * sizeof(char*));
vec = malloc((2 + 2 * symcnt + 3) * sizeof(char *));
if (vec == NULL) {
perror("docproc: ");
exit(1);
}
vec[idx++] = KERNELDOC;
vec[idx++] = DOCBOOK;
vec[idx++] = NODOCSECTIONS;
for (i=0; i < symfilecnt; i++) {
struct symfile * sym = &symfilelist[i];
for (j=0; j < sym->symbolcnt; j++) {
@ -286,13 +290,37 @@ void singfunc(char * filename, char * line)
exec_kernel_doc(vec);
}
/*
* Insert specific documentation section from a file.
* Call kernel-doc with the following parameters:
* kernel-doc -docbook -function "doc section" filename
*/
void docsect(char *filename, char *line)
{
char *vec[6]; /* kerneldoc -docbook -function "section" file NULL */
char *s;
for (s = line; *s; s++)
if (*s == '\n')
*s = '\0';
vec[0] = KERNELDOC;
vec[1] = DOCBOOK;
vec[2] = FUNCTION;
vec[3] = line;
vec[4] = filename;
vec[5] = NULL;
exec_kernel_doc(vec);
}
/*
* Parse file, calling action specific functions for:
* 1) Lines containing !E
* 2) Lines containing !I
* 3) Lines containing !D
* 4) Lines containing !F
* 5) Default lines - lines not matching the above
* 5) Lines containing !P
* 6) Default lines - lines not matching the above
*/
void parse_file(FILE *infile)
{
@ -326,6 +354,15 @@ void parse_file(FILE *infile)
s++;
singlefunctions(line +2, s);
break;
case 'P':
/* filename */
while (*s && !isspace(*s)) s++;
*s++ = '\0';
/* DOC: section name */
while (isspace(*s))
s++;
docsection(line + 2, s);
break;
default:
defaultline(line);
}
@ -372,6 +409,7 @@ int main(int argc, char *argv[])
externalfunctions = find_export_symbols;
symbolsonly = find_export_symbols;
singlefunctions = noaction2;
docsection = noaction2;
parse_file(infile);
/* Rewind to start from beginning of file again */
@ -381,6 +419,7 @@ int main(int argc, char *argv[])
externalfunctions = extfunc;
symbolsonly = printline;
singlefunctions = singfunc;
docsection = docsect;
parse_file(infile);
}
@ -394,6 +433,7 @@ int main(int argc, char *argv[])
externalfunctions = adddep;
symbolsonly = adddep;
singlefunctions = adddep2;
docsection = adddep2;
parse_file(infile);
printf("\n");
}

View File

@ -6,7 +6,19 @@
# e.g., to decode an i386 oops on an x86_64 system, use:
# AFLAGS=--32 decodecode < 386.oops
T=`mktemp`
cleanup() {
rm -f $T $T.s $T.o
exit 1
}
die() {
echo "$@"
exit 1
}
trap cleanup EXIT
T=`mktemp` || die "cannot create temp file"
code=
while read i ; do
@ -20,6 +32,7 @@ esac
done
if [ -z "$code" ]; then
rm $T
exit
fi
@ -48,4 +61,4 @@ echo -n " .byte 0x" > $T.s
echo $code >> $T.s
as $AFLAGS -o $T.o $T.s
objdump -S $T.o
rm $T.o $T.s
rm $T $T.s $T.o

View File

@ -9,7 +9,10 @@
# gcc-2.95.3, `030301' for gcc-3.3.1, etc.
#
if [[ $1 = "-p" ]] ; then with_patchlevel=1; shift; fi
if [ "$1" = "-p" ] ; then
with_patchlevel=1;
shift;
fi
compiler="$*"

View File

@ -440,17 +440,21 @@ void error_with_pos(const char *fmt, ...)
static void genksyms_usage(void)
{
fputs("Usage:\n" "genksyms [-dDwqhV] > /path/to/.tmp_obj.ver\n" "\n"
fputs("Usage:\n" "genksyms [-adDTwqhV] > /path/to/.tmp_obj.ver\n" "\n"
#ifdef __GNU_LIBRARY__
" -a, --arch Select architecture\n"
" -d, --debug Increment the debug level (repeatable)\n"
" -D, --dump Dump expanded symbol defs (for debugging only)\n"
" -T, --dump-types file Dump expanded types into file (for debugging only)\n"
" -w, --warnings Enable warnings\n"
" -q, --quiet Disable warnings (default)\n"
" -h, --help Print this message\n"
" -V, --version Print the release version\n"
#else /* __GNU_LIBRARY__ */
" -a Select architecture\n"
" -d Increment the debug level (repeatable)\n"
" -D Dump expanded symbol defs (for debugging only)\n"
" -T file Dump expanded types into file (for debugging only)\n"
" -w Enable warnings\n"
" -q Disable warnings (default)\n"
" -h Print this message\n"
@ -477,10 +481,10 @@ int main(int argc, char **argv)
{0, 0, 0, 0}
};
while ((o = getopt_long(argc, argv, "a:dwqVDT:k:p:",
while ((o = getopt_long(argc, argv, "a:dwqVDT:h",
&long_opts[0], NULL)) != EOF)
#else /* __GNU_LIBRARY__ */
while ((o = getopt(argc, argv, "a:dwqVDT:k:p:")) != EOF)
while ((o = getopt(argc, argv, "a:dwqVDT:h")) != EOF)
#endif /* __GNU_LIBRARY__ */
switch (o) {
case 'a':

View File

@ -24,22 +24,25 @@ oldconfig: $(obj)/conf
silentoldconfig: $(obj)/conf
$< -s $(Kconfig)
# Create new linux.po file
# Create new linux.pot file
# Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
# The symlink is used to repair a deficiency in arch/um
update-po-config: $(obj)/kxgettext
xgettext --default-domain=linux \
update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h
$(Q)echo " GEN config"
$(Q)xgettext --default-domain=linux \
--add-comments --keyword=_ --keyword=N_ \
--from-code=UTF-8 \
--files-from=scripts/kconfig/POTFILES.in \
--output $(obj)/config.pot
$(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot
$(Q)ln -fs Kconfig.i386 arch/um/Kconfig.arch
(for i in `ls arch/`; \
do \
$(obj)/kxgettext arch/$$i/Kconfig; \
done ) >> $(obj)/config.pot
msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \
$(Q)(for i in `ls arch/`; \
do \
echo " GEN $$i"; \
$(obj)/kxgettext arch/$$i/Kconfig \
>> $(obj)/config.pot; \
done )
$(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \
--output $(obj)/linux.pot
$(Q)rm -f arch/um/Kconfig.arch
$(Q)rm -f $(obj)/config.pot
@ -93,12 +96,6 @@ HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
HOST_EXTRACFLAGS += -DLOCALE
PHONY += $(obj)/dochecklxdialog
$(obj)/dochecklxdialog:
$(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_LOADLIBES)
always := dochecklxdialog
# ===========================================================================
# Shared Makefile for the various kconfig executables:
@ -142,8 +139,17 @@ gconf-objs := gconf.o kconfig_load.o zconf.tab.o
endif
clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \
.tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c
.tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c gconf.glade.h
clean-files += mconf qconf gconf
clean-files += config.pot linux.pot
# Check that we have the required ncurses stuff installed for lxdialog (menuconfig)
PHONY += $(obj)/dochecklxdialog
$(addprefix $(obj)/,$(lxdialog)): $(obj)/dochecklxdialog
$(obj)/dochecklxdialog:
$(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOST_LOADLIBES)
always := dochecklxdialog
# Add environment specific flags
HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS))
@ -248,6 +254,9 @@ $(obj)/%.moc: $(src)/%.h
$(obj)/lkc_defs.h: $(src)/lkc_proto.h
sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
# Extract gconf menu items for I18N support
$(obj)/gconf.glade.h: $(obj)/gconf.glade
intltool-extract --type=gettext/glade $(obj)/gconf.glade
###
# The following requires flex/bison/gperf

View File

@ -1,5 +1,12 @@
scripts/kconfig/lxdialog/checklist.c
scripts/kconfig/lxdialog/inputbox.c
scripts/kconfig/lxdialog/menubox.c
scripts/kconfig/lxdialog/textbox.c
scripts/kconfig/lxdialog/util.c
scripts/kconfig/lxdialog/yesno.c
scripts/kconfig/mconf.c
scripts/kconfig/conf.c
scripts/kconfig/confdata.c
scripts/kconfig/gconf.c
scripts/kconfig/gconf.glade.h
scripts/kconfig/qconf.cc

View File

@ -3,12 +3,13 @@
* Released under the terms of the GNU GPL v2.0.
*/
#include <locale.h>
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#include <unistd.h>
#include <sys/stat.h>
#define LKC_DIRECT_LINK
@ -40,7 +41,7 @@ static char nohelp_text[] = N_("Sorry, no help available for this option yet.\n"
static const char *get_help(struct menu *menu)
{
if (menu_has_help(menu))
return menu_get_help(menu);
return _(menu_get_help(menu));
else
return nohelp_text;
}
@ -78,7 +79,7 @@ static int conf_askvalue(struct symbol *sym, const char *def)
tristate val;
if (!sym_has_value(sym))
printf("(NEW) ");
printf(_("(NEW) "));
line[0] = '\n';
line[1] = 0;
@ -160,7 +161,7 @@ static int conf_askvalue(struct symbol *sym, const char *def)
}
case set_random:
do {
val = (tristate)(random() % 3);
val = (tristate)(rand() % 3);
} while (!sym_tristate_within_range(sym, val));
switch (val) {
case no: line[0] = 'n'; break;
@ -183,7 +184,7 @@ int conf_string(struct menu *menu)
const char *def;
while (1) {
printf("%*s%s ", indent - 1, "", menu->prompt->text);
printf("%*s%s ", indent - 1, "", _(menu->prompt->text));
printf("(%s) ", sym->name);
def = sym_get_string_value(sym);
if (sym_get_string_value(sym))
@ -216,7 +217,7 @@ static int conf_sym(struct menu *menu)
tristate oldval, newval;
while (1) {
printf("%*s%s ", indent - 1, "", menu->prompt->text);
printf("%*s%s ", indent - 1, "", _(menu->prompt->text));
if (sym->name)
printf("(%s) ", sym->name);
type = sym_get_type(sym);
@ -306,7 +307,7 @@ static int conf_choice(struct menu *menu)
case no:
return 1;
case mod:
printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu));
printf("%*s%s\n", indent - 1, "", _(menu_get_prompt(menu)));
return 0;
case yes:
break;
@ -316,7 +317,7 @@ static int conf_choice(struct menu *menu)
while (1) {
int cnt, def;
printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu));
printf("%*s%s\n", indent - 1, "", _(menu_get_prompt(menu)));
def_sym = sym_get_choice_value(sym);
cnt = def = 0;
line[0] = 0;
@ -324,7 +325,7 @@ static int conf_choice(struct menu *menu)
if (!menu_is_visible(child))
continue;
if (!child->sym) {
printf("%*c %s\n", indent, '*', menu_get_prompt(child));
printf("%*c %s\n", indent, '*', _(menu_get_prompt(child)));
continue;
}
cnt++;
@ -333,14 +334,14 @@ static int conf_choice(struct menu *menu)
printf("%*c", indent, '>');
} else
printf("%*c", indent, ' ');
printf(" %d. %s", cnt, menu_get_prompt(child));
printf(" %d. %s", cnt, _(menu_get_prompt(child)));
if (child->sym->name)
printf(" (%s)", child->sym->name);
if (!sym_has_value(child->sym))
printf(" (NEW)");
printf(_(" (NEW)"));
printf("\n");
}
printf("%*schoice", indent - 1, "");
printf(_("%*schoice"), indent - 1, "");
if (cnt == 1) {
printf("[1]: 1\n");
goto conf_childs;
@ -375,7 +376,7 @@ static int conf_choice(struct menu *menu)
break;
case set_random:
if (is_new)
def = (random() % cnt) + 1;
def = (rand() % cnt) + 1;
case set_default:
case set_yes:
case set_mod:
@ -399,9 +400,9 @@ static int conf_choice(struct menu *menu)
continue;
}
sym_set_choice_value(sym, child->sym);
if (child->list) {
for (child = child->list; child; child = child->next) {
indent += 2;
conf(child->list);
conf(child);
indent -= 2;
}
return 1;
@ -433,7 +434,7 @@ static void conf(struct menu *menu)
if (prompt)
printf("%*c\n%*c %s\n%*c\n",
indent, '*',
indent, '*', prompt,
indent, '*', _(prompt),
indent, '*');
default:
;
@ -495,12 +496,16 @@ static void check_conf(struct menu *menu)
int main(int ac, char **av)
{
int i = 1;
int opt;
const char *name;
struct stat tmpstat;
if (ac > i && av[i][0] == '-') {
switch (av[i++][1]) {
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) {
switch (opt) {
case 'o':
input_mode = ask_new;
break;
@ -513,12 +518,7 @@ int main(int ac, char **av)
break;
case 'D':
input_mode = set_default;
defconfig_file = av[i++];
if (!defconfig_file) {
printf(_("%s: No default config file specified\n"),
av[0]);
exit(1);
}
defconfig_file = optarg;
break;
case 'n':
input_mode = set_no;
@ -531,19 +531,22 @@ int main(int ac, char **av)
break;
case 'r':
input_mode = set_random;
srandom(time(NULL));
srand(time(NULL));
break;
case 'h':
case '?':
fprintf(stderr, "See README for usage info\n");
printf(_("See README for usage info\n"));
exit(0);
break;
default:
fprintf(stderr, _("See README for usage info\n"));
exit(1);
}
}
name = av[i];
if (!name) {
if (ac == optind) {
printf(_("%s: Kconfig file missing\n"), av[0]);
exit(1);
}
name = av[optind];
conf_parse(name);
//zconfdump(stdout);
switch (input_mode) {
@ -551,9 +554,9 @@ int main(int ac, char **av)
if (!defconfig_file)
defconfig_file = conf_get_default_confname();
if (conf_read(defconfig_file)) {
printf("***\n"
printf(_("***\n"
"*** Can't find default configuration \"%s\"!\n"
"***\n", defconfig_file);
"***\n"), defconfig_file);
exit(1);
}
break;

View File

@ -232,8 +232,7 @@ int conf_read_simple(const char *name, int def)
sym->type = S_BOOLEAN;
}
if (sym->flags & def_flags) {
conf_warning("trying to reassign symbol %s", sym->name);
break;
conf_warning("override: reassigning to symbol %s", sym->name);
}
switch (sym->type) {
case S_BOOLEAN:
@ -272,8 +271,7 @@ int conf_read_simple(const char *name, int def)
sym->type = S_OTHER;
}
if (sym->flags & def_flags) {
conf_warning("trying to reassign symbol %s", sym->name);
break;
conf_warning("override: reassigning to symbol %s", sym->name);
}
if (conf_set_sym_val(sym, def, def_flags, p))
continue;
@ -297,14 +295,12 @@ int conf_read_simple(const char *name, int def)
}
break;
case yes:
if (cs->def[def].tri != no) {
conf_warning("%s creates inconsistent choice state", sym->name);
cs->flags &= ~def_flags;
} else
cs->def[def].val = sym;
if (cs->def[def].tri != no)
conf_warning("override: %s changes choice state", sym->name);
cs->def[def].val = sym;
break;
}
cs->def[def].tri = E_OR(cs->def[def].tri, sym->def[def].tri);
cs->def[def].tri = EXPR_OR(cs->def[def].tri, sym->def[def].tri);
}
}
fclose(in);
@ -316,7 +312,7 @@ int conf_read_simple(const char *name, int def)
int conf_read(const char *name)
{
struct symbol *sym;
struct symbol *sym, *choice_sym;
struct property *prop;
struct expr *e;
int i, flags;
@ -357,9 +353,9 @@ int conf_read(const char *name)
*/
prop = sym_get_choice_prop(sym);
flags = sym->flags;
for (e = prop->expr; e; e = e->left.expr)
if (e->right.sym->visible != no)
flags &= e->right.sym->flags;
expr_list_for_each_sym(prop->expr, e, choice_sym)
if (choice_sym->visible != no)
flags &= choice_sym->flags;
sym->flags &= flags | ~SYMBOL_DEF_USER;
}

View File

@ -87,7 +87,7 @@ struct expr *expr_copy(struct expr *org)
break;
case E_AND:
case E_OR:
case E_CHOICE:
case E_LIST:
e->left.expr = expr_copy(org->left.expr);
e->right.expr = expr_copy(org->right.expr);
break;
@ -217,7 +217,7 @@ int expr_eq(struct expr *e1, struct expr *e2)
expr_free(e2);
trans_count = old_count;
return res;
case E_CHOICE:
case E_LIST:
case E_RANGE:
case E_NONE:
/* panic */;
@ -648,7 +648,7 @@ struct expr *expr_transform(struct expr *e)
case E_EQUAL:
case E_UNEQUAL:
case E_SYMBOL:
case E_CHOICE:
case E_LIST:
break;
default:
e->left.expr = expr_transform(e->left.expr);
@ -932,7 +932,7 @@ struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symb
break;
case E_SYMBOL:
return expr_alloc_comp(type, e->left.sym, sym);
case E_CHOICE:
case E_LIST:
case E_RANGE:
case E_NONE:
/* panic */;
@ -955,14 +955,14 @@ tristate expr_calc_value(struct expr *e)
case E_AND:
val1 = expr_calc_value(e->left.expr);
val2 = expr_calc_value(e->right.expr);
return E_AND(val1, val2);
return EXPR_AND(val1, val2);
case E_OR:
val1 = expr_calc_value(e->left.expr);
val2 = expr_calc_value(e->right.expr);
return E_OR(val1, val2);
return EXPR_OR(val1, val2);
case E_NOT:
val1 = expr_calc_value(e->left.expr);
return E_NOT(val1);
return EXPR_NOT(val1);
case E_EQUAL:
sym_calc_value(e->left.sym);
sym_calc_value(e->right.sym);
@ -1000,9 +1000,9 @@ int expr_compare_type(enum expr_type t1, enum expr_type t2)
if (t2 == E_OR)
return 1;
case E_OR:
if (t2 == E_CHOICE)
if (t2 == E_LIST)
return 1;
case E_CHOICE:
case E_LIST:
if (t2 == 0)
return 1;
default:
@ -1034,12 +1034,18 @@ void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *
expr_print(e->left.expr, fn, data, E_NOT);
break;
case E_EQUAL:
fn(data, e->left.sym, e->left.sym->name);
if (e->left.sym->name)
fn(data, e->left.sym, e->left.sym->name);
else
fn(data, NULL, "<choice>");
fn(data, NULL, "=");
fn(data, e->right.sym, e->right.sym->name);
break;
case E_UNEQUAL:
fn(data, e->left.sym, e->left.sym->name);
if (e->left.sym->name)
fn(data, e->left.sym, e->left.sym->name);
else
fn(data, NULL, "<choice>");
fn(data, NULL, "!=");
fn(data, e->right.sym, e->right.sym->name);
break;
@ -1053,11 +1059,11 @@ void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *
fn(data, NULL, " && ");
expr_print(e->right.expr, fn, data, E_AND);
break;
case E_CHOICE:
case E_LIST:
fn(data, e->right.sym, e->right.sym->name);
if (e->left.expr) {
fn(data, NULL, " ^ ");
expr_print(e->left.expr, fn, data, E_CHOICE);
expr_print(e->left.expr, fn, data, E_LIST);
}
break;
case E_RANGE:

View File

@ -25,14 +25,13 @@ struct file {
#define FILE_BUSY 0x0001
#define FILE_SCANNED 0x0002
#define FILE_PRINTED 0x0004
typedef enum tristate {
no, mod, yes
} tristate;
enum expr_type {
E_NONE, E_OR, E_AND, E_NOT, E_EQUAL, E_UNEQUAL, E_CHOICE, E_SYMBOL, E_RANGE
E_NONE, E_OR, E_AND, E_NOT, E_EQUAL, E_UNEQUAL, E_LIST, E_SYMBOL, E_RANGE
};
union expr_data {
@ -45,9 +44,12 @@ struct expr {
union expr_data left, right;
};
#define E_OR(dep1, dep2) (((dep1)>(dep2))?(dep1):(dep2))
#define E_AND(dep1, dep2) (((dep1)<(dep2))?(dep1):(dep2))
#define E_NOT(dep) (2-(dep))
#define EXPR_OR(dep1, dep2) (((dep1)>(dep2))?(dep1):(dep2))
#define EXPR_AND(dep1, dep2) (((dep1)<(dep2))?(dep1):(dep2))
#define EXPR_NOT(dep) (2-(dep))
#define expr_list_for_each_sym(l, e, s) \
for (e = (l); e && (s = e->right.sym); e = e->left.expr)
struct expr_value {
struct expr *expr;
@ -86,7 +88,6 @@ struct symbol {
#define SYMBOL_CHECK 0x0008
#define SYMBOL_CHOICE 0x0010
#define SYMBOL_CHOICEVAL 0x0020
#define SYMBOL_PRINTED 0x0040
#define SYMBOL_VALID 0x0080
#define SYMBOL_OPTIONAL 0x0100
#define SYMBOL_WRITE 0x0200
@ -105,7 +106,8 @@ struct symbol {
#define SYMBOL_HASHMASK 0xff
enum prop_type {
P_UNKNOWN, P_PROMPT, P_COMMENT, P_MENU, P_DEFAULT, P_CHOICE, P_SELECT, P_RANGE
P_UNKNOWN, P_PROMPT, P_COMMENT, P_MENU, P_DEFAULT, P_CHOICE,
P_SELECT, P_RANGE, P_ENV
};
struct property {

View File

@ -119,8 +119,6 @@ const char *dbg_print_flags(int val)
strcat(buf, "choice/");
if (val & SYMBOL_CHOICEVAL)
strcat(buf, "choiceval/");
if (val & SYMBOL_PRINTED)
strcat(buf, "printed/");
if (val & SYMBOL_VALID)
strcat(buf, "valid/");
if (val & SYMBOL_OPTIONAL)
@ -457,14 +455,18 @@ static void text_insert_help(struct menu *menu)
{
GtkTextBuffer *buffer;
GtkTextIter start, end;
const char *prompt = menu_get_prompt(menu);
const char *prompt = _(menu_get_prompt(menu));
gchar *name;
const char *help;
help = _(menu_get_help(menu));
help = menu_get_help(menu);
/* Gettextize if the help text not empty */
if ((help != 0) && (help[0] != 0))
help = _(help);
if (menu->sym && menu->sym->name)
name = g_strdup_printf(_(menu->sym->name));
name = g_strdup_printf(menu->sym->name);
else
name = g_strdup("");
@ -1171,7 +1173,7 @@ static gchar **fill_row(struct menu *menu)
bzero(row, sizeof(row));
row[COL_OPTION] =
g_strdup_printf("%s %s", menu_get_prompt(menu),
g_strdup_printf("%s %s", _(menu_get_prompt(menu)),
sym && sym_has_value(sym) ? "(NEW)" : "");
if (show_all && !menu_is_visible(menu))
@ -1221,7 +1223,7 @@ static gchar **fill_row(struct menu *menu)
if (def_menu)
row[COL_VALUE] =
g_strdup(menu_get_prompt(def_menu));
g_strdup(_(menu_get_prompt(def_menu)));
}
if (sym->flags & SYMBOL_CHOICEVAL)
row[COL_BTNRAD] = GINT_TO_POINTER(TRUE);

View File

@ -1275,6 +1275,11 @@ YY_RULE_SETUP
case 32:
YY_RULE_SETUP
{
while (zconfleng) {
if ((zconftext[zconfleng-1] != ' ') && (zconftext[zconfleng-1] != '\t'))
break;
zconfleng--;
}
append_string(zconftext, zconfleng);
if (!first_ts)
first_ts = last_ts;

View File

@ -44,6 +44,7 @@ extern "C" {
#define T_OPT_MODULES 1
#define T_OPT_DEFCONFIG_LIST 2
#define T_OPT_ENV 3
struct kconf_id {
int name;
@ -74,6 +75,7 @@ void kconfig_load(void);
/* menu.c */
void menu_init(void);
void menu_warn(struct menu *menu, const char *fmt, ...);
struct menu *menu_add_menu(void);
void menu_end_menu(void);
void menu_add_entry(struct symbol *sym);
@ -103,6 +105,8 @@ void str_printf(struct gstr *gs, const char *fmt, ...);
const char *str_get(struct gstr *gs);
/* symbol.c */
extern struct expr *sym_env_list;
void sym_init(void);
void sym_clear_all_valid(void);
void sym_set_all_changed(void);
@ -110,6 +114,7 @@ void sym_set_changed(struct symbol *sym);
struct symbol *sym_check_deps(struct symbol *sym);
struct property *prop_alloc(enum prop_type type, struct symbol *sym);
struct symbol *prop_get_symbol(struct property *prop);
struct property *sym_get_env_prop(struct symbol *sym);
static inline tristate sym_get_tristate_value(struct symbol *sym)
{

View File

@ -36,14 +36,16 @@ trap "rm -f $tmp" 0 1 2 3 15
# Check if we can link to ncurses
check() {
echo "main() {}" | $cc -xc - -o $tmp 2> /dev/null
echo -e " #include CURSES_LOC \n main() {}" |
$cc -xc - -o $tmp 2> /dev/null
if [ $? != 0 ]; then
echo " *** Unable to find the ncurses libraries." 1>&2
echo " *** make menuconfig require the ncurses libraries" 1>&2
echo " *** " 1>&2
echo " *** Install ncurses (ncurses-devel) and try again" 1>&2
echo " *** " 1>&2
exit 1
echo " *** Unable to find the ncurses libraries or the" 1>&2
echo " *** required header files." 1>&2
echo " *** 'make menuconfig' requires the ncurses libraries." 1>&2
echo " *** " 1>&2
echo " *** Install ncurses (ncurses-devel) and try again." 1>&2
echo " *** " 1>&2
exit 1
fi
}

View File

@ -97,8 +97,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected)
int x = width / 2 - 11;
int y = height - 2;
print_button(dialog, "Select", y, x, selected == 0);
print_button(dialog, " Help ", y, x + 14, selected == 1);
print_button(dialog, gettext("Select"), y, x, selected == 0);
print_button(dialog, gettext(" Help "), y, x + 14, selected == 1);
wmove(dialog, y, x + 1 + 14 * selected);
wrefresh(dialog);

View File

@ -26,6 +26,12 @@
#include <string.h>
#include <stdbool.h>
#ifndef KBUILD_NO_NLS
# include <libintl.h>
#else
# define gettext(Msgid) ((const char *) (Msgid))
#endif
#ifdef __sun__
#define CURS_MACROS
#endif
@ -187,10 +193,9 @@ int item_is_tag(char tag);
int on_key_esc(WINDOW *win);
int on_key_resize(void);
void init_dialog(const char *backtitle);
int init_dialog(const char *backtitle);
void set_dialog_backtitle(const char *backtitle);
void reset_dialog(void);
void end_dialog(void);
void end_dialog(int x, int y);
void attr_clear(WINDOW * win, int height, int width, chtype attr);
void dialog_clear(void);
void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x);

View File

@ -31,8 +31,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected)
int x = width / 2 - 11;
int y = height - 2;
print_button(dialog, " Ok ", y, x, selected == 0);
print_button(dialog, " Help ", y, x + 14, selected == 1);
print_button(dialog, gettext(" Ok "), y, x, selected == 0);
print_button(dialog, gettext(" Help "), y, x + 14, selected == 1);
wmove(dialog, y, x + 1 + 14 * selected);
wrefresh(dialog);

View File

@ -157,9 +157,9 @@ static void print_buttons(WINDOW * win, int height, int width, int selected)
int x = width / 2 - 16;
int y = height - 2;
print_button(win, "Select", y, x, selected == 0);
print_button(win, " Exit ", y, x + 12, selected == 1);
print_button(win, " Help ", y, x + 24, selected == 2);
print_button(win, gettext("Select"), y, x, selected == 0);
print_button(win, gettext(" Exit "), y, x + 12, selected == 1);
print_button(win, gettext(" Help "), y, x + 24, selected == 2);
wmove(win, y, x + 1 + 12 * selected);
wrefresh(win);

View File

@ -114,7 +114,7 @@ int dialog_textbox(const char *title, const char *tbuf,
print_title(dialog, title, width);
print_button(dialog, " Exit ", height - 2, width / 2 - 4, TRUE);
print_button(dialog, gettext(" Exit "), height - 2, width / 2 - 4, TRUE);
wnoutrefresh(dialog);
getyx(dialog, cur_y, cur_x); /* Save cursor position */

View File

@ -266,10 +266,26 @@ void dialog_clear(void)
/*
* Do some initialization for dialog
*/
void init_dialog(const char *backtitle)
int init_dialog(const char *backtitle)
{
int height, width;
initscr(); /* Init curses */
getmaxyx(stdscr, height, width);
if (height < 19 || width < 80) {
endwin();
return -ERRDISPLAYTOOSMALL;
}
dlg.backtitle = backtitle;
color_setup(getenv("MENUCONFIG_COLOR"));
keypad(stdscr, TRUE);
cbreak();
noecho();
dialog_clear();
return 0;
}
void set_dialog_backtitle(const char *backtitle)
@ -277,20 +293,14 @@ void set_dialog_backtitle(const char *backtitle)
dlg.backtitle = backtitle;
}
void reset_dialog(void)
{
initscr(); /* Init curses */
keypad(stdscr, TRUE);
cbreak();
noecho();
dialog_clear();
}
/*
* End using dialog functions.
*/
void end_dialog(void)
void end_dialog(int x, int y)
{
/* move cursor back to original position */
move(y, x);
refresh();
endwin();
}

View File

@ -29,8 +29,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected)
int x = width / 2 - 10;
int y = height - 2;
print_button(dialog, " Yes ", y, x, selected == 0);
print_button(dialog, " No ", y, x + 13, selected == 1);
print_button(dialog, gettext(" Yes "), y, x, selected == 0);
print_button(dialog, gettext(" No "), y, x + 13, selected == 1);
wmove(dialog, y, x + 1 + 13 * selected);
wrefresh(dialog);

View File

@ -8,17 +8,13 @@
* i18n, 2005, Arnaldo Carvalho de Melo <acme@conectiva.com.br>
*/
#include <sys/ioctl.h>
#include <sys/wait.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <signal.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
#include <locale.h>
@ -275,8 +271,6 @@ search_help[] = N_(
"\n");
static int indent;
static struct termios ios_org;
static int rows = 0, cols = 0;
static struct menu *current_menu;
static int child_count;
static int single_menu_mode;
@ -290,51 +284,16 @@ static void show_textbox(const char *title, const char *text, int r, int c);
static void show_helptext(const char *title, const char *text);
static void show_help(struct menu *menu);
static void init_wsize(void)
{
struct winsize ws;
char *env;
if (!ioctl(STDIN_FILENO, TIOCGWINSZ, &ws)) {
rows = ws.ws_row;
cols = ws.ws_col;
}
if (!rows) {
env = getenv("LINES");
if (env)
rows = atoi(env);
if (!rows)
rows = 24;
}
if (!cols) {
env = getenv("COLUMNS");
if (env)
cols = atoi(env);
if (!cols)
cols = 80;
}
if (rows < 19 || cols < 80) {
fprintf(stderr, N_("Your display is too small to run Menuconfig!\n"));
fprintf(stderr, N_("It must be at least 19 lines by 80 columns.\n"));
exit(1);
}
rows -= 4;
cols -= 5;
}
static void get_prompt_str(struct gstr *r, struct property *prop)
{
int i, j;
struct menu *submenu[8], *menu;
str_printf(r, "Prompt: %s\n", prop->text);
str_printf(r, " Defined at %s:%d\n", prop->menu->file->name,
str_printf(r, _("Prompt: %s\n"), _(prop->text));
str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name,
prop->menu->lineno);
if (!expr_is_yes(prop->visible.expr)) {
str_append(r, " Depends on: ");
str_append(r, _(" Depends on: "));
expr_gstr_print(prop->visible.expr, r);
str_append(r, "\n");
}
@ -342,13 +301,13 @@ static void get_prompt_str(struct gstr *r, struct property *prop)
for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent)
submenu[i++] = menu;
if (i > 0) {
str_printf(r, " Location:\n");
str_printf(r, _(" Location:\n"));
for (j = 4; --i >= 0; j += 2) {
menu = submenu[i];
str_printf(r, "%*c-> %s", j, ' ', menu_get_prompt(menu));
str_printf(r, "%*c-> %s", j, ' ', _(menu_get_prompt(menu)));
if (menu->sym) {
str_printf(r, " (%s [=%s])", menu->sym->name ?
menu->sym->name : "<choice>",
menu->sym->name : _("<choice>"),
sym_get_string_value(menu->sym));
}
str_append(r, "\n");
@ -378,7 +337,7 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym)
if (hit)
str_append(r, "\n");
if (sym->rev_dep.expr) {
str_append(r, " Selected by: ");
str_append(r, _(" Selected by: "));
expr_gstr_print(sym->rev_dep.expr, r);
str_append(r, "\n");
}
@ -394,7 +353,7 @@ static struct gstr get_relations_str(struct symbol **sym_arr)
for (i = 0; sym_arr && (sym = sym_arr[i]); i++)
get_symbol_str(&res, sym);
if (!i)
str_append(&res, "No matches found.\n");
str_append(&res, _("No matches found.\n"));
return res;
}
@ -474,6 +433,7 @@ static void build_conf(struct menu *menu)
switch (prop->type) {
case P_MENU:
child_count++;
prompt = _(prompt);
if (single_menu_mode) {
item_make("%s%*c%s",
menu->data ? "-->" : "++>",
@ -489,7 +449,7 @@ static void build_conf(struct menu *menu)
case P_COMMENT:
if (prompt) {
child_count++;
item_make(" %*c*** %s ***", indent + 1, ' ', prompt);
item_make(" %*c*** %s ***", indent + 1, ' ', _(prompt));
item_set_tag(':');
item_set_data(menu);
}
@ -497,7 +457,7 @@ static void build_conf(struct menu *menu)
default:
if (prompt) {
child_count++;
item_make("---%*c%s", indent + 1, ' ', prompt);
item_make("---%*c%s", indent + 1, ' ', _(prompt));
item_set_tag(':');
item_set_data(menu);
}
@ -541,10 +501,10 @@ static void build_conf(struct menu *menu)
item_set_data(menu);
}
item_add_str("%*c%s", indent + 1, ' ', menu_get_prompt(menu));
item_add_str("%*c%s", indent + 1, ' ', _(menu_get_prompt(menu)));
if (val == yes) {
if (def_menu) {
item_add_str(" (%s)", menu_get_prompt(def_menu));
item_add_str(" (%s)", _(menu_get_prompt(def_menu)));
item_add_str(" --->");
if (def_menu->list) {
indent += 2;
@ -556,7 +516,7 @@ static void build_conf(struct menu *menu)
}
} else {
if (menu == current_menu) {
item_make("---%*c%s", indent + 1, ' ', menu_get_prompt(menu));
item_make("---%*c%s", indent + 1, ' ', _(menu_get_prompt(menu)));
item_set_tag(':');
item_set_data(menu);
goto conf_childs;
@ -599,17 +559,17 @@ static void build_conf(struct menu *menu)
tmp = indent - tmp + 4;
if (tmp < 0)
tmp = 0;
item_add_str("%*c%s%s", tmp, ' ', menu_get_prompt(menu),
item_add_str("%*c%s%s", tmp, ' ', _(menu_get_prompt(menu)),
(sym_has_value(sym) || !sym_is_changable(sym)) ?
"" : " (NEW)");
"" : _(" (NEW)"));
item_set_tag('s');
item_set_data(menu);
goto conf_childs;
}
}
item_add_str("%*c%s%s", indent + 1, ' ', menu_get_prompt(menu),
item_add_str("%*c%s%s", indent + 1, ' ', _(menu_get_prompt(menu)),
(sym_has_value(sym) || !sym_is_changable(sym)) ?
"" : " (NEW)");
"" : _(" (NEW)"));
if (menu->prompt->type == P_MENU) {
item_add_str(" --->");
return;
@ -647,7 +607,7 @@ static void conf(struct menu *menu)
item_set_tag('S');
}
dialog_clear();
res = dialog_menu(prompt ? prompt : _("Main Menu"),
res = dialog_menu(prompt ? _(prompt) : _("Main Menu"),
_(menu_instructions),
active_menu, &s_scroll);
if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL)
@ -694,7 +654,7 @@ static void conf(struct menu *menu)
if (sym)
show_help(submenu);
else
show_helptext("README", _(mconf_readme));
show_helptext(_("README"), _(mconf_readme));
break;
case 3:
if (item_is_tag('t')) {
@ -752,13 +712,13 @@ static void show_help(struct menu *menu)
str_append(&help, nohelp_text);
}
get_symbol_str(&help, sym);
show_helptext(menu_get_prompt(menu), str_get(&help));
show_helptext(_(menu_get_prompt(menu)), str_get(&help));
str_free(&help);
}
static void conf_choice(struct menu *menu)
{
const char *prompt = menu_get_prompt(menu);
const char *prompt = _(menu_get_prompt(menu));
struct menu *child;
struct symbol *active;
@ -772,7 +732,7 @@ static void conf_choice(struct menu *menu)
for (child = menu->list; child; child = child->next) {
if (!menu_is_visible(child))
continue;
item_make("%s", menu_get_prompt(child));
item_make("%s", _(menu_get_prompt(child)));
item_set_data(child);
if (child->sym == active)
item_set_selected(1);
@ -780,7 +740,7 @@ static void conf_choice(struct menu *menu)
item_set_tag('X');
}
dialog_clear();
res = dialog_checklist(prompt ? prompt : _("Main Menu"),
res = dialog_checklist(prompt ? _(prompt) : _("Main Menu"),
_(radiolist_instructions),
15, 70, 6);
selected = item_activate_selected();
@ -826,10 +786,10 @@ static void conf_string(struct menu *menu)
heading = _(inputbox_instructions_string);
break;
default:
heading = "Internal mconf error!";
heading = _("Internal mconf error!");
}
dialog_clear();
res = dialog_inputbox(prompt ? prompt : _("Main Menu"),
res = dialog_inputbox(prompt ? _(prompt) : _("Main Menu"),
heading, 10, 75,
sym_get_string_value(menu->sym));
switch (res) {
@ -900,13 +860,9 @@ static void conf_save(void)
}
}
static void conf_cleanup(void)
{
tcsetattr(1, TCSAFLUSH, &ios_org);
}
int main(int ac, char **av)
{
int saved_x, saved_y;
char *mode;
int res;
@ -923,11 +879,13 @@ int main(int ac, char **av)
single_menu_mode = 1;
}
tcgetattr(1, &ios_org);
atexit(conf_cleanup);
init_wsize();
reset_dialog();
init_dialog(NULL);
getyx(stdscr, saved_y, saved_x);
if (init_dialog(NULL)) {
fprintf(stderr, N_("Your display is too small to run Menuconfig!\n"));
fprintf(stderr, N_("It must be at least 19 lines by 80 columns.\n"));
return 1;
}
set_config_filename(conf_get_configname());
do {
conf(&rootmenu);
@ -941,7 +899,7 @@ int main(int ac, char **av)
else
res = -1;
} while (res == KEY_ESC);
end_dialog();
end_dialog(saved_x, saved_y);
switch (res) {
case 0:

View File

@ -15,7 +15,7 @@ static struct menu **last_entry_ptr;
struct file *file_list;
struct file *current_file;
static void menu_warn(struct menu *menu, const char *fmt, ...)
void menu_warn(struct menu *menu, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
@ -172,6 +172,9 @@ void menu_add_option(int token, char *arg)
else if (sym_defconfig_list != current_entry->sym)
zconf_error("trying to redefine defconfig symbol");
break;
case T_OPT_ENV:
prop_add_env(arg);
break;
}
}
@ -239,9 +242,11 @@ void menu_finalize(struct menu *parent)
for (menu = parent->list; menu; menu = menu->next) {
if (menu->sym) {
current_entry = parent;
menu_set_type(menu->sym->type);
if (sym->type == S_UNKNOWN)
menu_set_type(menu->sym->type);
current_entry = menu;
menu_set_type(sym->type);
if (menu->sym->type == S_UNKNOWN)
menu_set_type(sym->type);
break;
}
}
@ -326,12 +331,42 @@ void menu_finalize(struct menu *parent)
"values not supported");
}
current_entry = menu;
menu_set_type(sym->type);
if (menu->sym->type == S_UNKNOWN)
menu_set_type(sym->type);
/* Non-tristate choice values of tristate choices must
* depend on the choice being set to Y. The choice
* values' dependencies were propagated to their
* properties above, so the change here must be re-
* propagated. */
if (sym->type == S_TRISTATE && menu->sym->type != S_TRISTATE) {
basedep = expr_alloc_comp(E_EQUAL, sym, &symbol_yes);
basedep = expr_alloc_and(basedep, menu->dep);
basedep = expr_eliminate_dups(basedep);
menu->dep = basedep;
for (prop = menu->sym->prop; prop; prop = prop->next) {
if (prop->menu != menu)
continue;
dep = expr_alloc_and(expr_copy(basedep),
prop->visible.expr);
dep = expr_eliminate_dups(dep);
dep = expr_trans_bool(dep);
prop->visible.expr = dep;
if (prop->type == P_SELECT) {
struct symbol *es = prop_get_symbol(prop);
dep2 = expr_alloc_symbol(menu->sym);
dep = expr_alloc_and(dep2,
expr_copy(dep));
dep = expr_alloc_or(es->rev_dep.expr, dep);
dep = expr_eliminate_dups(dep);
es->rev_dep.expr = dep;
}
}
}
menu_add_symbol(P_CHOICE, sym, NULL);
prop = sym_get_choice_prop(sym);
for (ep = &prop->expr; *ep; ep = &(*ep)->left.expr)
;
*ep = expr_alloc_one(E_CHOICE, NULL);
*ep = expr_alloc_one(E_LIST, NULL);
(*ep)->right.sym = menu->sym;
}
if (menu->list && (!menu->prompt || !menu->prompt->text)) {
@ -394,9 +429,9 @@ bool menu_is_visible(struct menu *menu)
const char *menu_get_prompt(struct menu *menu)
{
if (menu->prompt)
return _(menu->prompt->text);
return menu->prompt->text;
else if (menu->sym)
return _(menu->sym->name);
return menu->sym->name;
return NULL;
}

View File

@ -114,7 +114,7 @@ void ConfigItem::updateMenu(void)
sym = menu->sym;
prop = menu->prompt;
prompt = QString::fromLocal8Bit(menu_get_prompt(menu));
prompt = _(menu_get_prompt(menu));
if (prop) switch (prop->type) {
case P_MENU:
@ -208,7 +208,7 @@ void ConfigItem::updateMenu(void)
break;
}
if (!sym_has_value(sym) && visible)
prompt += " (NEW)";
prompt += _(" (NEW)");
set_prompt:
setText(promptColIdx, prompt);
}
@ -346,7 +346,7 @@ ConfigList::ConfigList(ConfigView* p, const char *name)
for (i = 0; i < colNr; i++)
colMap[i] = colRevMap[i] = -1;
addColumn(promptColIdx, "Option");
addColumn(promptColIdx, _("Option"));
reinit();
}
@ -360,14 +360,14 @@ void ConfigList::reinit(void)
removeColumn(nameColIdx);
if (showName)
addColumn(nameColIdx, "Name");
addColumn(nameColIdx, _("Name"));
if (showRange) {
addColumn(noColIdx, "N");
addColumn(modColIdx, "M");
addColumn(yesColIdx, "Y");
}
if (showData)
addColumn(dataColIdx, "Value");
addColumn(dataColIdx, _("Value"));
updateListAll();
}
@ -803,7 +803,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
QAction *action;
headerPopup = new QPopupMenu(this);
action = new QAction(NULL, "Show Name", 0, this);
action = new QAction(NULL, _("Show Name"), 0, this);
action->setToggleAction(TRUE);
connect(action, SIGNAL(toggled(bool)),
parent(), SLOT(setShowName(bool)));
@ -811,7 +811,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
action, SLOT(setOn(bool)));
action->setOn(showName);
action->addTo(headerPopup);
action = new QAction(NULL, "Show Range", 0, this);
action = new QAction(NULL, _("Show Range"), 0, this);
action->setToggleAction(TRUE);
connect(action, SIGNAL(toggled(bool)),
parent(), SLOT(setShowRange(bool)));
@ -819,7 +819,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
action, SLOT(setOn(bool)));
action->setOn(showRange);
action->addTo(headerPopup);
action = new QAction(NULL, "Show Data", 0, this);
action = new QAction(NULL, _("Show Data"), 0, this);
action->setToggleAction(TRUE);
connect(action, SIGNAL(toggled(bool)),
parent(), SLOT(setShowData(bool)));
@ -1041,7 +1041,12 @@ void ConfigInfoView::menuInfo(void)
if (showDebug())
debug = debug_info(sym);
help = print_filter(_(menu_get_help(menu)));
help = menu_get_help(menu);
/* Gettextize if the help text not empty */
if (help.isEmpty())
help = print_filter(menu_get_help(menu));
else
help = print_filter(_(menu_get_help(menu)));
} else if (menu->prompt) {
head += "<big><b>";
head += print_filter(_(menu->prompt->text));
@ -1083,7 +1088,11 @@ QString ConfigInfoView::debug_info(struct symbol *sym)
debug += "</a><br>";
break;
case P_DEFAULT:
debug += "default: ";
case P_SELECT:
case P_RANGE:
case P_ENV:
debug += prop_get_type_name(prop->type);
debug += ": ";
expr_print(prop->expr, expr_print_help, &debug, E_NONE);
debug += "<br>";
break;
@ -1094,16 +1103,6 @@ QString ConfigInfoView::debug_info(struct symbol *sym)
debug += "<br>";
}
break;
case P_SELECT:
debug += "select: ";
expr_print(prop->expr, expr_print_help, &debug, E_NONE);
debug += "<br>";
break;
case P_RANGE:
debug += "range: ";
expr_print(prop->expr, expr_print_help, &debug, E_NONE);
debug += "<br>";
break;
default:
debug += "unknown property: ";
debug += prop_get_type_name(prop->type);
@ -1167,7 +1166,7 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char
QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
{
QPopupMenu* popup = Parent::createPopupMenu(pos);
QAction* action = new QAction(NULL,"Show Debug Info", 0, popup);
QAction* action = new QAction(NULL, _("Show Debug Info"), 0, popup);
action->setToggleAction(TRUE);
connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool)));
@ -1189,11 +1188,11 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
QVBoxLayout* layout1 = new QVBoxLayout(this, 11, 6);
QHBoxLayout* layout2 = new QHBoxLayout(0, 0, 6);
layout2->addWidget(new QLabel("Find:", this));
layout2->addWidget(new QLabel(_("Find:"), this));
editField = new QLineEdit(this);
connect(editField, SIGNAL(returnPressed()), SLOT(search()));
layout2->addWidget(editField);
searchButton = new QPushButton("Search", this);
searchButton = new QPushButton(_("Search"), this);
searchButton->setAutoDefault(FALSE);
connect(searchButton, SIGNAL(clicked()), SLOT(search()));
layout2->addWidget(searchButton);
@ -1313,58 +1312,58 @@ ConfigMainWindow::ConfigMainWindow(void)
menu = menuBar();
toolBar = new QToolBar("Tools", this);
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()));
backAction->setEnabled(FALSE);
QAction *quitAction = new QAction("Quit", "&Quit", CTRL+Key_Q, this);
QAction *quitAction = new QAction("Quit", _("&Quit"), CTRL+Key_Q, this);
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"), CTRL+Key_L, this);
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"), CTRL+Key_S, this);
connect(saveAction, SIGNAL(activated()), SLOT(saveConfig()));
conf_set_changed_callback(conf_changed);
// Set saveAction's initial state
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()));
QAction *searchAction = new QAction("Find", "&Find", CTRL+Key_F, this);
QAction *searchAction = new QAction("Find", _("&Find"), CTRL+Key_F, this);
connect(searchAction, SIGNAL(activated()), SLOT(searchConfig()));
QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), "Split View", 0, this);
QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), _("Single View"), 0, this);
connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView()));
QAction *splitViewAction = new QAction("Split View", QPixmap(xpm_split_view), "Split View", 0, this);
QAction *splitViewAction = new QAction("Split View", QPixmap(xpm_split_view), _("Split View"), 0, this);
connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView()));
QAction *fullViewAction = new QAction("Full View", QPixmap(xpm_tree_view), "Full View", 0, this);
QAction *fullViewAction = new QAction("Full View", QPixmap(xpm_tree_view), _("Full View"), 0, this);
connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView()));
QAction *showNameAction = new QAction(NULL, "Show Name", 0, this);
QAction *showNameAction = new QAction(NULL, _("Show Name"), 0, this);
showNameAction->setToggleAction(TRUE);
connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool)));
connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool)));
showNameAction->setOn(configView->showName());
QAction *showRangeAction = new QAction(NULL, "Show Range", 0, this);
QAction *showRangeAction = new QAction(NULL, _("Show Range"), 0, this);
showRangeAction->setToggleAction(TRUE);
connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool)));
connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool)));
showRangeAction->setOn(configList->showRange);
QAction *showDataAction = new QAction(NULL, "Show Data", 0, this);
QAction *showDataAction = new QAction(NULL, _("Show Data"), 0, this);
showDataAction->setToggleAction(TRUE);
connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool)));
connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool)));
showDataAction->setOn(configList->showData);
QAction *showAllAction = new QAction(NULL, "Show All Options", 0, this);
QAction *showAllAction = new QAction(NULL, _("Show All Options"), 0, this);
showAllAction->setToggleAction(TRUE);
connect(showAllAction, SIGNAL(toggled(bool)), configView, SLOT(setShowAll(bool)));
connect(showAllAction, SIGNAL(toggled(bool)), menuView, SLOT(setShowAll(bool)));
showAllAction->setOn(configList->showAll);
QAction *showDebugAction = new QAction(NULL, "Show Debug Info", 0, this);
QAction *showDebugAction = new QAction(NULL, _("Show Debug Info"), 0, this);
showDebugAction->setToggleAction(TRUE);
connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool)));
connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool)));
showDebugAction->setOn(helpText->showDebug());
QAction *showIntroAction = new QAction(NULL, "Introduction", 0, this);
QAction *showIntroAction = new QAction(NULL, _("Introduction"), 0, this);
connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro()));
QAction *showAboutAction = new QAction(NULL, "About", 0, this);
QAction *showAboutAction = new QAction(NULL, _("About"), 0, this);
connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout()));
// init tool bar
@ -1379,7 +1378,7 @@ ConfigMainWindow::ConfigMainWindow(void)
// create config menu
QPopupMenu* config = new QPopupMenu(this);
menu->insertItem("&File", config);
menu->insertItem(_("&File"), config);
loadAction->addTo(config);
saveAction->addTo(config);
saveAsAction->addTo(config);
@ -1388,12 +1387,12 @@ ConfigMainWindow::ConfigMainWindow(void)
// create edit menu
QPopupMenu* editMenu = new QPopupMenu(this);
menu->insertItem("&Edit", editMenu);
menu->insertItem(_("&Edit"), editMenu);
searchAction->addTo(editMenu);
// create options menu
QPopupMenu* optionMenu = new QPopupMenu(this);
menu->insertItem("&Option", optionMenu);
menu->insertItem(_("&Option"), optionMenu);
showNameAction->addTo(optionMenu);
showRangeAction->addTo(optionMenu);
showDataAction->addTo(optionMenu);
@ -1404,7 +1403,7 @@ ConfigMainWindow::ConfigMainWindow(void)
// create help menu
QPopupMenu* helpMenu = new QPopupMenu(this);
menu->insertSeparator();
menu->insertItem("&Help", helpMenu);
menu->insertItem(_("&Help"), helpMenu);
showIntroAction->addTo(helpMenu);
showAboutAction->addTo(helpMenu);
@ -1452,14 +1451,14 @@ void ConfigMainWindow::loadConfig(void)
if (s.isNull())
return;
if (conf_read(QFile::encodeName(s)))
QMessageBox::information(this, "qconf", "Unable to load configuration!");
QMessageBox::information(this, "qconf", _("Unable to load configuration!"));
ConfigView::updateListAll();
}
void ConfigMainWindow::saveConfig(void)
{
if (conf_write(NULL))
QMessageBox::information(this, "qconf", "Unable to save configuration!");
QMessageBox::information(this, "qconf", _("Unable to save configuration!"));
}
void ConfigMainWindow::saveConfigAs(void)
@ -1468,7 +1467,7 @@ void ConfigMainWindow::saveConfigAs(void)
if (s.isNull())
return;
if (conf_write(QFile::encodeName(s)))
QMessageBox::information(this, "qconf", "Unable to save configuration!");
QMessageBox::information(this, "qconf", _("Unable to save configuration!"));
}
void ConfigMainWindow::searchConfig(void)
@ -1612,11 +1611,11 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e)
e->accept();
return;
}
QMessageBox mb("qconf", "Save configuration?", QMessageBox::Warning,
QMessageBox mb("qconf", _("Save configuration?"), QMessageBox::Warning,
QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, QMessageBox::Cancel | QMessageBox::Escape);
mb.setButtonText(QMessageBox::Yes, "&Save Changes");
mb.setButtonText(QMessageBox::No, "&Discard Changes");
mb.setButtonText(QMessageBox::Cancel, "Cancel Exit");
mb.setButtonText(QMessageBox::Yes, _("&Save Changes"));
mb.setButtonText(QMessageBox::No, _("&Discard Changes"));
mb.setButtonText(QMessageBox::Cancel, _("Cancel Exit"));
switch (mb.exec()) {
case QMessageBox::Yes:
conf_write(NULL);
@ -1631,7 +1630,7 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e)
void ConfigMainWindow::showIntro(void)
{
static char str[] = "Welcome to the qconf graphical kernel configuration tool for Linux.\n\n"
static const QString str = _("Welcome to the qconf graphical kernel configuration tool for Linux.\n\n"
"For each option, a blank box indicates the feature is disabled, a check\n"
"indicates it is enabled, and a dot indicates that it is to be compiled\n"
"as a module. Clicking on the box will cycle through the three states.\n\n"
@ -1641,15 +1640,15 @@ void ConfigMainWindow::showIntro(void)
"options must be enabled to support the option you are interested in, you can\n"
"still view the help of a grayed-out option.\n\n"
"Toggling Show Debug Info under the Options menu will show the dependencies,\n"
"which you can then match by examining other options.\n\n";
"which you can then match by examining other options.\n\n");
QMessageBox::information(this, "qconf", str);
}
void ConfigMainWindow::showAbout(void)
{
static char str[] = "qconf is Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>.\n\n"
"Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n";
static const QString str = _("qconf is Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>.\n\n"
"Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n");
QMessageBox::information(this, "qconf", str);
}
@ -1707,7 +1706,7 @@ static const char *progname;
static void usage(void)
{
printf("%s <config>\n", progname);
printf(_("%s <config>\n"), progname);
exit(0);
}

View File

@ -34,6 +34,8 @@ struct symbol *sym_defconfig_list;
struct symbol *modules_sym;
tristate modules_val;
struct expr *sym_env_list;
void sym_add_default(struct symbol *sym, const char *def)
{
struct property *prop = prop_alloc(P_DEFAULT, sym);
@ -45,7 +47,6 @@ void sym_init(void)
{
struct symbol *sym;
struct utsname uts;
char *p;
static bool inited = false;
if (inited)
@ -54,20 +55,6 @@ void sym_init(void)
uname(&uts);
sym = sym_lookup("ARCH", 0);
sym->type = S_STRING;
sym->flags |= SYMBOL_AUTO;
p = getenv("ARCH");
if (p)
sym_add_default(sym, p);
sym = sym_lookup("KERNELVERSION", 0);
sym->type = S_STRING;
sym->flags |= SYMBOL_AUTO;
p = getenv("KERNELVERSION");
if (p)
sym_add_default(sym, p);
sym = sym_lookup("UNAME_RELEASE", 0);
sym->type = S_STRING;
sym->flags |= SYMBOL_AUTO;
@ -117,6 +104,15 @@ struct property *sym_get_choice_prop(struct symbol *sym)
return NULL;
}
struct property *sym_get_env_prop(struct symbol *sym)
{
struct property *prop;
for_all_properties(sym, prop, P_ENV)
return prop;
return NULL;
}
struct property *sym_get_default_prop(struct symbol *sym)
{
struct property *prop;
@ -199,7 +195,7 @@ static void sym_calc_visibility(struct symbol *sym)
tri = no;
for_all_prompts(sym, prop) {
prop->visible.tri = expr_calc_value(prop->visible.expr);
tri = E_OR(tri, prop->visible.tri);
tri = EXPR_OR(tri, prop->visible.tri);
}
if (tri == mod && (sym->type != S_TRISTATE || modules_val == no))
tri = yes;
@ -247,8 +243,7 @@ static struct symbol *sym_calc_choice(struct symbol *sym)
/* just get the first visible value */
prop = sym_get_choice_prop(sym);
for (e = prop->expr; e; e = e->left.expr) {
def_sym = e->right.sym;
expr_list_for_each_sym(prop->expr, e, def_sym) {
sym_calc_visibility(def_sym);
if (def_sym->visible != no)
return def_sym;
@ -303,7 +298,7 @@ void sym_calc_value(struct symbol *sym)
if (sym_is_choice_value(sym) && sym->visible == yes) {
prop = sym_get_choice_prop(sym);
newval.tri = (prop_get_symbol(prop)->curr.val == sym) ? yes : no;
} else if (E_OR(sym->visible, sym->rev_dep.tri) != no) {
} else if (EXPR_OR(sym->visible, sym->rev_dep.tri) != no) {
sym->flags |= SYMBOL_WRITE;
if (sym_has_value(sym))
newval.tri = sym->def[S_DEF_USER].tri;
@ -312,7 +307,7 @@ void sym_calc_value(struct symbol *sym)
if (prop)
newval.tri = expr_calc_value(prop->expr);
}
newval.tri = E_OR(E_AND(newval.tri, sym->visible), sym->rev_dep.tri);
newval.tri = EXPR_OR(EXPR_AND(newval.tri, sym->visible), sym->rev_dep.tri);
} else if (!sym_is_choice(sym)) {
prop = sym_get_default_prop(sym);
if (prop) {
@ -347,6 +342,9 @@ void sym_calc_value(struct symbol *sym)
;
}
if (sym->flags & SYMBOL_AUTO)
sym->flags &= ~SYMBOL_WRITE;
sym->curr = newval;
if (sym_is_choice(sym) && newval.tri == yes)
sym->curr.val = sym_calc_choice(sym);
@ -361,12 +359,14 @@ void sym_calc_value(struct symbol *sym)
}
if (sym_is_choice(sym)) {
struct symbol *choice_sym;
int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE);
prop = sym_get_choice_prop(sym);
for (e = prop->expr; e; e = e->left.expr) {
e->right.sym->flags |= flags;
expr_list_for_each_sym(prop->expr, e, choice_sym) {
choice_sym->flags |= flags;
if (flags & SYMBOL_CHANGED)
sym_set_changed(e->right.sym);
sym_set_changed(choice_sym);
}
}
}
@ -849,7 +849,7 @@ struct property *prop_alloc(enum prop_type type, struct symbol *sym)
struct symbol *prop_get_symbol(struct property *prop)
{
if (prop->expr && (prop->expr->type == E_SYMBOL ||
prop->expr->type == E_CHOICE))
prop->expr->type == E_LIST))
return prop->expr->left.sym;
return NULL;
}
@ -859,6 +859,8 @@ const char *prop_get_type_name(enum prop_type type)
switch (type) {
case P_PROMPT:
return "prompt";
case P_ENV:
return "env";
case P_COMMENT:
return "comment";
case P_MENU:
@ -876,3 +878,32 @@ const char *prop_get_type_name(enum prop_type type)
}
return "unknown";
}
void prop_add_env(const char *env)
{
struct symbol *sym, *sym2;
struct property *prop;
char *p;
sym = current_entry->sym;
sym->flags |= SYMBOL_AUTO;
for_all_properties(sym, prop, P_ENV) {
sym2 = prop_get_symbol(prop);
if (strcmp(sym2->name, env))
menu_warn(current_entry, "redefining environment symbol from %s",
sym2->name);
return;
}
prop = prop_alloc(P_ENV, sym);
prop->expr = expr_alloc_symbol(sym_lookup(env, 1));
sym_env_list = expr_alloc_one(E_LIST, sym_env_list);
sym_env_list->right.sym = sym;
p = getenv(env);
if (p)
sym_add_default(sym, p);
else
menu_warn(current_entry, "environment variable %s undefined", env);
}

View File

@ -29,6 +29,8 @@ struct file *file_lookup(const char *name)
/* write a dependency file as used by kbuild to track dependencies */
int file_write_dep(const char *name)
{
struct symbol *sym, *env_sym;
struct expr *e;
struct file *file;
FILE *out;
@ -45,8 +47,25 @@ int file_write_dep(const char *name)
fprintf(out, "\t%s\n", file->name);
}
fprintf(out, "\ninclude/config/auto.conf: \\\n"
"\t$(deps_config)\n\n"
"$(deps_config): ;\n");
"\t$(deps_config)\n\n");
expr_list_for_each_sym(sym_env_list, e, sym) {
struct property *prop;
const char *value;
prop = sym_get_env_prop(sym);
env_sym = prop_get_symbol(prop);
if (!env_sym)
continue;
value = getenv(env_sym->name);
if (!value)
value = "";
fprintf(out, "ifneq \"$(%s)\" \"%s\"\n", env_sym->name, value);
fprintf(out, "include/config/auto.conf: FORCE\n");
fprintf(out, "endif\n");
}
fprintf(out, "\n$(deps_config): ;\n");
fclose(out);
rename("..config.tmp", name);
return 0;

View File

@ -35,10 +35,10 @@ int, T_TYPE, TF_COMMAND, S_INT
hex, T_TYPE, TF_COMMAND, S_HEX
string, T_TYPE, TF_COMMAND, S_STRING
select, T_SELECT, TF_COMMAND
enable, T_SELECT, TF_COMMAND
range, T_RANGE, TF_COMMAND
option, T_OPTION, TF_COMMAND
on, T_ON, TF_PARAM
modules, T_OPT_MODULES, TF_OPTION
defconfig_list, T_OPT_DEFCONFIG_LIST,TF_OPTION
env, T_OPT_ENV, TF_OPTION
%%

Some files were not shown because too many files have changed in this diff Show More