Commit 5ea293a9 authored by Linus Torvalds's avatar Linus Torvalds

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
  ...
parents 03bc26cf d3883ece
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
*.i *.i
*.lst *.lst
*.symtypes *.symtypes
*.order
# #
# Top-level generic files # Top-level generic files
......
...@@ -24,7 +24,7 @@ visible if its parent entry is also visible. ...@@ -24,7 +24,7 @@ visible if its parent entry is also visible.
Menu entries 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: them. A single configuration option is defined like this:
config MODVERSIONS config MODVERSIONS
...@@ -50,7 +50,7 @@ applicable everywhere (see syntax). ...@@ -50,7 +50,7 @@ applicable everywhere (see syntax).
- type definition: "bool"/"tristate"/"string"/"hex"/"int" - type definition: "bool"/"tristate"/"string"/"hex"/"int"
Every config option must have a type. There are only two basic types: 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 definition optionally accepts an input prompt, so these two examples
are equivalent: are equivalent:
...@@ -108,7 +108,7 @@ applicable everywhere (see syntax). ...@@ -108,7 +108,7 @@ applicable everywhere (see syntax).
equal to 'y' without visiting the dependencies. So abusing equal to 'y' without visiting the dependencies. So abusing
select you are able to select a symbol FOO even if FOO depends 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 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 no dependencies. That will limit the usefulness but on the
other hand avoid the illegal configurations all over. kconfig other hand avoid the illegal configurations all over. kconfig
should one day warn about such things. should one day warn about such things.
...@@ -127,6 +127,27 @@ applicable everywhere (see syntax). ...@@ -127,6 +127,27 @@ applicable everywhere (see syntax).
used to help visually separate configuration logic from help within used to help visually separate configuration logic from help within
the file as an aid to developers. 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 Menu dependencies
----------------- -----------------
...@@ -162,9 +183,9 @@ An expression can have a value of 'n', 'm' or 'y' (or 0, 1, 2 ...@@ -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 respectively for calculations). A menu entry becomes visible when it's
expression evaluates to 'm' or 'y'. expression evaluates to 'm' or 'y'.
There are two types of symbols: constant and nonconstant symbols. There are two types of symbols: constant and non-constant symbols.
Nonconstant symbols are the most common ones and are defined with the Non-constant symbols are the most common ones and are defined with the
'config' statement. Nonconstant symbols consist entirely of alphanumeric 'config' statement. Non-constant symbols consist entirely of alphanumeric
characters or underscores. characters or underscores.
Constant symbols are only part of expressions. Constant symbols are Constant symbols are only part of expressions. Constant symbols are
always surrounded by single or double quotes. Within the quote, any always surrounded by single or double quotes. Within the quote, any
...@@ -301,3 +322,81 @@ mainmenu: ...@@ -301,3 +322,81 @@ mainmenu:
This sets the config program's title bar if the config program chooses This sets the config program's title bar if the config program chooses
to use it. 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
...@@ -520,6 +520,11 @@ KBUILD_CFLAGS += -g ...@@ -520,6 +520,11 @@ KBUILD_CFLAGS += -g
KBUILD_AFLAGS += -gdwarf-2 KBUILD_AFLAGS += -gdwarf-2
endif 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 # Force gcc to behave correct even for buggy distributions
KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector) KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
...@@ -793,7 +798,7 @@ define rule_vmlinux-modpost ...@@ -793,7 +798,7 @@ define rule_vmlinux-modpost
endef endef
# vmlinux image - including updated kernel symbols # 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 ifdef CONFIG_HEADERS_CHECK
$(Q)$(MAKE) -f $(srctree)/Makefile headers_check $(Q)$(MAKE) -f $(srctree)/Makefile headers_check
endif endif
...@@ -804,7 +809,9 @@ endif ...@@ -804,7 +809,9 @@ endif
$(call if_changed_rule,vmlinux__) $(call if_changed_rule,vmlinux__)
$(Q)rm -f .old_version $(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) $(call if_changed_rule,vmlinux-modpost)
# The actual objects are generated when descending, # The actual objects are generated when descending,
...@@ -1021,9 +1028,14 @@ ifdef CONFIG_MODULES ...@@ -1021,9 +1028,14 @@ ifdef CONFIG_MODULES
all: modules all: modules
# Build 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 PHONY += modules
modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)
$(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order
@echo ' Building modules, stage 2.'; @echo ' Building modules, stage 2.';
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
...@@ -1051,6 +1063,7 @@ _modinst_: ...@@ -1051,6 +1063,7 @@ _modinst_:
rm -f $(MODLIB)/build ; \ rm -f $(MODLIB)/build ; \
ln -s $(objtree) $(MODLIB)/build ; \ ln -s $(objtree) $(MODLIB)/build ; \
fi fi
@cp -f $(objtree)/modules.order $(MODLIB)/
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
# This depmod is only for convenience to give the initial # This depmod is only for convenience to give the initial
...@@ -1110,7 +1123,7 @@ clean: archclean $(clean-dirs) ...@@ -1110,7 +1123,7 @@ clean: archclean $(clean-dirs)
@find . $(RCS_FIND_IGNORE) \ @find . $(RCS_FIND_IGNORE) \
\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ -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 -type f -print | xargs rm -f
# mrproper - Delete all generated files, including .config # mrproper - Delete all generated files, including .config
...@@ -1175,7 +1188,7 @@ help: ...@@ -1175,7 +1188,7 @@ help:
@echo ' dir/ - Build all files in dir and below' @echo ' dir/ - Build all files in dir and below'
@echo ' dir/file.[ois] - Build specified target only' @echo ' dir/file.[ois] - Build specified target only'
@echo ' dir/file.ko - Build module including final link' @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 ' tags/TAGS - Generate tags file for editors'
@echo ' cscope - Generate cscope index' @echo ' cscope - Generate cscope index'
@echo ' kernelrelease - Output the release version string' @echo ' kernelrelease - Output the release version string'
...@@ -1188,6 +1201,8 @@ help: ...@@ -1188,6 +1201,8 @@ help:
@echo 'Static analysers' @echo 'Static analysers'
@echo ' checkstack - Generate a list of stack hogs' @echo ' checkstack - Generate a list of stack hogs'
@echo ' namespacecheck - Name space analysis on compiled kernel' @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' @echo ' export_report - List the usages of all exported symbols'
@if [ -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \ @if [ -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \
echo ' headers_check - Sanity check on exported headers'; \ echo ' headers_check - Sanity check on exported headers'; \
...@@ -1371,6 +1386,7 @@ define xtags ...@@ -1371,6 +1386,7 @@ define xtags
if $1 --version 2>&1 | grep -iq exuberant; then \ if $1 --version 2>&1 | grep -iq exuberant; then \
$(all-sources) | xargs $1 -a \ $(all-sources) | xargs $1 -a \
-I __initdata,__exitdata,__acquires,__releases \ -I __initdata,__exitdata,__acquires,__releases \
-I __read_mostly,____cacheline_aligned,____cacheline_aligned_in_smp,____cacheline_internodealigned_in_smp \
-I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \
--extra=+f --c-kinds=+px \ --extra=+f --c-kinds=+px \
--regex-asm='/^ENTRY\(([^)]*)\).*/\1/'; \ --regex-asm='/^ENTRY\(([^)]*)\).*/\1/'; \
...@@ -1428,12 +1444,12 @@ tags: FORCE ...@@ -1428,12 +1444,12 @@ tags: FORCE
includecheck: includecheck:
find * $(RCS_FIND_IGNORE) \ find * $(RCS_FIND_IGNORE) \
-name '*.[hcS]' -type f -print | sort \ -name '*.[hcS]' -type f -print | sort \
| xargs $(PERL) -w scripts/checkincludes.pl | xargs $(PERL) -w $(srctree)/scripts/checkincludes.pl
versioncheck: versioncheck:
find * $(RCS_FIND_IGNORE) \ find * $(RCS_FIND_IGNORE) \
-name '*.[hcS]' -type f -print | sort \ -name '*.[hcS]' -type f -print | sort \
| xargs $(PERL) -w scripts/checkversion.pl | xargs $(PERL) -w $(srctree)/scripts/checkversion.pl
namespacecheck: namespacecheck:
$(PERL) $(srctree)/scripts/namespace.pl $(PERL) $(srctree)/scripts/namespace.pl
......
...@@ -46,11 +46,11 @@ SECTIONS ...@@ -46,11 +46,11 @@ SECTIONS
__init_begin = .; __init_begin = .;
.init.text : { .init.text : {
_sinittext = .; _sinittext = .;
*(.init.text) INIT_TEXT
_einittext = .; _einittext = .;
} }
.init.data : { .init.data : {
*(.init.data) INIT_DATA
} }
. = ALIGN(16); . = ALIGN(16);
...@@ -136,8 +136,8 @@ SECTIONS ...@@ -136,8 +136,8 @@ SECTIONS
/* Sections to be discarded */ /* Sections to be discarded */
/DISCARD/ : { /DISCARD/ : {
*(.exit.text) EXIT_TEXT
*(.exit.data) EXIT_DATA
*(.exitcall.exit) *(.exitcall.exit)
} }
......
...@@ -30,8 +30,7 @@ _atomic_dec_and_lock: \n\ ...@@ -30,8 +30,7 @@ _atomic_dec_and_lock: \n\
.previous \n\ .previous \n\
.end _atomic_dec_and_lock"); .end _atomic_dec_and_lock");
static int __attribute_used__ static int __used atomic_dec_and_lock_1(atomic_t *atomic, spinlock_t *lock)
atomic_dec_and_lock_1(atomic_t *atomic, spinlock_t *lock)
{ {
/* Slow path */ /* Slow path */
spin_lock(lock); spin_lock(lock);
......
...@@ -30,7 +30,7 @@ SECTIONS ...@@ -30,7 +30,7 @@ SECTIONS
} }
.init : { /* Init code and data */ .init : { /* Init code and data */
*(.init.text) INIT_TEXT
_einittext = .; _einittext = .;
__proc_info_begin = .; __proc_info_begin = .;
*(.proc.info.init) *(.proc.info.init)
...@@ -70,15 +70,15 @@ SECTIONS ...@@ -70,15 +70,15 @@ SECTIONS
__per_cpu_end = .; __per_cpu_end = .;
#ifndef CONFIG_XIP_KERNEL #ifndef CONFIG_XIP_KERNEL
__init_begin = _stext; __init_begin = _stext;
*(.init.data) INIT_DATA
. = ALIGN(4096); . = ALIGN(4096);
__init_end = .; __init_end = .;
#endif #endif
} }
/DISCARD/ : { /* Exit code and data */ /DISCARD/ : { /* Exit code and data */
*(.exit.text) EXIT_TEXT
*(.exit.data) EXIT_DATA
*(.exitcall.exit) *(.exitcall.exit)
#ifndef CONFIG_MMU #ifndef CONFIG_MMU
*(.fixup) *(.fixup)
...@@ -130,7 +130,7 @@ SECTIONS ...@@ -130,7 +130,7 @@ SECTIONS
#ifdef CONFIG_XIP_KERNEL #ifdef CONFIG_XIP_KERNEL
. = ALIGN(4096); . = ALIGN(4096);
__init_begin = .; __init_begin = .;
*(.init.data) INIT_DATA
. = ALIGN(4096); . = ALIGN(4096);
__init_end = .; __init_end = .;
#endif #endif
......
# #
# Makefile for the linux kernel. # 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. # Object file lists.
......
# #
# Makefile for the linux kernel. # 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. # Object file lists.
......
...@@ -27,19 +27,19 @@ SECTIONS ...@@ -27,19 +27,19 @@ SECTIONS
__init_begin = .; __init_begin = .;
_sinittext = .; _sinittext = .;
*(.text.reset) *(.text.reset)
*(.init.text) INIT_TEXT
/* /*
* .exit.text is discarded at runtime, not * .exit.text is discarded at runtime, not
* link time, to deal with references from * link time, to deal with references from
* __bug_table * __bug_table
*/ */
*(.exit.text) EXIT_TEXT
_einittext = .; _einittext = .;
. = ALIGN(4); . = ALIGN(4);
__tagtable_begin = .; __tagtable_begin = .;
*(.taglist.init) *(.taglist.init)
__tagtable_end = .; __tagtable_end = .;
*(.init.data) INIT_DATA
. = ALIGN(16); . = ALIGN(16);
__setup_start = .; __setup_start = .;
*(.init.setup) *(.init.setup)
...@@ -135,7 +135,7 @@ SECTIONS ...@@ -135,7 +135,7 @@ SECTIONS
* thrown away, as cleanup code is never called unless it's a module. * thrown away, as cleanup code is never called unless it's a module.
*/ */
/DISCARD/ : { /DISCARD/ : {
*(.exit.data) EXIT_DATA
*(.exitcall.exit) *(.exitcall.exit)
} }
......
...@@ -91,13 +91,13 @@ SECTIONS ...@@ -91,13 +91,13 @@ SECTIONS
{ {
. = ALIGN(PAGE_SIZE); . = ALIGN(PAGE_SIZE);
__sinittext = .; __sinittext = .;
*(.init.text) INIT_TEXT
__einittext = .; __einittext = .;
} }
.init.data : .init.data :
{ {
. = ALIGN(16); . = ALIGN(16);
*(.init.data) INIT_DATA
} }
.init.setup : .init.setup :
{ {
...@@ -198,8 +198,8 @@ SECTIONS ...@@ -198,8 +198,8 @@ SECTIONS
/DISCARD/ : /DISCARD/ :
{ {
*(.exit.text) EXIT_TEXT
*(.exit.data) EXIT_DATA
*(.exitcall.exit) *(.exitcall.exit)
} }
} }
...@@ -57,10 +57,10 @@ SECTIONS ...@@ -57,10 +57,10 @@ SECTIONS
__init_begin = .; __init_begin = .;
.init.text : { .init.text : {
_sinittext = .; _sinittext = .;
*(.init.text) INIT_TEXT
_einittext = .; _einittext = .;
} }
.init.data : { *(.init.data) } .init.data : { INIT_DATA }
. = ALIGN(16); . = ALIGN(16);
__setup_start = .; __setup_start = .;
.init.setup : { *(.init.setup) } .init.setup : { *(.init.setup) }
...@@ -109,8 +109,8 @@ SECTIONS ...@@ -109,8 +109,8 @@ SECTIONS
/* Sections to be discarded */ /* Sections to be discarded */
/DISCARD/ : { /DISCARD/ : {
*(.text.exit) EXIT_TEXT
*(.data.exit) EXIT_DATA
*(.exitcall.exit) *(.exitcall.exit)
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
target = $(target_compressed_dir) target = $(target_compressed_dir)
src = $(src_compressed_dir) src = $(src_compressed_dir)
CC = gcc-cris -mlinux -march=v32 -I $(TOPDIR)/include CC = gcc-cris -mlinux -march=v32 $(LINUXINCLUDE)
CFLAGS = -O2 CFLAGS = -O2
LD = gcc-cris -mlinux -march=v32 -nostdlib LD = gcc-cris -mlinux -march=v32 -nostdlib
OBJCOPY = objcopy-cris OBJCOPY = objcopy-cris
......
...@@ -61,10 +61,10 @@ SECTIONS ...@@ -61,10 +61,10 @@ SECTIONS
__init_begin = .; __init_begin = .;
.init.text : { .init.text : {
_sinittext = .; _sinittext = .;
*(.init.text) INIT_TEXT
_einittext = .; _einittext = .;
} }
.init.data : { *(.init.data) } .init.data : { INIT_DATA }
. = ALIGN(16); . = ALIGN(16);
__setup_start = .; __setup_start = .;
.init.setup : { *(.init.setup) } .init.setup : { *(.init.setup) }
...@@ -124,8 +124,8 @@ SECTIONS ...@@ -124,8 +124,8 @@ SECTIONS
/* Sections to be discarded */ /* Sections to be discarded */
/DISCARD/ : { /DISCARD/ : {
*(.text.exit) EXIT_TEXT
*(.data.exit) EXIT_DATA
*(.exitcall.exit) *(.exitcall.exit)
} }
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
targets := Image zImage bootpImage targets := Image zImage bootpImage
SYSTEM =$(TOPDIR)/$(LINUX) SYSTEM =$(LINUX)
ZTEXTADDR = 0x02080000 ZTEXTADDR = 0x02080000
PARAMS_PHYS = 0x0207c000 PARAMS_PHYS = 0x0207c000
...@@ -45,7 +45,7 @@ zImage: $(CONFIGURE) compressed/$(LINUX) ...@@ -45,7 +45,7 @@ zImage: $(CONFIGURE) compressed/$(LINUX)
bootpImage: bootp/bootp bootpImage: bootp/bootp
$(OBJCOPY) -O binary -R .note -R .comment -S 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) @$(MAKE) -C compressed $(LINUX)
bootp/bootp: zImage initrd bootp/bootp: zImage initrd
...@@ -59,10 +59,10 @@ initrd: ...@@ -59,10 +59,10 @@ initrd:
# installation # installation
# #
install: $(CONFIGURE) Image 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 zinstall: $(CONFIGURE) zImage
sh ./install.sh $(KERNELRELEASE) zImage $(TOPDIR)/System.map "$(INSTALL_PATH)" sh ./install.sh $(KERNELRELEASE) zImage System.map "$(INSTALL_PATH)"
# #
# miscellany # miscellany
......
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
* Example: * Example:
* $ cd ~/linux * $ cd ~/linux
* $ make menuconfig <go to "Kernel Hacking" and turn on remote debugging> * $ make menuconfig <go to "Kernel Hacking" and turn on remote debugging>
* $ make dep; make vmlinux * $ make vmlinux
* *
* Step 3: * Step 3:
* Download the kernel to the remote target and start * Download the kernel to the remote target and start
......
...@@ -28,14 +28,14 @@ SECTIONS ...@@ -28,14 +28,14 @@ SECTIONS
.init.text : { .init.text : {
*(.text.head) *(.text.head)
#ifndef CONFIG_DEBUG_INFO #ifndef CONFIG_DEBUG_INFO
*(.init.text) INIT_TEXT
*(.exit.text) EXIT_TEXT
*(.exit.data) EXIT_DATA
*(.exitcall.exit) *(.exitcall.exit)
#endif #endif
} }
_einittext = .; _einittext = .;
.init.data : { *(.init.data) } .init.data : { INIT_DATA }
. = ALIGN(8); . = ALIGN(8);
__setup_start = .; __setup_start = .;
...@@ -106,8 +106,8 @@ SECTIONS ...@@ -106,8 +106,8 @@ SECTIONS
LOCK_TEXT LOCK_TEXT
#ifdef CONFIG_DEBUG_INFO #ifdef CONFIG_DEBUG_INFO
*( *(
.init.text INIT_TEXT
.exit.text EXIT_TEXT
.exitcall.exit .exitcall.exit
) )
#endif #endif
...@@ -138,7 +138,7 @@ SECTIONS ...@@ -138,7 +138,7 @@ SECTIONS
.data : { /* Data */ .data : { /* Data */
DATA_DATA DATA_DATA
*(.data.*) *(.data.*)
*(.exit.data) EXIT_DATA
CONSTRUCTORS CONSTRUCTORS
} }
......
...@@ -110,9 +110,9 @@ SECTIONS ...@@ -110,9 +110,9 @@ SECTIONS
. = ALIGN(0x4) ; . = ALIGN(0x4) ;
___init_begin = .; ___init_begin = .;
__sinittext = .; __sinittext = .;
*(.init.text) INIT_TEXT
__einittext = .; __einittext = .;
*(.init.data) INIT_DATA
. = ALIGN(0x4) ; . = ALIGN(0x4) ;
___setup_start = .; ___setup_start = .;
*(.init.setup) *(.init.setup)
...@@ -124,8 +124,8 @@ SECTIONS ...@@ -124,8 +124,8 @@ SECTIONS
___con_initcall_start = .; ___con_initcall_start = .;
*(.con_initcall.init) *(.con_initcall.init)
___con_initcall_end = .; ___con_initcall_end = .;
*(.exit.text) EXIT_TEXT
*(.exit.data) EXIT_DATA
#if defined(CONFIG_BLK_DEV_INITRD) #if defined(CONFIG_BLK_DEV_INITRD)
. = ALIGN(4); . = ALIGN(4);
___initramfs_start = .; ___initramfs_start = .;
......
...@@ -27,8 +27,8 @@ SECTIONS ...@@ -27,8 +27,8 @@ SECTIONS
{ {
/* Sections to be discarded */ /* Sections to be discarded */
/DISCARD/ : { /DISCARD/ : {
*(.exit.text) EXIT_TEXT
*(.exit.data) EXIT_DATA
*(.exitcall.exit) *(.exitcall.exit)
*(.IA_64.unwind.exit.text) *(.IA_64.unwind.exit.text)
*(.IA_64.unwind_info.exit.text) *(.IA_64.unwind_info.exit.text)
...@@ -119,12 +119,12 @@ SECTIONS ...@@ -119,12 +119,12 @@ SECTIONS
.init.text : AT(ADDR(.init.text) - LOAD_OFFSET) .init.text : AT(ADDR(.init.text) - LOAD_OFFSET)
{ {
_sinittext = .; _sinittext = .;
*(.init.text) INIT_TEXT
_einittext = .; _einittext = .;
} }
.init.data : AT(ADDR(.init.data) - LOAD_OFFSET) .init.data : AT(ADDR(.init.data) - LOAD_OFFSET)
{ *(.init.data) } { INIT_DATA }
#ifdef CONFIG_BLK_DEV_INITRD #ifdef CONFIG_BLK_DEV_INITRD
.init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET)
......
...@@ -76,10 +76,10 @@ SECTIONS ...@@ -76,10 +76,10 @@ SECTIONS
__init_begin = .; __init_begin = .;
.init.text : { .init.text : {
_sinittext = .; _sinittext = .;
*(.init.text) INIT_TEXT
_einittext = .; _einittext = .;
} }
.init.data : { *(.init.data) } .init.data : { INIT_DATA }
. = ALIGN(16); . = ALIGN(16);
__setup_start = .; __setup_start = .;
.init.setup : { *(.init.setup) } .init.setup : { *(.init.setup) }
...@@ -100,8 +100,8 @@ SECTIONS ...@@ -100,8 +100,8 @@ SECTIONS
.altinstr_replacement : { *(.altinstr_replacement) } .altinstr_replacement : { *(.altinstr_replacement) }
/* .exit.text is discard at runtime, not link time, to deal with references /* .exit.text is discard at runtime, not link time, to deal with references
from .altinstructions and .eh_frame */ from .altinstructions and .eh_frame */
.exit.text : { *(.exit.text) } .exit.text : { EXIT_TEXT }
.exit.data : { *(.exit.data) } .exit.data : { EXIT_DATA }
#ifdef CONFIG_BLK_DEV_INITRD #ifdef CONFIG_BLK_DEV_INITRD
. = ALIGN(4096); . = ALIGN(4096);
...@@ -124,8 +124,8 @@ SECTIONS ...@@ -124,8 +124,8 @@ SECTIONS
/* Sections to be discarded */ /* Sections to be discarded */
/DISCARD/ : { /DISCARD/ : {
*(.exit.text) EXIT_TEXT
*(.exit.data) EXIT_DATA
*(.exitcall.exit) *(.exitcall.exit)
} }
......
...@@ -45,10 +45,10 @@ SECTIONS ...@@ -45,10 +45,10 @@ SECTIONS
__init_begin = .; __init_begin = .;
.init.text : { .init.text : {
_sinittext = .; _sinittext = .;
*(.init.text) INIT_TEXT
_einittext = .; _einittext = .;
} }
.init.data : { *(.init.data) } .init.data : { INIT_DATA }
. = ALIGN(16); . = ALIGN(16);
__setup_start = .; __setup_start = .;
.init.setup : { *(.init.setup) } .init.setup : { *(.init.setup) }
...@@ -82,8 +82,8 @@ SECTIONS ...@@ -82,8 +82,8 @@ SECTIONS
/* Sections to be discarded */ /* Sections to be discarded */
/DISCARD/ : { /DISCARD/ : {
*(.exit.text) EXIT_TEXT
*(.exit.data) EXIT_DATA
*(.exitcall.exit) *(.exitcall.exit)
} }
......
...@@ -38,10 +38,10 @@ SECTIONS ...@@ -38,10 +38,10 @@ SECTIONS
__init_begin = .; __init_begin = .;
.init.text : { .init.text : {
_sinittext = .; _sinittext = .;
*(.init.text) INIT_TEXT
_einittext = .; _einittext = .;
} }
.init.data : { *(.init.data) } .init.data : { INIT_DATA }
. = ALIGN(16); . = ALIGN(16);
__setup_start = .; __setup_start = .;
.init.setup : { *(.init.setup) } .init.setup : { *(.init.setup) }
...@@ -77,8 +77,8 @@ __init_begin = .; ...@@ -77,8 +77,8 @@ __init_begin = .;
/* Sections to be discarded */ /* Sections to be discarded */
/DISCARD/ : { /DISCARD/ : {
*(.exit.text) EXIT_TEXT
*(.exit.data) EXIT_DATA
*(.exitcall.exit) *(.exitcall.exit)
} }
......
...@@ -143,9 +143,9 @@ SECTIONS { ...@@ -143,9 +143,9 @@ SECTIONS {
. = ALIGN(4096); . = ALIGN(4096);
__init_begin = .; __init_begin = .;
_sinittext = .; _sinittext = .;
*(.init.text) INIT_TEXT
_einittext = .; _einittext = .;
*(.init.data) INIT_DATA
. = ALIGN(16); . = ALIGN(16);
__setup_start = .; __setup_start = .;
*(.init.setup) *(.init.setup)
...@@ -170,8 +170,8 @@ SECTIONS { ...@@ -170,8 +170,8 @@ SECTIONS {
} > INIT } > INIT
/DISCARD/ : { /DISCARD/ : {
*(.exit.text) EXIT_TEXT
*(.exit.data) EXIT_DATA
*(.exitcall.exit) *(.exitcall.exit)
} }
......
...@@ -114,11 +114,11 @@ SECTIONS ...@@ -114,11 +114,11 @@ SECTIONS
__init_begin = .; __init_begin = .;
.init.text : { .init.text : {
_sinittext = .; _sinittext = .;
*(.init.text) INIT_TEXT
_einittext = .; _einittext = .;
} }
.init.data : { .init.data : {
*(.init.data) INIT_DATA
} }
. = ALIGN(16); . = ALIGN(16);
.init.setup : { .init.setup : {
...@@ -144,10 +144,10 @@ SECTIONS ...@@ -144,10 +144,10 @@ SECTIONS
* references from .rodata * references from .rodata
*/ */
.exit.text : { .exit.text : {
*(.exit.text) EXIT_TEXT
} }
.exit.data : { .exit.data : {
*(.exit.data) EXIT_DATA
} }
#if defined(CONFIG_BLK_DEV_INITRD) #if defined(CONFIG_BLK_DEV_INITRD)
. = ALIGN(_PAGE_SIZE); . = ALIGN(_PAGE_SIZE);
......
# #
# Makefile for common code for Toshiba TX4927 based systems # 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 obj-y += tx4927_prom.o tx4927_setup.o tx4927_irq.o
......
# #
# Makefile for common code for Toshiba TX4927 based systems # 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-y += prom.o setup.o irq.o
obj-$(CONFIG_KGDB) += dbgio.o obj-$(CONFIG_KGDB) += dbgio.o
......
# #
# Makefile for common code for Toshiba TX4927 based systems # 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 obj-y += prom.o setup.o irq.o spi_eeprom.o
......
...@@ -172,11 +172,11 @@ SECTIONS ...@@ -172,11 +172,11 @@ SECTIONS
__init_begin = .; __init_begin = .;
.init.text : { .init.text : {
_sinittext = .; _sinittext = .;
*(.init.text) INIT_TEXT
_einittext = .; _einittext = .;
} }
.init.data : { .init.data : {
*(.init.data) INIT_DATA
} }
. = ALIGN(16); . = ALIGN(16);
.init.setup : { .init.setup : {
...@@ -215,10 +215,10 @@ SECTIONS ...@@ -215,10 +215,10 @@ SECTIONS
* from .altinstructions and .eh_frame * from .altinstructions and .eh_frame
*/ */
.exit.text : { .exit.text : {
*(.exit.text) EXIT_TEXT
} }
.exit.data : { .exit.data : {
*(.exit.data) EXIT_DATA
} }
#ifdef CONFIG_BLK_DEV_INITRD #ifdef CONFIG_BLK_DEV_INITRD
. = ALIGN(PAGE_SIZE); . = ALIGN(PAGE_SIZE);
......
...@@ -65,7 +65,7 @@ obj-wlib := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-wlib)))) ...@@ -65,7 +65,7 @@ obj-wlib := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-wlib))))
obj-plat := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-plat)))) obj-plat := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-plat))))
quiet_cmd_copy_zlib = COPY $@ 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 $@ quiet_cmd_copy_zlibheader = COPY $@
cmd_copy_zlibheader = sed "s@<linux/\([^>]*\).*@\"\1\"@" $< > $@ cmd_copy_zlibheader = sed "s@<linux/\([^>]*\).*@\"\1\"@" $< > $@
......
...@@ -158,7 +158,7 @@ static ssize_t show_##NAME(struct sys_device *dev, char *buf) \ ...@@ -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); \ unsigned long val = run_on_cpu(cpu->sysdev.id, read_##NAME, 0); \
return sprintf(buf, "%lx\n", val); \ 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) \ store_##NAME(struct sys_device *dev, const char *buf, size_t count) \
{ \ { \
struct cpu *cpu = container_of(dev, struct cpu, sysdev); \ struct cpu *cpu = container_of(dev, struct cpu, sysdev); \
......
...@@ -23,7 +23,7 @@ SECTIONS ...@@ -23,7 +23,7 @@ SECTIONS
/* Sections to be discarded. */ /* Sections to be discarded. */
/DISCARD/ : { /DISCARD/ : {
*(.exitcall.exit) *(.exitcall.exit)
*(.exit.data) EXIT_DATA
} }
. = KERNELBASE; . = KERNELBASE;
...@@ -76,17 +76,19 @@ SECTIONS ...@@ -76,17 +76,19 @@ SECTIONS
.init.text : { .init.text : {
_sinittext = .; _sinittext = .;
*(.init.text) INIT_TEXT
_einittext = .; _einittext = .;
} }
/* .exit.text is discarded at runtime, not link time, /* .exit.text is discarded at runtime, not link time,
* to deal with references from __bug_table * to deal with references from __bug_table
*/ */
.exit.text : { *(.exit.text) } .exit.text : {
EXIT_TEXT
}
.init.data : { .init.data : {
*(.init.data); INIT_DATA
__vtop_table_begin = .; __vtop_table_begin = .;
*(.vtop_fixup); *(.vtop_fixup);
__vtop_table_end = .; __vtop_table_end = .;
......
...@@ -172,15 +172,15 @@ static void power4_stop(void) ...@@ -172,15 +172,15 @@ static void power4_stop(void)
} }
/* Fake functions used by canonicalize_pc */ /* 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)
{ {
} }
......
...@@ -97,14 +97,14 @@ SECTIONS ...@@ -97,14 +97,14 @@ SECTIONS
__init_begin = .; __init_begin = .;
.init.text : { .init.text : {
_sinittext = .; _sinittext = .;
*(.init.text) INIT_TEXT
_einittext = .; _einittext = .;
} }
/* .exit.text is discarded at runtime, not link time, /* .exit.text is discarded at runtime, not link time,
to deal with references from __bug_table */ to deal with references from __bug_table */
.exit.text : { *(.exit.text) } .exit.text : { EXIT_TEXT }
.init.data : { .init.data : {
*(.init.data); INIT_DATA
__vtop_table_begin = .; __vtop_table_begin = .;
*(.vtop_fixup); *(.vtop_fixup);
__vtop_table_end = .; __vtop_table_end = .;
...@@ -164,6 +164,6 @@ SECTIONS ...@@ -164,6 +164,6 @@ SECTIONS
/* Sections to be discarded. */ /* Sections to be discarded. */
/DISCARD/ : { /DISCARD/ : {
*(.exitcall.exit) *(.exitcall.exit)
*(.exit.data) EXIT_DATA
} }
} }
...@@ -97,7 +97,7 @@ SECTIONS ...@@ -97,7 +97,7 @@ SECTIONS
__init_begin = .; __init_begin = .;
.init.text : { .init.text : {
_sinittext = .; _sinittext = .;
*(.init.text) INIT_TEXT
_einittext = .; _einittext = .;
} }
/* /*
...@@ -105,11 +105,11 @@ SECTIONS ...@@ -105,11 +105,11 @@ SECTIONS
* to deal with references from __bug_table * to deal with references from __bug_table
*/ */
.exit.text : { .exit.text : {
*(.exit.text) EXIT_TEXT
} }
.init.data : { .init.data : {
*(.init.data) INIT_DATA
} }
. = ALIGN(0x100); . = ALIGN(0x100);
.init.setup : { .init.setup : {
...@@ -156,7 +156,7 @@ SECTIONS ...@@ -156,7 +156,7 @@ SECTIONS
/* Sections to be discarded */ /* Sections to be discarded */
/DISCARD/ : { /DISCARD/ : {
*(.exit.data) EXIT_DATA
*(.exitcall.exit) *(.exitcall.exit)
} }
......
...@@ -84,9 +84,9 @@ SECTIONS ...@@ -84,9 +84,9 @@ SECTIONS
. = ALIGN(PAGE_SIZE); /* Init code and data */ . = ALIGN(PAGE_SIZE); /* Init code and data */
__init_begin = .; __init_begin = .;
_sinittext = .; _sinittext = .;
.init.text : { *(.init.text) } .init.text : { INIT_TEXT }
_einittext = .; _einittext = .;
.init.data : { *(.init.data) } .init.data : { INIT_DATA }
. = ALIGN(16); . = ALIGN(16);
__setup_start = .; __setup_start = .;
...@@ -122,8 +122,8 @@ SECTIONS ...@@ -122,8 +122,8 @@ SECTIONS
* .exit.text is discarded at runtime, not link time, to deal with * .exit.text is discarded at runtime, not link time, to deal with
* references from __bug_table * references from __bug_table
*/ */
.exit.text : { *(.exit.text) } .exit.text : { EXIT_TEXT }
.exit.data : { *(.exit.data) } .exit.data : { EXIT_DATA }
. = ALIGN(PAGE_SIZE); . = ALIGN(PAGE_SIZE);
.bss : { .bss : {
......
...@@ -96,9 +96,9 @@ SECTIONS ...@@ -96,9 +96,9 @@ SECTIONS
. = ALIGN(PAGE_SIZE); /* Init code and data */ . = ALIGN(PAGE_SIZE); /* Init code and data */
__init_begin = .; __init_begin = .;
_sinittext = .; _sinittext = .;
.init.text : C_PHYS(.init.text) { *(.init.text) } .init.text : C_PHYS(.init.text) { INIT_TEXT }
_einittext = .; _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 */ . = ALIGN(L1_CACHE_BYTES); /* Better if Cache Line aligned */
__setup_start = .; __setup_start = .;
.init.setup : C_PHYS(.init.setup) { *(.init.setup) } .init.setup : C_PHYS(.init.setup) { *(.init.setup) }
...@@ -134,8 +134,8 @@ SECTIONS ...@@ -134,8 +134,8 @@ SECTIONS
* .exit.text is discarded at runtime, not link time, to deal with * .exit.text is discarded at runtime, not link time, to deal with
* references from __bug_table * references from __bug_table
*/ */
.exit.text : C_PHYS(.exit.text) { *(.exit.text) } .exit.text : C_PHYS(.exit.text) { EXIT_TEXT }
.exit.data : C_PHYS(.exit.data) { *(.exit.data) } .exit.data : C_PHYS(.exit.data) { EXIT_DATA }
. = ALIGN(PAGE_SIZE); . = ALIGN(PAGE_SIZE);
.bss : C_PHYS(.bss) { .bss : C_PHYS(.bss) {
......
...@@ -48,12 +48,12 @@ SECTIONS ...@@ -48,12 +48,12 @@ SECTIONS
__init_begin = .; __init_begin = .;
.init.text : { .init.text : {
_sinittext = .; _sinittext = .;
*(.init.text) INIT_TEXT
_einittext = .; _einittext = .;
} }
__init_text_end = .; __init_text_end = .;
.init.data : { .init.data : {
*(.init.data) INIT_DATA
} }
. = ALIGN(16); . = ALIGN(16);
.init.setup : { .init.setup : {
...@@ -102,8 +102,8 @@ SECTIONS ...@@ -102,8 +102,8 @@ SECTIONS
_end = . ; _end = . ;
PROVIDE (end = .); PROVIDE (end = .);
/DISCARD/ : { /DISCARD/ : {
*(.exit.text) EXIT_TEXT
*(.exit.data) EXIT_DATA
*(.exitcall.exit) *(.exitcall.exit)
} }
......
...@@ -175,7 +175,7 @@ unsigned long compute_effective_address(struct pt_regs *regs, ...@@ -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... */ /* 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); die_if_kernel(str, regs);
} }
......
...@@ -56,11 +56,11 @@ SECTIONS ...@@ -56,11 +56,11 @@ SECTIONS
.init.text : { .init.text : {
__init_begin = .; __init_begin = .;
_sinittext = .; _sinittext = .;
*(.init.text) INIT_TEXT
_einittext = .; _einittext = .;
} }
.init.data : { .init.data : {
*(.init.data) INIT_DATA
} }
. = ALIGN(16); . = ALIGN(16);
.init.setup : { .init.setup : {
...@@ -137,8 +137,8 @@ SECTIONS ...@@ -137,8 +137,8 @@ SECTIONS
PROVIDE (end = .); PROVIDE (end = .);
/DISCARD/ : { /DISCARD/ : {
*(.exit.text) EXIT_TEXT
*(.exit.data) EXIT_DATA
*(.exitcall.exit) *(.exitcall.exit)
} }
......
...@@ -42,15 +42,15 @@ typedef void (*exitcall_t)(void); ...@@ -42,15 +42,15 @@ typedef void (*exitcall_t)(void);
/* These are for everybody (although not all archs will actually /* These are for everybody (although not all archs will actually
discard it in modules) */ discard it in modules) */
#define __init __attribute__ ((__section__ (".init.text"))) #define __init __section(.init.text)
#define __initdata __attribute__ ((__section__ (".init.data"))) #define __initdata __section(.init.data)
#define __exitdata __attribute__ ((__section__(".exit.data"))) #define __exitdata __section(.exit.data)
#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit"))) #define __exit_call __used __section(.exitcall.exit)
#ifdef MODULE #ifdef MODULE
#define __exit __attribute__ ((__section__(".exit.text"))) #define __exit __section(.exit.text)
#else #else
#define __exit __attribute_used__ __attribute__ ((__section__(".exit.text"))) #define __exit __used __section(.exit.text)
#endif #endif
#endif #endif
...@@ -103,16 +103,16 @@ extern struct uml_param __uml_setup_start, __uml_setup_end; ...@@ -103,16 +103,16 @@ extern struct uml_param __uml_setup_start, __uml_setup_end;
* Mark functions and data as being only used at initialization * Mark functions and data as being only used at initialization
* or exit time. * or exit time.
*/ */
#define __uml_init_setup __attribute_used__ __attribute__ ((__section__ (".uml.setup.init"))) #define __uml_init_setup __used __section(.uml.setup.init)
#define __uml_setup_help __attribute_used__ __attribute__ ((__section__ (".uml.help.init"))) #define __uml_setup_help __used __section(.uml.help.init)
#define __uml_init_call __attribute_used__ __attribute__ ((__section__ (".uml.initcall.init"))) #define __uml_init_call __used __section(.uml.initcall.init)
#define __uml_postsetup_call __attribute_used__ __attribute__ ((__section__ (".uml.postsetup.init"))) #define __uml_postsetup_call __used __section(.uml.postsetup.init)
#define __uml_exit_call __attribute_used__ __attribute__ ((__section__ (".uml.exitcall.exit"))) #define __uml_exit_call __used __section(.uml.exitcall.exit)
#ifndef __KERNEL__ #ifndef __KERNEL__
#define __define_initcall(level,fn) \ #define __define_initcall(level,fn) \
static initcall_t __initcall_##fn __attribute_used__ \ static initcall_t __initcall_##fn __used \
__attribute__((__section__(".initcall" level ".init"))) = fn __attribute__((__section__(".initcall" level ".init"))) = fn
/* Userspace initcalls shouldn't depend on anything in the kernel, so we'll /* 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; ...@@ -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 __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 #endif
......
...@@ -17,7 +17,7 @@ SECTIONS ...@@ -17,7 +17,7 @@ SECTIONS
__init_begin = .; __init_begin = .;
.init.text : { .init.text : {
_sinittext = .; _sinittext = .;
*(.init.text) INIT_TEXT
_einittext = .; _einittext = .;
} }
...@@ -84,7 +84,7 @@ SECTIONS ...@@ -84,7 +84,7 @@ SECTIONS
#include "asm/common.lds.S" #include "asm/common.lds.S"
init.data : { *(.init.data) } init.data : { INIT_DATA }
/* Ensure the __preinit_array_start label is properly aligned. We /* Ensure the __preinit_array_start label is properly aligned. We
could instead move the label definition inside the section, but could instead move the label definition inside the section, but
......
...@@ -23,7 +23,7 @@ SECTIONS ...@@ -23,7 +23,7 @@ SECTIONS
__init_begin = .; __init_begin = .;
.init.text : { .init.text : {
_sinittext = .; _sinittext = .;
*(.init.text) INIT_TEXT
_einittext = .; _einittext = .;
} }
. = ALIGN(4096); . = ALIGN(4096);
...@@ -48,7 +48,7 @@ SECTIONS ...@@ -48,7 +48,7 @@ SECTIONS
#include "asm/common.lds.S" #include "asm/common.lds.S"
init.data : { *(init.data) } init.data : { INIT_DATA }
.data : .data :
{ {
. = ALIGN(KERNEL_STACK_SIZE); /* init_task */ . = ALIGN(KERNEL_STACK_SIZE); /* init_task */
......
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
#define DATA_CONTENTS \ #define DATA_CONTENTS \
__sdata = . ; \ __sdata = . ; \
DATA_DATA \ DATA_DATA \
*(.exit.data) /* 2.5 convention */ \ EXIT_DATA /* 2.5 convention */ \
*(.data.exit) /* 2.4 convention */ \ *(.data.exit) /* 2.4 convention */ \
. = ALIGN (16) ; \ . = ALIGN (16) ; \
*(.data.cacheline_aligned) \ *(.data.cacheline_aligned) \
...@@ -157,9 +157,9 @@ ...@@ -157,9 +157,9 @@
. = ALIGN (4096) ; \ . = ALIGN (4096) ; \
__init_start = . ; \ __init_start = . ; \
__sinittext = .; \ __sinittext = .; \
*(.init.text) /* 2.5 convention */ \ INIT_TEXT /* 2.5 convention */ \
__einittext = .; \ __einittext = .; \
*(.init.data) \ INIT_DATA \
*(.text.init) /* 2.4 convention */ \ *(.text.init) /* 2.4 convention */ \
*(.data.init) \ *(.data.init) \
INITCALL_CONTENTS \ INITCALL_CONTENTS \
...@@ -170,7 +170,7 @@ ...@@ -170,7 +170,7 @@
#define ROMK_INIT_RAM_CONTENTS \ #define ROMK_INIT_RAM_CONTENTS \
. = ALIGN (4096) ; \ . = ALIGN (4096) ; \
__init_start = . ; \ __init_start = . ; \
*(.init.data) /* 2.5 convention */ \ INIT_DATA /* 2.5 convention */ \
*(.data.init) /* 2.4 convention */ \ *(.data.init) /* 2.4 convention */ \
__init_end = . ; \ __init_end = . ; \
. = ALIGN (4096) ; . = ALIGN (4096) ;
...@@ -179,7 +179,7 @@ ...@@ -179,7 +179,7 @@
should go into ROM. */ should go into ROM. */
#define ROMK_INIT_ROM_CONTENTS \ #define ROMK_INIT_ROM_CONTENTS \
_sinittext = .; \ _sinittext = .; \
*(.init.text) /* 2.5 convention */ \ INIT_TEXT /* 2.5 convention */ \
_einittext = .; \ _einittext = .; \
*(.text.init) /* 2.4 convention */ \ *(.text.init) /* 2.4 convention */ \
INITCALL_CONTENTS \ INITCALL_CONTENTS \
......
...@@ -131,10 +131,12 @@ SECTIONS ...@@ -131,10 +131,12 @@ SECTIONS
.init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
__init_begin = .; __init_begin = .;
_sinittext = .; _sinittext = .;
*(.init.text) INIT_TEXT
_einittext = .; _einittext = .;
} }
.init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) } .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {
INIT_DATA
}
. = ALIGN(16); . = ALIGN(16);
.init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) {
__setup_start = .; __setup_start = .;
...@@ -169,8 +171,12 @@ SECTIONS ...@@ -169,8 +171,12 @@ SECTIONS
} }
/* .exit.text is discard at runtime, not link time, to deal with references /* .exit.text is discard at runtime, not link time, to deal with references
from .altinstructions and .eh_frame */ from .altinstructions and .eh_frame */
.exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) } .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) {
.exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) } EXIT_TEXT
}
.exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) {
EXIT_DATA
}
#if defined(CONFIG_BLK_DEV_INITRD) #if defined(CONFIG_BLK_DEV_INITRD)
. = ALIGN(4096); . = ALIGN(4096);
.init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
......
...@@ -155,12 +155,15 @@ SECTIONS ...@@ -155,12 +155,15 @@ SECTIONS
__init_begin = .; __init_begin = .;
.init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
_sinittext = .; _sinittext = .;
*(.init.text) INIT_TEXT
_einittext = .; _einittext = .;
} }
__initdata_begin = .; .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {
.init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) } __initdata_begin = .;
__initdata_end = .; INIT_DATA
__initdata_end = .;
}
. = ALIGN(16); . = ALIGN(16);
__setup_start = .; __setup_start = .;
.init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { *(.init.setup) } .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { *(.init.setup) }
...@@ -187,8 +190,12 @@ SECTIONS ...@@ -187,8 +190,12 @@ SECTIONS
} }
/* .exit.text is discard at runtime, not link time, to deal with references /* .exit.text is discard at runtime, not link time, to deal with references
from .altinstructions and .eh_frame */ from .altinstructions and .eh_frame */
.exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) } .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) {
.exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) } EXIT_TEXT
}
.exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) {
EXIT_DATA
}
/* vdso blob that is mapped into user space */ /* vdso blob that is mapped into user space */
vdso_start = . ; vdso_start = . ;
......
...@@ -136,13 +136,13 @@ SECTIONS ...@@ -136,13 +136,13 @@ SECTIONS
__init_begin = .; __init_begin = .;
.init.text : { .init.text : {
_sinittext = .; _sinittext = .;
*(.init.literal) *(.init.text) *(.init.literal) INIT_TEXT
_einittext = .; _einittext = .;
} }
.init.data : .init.data :
{ {
*(.init.data) INIT_DATA
. = ALIGN(0x4); . = ALIGN(0x4);
__tagtable_begin = .; __tagtable_begin = .;
*(.taglist) *(.taglist)
...@@ -278,8 +278,9 @@ SECTIONS ...@@ -278,8 +278,9 @@ SECTIONS
/* Sections to be discarded */ /* Sections to be discarded */
/DISCARD/ : /DISCARD/ :
{ {
*(.exit.literal .exit.text) *(.exit.literal)
*(.exit.data) EXIT_TEXT
EXIT_DATA
*(.exitcall.exit) *(.exitcall.exit)
} }
......
# #
# Makefile for the Linux/Xtensa-specific parts of the memory manager. # 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 obj-y := init.o fault.o tlb.o misc.o cache.o
...@@ -3,11 +3,6 @@ ...@@ -3,11 +3,6 @@
# Makefile for the Xtensa Instruction Set Simulator (ISS) # Makefile for the Xtensa Instruction Set Simulator (ISS)
# "prom monitor" library routines under Linux. # "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 obj-y = io.o console.o setup.o network.o
...@@ -2,9 +2,5 @@ obj-$(CONFIG_PM) += sysfs.o ...@@ -2,9 +2,5 @@ obj-$(CONFIG_PM) += sysfs.o
obj-$(CONFIG_PM_SLEEP) += main.o obj-$(CONFIG_PM_SLEEP) += main.o
obj-$(CONFIG_PM_TRACE) += trace.o obj-$(CONFIG_PM_TRACE) += trace.o
ifeq ($(CONFIG_DEBUG_DRIVER),y) ccflags-$(CONFIG_DEBUG_DRIVER) := -DDEBUG
EXTRA_CFLAGS += -DDEBUG ccflags-$(CONFIG_PM_VERBOSE) += -DDEBUG
endif
ifeq ($(CONFIG_PM_VERBOSE),y)
EXTRA_CFLAGS += -DDEBUG
endif
EXTRA_CFLAGS += -I$(TOPDIR)/drivers/net/cxgb3 \ EXTRA_CFLAGS += -Idrivers/net/cxgb3
-I$(TOPDIR)/drivers/infiniband/hw/cxgb3/core
obj-$(CONFIG_INFINIBAND_CXGB3) += iw_cxgb3.o obj-$(CONFIG_INFINIBAND_CXGB3) += iw_cxgb3.o
......
...@@ -31,8 +31,8 @@ extern struct rio_route_ops __end_rio_route_ops[]; ...@@ -31,8 +31,8 @@ extern struct rio_route_ops __end_rio_route_ops[];
/* Helpers internal to the RIO core code */ /* Helpers internal to the RIO core code */
#define DECLARE_RIO_ROUTE_SECTION(section, vid, did, add_hook, get_hook) \ #define DECLARE_RIO_ROUTE_SECTION(section, vid, did, add_hook, get_hook) \
static struct rio_route_ops __rio_route_ops __attribute_used__ \ static struct rio_route_ops __rio_route_ops __used \
__attribute__((__section__(#section))) = { vid, did, add_hook, get_hook }; __section(section)= { vid, did, add_hook, get_hook };
/** /**
* DECLARE_RIO_ROUTE_OPS - Registers switch routing operations * DECLARE_RIO_ROUTE_OPS - Registers switch routing operations
......
...@@ -1376,7 +1376,7 @@ static int do_atm_ioctl(unsigned int fd, unsigned int cmd32, unsigned long arg) ...@@ -1376,7 +1376,7 @@ static int do_atm_ioctl(unsigned int fd, unsigned int cmd32, unsigned long arg)
return -EINVAL; return -EINVAL;
} }
static __attribute_used__ int static __used int
ret_einval(unsigned int fd, unsigned int cmd, unsigned long arg) ret_einval(unsigned int fd, unsigned int cmd, unsigned long arg)
{ {
return -EINVAL; return -EINVAL;
......
...@@ -16,23 +16,3 @@ EXTRA_CFLAGS += -DSMBFS_PARANOIA ...@@ -16,23 +16,3 @@ EXTRA_CFLAGS += -DSMBFS_PARANOIA
#EXTRA_CFLAGS += -DDEBUG_SMB_TIMESTAMP #EXTRA_CFLAGS += -DDEBUG_SMB_TIMESTAMP
#EXTRA_CFLAGS += -Werror #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
...@@ -110,7 +110,7 @@ struct tagtable { ...@@ -110,7 +110,7 @@ struct tagtable {
int (*parse)(struct tag *); int (*parse)(struct tag *);
}; };
#define __tag __attribute_used__ __attribute__((__section__(".taglist.init"))) #define __tag __used __attribute__((__section__(".taglist.init")))
#define __tagtable(tag, fn) \ #define __tagtable(tag, fn) \
static struct tagtable __tagtable_##fn __tag = { tag, fn } static struct tagtable __tagtable_##fn __tag = { tag, fn }
......
...@@ -9,10 +9,46 @@ ...@@ -9,10 +9,46 @@
/* Align . to a 8 byte boundary equals to maximum function alignment. */ /* Align . to a 8 byte boundary equals to maximum function alignment. */
#define ALIGN_FUNCTION() . = ALIGN(8) #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 */ /* .data section */
#define DATA_DATA \ #define DATA_DATA \
*(.data) \ *(.data) \
*(.data.init.refok) \ *(.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); \ . = ALIGN(8); \
VMLINUX_SYMBOL(__start___markers) = .; \ VMLINUX_SYMBOL(__start___markers) = .; \
*(__markers) \ *(__markers) \
...@@ -132,6 +168,17 @@ ...@@ -132,6 +168,17 @@
*(__ksymtab_strings) \ *(__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. */ \ /* Built-in module parameters. */ \
__param : AT(ADDR(__param) - LOAD_OFFSET) { \ __param : AT(ADDR(__param) - LOAD_OFFSET) { \
VMLINUX_SYMBOL(__start___param) = .; \ VMLINUX_SYMBOL(__start___param) = .; \
...@@ -139,7 +186,6 @@ ...@@ -139,7 +186,6 @@
VMLINUX_SYMBOL(__stop___param) = .; \ VMLINUX_SYMBOL(__stop___param) = .; \
VMLINUX_SYMBOL(__end_rodata) = .; \ VMLINUX_SYMBOL(__end_rodata) = .; \
} \ } \
\
. = ALIGN((align)); . = ALIGN((align));
/* RODATA provided for backward compatibility. /* RODATA provided for backward compatibility.
...@@ -158,8 +204,16 @@ ...@@ -158,8 +204,16 @@
#define TEXT_TEXT \ #define TEXT_TEXT \
ALIGN_FUNCTION(); \ ALIGN_FUNCTION(); \
*(.text) \ *(.text) \
*(.ref.text) \
*(.text.init.refok) \ *(.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 /* sched.text is aling to function alignment to secure we have same
* address even at second ld pass when generating System.map */ * address even at second ld pass when generating System.map */
...@@ -183,6 +237,37 @@ ...@@ -183,6 +237,37 @@
*(.kprobes.text) \ *(.kprobes.text) \
VMLINUX_SYMBOL(__kprobes_text_end) = .; 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. /* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to Symbols in the DWARF debugging sections are relative to
the beginning of the section so we begin them at 0. */ the beginning of the section so we begin them at 0. */
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
extern void ia64_bad_param_for_setreg (void); extern void ia64_bad_param_for_setreg (void);
extern void ia64_bad_param_for_getreg (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) \ #define ia64_setreg(regnum, val) \
({ \ ({ \
......
...@@ -65,6 +65,6 @@ extern struct sh_machine_vector sh_mv; ...@@ -65,6 +65,6 @@ extern struct sh_machine_vector sh_mv;
#define get_system_type() sh_mv.mv_name #define get_system_type() sh_mv.mv_name
#define __initmv \ #define __initmv \
__attribute_used__ __attribute__((__section__ (".machvec.init"))) __used __section(.machvec.init)
#endif /* _ASM_SH_MACHVEC_H */ #endif /* _ASM_SH_MACHVEC_H */
...@@ -68,7 +68,7 @@ struct thread_info { ...@@ -68,7 +68,7 @@ struct thread_info {
#define init_stack (init_thread_union.stack) #define init_stack (init_thread_union.stack)
/* how to get the current stack pointer from C */ /* 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 */ /* how to get the thread information struct from C */
static inline struct thread_info *current_thread_info(void) static inline struct thread_info *current_thread_info(void)
......
...@@ -85,7 +85,7 @@ struct thread_info { ...@@ -85,7 +85,7 @@ struct thread_info {
/* how to get the current stack pointer from C */ /* 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 */ /* how to get the thread information struct from C */
static inline struct thread_info *current_thread_info(void) static inline struct thread_info *current_thread_info(void)
......
...@@ -34,7 +34,6 @@ header-y += atmsap.h ...@@ -34,7 +34,6 @@ header-y += atmsap.h
header-y += atmsvc.h header-y += atmsvc.h
header-y += atm_zatm.h header-y += atm_zatm.h
header-y += auto_fs4.h header-y += auto_fs4.h
header-y += auxvec.h
header-y += ax25.h header-y += ax25.h
header-y += b1lli.h header-y += b1lli.h
header-y += baycom.h header-y += baycom.h
...@@ -73,7 +72,7 @@ header-y += gen_stats.h ...@@ -73,7 +72,7 @@ header-y += gen_stats.h
header-y += gigaset_dev.h header-y += gigaset_dev.h
header-y += hdsmart.h header-y += hdsmart.h
header-y += hysdn_if.h header-y += hysdn_if.h
header-y += i2c-dev.h header-y += i2o-dev.h
header-y += i8k.h header-y += i8k.h
header-y += if_arcnet.h header-y += if_arcnet.h
header-y += if_bonding.h header-y += if_bonding.h
...@@ -158,7 +157,6 @@ header-y += veth.h ...@@ -158,7 +157,6 @@ header-y += veth.h
header-y += video_decoder.h header-y += video_decoder.h
header-y += video_encoder.h header-y += video_encoder.h
header-y += videotext.h header-y += videotext.h
header-y += vt.h
header-y += x25.h header-y += x25.h
unifdef-y += acct.h unifdef-y += acct.h
...@@ -173,6 +171,7 @@ unifdef-y += atm.h ...@@ -173,6 +171,7 @@ unifdef-y += atm.h
unifdef-y += atm_tcp.h unifdef-y += atm_tcp.h
unifdef-y += audit.h unifdef-y += audit.h
unifdef-y += auto_fs.h unifdef-y += auto_fs.h
unifdef-y += auxvec.h
unifdef-y += binfmts.h unifdef-y += binfmts.h
unifdef-y += capability.h unifdef-y += capability.h
unifdef-y += capi.h unifdef-y += capi.h
...@@ -214,7 +213,7 @@ unifdef-y += hdreg.h ...@@ -214,7 +213,7 @@ unifdef-y += hdreg.h
unifdef-y += hiddev.h unifdef-y += hiddev.h
unifdef-y += hpet.h unifdef-y += hpet.h
unifdef-y += i2c.h unifdef-y += i2c.h
unifdef-y += i2o-dev.h unifdef-y += i2c-dev.h
unifdef-y += icmp.h unifdef-y += icmp.h
unifdef-y += icmpv6.h unifdef-y += icmpv6.h
unifdef-y += if_addr.h unifdef-y += if_addr.h
...@@ -349,6 +348,7 @@ unifdef-y += videodev.h ...@@ -349,6 +348,7 @@ unifdef-y += videodev.h
unifdef-y += virtio_config.h unifdef-y += virtio_config.h
unifdef-y += virtio_blk.h unifdef-y += virtio_blk.h
unifdef-y += virtio_net.h unifdef-y += virtio_net.h
unifdef-y += vt.h
unifdef-y += wait.h unifdef-y += wait.h
unifdef-y += wanrouter.h unifdef-y += wanrouter.h
unifdef-y += watchdog.h unifdef-y += watchdog.h
......
...@@ -7,10 +7,8 @@ ...@@ -7,10 +7,8 @@
#if __GNUC_MINOR__ >= 3 #if __GNUC_MINOR__ >= 3
# define __used __attribute__((__used__)) # define __used __attribute__((__used__))
# define __attribute_used__ __used /* deprecated */
#else #else
# define __used __attribute__((__unused__)) # define __used __attribute__((__unused__))
# define __attribute_used__ __used /* deprecated */
#endif #endif
#if __GNUC_MINOR__ >= 4 #if __GNUC_MINOR__ >= 4
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#endif #endif
#define __used __attribute__((__used__)) #define __used __attribute__((__used__))
#define __attribute_used__ __used /* deprecated */
#define __must_check __attribute__((warn_unused_result)) #define __must_check __attribute__((warn_unused_result))
#define __compiler_offsetof(a,b) __builtin_offsetof(a,b) #define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
#define __always_inline inline __attribute__((always_inline)) #define __always_inline inline __attribute__((always_inline))
......
...@@ -126,10 +126,6 @@ extern void __chk_io_ptr(const volatile void __iomem *); ...@@ -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 * Mark functions that are referenced only in inline assembly as __used so
* the code is emitted even though it appears to be unreferenced. * the code is emitted even though it appears to be unreferenced.
*/ */
#ifndef __attribute_used__
# define __attribute_used__ /* deprecated */
#endif
#ifndef __used #ifndef __used
# define __used /* unimplemented */ # define __used /* unimplemented */
#endif #endif
...@@ -175,4 +171,9 @@ extern void __chk_io_ptr(const volatile void __iomem *); ...@@ -175,4 +171,9 @@ extern void __chk_io_ptr(const volatile void __iomem *);
#define __cold #define __cold
#endif #endif
/* Simple shorthand for a section definition */
#ifndef __section
# define __section(S) __attribute__ ((__section__(#S)))
#endif
#endif /* __LINUX_COMPILER_H */ #endif /* __LINUX_COMPILER_H */
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
typeof(desc) _desc \ typeof(desc) _desc \
__attribute__((aligned(sizeof(Elf##size##_Word)))); \ __attribute__((aligned(sizeof(Elf##size##_Word)))); \
} _ELFNOTE_PASTE(_note_, unique) \ } _ELFNOTE_PASTE(_note_, unique) \
__attribute_used__ \ __used \
__attribute__((section(".note." name), \ __attribute__((section(".note." name), \
aligned(sizeof(Elf##size##_Word)), \ aligned(sizeof(Elf##size##_Word)), \
unused)) = { \ unused)) = { \
......
...@@ -40,10 +40,10 @@ ...@@ -40,10 +40,10 @@
/* These are for everybody (although not all archs will actually /* These are for everybody (although not all archs will actually
discard it in modules) */ discard it in modules) */
#define __init __attribute__ ((__section__ (".init.text"))) __cold #define __init __section(.init.text) __cold
#define __initdata __attribute__ ((__section__ (".init.data"))) #define __initdata __section(.init.data)
#define __exitdata __attribute__ ((__section__(".exit.data"))) #define __exitdata __section(.exit.data)
#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit"))) #define __exit_call __used __section(.exitcall.exit)
/* modpost check for section mismatches during the kernel build. /* modpost check for section mismatches during the kernel build.
* A section mismatch happens when there are references from a * A section mismatch happens when there are references from a
...@@ -52,25 +52,81 @@ ...@@ -52,25 +52,81 @@
* when early init has completed so all such references are potential bugs. * when early init has completed so all such references are potential bugs.
* For exit sections the same issue exists. * For exit sections the same issue exists.
* The following markers are used for the cases where the reference to * 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 * the *init / *exit section (code or data) is valid and will teach
* not to issue a warning. * modpost not to issue a warning.
* The markers follow same syntax rules as __init / __initdata. */ * The markers follow same syntax rules as __init / __initdata. */
#define __init_refok noinline __attribute__ ((__section__ (".text.init.refok"))) #define __ref __section(.ref.text) noinline
#define __initdata_refok __attribute__ ((__section__ (".data.init.refok"))) #define __refdata __section(.ref.data)
#define __exit_refok noinline __attribute__ ((__section__ (".exit.text.refok"))) #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 #ifdef MODULE
#define __exit __attribute__ ((__section__(".exit.text"))) __cold #define __exitused
#else #else
#define __exit __attribute_used__ __attribute__ ((__section__(".exit.text"))) __cold #define __exitused __used
#endif #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 */ /* For assembly routines */
#define __INIT .section ".init.text","ax" #define __INIT .section ".init.text","ax"
#define __INIT_REFOK .section ".text.init.refok","ax"
#define __FINIT .previous #define __FINIT .previous
#define __INITDATA .section ".init.data","aw" #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__ #ifndef __ASSEMBLY__
/* /*
...@@ -108,7 +164,7 @@ void prepare_namespace(void); ...@@ -108,7 +164,7 @@ void prepare_namespace(void);
*/ */
#define __define_initcall(level,fn,id) \ #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 __attribute__((__section__(".initcall" level ".init"))) = fn
/* /*
...@@ -142,11 +198,11 @@ void prepare_namespace(void); ...@@ -142,11 +198,11 @@ void prepare_namespace(void);
#define console_initcall(fn) \ #define console_initcall(fn) \
static initcall_t __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) \ #define security_initcall(fn) \
static initcall_t __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 { struct obs_kernel_param {
const char *str; const char *str;
...@@ -163,8 +219,7 @@ struct obs_kernel_param { ...@@ -163,8 +219,7 @@ struct obs_kernel_param {
#define __setup_param(str, unique_id, fn, early) \ #define __setup_param(str, unique_id, fn, early) \
static char __setup_str_##unique_id[] __initdata __aligned(1) = str; \ static char __setup_str_##unique_id[] __initdata __aligned(1) = str; \
static struct obs_kernel_param __setup_##unique_id \ static struct obs_kernel_param __setup_##unique_id \
__attribute_used__ \ __used __section(.init.setup) \
__attribute__((__section__(".init.setup"))) \
__attribute__((aligned((sizeof(long))))) \ __attribute__((aligned((sizeof(long))))) \
= { __setup_str_##unique_id, fn, early } = { __setup_str_##unique_id, fn, early }
...@@ -242,7 +297,7 @@ void __init parse_early_param(void); ...@@ -242,7 +297,7 @@ void __init parse_early_param(void);
#endif #endif
/* Data marked not to be saved by software suspend */ /* 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 /* This means "can be init if no module support, otherwise module load
may call it." */ may call it." */
...@@ -254,43 +309,6 @@ void __init parse_early_param(void); ...@@ -254,43 +309,6 @@ void __init parse_early_param(void);
#define __initdata_or_module __initdata #define __initdata_or_module __initdata
#endif /*CONFIG_MODULES*/ #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 /* Functions marked as __devexit may be discarded at kernel link time, depending
on config options. Newer versions of binutils detect references from on config options. Newer versions of binutils detect references from
retained sections to discarded sections and flag an error. Pointers to retained sections to discarded sections and flag an error. Pointers to
......
...@@ -178,7 +178,7 @@ void *__symbol_get_gpl(const char *symbol); ...@@ -178,7 +178,7 @@ void *__symbol_get_gpl(const char *symbol);
#define __CRC_SYMBOL(sym, sec) \ #define __CRC_SYMBOL(sym, sec) \
extern void *__crc_##sym __attribute__((weak)); \ extern void *__crc_##sym __attribute__((weak)); \
static const unsigned long __kcrctab_##sym \ static const unsigned long __kcrctab_##sym \
__attribute_used__ \ __used \
__attribute__((section("__kcrctab" sec), unused)) \ __attribute__((section("__kcrctab" sec), unused)) \
= (unsigned long) &__crc_##sym; = (unsigned long) &__crc_##sym;
#else #else
...@@ -193,7 +193,7 @@ void *__symbol_get_gpl(const char *symbol); ...@@ -193,7 +193,7 @@ void *__symbol_get_gpl(const char *symbol);
__attribute__((section("__ksymtab_strings"))) \ __attribute__((section("__ksymtab_strings"))) \
= MODULE_SYMBOL_PREFIX #sym; \ = MODULE_SYMBOL_PREFIX #sym; \
static const struct kernel_symbol __ksymtab_##sym \ static const struct kernel_symbol __ksymtab_##sym \
__attribute_used__ \ __used \
__attribute__((section("__ksymtab" sec), unused)) \ __attribute__((section("__ksymtab" sec), unused)) \
= { (unsigned long)&sym, __kstrtab_##sym } = { (unsigned long)&sym, __kstrtab_##sym }
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#define __module_cat(a,b) ___module_cat(a,b) #define __module_cat(a,b) ___module_cat(a,b)
#define __MODULE_INFO(tag, name, info) \ #define __MODULE_INFO(tag, name, info) \
static const char __module_cat(name,__LINE__)[] \ static const char __module_cat(name,__LINE__)[] \
__attribute_used__ \ __used \
__attribute__((section(".modinfo"),unused)) = __stringify(tag) "=" info __attribute__((section(".modinfo"),unused)) = __stringify(tag) "=" info
#else /* !MODULE */ #else /* !MODULE */
#define __MODULE_INFO(tag, name, info) #define __MODULE_INFO(tag, name, info)
...@@ -72,7 +72,7 @@ struct kparam_array ...@@ -72,7 +72,7 @@ struct kparam_array
BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)); \ BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)); \
static const char __param_str_##name[] = prefix #name; \ static const char __param_str_##name[] = prefix #name; \
static struct kernel_param const __param_##name \ static struct kernel_param const __param_##name \
__attribute_used__ \ __used \
__attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
= { __param_str_##name, perm, set, get, { arg } } = { __param_str_##name, perm, set, get, { arg } }
......
...@@ -867,7 +867,7 @@ enum pci_fixup_pass { ...@@ -867,7 +867,7 @@ enum pci_fixup_pass {
/* Anonymous variables would be nice... */ /* Anonymous variables would be nice... */
#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, hook) \ #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 }; __attribute__((__section__(#section))) = { vendor, device, hook };
#define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \ #define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \
DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \
......
config ARCH
string
option env="ARCH"
config KERNELVERSION
string
option env="KERNELVERSION"
config DEFCONFIG_LIST config DEFCONFIG_LIST
string string
depends on !UML depends on !UML
......
...@@ -79,6 +79,38 @@ config HEADERS_CHECK ...@@ -79,6 +79,38 @@ config HEADERS_CHECK
exported to $(INSTALL_HDR_PATH) (usually 'usr/include' in exported to $(INSTALL_HDR_PATH) (usually 'usr/include' in
your build tree), to make sure they're suitable. 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 config DEBUG_KERNEL
bool "Kernel debugging" bool "Kernel debugging"
help help
......
...@@ -83,10 +83,12 @@ ifneq ($(strip $(obj-y) $(obj-m) $(obj-n) $(obj-) $(lib-target)),) ...@@ -83,10 +83,12 @@ ifneq ($(strip $(obj-y) $(obj-m) $(obj-n) $(obj-) $(lib-target)),)
builtin-target := $(obj)/built-in.o builtin-target := $(obj)/built-in.o
endif endif
modorder-target := $(obj)/modules.order
# We keep a list of all modules in $(MODVERDIR) # We keep a list of all modules in $(MODVERDIR)
__build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \ __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) $(subdir-ym) $(always)
@: @:
...@@ -101,6 +103,10 @@ ifneq ($(KBUILD_CHECKSRC),0) ...@@ -101,6 +103,10 @@ ifneq ($(KBUILD_CHECKSRC),0)
endif endif
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) # Compile C sources (.c)
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
...@@ -266,7 +272,8 @@ ifdef builtin-target ...@@ -266,7 +272,8 @@ ifdef builtin-target
quiet_cmd_link_o_target = LD $@ quiet_cmd_link_o_target = LD $@
# If the list of objects to link is empty, just create an empty built-in.o # If the list of objects to link is empty, just create an empty built-in.o
cmd_link_o_target = $(if $(strip $(obj-y)),\ 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 $@) rm -f $@; $(AR) rcs $@)
$(builtin-target): $(obj-y) FORCE $(builtin-target): $(obj-y) FORCE
...@@ -275,6 +282,19 @@ $(builtin-target): $(obj-y) FORCE ...@@ -275,6 +282,19 @@ $(builtin-target): $(obj-y) FORCE
targets += $(builtin-target) targets += $(builtin-target)
endif # 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 # Rule to compile a set of .o files into one .a file
# #
...@@ -301,7 +321,7 @@ $($(subst $(obj)/,,$(@:.o=-objs))) \ ...@@ -301,7 +321,7 @@ $($(subst $(obj)/,,$(@:.o=-objs))) \
$($(subst $(obj)/,,$(@:.o=-y)))), $^) $($(subst $(obj)/,,$(@:.o=-y)))), $^)
quiet_cmd_link_multi-y = LD $@ 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] $@ quiet_cmd_link_multi-m = LD [M] $@
cmd_link_multi-m = $(cmd_link_multi-y) cmd_link_multi-m = $(cmd_link_multi-y)
......
...@@ -25,6 +25,11 @@ lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m))) ...@@ -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) # 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) # 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 := $(patsubst %/,%,$(filter %/, $(obj-y)))
subdir-y += $(__subdir-y) subdir-y += $(__subdir-y)
__subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m))) __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) ...@@ -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)) extra-y := $(addprefix $(obj)/,$(extra-y))
always := $(addprefix $(obj)/,$(always)) always := $(addprefix $(obj)/,$(always))
targets := $(addprefix $(obj)/,$(targets)) targets := $(addprefix $(obj)/,$(targets))
modorder := $(addprefix $(obj)/,$(modorder))
obj-y := $(addprefix $(obj)/,$(obj-y)) obj-y := $(addprefix $(obj)/,$(obj-y))
obj-m := $(addprefix $(obj)/,$(obj-m)) obj-m := $(addprefix $(obj)/,$(obj-m))
lib-y := $(addprefix $(obj)/,$(lib-y)) lib-y := $(addprefix $(obj)/,$(lib-y))
......
...@@ -21,7 +21,7 @@ quiet_cmd_modules_install = INSTALL $@ ...@@ -21,7 +21,7 @@ quiet_cmd_modules_install = INSTALL $@
# Modules built outside the kernel source tree go into extra by default # Modules built outside the kernel source tree go into extra by default
INSTALL_MOD_DIR ?= extra 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)) modinst_dir = $(if $(KBUILD_EXTMOD),$(ext-mod-dir),kernel/$(@D))
......
...@@ -62,6 +62,7 @@ modpost = scripts/mod/modpost \ ...@@ -62,6 +62,7 @@ modpost = scripts/mod/modpost \
$(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \ $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \
$(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \ $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \
$(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
$(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \
$(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w)
quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
* !Ifilename * !Ifilename
* !Dfilename * !Dfilename
* !Ffilename * !Ffilename
* !Pfilename
* *
*/ */
...@@ -57,6 +58,7 @@ FILEONLY *symbolsonly; ...@@ -57,6 +58,7 @@ FILEONLY *symbolsonly;
typedef void FILELINE(char * file, char * line); typedef void FILELINE(char * file, char * line);
FILELINE * singlefunctions; FILELINE * singlefunctions;
FILELINE * entity_system; FILELINE * entity_system;
FILELINE * docsection;
#define MAXLINESZ 2048 #define MAXLINESZ 2048
#define MAXFILES 250 #define MAXFILES 250
...@@ -65,6 +67,7 @@ FILELINE * entity_system; ...@@ -65,6 +67,7 @@ FILELINE * entity_system;
#define DOCBOOK "-docbook" #define DOCBOOK "-docbook"
#define FUNCTION "-function" #define FUNCTION "-function"
#define NOFUNCTION "-nofunction" #define NOFUNCTION "-nofunction"
#define NODOCSECTIONS "-no-doc-sections"
char *srctree; char *srctree;
...@@ -231,13 +234,14 @@ void docfunctions(char * filename, char * type) ...@@ -231,13 +234,14 @@ void docfunctions(char * filename, char * type)
for (i=0; i <= symfilecnt; i++) for (i=0; i <= symfilecnt; i++)
symcnt += symfilelist[i].symbolcnt; symcnt += symfilelist[i].symbolcnt;
vec = malloc((2 + 2 * symcnt + 2) * sizeof(char*)); vec = malloc((2 + 2 * symcnt + 3) * sizeof(char *));
if (vec == NULL) { if (vec == NULL) {
perror("docproc: "); perror("docproc: ");
exit(1); exit(1);
} }
vec[idx++] = KERNELDOC; vec[idx++] = KERNELDOC;
vec[idx++] = DOCBOOK; vec[idx++] = DOCBOOK;
vec[idx++] = NODOCSECTIONS;
for (i=0; i < symfilecnt; i++) { for (i=0; i < symfilecnt; i++) {
struct symfile * sym = &symfilelist[i]; struct symfile * sym = &symfilelist[i];
for (j=0; j < sym->symbolcnt; j++) { for (j=0; j < sym->symbolcnt; j++) {
...@@ -286,13 +290,37 @@ void singfunc(char * filename, char * line) ...@@ -286,13 +290,37 @@ void singfunc(char * filename, char * line)
exec_kernel_doc(vec); 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: * Parse file, calling action specific functions for:
* 1) Lines containing !E * 1) Lines containing !E
* 2) Lines containing !I * 2) Lines containing !I
* 3) Lines containing !D * 3) Lines containing !D
* 4) Lines containing !F * 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) void parse_file(FILE *infile)
{ {
...@@ -326,6 +354,15 @@ void parse_file(FILE *infile) ...@@ -326,6 +354,15 @@ void parse_file(FILE *infile)
s++; s++;
singlefunctions(line +2, s); singlefunctions(line +2, s);
break; break;
case 'P':
/* filename */
while (*s && !isspace(*s)) s++;
*s++ = '\0';
/* DOC: section name */
while (isspace(*s))
s++;
docsection(line + 2, s);
break;
default: default:
defaultline(line); defaultline(line);
} }
...@@ -372,6 +409,7 @@ int main(int argc, char *argv[]) ...@@ -372,6 +409,7 @@ int main(int argc, char *argv[])
externalfunctions = find_export_symbols; externalfunctions = find_export_symbols;
symbolsonly = find_export_symbols; symbolsonly = find_export_symbols;
singlefunctions = noaction2; singlefunctions = noaction2;
docsection = noaction2;
parse_file(infile); parse_file(infile);
/* Rewind to start from beginning of file again */ /* Rewind to start from beginning of file again */
...@@ -381,6 +419,7 @@ int main(int argc, char *argv[]) ...@@ -381,6 +419,7 @@ int main(int argc, char *argv[])
externalfunctions = extfunc; externalfunctions = extfunc;
symbolsonly = printline; symbolsonly = printline;
singlefunctions = singfunc; singlefunctions = singfunc;
docsection = docsect;
parse_file(infile); parse_file(infile);
} }
...@@ -394,6 +433,7 @@ int main(int argc, char *argv[]) ...@@ -394,6 +433,7 @@ int main(int argc, char *argv[])
externalfunctions = adddep; externalfunctions = adddep;
symbolsonly = adddep; symbolsonly = adddep;
singlefunctions = adddep2; singlefunctions = adddep2;
docsection = adddep2;
parse_file(infile); parse_file(infile);
printf("\n"); printf("\n");
} }
......
...@@ -6,7 +6,19 @@ ...@@ -6,7 +6,19 @@
# e.g., to decode an i386 oops on an x86_64 system, use: # e.g., to decode an i386 oops on an x86_64 system, use:
# AFLAGS=--32 decodecode < 386.oops # 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= code=
while read i ; do while read i ; do
...@@ -20,6 +32,7 @@ esac ...@@ -20,6 +32,7 @@ esac
done done
if [ -z "$code" ]; then if [ -z "$code" ]; then
rm $T
exit exit
fi fi
...@@ -48,4 +61,4 @@ echo -n " .byte 0x" > $T.s ...@@ -48,4 +61,4 @@ echo -n " .byte 0x" > $T.s
echo $code >> $T.s echo $code >> $T.s
as $AFLAGS -o $T.o $T.s as $AFLAGS -o $T.o $T.s
objdump -S $T.o objdump -S $T.o
rm $T.o $T.s rm $T $T.s $T.o
...@@ -9,7 +9,10 @@ ...@@ -9,7 +9,10 @@
# gcc-2.95.3, `030301' for gcc-3.3.1, etc. # 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="$*" compiler="$*"
......
...@@ -440,17 +440,21 @@ void error_with_pos(const char *fmt, ...) ...@@ -440,17 +440,21 @@ void error_with_pos(const char *fmt, ...)
static void genksyms_usage(void) 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__ #ifdef __GNU_LIBRARY__
" -a, --arch Select architecture\n"
" -d, --debug Increment the debug level (repeatable)\n" " -d, --debug Increment the debug level (repeatable)\n"
" -D, --dump Dump expanded symbol defs (for debugging only)\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" " -w, --warnings Enable warnings\n"
" -q, --quiet Disable warnings (default)\n" " -q, --quiet Disable warnings (default)\n"
" -h, --help Print this message\n" " -h, --help Print this message\n"
" -V, --version Print the release version\n" " -V, --version Print the release version\n"
#else /* __GNU_LIBRARY__ */ #else /* __GNU_LIBRARY__ */
" -a Select architecture\n"
" -d Increment the debug level (repeatable)\n" " -d Increment the debug level (repeatable)\n"
" -D Dump expanded symbol defs (for debugging only)\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" " -w Enable warnings\n"
" -q Disable warnings (default)\n" " -q Disable warnings (default)\n"
" -h Print this message\n" " -h Print this message\n"
...@@ -477,10 +481,10 @@ int main(int argc, char **argv) ...@@ -477,10 +481,10 @@ int main(int argc, char **argv)
{0, 0, 0, 0} {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) &long_opts[0], NULL)) != EOF)
#else /* __GNU_LIBRARY__ */ #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__ */ #endif /* __GNU_LIBRARY__ */
switch (o) { switch (o) {
case 'a': case 'a':
......
...@@ -24,22 +24,25 @@ oldconfig: $(obj)/conf ...@@ -24,22 +24,25 @@ oldconfig: $(obj)/conf
silentoldconfig: $(obj)/conf silentoldconfig: $(obj)/conf
$< -s $(Kconfig) $< -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 # 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 # The symlink is used to repair a deficiency in arch/um
update-po-config: $(obj)/kxgettext update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h
xgettext --default-domain=linux \ $(Q)echo " GEN config"
$(Q)xgettext --default-domain=linux \
--add-comments --keyword=_ --keyword=N_ \ --add-comments --keyword=_ --keyword=N_ \
--from-code=UTF-8 \ --from-code=UTF-8 \
--files-from=scripts/kconfig/POTFILES.in \ --files-from=scripts/kconfig/POTFILES.in \
--output $(obj)/config.pot --output $(obj)/config.pot
$(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot $(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot
$(Q)ln -fs Kconfig.i386 arch/um/Kconfig.arch $(Q)ln -fs Kconfig.i386 arch/um/Kconfig.arch
(for i in `ls arch/`; \ $(Q)(for i in `ls arch/`; \
do \ do \
$(obj)/kxgettext arch/$$i/Kconfig; \ echo " GEN $$i"; \
done ) >> $(obj)/config.pot $(obj)/kxgettext arch/$$i/Kconfig \
msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \ >> $(obj)/config.pot; \
done )
$(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \
--output $(obj)/linux.pot --output $(obj)/linux.pot
$(Q)rm -f arch/um/Kconfig.arch $(Q)rm -f arch/um/Kconfig.arch
$(Q)rm -f $(obj)/config.pot $(Q)rm -f $(obj)/config.pot
...@@ -93,12 +96,6 @@ HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) ...@@ -93,12 +96,6 @@ HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
HOST_EXTRACFLAGS += -DLOCALE 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: # Shared Makefile for the various kconfig executables:
...@@ -142,8 +139,17 @@ gconf-objs := gconf.o kconfig_load.o zconf.tab.o ...@@ -142,8 +139,17 @@ gconf-objs := gconf.o kconfig_load.o zconf.tab.o
endif endif
clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \ 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 += 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 # Add environment specific flags
HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS)) HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS))
...@@ -248,6 +254,9 @@ $(obj)/%.moc: $(src)/%.h ...@@ -248,6 +254,9 @@ $(obj)/%.moc: $(src)/%.h
$(obj)/lkc_defs.h: $(src)/lkc_proto.h $(obj)/lkc_defs.h: $(src)/lkc_proto.h
sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/' 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 # The following requires flex/bison/gperf
......
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/mconf.c
scripts/kconfig/conf.c scripts/kconfig/conf.c
scripts/kconfig/confdata.c scripts/kconfig/confdata.c
scripts/kconfig/gconf.c scripts/kconfig/gconf.c
scripts/kconfig/gconf.glade.h
scripts/kconfig/qconf.cc scripts/kconfig/qconf.cc
...@@ -3,12 +3,13 @@ ...@@ -3,12 +3,13 @@
* Released under the terms of the GNU GPL v2.0. * Released under the terms of the GNU GPL v2.0.
*/ */
#include <locale.h>
#include <ctype.h> #include <ctype.h>
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#include <time.h> #include <time.h>
#include <unistd.h>
#include <sys/stat.h> #include <sys/stat.h>
#define LKC_DIRECT_LINK #define LKC_DIRECT_LINK
...@@ -40,7 +41,7 @@ static char nohelp_text[] = N_("Sorry, no help available for this option yet.\n" ...@@ -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) static const char *get_help(struct menu *menu)
{ {
if (menu_has_help(menu)) if (menu_has_help(menu))
return menu_get_help(menu); return _(menu_get_help(menu));
else else
return nohelp_text; return nohelp_text;
} }
...@@ -78,7 +79,7 @@ static int conf_askvalue(struct symbol *sym, const char *def) ...@@ -78,7 +79,7 @@ static int conf_askvalue(struct symbol *sym, const char *def)
tristate val; tristate val;
if (!sym_has_value(sym)) if (!sym_has_value(sym))
printf("(NEW) "); printf(_("(NEW) "));
line[0] = '\n'; line[0] = '\n';
line[1] = 0; line[1] = 0;
...@@ -160,7 +161,7 @@ static int conf_askvalue(struct symbol *sym, const char *def) ...@@ -160,7 +161,7 @@ static int conf_askvalue(struct symbol *sym, const char *def)
} }
case set_random: case set_random:
do { do {
val = (tristate)(random() % 3); val = (tristate)(rand() % 3);
} while (!sym_tristate_within_range(sym, val)); } while (!sym_tristate_within_range(sym, val));
switch (val) { switch (val) {
case no: line[0] = 'n'; break; case no: line[0] = 'n'; break;
...@@ -183,7 +184,7 @@ int conf_string(struct menu *menu) ...@@ -183,7 +184,7 @@ int conf_string(struct menu *menu)
const char *def; const char *def;
while (1) { while (1) {
printf("%*s%s ", indent - 1, "", menu->prompt->text); printf("%*s%s ", indent - 1, "", _(menu->prompt->text));
printf("(%s) ", sym->name); printf("(%s) ", sym->name);
def = sym_get_string_value(sym); def = sym_get_string_value(sym);
if (sym_get_string_value(sym)) if (sym_get_string_value(sym))
...@@ -216,7 +217,7 @@ static int conf_sym(struct menu *menu) ...@@ -216,7 +217,7 @@ static int conf_sym(struct menu *menu)
tristate oldval, newval; tristate oldval, newval;
while (1) { while (1) {
printf("%*s%s ", indent - 1, "", menu->prompt->text); printf("%*s%s ", indent - 1, "", _(menu->prompt->text));
if (sym->name) if (sym->name)
printf("(%s) ", sym->name); printf("(%s) ", sym->name);
type = sym_get_type(sym); type = sym_get_type(sym);
...@@ -306,7 +307,7 @@ static int conf_choice(struct menu *menu) ...@@ -306,7 +307,7 @@ static int conf_choice(struct menu *menu)
case no: case no:
return 1; return 1;
case mod: case mod:
printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu)); printf("%*s%s\n", indent - 1, "", _(menu_get_prompt(menu)));
return 0; return 0;
case yes: case yes:
break; break;
...@@ -316,7 +317,7 @@ static int conf_choice(struct menu *menu) ...@@ -316,7 +317,7 @@ static int conf_choice(struct menu *menu)
while (1) { while (1) {
int cnt, def; 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); def_sym = sym_get_choice_value(sym);
cnt = def = 0; cnt = def = 0;
line[0] = 0; line[0] = 0;
...@@ -324,7 +325,7 @@ static int conf_choice(struct menu *menu) ...@@ -324,7 +325,7 @@ static int conf_choice(struct menu *menu)
if (!menu_is_visible(child)) if (!menu_is_visible(child))
continue; continue;
if (!child->sym) { if (!child->sym) {
printf("%*c %s\n", indent, '*', menu_get_prompt(child)); printf("%*c %s\n", indent, '*', _(menu_get_prompt(child)));
continue; continue;
} }
cnt++; cnt++;
...@@ -333,14 +334,14 @@ static int conf_choice(struct menu *menu) ...@@ -333,14 +334,14 @@ static int conf_choice(struct menu *menu)
printf("%*c", indent, '>'); printf("%*c", indent, '>');
} else } else
printf("%*c", indent, ' '); printf("%*c", indent, ' ');
printf(" %d. %s", cnt, menu_get_prompt(child)); printf(" %d. %s", cnt, _(menu_get_prompt(child)));
if (child->sym->name) if (child->sym->name)
printf(" (%s)", child->sym->name); printf(" (%s)", child->sym->name);
if (!sym_has_value(child->sym)) if (!sym_has_value(child->sym))
printf(" (NEW)"); printf(_(" (NEW)"));
printf("\n"); printf("\n");
} }
printf("%*schoice", indent - 1, ""); printf(_("%*schoice"), indent - 1, "");
if (cnt == 1) { if (cnt == 1) {
printf("[1]: 1\n"); printf("[1]: 1\n");
goto conf_childs; goto conf_childs;
...@@ -375,7 +376,7 @@ static int conf_choice(struct menu *menu) ...@@ -375,7 +376,7 @@ static int conf_choice(struct menu *menu)
break; break;
case set_random: case set_random:
if (is_new) if (is_new)
def = (random() % cnt) + 1; def = (rand() % cnt) + 1;
case set_default: case set_default:
case set_yes: case set_yes:
case set_mod: case set_mod:
...@@ -399,9 +400,9 @@ static int conf_choice(struct menu *menu) ...@@ -399,9 +400,9 @@ static int conf_choice(struct menu *menu)
continue; continue;
} }
sym_set_choice_value(sym, child->sym); sym_set_choice_value(sym, child->sym);
if (child->list) { for (child = child->list; child; child = child->next) {
indent += 2; indent += 2;
conf(child->list); conf(child);
indent -= 2; indent -= 2;
} }
return 1; return 1;
...@@ -433,7 +434,7 @@ static void conf(struct menu *menu) ...@@ -433,7 +434,7 @@ static void conf(struct menu *menu)
if (prompt) if (prompt)
printf("%*c\n%*c %s\n%*c\n", printf("%*c\n%*c %s\n%*c\n",
indent, '*', indent, '*',
indent, '*', prompt, indent, '*', _(prompt),
indent, '*'); indent, '*');
default: default:
; ;
...@@ -495,12 +496,16 @@ static void check_conf(struct menu *menu) ...@@ -495,12 +496,16 @@ static void check_conf(struct menu *menu)
int main(int ac, char **av) int main(int ac, char **av)
{ {
int i = 1; int opt;
const char *name; const char *name;
struct stat tmpstat; struct stat tmpstat;
if (ac > i && av[i][0] == '-') { setlocale(LC_ALL, "");
switch (av[i++][1]) { bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) {
switch (opt) {
case 'o': case 'o':
input_mode = ask_new; input_mode = ask_new;
break; break;
...@@ -513,12 +518,7 @@ int main(int ac, char **av) ...@@ -513,12 +518,7 @@ int main(int ac, char **av)
break; break;
case 'D': case 'D':
input_mode = set_default; input_mode = set_default;
defconfig_file = av[i++]; defconfig_file = optarg;
if (!defconfig_file) {
printf(_("%s: No default config file specified\n"),
av[0]);
exit(1);
}
break; break;
case 'n': case 'n':
input_mode = set_no; input_mode = set_no;
...@@ -531,19 +531,22 @@ int main(int ac, char **av) ...@@ -531,19 +531,22 @@ int main(int ac, char **av)
break; break;
case 'r': case 'r':
input_mode = set_random; input_mode = set_random;
srandom(time(NULL)); srand(time(NULL));
break; break;
case 'h': case 'h':
case '?': printf(_("See README for usage info\n"));
fprintf(stderr, "See README for usage info\n");
exit(0); exit(0);
break;
default:
fprintf(stderr, _("See README for usage info\n"));
exit(1);
} }
} }
name = av[i]; if (ac == optind) {
if (!name) {
printf(_("%s: Kconfig file missing\n"), av[0]); printf(_("%s: Kconfig file missing\n"), av[0]);
exit(1); exit(1);
} }
name = av[optind];
conf_parse(name); conf_parse(name);
//zconfdump(stdout); //zconfdump(stdout);
switch (input_mode) { switch (input_mode) {
...@@ -551,9 +554,9 @@ int main(int ac, char **av) ...@@ -551,9 +554,9 @@ int main(int ac, char **av)
if (!defconfig_file) if (!defconfig_file)
defconfig_file = conf_get_default_confname(); defconfig_file = conf_get_default_confname();
if (conf_read(defconfig_file)) { if (conf_read(defconfig_file)) {
printf("***\n" printf(_("***\n"
"*** Can't find default configuration \"%s\"!\n" "*** Can't find default configuration \"%s\"!\n"
"***\n", defconfig_file); "***\n"), defconfig_file);
exit(1); exit(1);
} }
break; break;
......
...@@ -232,8 +232,7 @@ int conf_read_simple(const char *name, int def) ...@@ -232,8 +232,7 @@ int conf_read_simple(const char *name, int def)
sym->type = S_BOOLEAN; sym->type = S_BOOLEAN;
} }
if (sym->flags & def_flags) { if (sym->flags & def_flags) {
conf_warning("trying to reassign symbol %s", sym->name); conf_warning("override: reassigning to symbol %s", sym->name);
break;
} }
switch (sym->type) { switch (sym->type) {
case S_BOOLEAN: case S_BOOLEAN:
...@@ -272,8 +271,7 @@ int conf_read_simple(const char *name, int def) ...@@ -272,8 +271,7 @@ int conf_read_simple(const char *name, int def)
sym->type = S_OTHER; sym->type = S_OTHER;
} }
if (sym->flags & def_flags) { if (sym->flags & def_flags) {
conf_warning("trying to reassign symbol %s", sym->name); conf_warning("override: reassigning to symbol %s", sym->name);
break;
} }
if (conf_set_sym_val(sym, def, def_flags, p)) if (conf_set_sym_val(sym, def, def_flags, p))
continue; continue;
...@@ -297,14 +295,12 @@ int conf_read_simple(const char *name, int def) ...@@ -297,14 +295,12 @@ int conf_read_simple(const char *name, int def)
} }
break; break;
case yes: case yes:
if (cs->def[def].tri != no) { if (cs->def[def].tri != no)
conf_warning("%s creates inconsistent choice state", sym->name); conf_warning("override: %s changes choice state", sym->name);
cs->flags &= ~def_flags; cs->def[def].val = sym;
} else
cs->def[def].val = sym;
break; 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); fclose(in);
...@@ -316,7 +312,7 @@ int conf_read_simple(const char *name, int def) ...@@ -316,7 +312,7 @@ int conf_read_simple(const char *name, int def)
int conf_read(const char *name) int conf_read(const char *name)
{ {
struct symbol *sym; struct symbol *sym, *choice_sym;
struct property *prop; struct property *prop;
struct expr *e; struct expr *e;
int i, flags; int i, flags;
...@@ -357,9 +353,9 @@ int conf_read(const char *name) ...@@ -357,9 +353,9 @@ int conf_read(const char *name)
*/ */
prop = sym_get_choice_prop(sym); prop = sym_get_choice_prop(sym);
flags = sym->flags; flags = sym->flags;
for (e = prop->expr; e; e = e->left.expr) expr_list_for_each_sym(prop->expr, e, choice_sym)
if (e->right.sym->visible != no) if (choice_sym->visible != no)
flags &= e->right.sym->flags; flags &= choice_sym->flags;
sym->flags &= flags | ~SYMBOL_DEF_USER; sym->flags &= flags | ~SYMBOL_DEF_USER;
} }
......
...@@ -87,7 +87,7 @@ struct expr *expr_copy(struct expr *org) ...@@ -87,7 +87,7 @@ struct expr *expr_copy(struct expr *org)
break; break;
case E_AND: case E_AND:
case E_OR: case E_OR:
case E_CHOICE: case E_LIST:
e->left.expr = expr_copy(org->left.expr); e->left.expr = expr_copy(org->left.expr);
e->right.expr = expr_copy(org->right.expr); e->right.expr = expr_copy(org->right.expr);
break; break;
...@@ -217,7 +217,7 @@ int expr_eq(struct expr *e1, struct expr *e2) ...@@ -217,7 +217,7 @@ int expr_eq(struct expr *e1, struct expr *e2)
expr_free(e2); expr_free(e2);
trans_count = old_count; trans_count = old_count;
return res; return res;
case E_CHOICE: case E_LIST:
case E_RANGE: case E_RANGE:
case E_NONE: case E_NONE:
/* panic */; /* panic */;
...@@ -648,7 +648,7 @@ struct expr *expr_transform(struct expr *e) ...@@ -648,7 +648,7 @@ struct expr *expr_transform(struct expr *e)
case E_EQUAL: case E_EQUAL:
case E_UNEQUAL: case E_UNEQUAL:
case E_SYMBOL: case E_SYMBOL:
case E_CHOICE: case E_LIST:
break; break;
default: default:
e->left.expr = expr_transform(e->left.expr); 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 ...@@ -932,7 +932,7 @@ struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symb
break; break;
case E_SYMBOL: case E_SYMBOL:
return expr_alloc_comp(type, e->left.sym, sym); return expr_alloc_comp(type, e->left.sym, sym);
case E_CHOICE: case E_LIST:
case E_RANGE: case E_RANGE:
case E_NONE: case E_NONE:
/* panic */; /* panic */;
...@@ -955,14 +955,14 @@ tristate expr_calc_value(struct expr *e) ...@@ -955,14 +955,14 @@ tristate expr_calc_value(struct expr *e)
case E_AND: case E_AND:
val1 = expr_calc_value(e->left.expr); val1 = expr_calc_value(e->left.expr);
val2 = expr_calc_value(e->right.expr); val2 = expr_calc_value(e->right.expr);
return E_AND(val1, val2); return EXPR_AND(val1, val2);
case E_OR: case E_OR:
val1 = expr_calc_value(e->left.expr); val1 = expr_calc_value(e->left.expr);
val2 = expr_calc_value(e->right.expr); val2 = expr_calc_value(e->right.expr);
return E_OR(val1, val2); return EXPR_OR(val1, val2);
case E_NOT: case E_NOT:
val1 = expr_calc_value(e->left.expr); val1 = expr_calc_value(e->left.expr);
return E_NOT(val1); return EXPR_NOT(val1);
case E_EQUAL: case E_EQUAL:
sym_calc_value(e->left.sym); sym_calc_value(e->left.sym);
sym_calc_value(e->right.sym); sym_calc_value(e->right.sym);
...@@ -1000,9 +1000,9 @@ int expr_compare_type(enum expr_type t1, enum expr_type t2) ...@@ -1000,9 +1000,9 @@ int expr_compare_type(enum expr_type t1, enum expr_type t2)
if (t2 == E_OR) if (t2 == E_OR)
return 1; return 1;
case E_OR: case E_OR:
if (t2 == E_CHOICE) if (t2 == E_LIST)
return 1; return 1;
case E_CHOICE: case E_LIST:
if (t2 == 0) if (t2 == 0)
return 1; return 1;
default: default:
...@@ -1034,12 +1034,18 @@ void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char * ...@@ -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); expr_print(e->left.expr, fn, data, E_NOT);
break; break;
case E_EQUAL: 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, NULL, "=");
fn(data, e->right.sym, e->right.sym->name); fn(data, e->right.sym, e->right.sym->name);
break; break;
case E_UNEQUAL: 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, NULL, "!=");
fn(data, e->right.sym, e->right.sym->name); fn(data, e->right.sym, e->right.sym->name);
break; break;
...@@ -1053,11 +1059,11 @@ void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char * ...@@ -1053,11 +1059,11 @@ void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *
fn(data, NULL, " && "); fn(data, NULL, " && ");
expr_print(e->right.expr, fn, data, E_AND); expr_print(e->right.expr, fn, data, E_AND);
break; break;
case E_CHOICE: case E_LIST:
fn(data, e->right.sym, e->right.sym->name); fn(data, e->right.sym, e->right.sym->name);
if (e->left.expr) { if (e->left.expr) {
fn(data, NULL, " ^ "); fn(data, NULL, " ^ ");
expr_print(e->left.expr, fn, data, E_CHOICE); expr_print(e->left.expr, fn, data, E_LIST);
} }
break; break;
case E_RANGE: case E_RANGE:
......
...@@ -25,14 +25,13 @@ struct file { ...@@ -25,14 +25,13 @@ struct file {
#define FILE_BUSY 0x0001 #define FILE_BUSY 0x0001
#define FILE_SCANNED 0x0002 #define FILE_SCANNED 0x0002
#define FILE_PRINTED 0x0004
typedef enum tristate { typedef enum tristate {
no, mod, yes no, mod, yes
} tristate; } tristate;
enum expr_type { 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 { union expr_data {
...@@ -45,9 +44,12 @@ struct expr { ...@@ -45,9 +44,12 @@ struct expr {
union expr_data left, right; union expr_data left, right;
}; };
#define E_OR(dep1, dep2) (((dep1)>(dep2))?(dep1):(dep2)) #define EXPR_OR(dep1, dep2) (((dep1)>(dep2))?(dep1):(dep2))
#define E_AND(dep1, dep2) (((dep1)<(dep2))?(dep1):(dep2)) #define EXPR_AND(dep1, dep2) (((dep1)<(dep2))?(dep1):(dep2))
#define E_NOT(dep) (2-(dep)) #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_value {
struct expr *expr; struct expr *expr;
...@@ -86,7 +88,6 @@ struct symbol { ...@@ -86,7 +88,6 @@ struct symbol {
#define SYMBOL_CHECK 0x0008 #define SYMBOL_CHECK 0x0008
#define SYMBOL_CHOICE 0x0010 #define SYMBOL_CHOICE 0x0010
#define SYMBOL_CHOICEVAL 0x0020 #define SYMBOL_CHOICEVAL 0x0020
#define SYMBOL_PRINTED 0x0040
#define SYMBOL_VALID 0x0080 #define SYMBOL_VALID 0x0080
#define SYMBOL_OPTIONAL 0x0100 #define SYMBOL_OPTIONAL 0x0100
#define SYMBOL_WRITE 0x0200 #define SYMBOL_WRITE 0x0200
...@@ -105,7 +106,8 @@ struct symbol { ...@@ -105,7 +106,8 @@ struct symbol {
#define SYMBOL_HASHMASK 0xff #define SYMBOL_HASHMASK 0xff
enum prop_type { 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 { struct property {
......
...@@ -119,8 +119,6 @@ const char *dbg_print_flags(int val) ...@@ -119,8 +119,6 @@ const char *dbg_print_flags(int val)
strcat(buf, "choice/"); strcat(buf, "choice/");
if (val & SYMBOL_CHOICEVAL) if (val & SYMBOL_CHOICEVAL)
strcat(buf, "choiceval/"); strcat(buf, "choiceval/");
if (val & SYMBOL_PRINTED)
strcat(buf, "printed/");
if (val & SYMBOL_VALID) if (val & SYMBOL_VALID)
strcat(buf, "valid/"); strcat(buf, "valid/");
if (val & SYMBOL_OPTIONAL) if (val & SYMBOL_OPTIONAL)
...@@ -457,14 +455,18 @@ static void text_insert_help(struct menu *menu) ...@@ -457,14 +455,18 @@ static void text_insert_help(struct menu *menu)
{ {
GtkTextBuffer *buffer; GtkTextBuffer *buffer;
GtkTextIter start, end; GtkTextIter start, end;
const char *prompt = menu_get_prompt(menu); const char *prompt = _(menu_get_prompt(menu));
gchar *name; gchar *name;
const char *help; 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) if (menu->sym && menu->sym->name)
name = g_strdup_printf(_(menu->sym->name)); name = g_strdup_printf(menu->sym->name);
else else
name = g_strdup(""); name = g_strdup("");
...@@ -1171,7 +1173,7 @@ static gchar **fill_row(struct menu *menu) ...@@ -1171,7 +1173,7 @@ static gchar **fill_row(struct menu *menu)
bzero(row, sizeof(row)); bzero(row, sizeof(row));
row[COL_OPTION] = 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)" : ""); sym && sym_has_value(sym) ? "(NEW)" : "");
if (show_all && !menu_is_visible(menu)) if (show_all && !menu_is_visible(menu))
...@@ -1221,7 +1223,7 @@ static gchar **fill_row(struct menu *menu) ...@@ -1221,7 +1223,7 @@ static gchar **fill_row(struct menu *menu)
if (def_menu) if (def_menu)
row[COL_VALUE] = row[COL_VALUE] =
g_strdup(menu_get_prompt(def_menu)); g_strdup(_(menu_get_prompt(def_menu)));
} }
if (sym->flags & SYMBOL_CHOICEVAL) if (sym->flags & SYMBOL_CHOICEVAL)
row[COL_BTNRAD] = GINT_TO_POINTER(TRUE); row[COL_BTNRAD] = GINT_TO_POINTER(TRUE);
......
...@@ -1275,6 +1275,11 @@ YY_RULE_SETUP ...@@ -1275,6 +1275,11 @@ YY_RULE_SETUP
case 32: case 32:
YY_RULE_SETUP YY_RULE_SETUP
{ {
while (zconfleng) {
if ((zconftext[zconfleng-1] != ' ') && (zconftext[zconfleng-1] != '\t'))
break;
zconfleng--;
}
append_string(zconftext, zconfleng); append_string(zconftext, zconfleng);
if (!first_ts) if (!first_ts)
first_ts = last_ts; first_ts = last_ts;
......
...@@ -44,6 +44,7 @@ extern "C" { ...@@ -44,6 +44,7 @@ extern "C" {
#define T_OPT_MODULES 1 #define T_OPT_MODULES 1
#define T_OPT_DEFCONFIG_LIST 2 #define T_OPT_DEFCONFIG_LIST 2
#define T_OPT_ENV 3
struct kconf_id { struct kconf_id {
int name; int name;
...@@ -74,6 +75,7 @@ void kconfig_load(void); ...@@ -74,6 +75,7 @@ void kconfig_load(void);
/* menu.c */ /* menu.c */
void menu_init(void); void menu_init(void);
void menu_warn(struct menu *menu, const char *fmt, ...);
struct menu *menu_add_menu(void); struct menu *menu_add_menu(void);
void menu_end_menu(void); void menu_end_menu(void);
void menu_add_entry(struct symbol *sym); void menu_add_entry(struct symbol *sym);
...@@ -103,6 +105,8 @@ void str_printf(struct gstr *gs, const char *fmt, ...); ...@@ -103,6 +105,8 @@ void str_printf(struct gstr *gs, const char *fmt, ...);
const char *str_get(struct gstr *gs); const char *str_get(struct gstr *gs);
/* symbol.c */ /* symbol.c */
extern struct expr *sym_env_list;
void sym_init(void); void sym_init(void);
void sym_clear_all_valid(void); void sym_clear_all_valid(void);
void sym_set_all_changed(void); void sym_set_all_changed(void);
...@@ -110,6 +114,7 @@ void sym_set_changed(struct symbol *sym); ...@@ -110,6 +114,7 @@ void sym_set_changed(struct symbol *sym);
struct symbol *sym_check_deps(struct symbol *sym); struct symbol *sym_check_deps(struct symbol *sym);
struct property *prop_alloc(enum prop_type type, struct symbol *sym); struct property *prop_alloc(enum prop_type type, struct symbol *sym);
struct symbol *prop_get_symbol(struct property *prop); 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) static inline tristate sym_get_tristate_value(struct symbol *sym)
{ {
......
...@@ -36,14 +36,16 @@ trap "rm -f $tmp" 0 1 2 3 15 ...@@ -36,14 +36,16 @@ trap "rm -f $tmp" 0 1 2 3 15
# Check if we can link to ncurses # Check if we can link to ncurses
check() { 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 if [ $? != 0 ]; then
echo " *** Unable to find the ncurses libraries." 1>&2 echo " *** Unable to find the ncurses libraries or the" 1>&2
echo " *** make menuconfig require the ncurses libraries" 1>&2 echo " *** required header files." 1>&2
echo " *** " 1>&2 echo " *** 'make menuconfig' requires the ncurses libraries." 1>&2
echo " *** Install ncurses (ncurses-devel) and try again" 1>&2 echo " *** " 1>&2
echo " *** " 1>&2 echo " *** Install ncurses (ncurses-devel) and try again." 1>&2
exit 1 echo " *** " 1>&2
exit 1
fi fi
} }
......
...@@ -97,8 +97,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected) ...@@ -97,8 +97,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected)
int x = width / 2 - 11; int x = width / 2 - 11;
int y = height - 2; int y = height - 2;
print_button(dialog, "Select", y, x, selected == 0); print_button(dialog, gettext("Select"), y, x, selected == 0);
print_button(dialog, " Help ", y, x + 14, selected == 1); print_button(dialog, gettext(" Help "), y, x + 14, selected == 1);
wmove(dialog, y, x + 1 + 14 * selected); wmove(dialog, y, x + 1 + 14 * selected);
wrefresh(dialog); wrefresh(dialog);
......
...@@ -26,6 +26,12 @@ ...@@ -26,6 +26,12 @@
#include <string.h> #include <string.h>
#include <stdbool.h> #include <stdbool.h>
#ifndef KBUILD_NO_NLS
# include <libintl.h>
#else
# define gettext(Msgid) ((const char *) (Msgid))
#endif
#ifdef __sun__ #ifdef __sun__
#define CURS_MACROS #define CURS_MACROS
#endif #endif
...@@ -187,10 +193,9 @@ int item_is_tag(char tag); ...@@ -187,10 +193,9 @@ int item_is_tag(char tag);
int on_key_esc(WINDOW *win); int on_key_esc(WINDOW *win);
int on_key_resize(void); 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 set_dialog_backtitle(const char *backtitle);
void reset_dialog(void); void end_dialog(int x, int y);
void end_dialog(void);
void attr_clear(WINDOW * win, int height, int width, chtype attr); void attr_clear(WINDOW * win, int height, int width, chtype attr);
void dialog_clear(void); void dialog_clear(void);
void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x); void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x);
......
...@@ -31,8 +31,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected) ...@@ -31,8 +31,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected)
int x = width / 2 - 11; int x = width / 2 - 11;
int y = height - 2; int y = height - 2;
print_button(dialog, " Ok ", y, x, selected == 0); print_button(dialog, gettext(" Ok "), y, x, selected == 0);
print_button(dialog, " Help ", y, x + 14, selected == 1); print_button(dialog, gettext(" Help "), y, x + 14, selected == 1);
wmove(dialog, y, x + 1 + 14 * selected); wmove(dialog, y, x + 1 + 14 * selected);
wrefresh(dialog); wrefresh(dialog);
......
...@@ -157,9 +157,9 @@ static void print_buttons(WINDOW * win, int height, int width, int selected) ...@@ -157,9 +157,9 @@ static void print_buttons(WINDOW * win, int height, int width, int selected)
int x = width / 2 - 16; int x = width / 2 - 16;
int y = height - 2; int y = height - 2;
print_button(win, "Select", y, x, selected == 0); print_button(win, gettext("Select"), y, x, selected == 0);
print_button(win, " Exit ", y, x + 12, selected == 1); print_button(win, gettext(" Exit "), y, x + 12, selected == 1);
print_button(win, " Help ", y, x + 24, selected == 2); print_button(win, gettext(" Help "), y, x + 24, selected == 2);
wmove(win, y, x + 1 + 12 * selected); wmove(win, y, x + 1 + 12 * selected);
wrefresh(win); wrefresh(win);
......
...@@ -114,7 +114,7 @@ int dialog_textbox(const char *title, const char *tbuf, ...@@ -114,7 +114,7 @@ int dialog_textbox(const char *title, const char *tbuf,
print_title(dialog, title, width); 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); wnoutrefresh(dialog);
getyx(dialog, cur_y, cur_x); /* Save cursor position */ getyx(dialog, cur_y, cur_x); /* Save cursor position */
......
...@@ -266,31 +266,41 @@ void dialog_clear(void) ...@@ -266,31 +266,41 @@ void dialog_clear(void)
/* /*
* Do some initialization for dialog * Do some initialization for dialog
*/ */
void init_dialog(const char *backtitle) int init_dialog(const char *backtitle)
{ {
dlg.backtitle = backtitle; int height, width;
color_setup(getenv("MENUCONFIG_COLOR"));
} initscr(); /* Init curses */
getmaxyx(stdscr, height, width);
if (height < 19 || width < 80) {
endwin();
return -ERRDISPLAYTOOSMALL;
}
void set_dialog_backtitle(const char *backtitle)
{
dlg.backtitle = backtitle; dlg.backtitle = backtitle;
} color_setup(getenv("MENUCONFIG_COLOR"));
void reset_dialog(void)
{
initscr(); /* Init curses */
keypad(stdscr, TRUE); keypad(stdscr, TRUE);
cbreak(); cbreak();
noecho(); noecho();
dialog_clear(); dialog_clear();
return 0;
}
void set_dialog_backtitle(const char *backtitle)
{
dlg.backtitle = backtitle;
} }
/* /*
* End using dialog functions. * 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(); endwin();
} }
......
...@@ -29,8 +29,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected) ...@@ -29,8 +29,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected)
int x = width / 2 - 10; int x = width / 2 - 10;
int y = height - 2; int y = height - 2;
print_button(dialog, " Yes ", y, x, selected == 0); print_button(dialog, gettext(" Yes "), y, x, selected == 0);
print_button(dialog, " No ", y, x + 13, selected == 1); print_button(dialog, gettext(" No "), y, x + 13, selected == 1);
wmove(dialog, y, x + 1 + 13 * selected); wmove(dialog, y, x + 1 + 13 * selected);
wrefresh(dialog); wrefresh(dialog);
......
...@@ -8,17 +8,13 @@ ...@@ -8,17 +8,13 @@
* i18n, 2005, Arnaldo Carvalho de Melo <acme@conectiva.com.br> * i18n, 2005, Arnaldo Carvalho de Melo <acme@conectiva.com.br>
*/ */
#include <sys/ioctl.h>
#include <sys/wait.h>
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <limits.h> #include <limits.h>
#include <signal.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <termios.h>
#include <unistd.h> #include <unistd.h>
#include <locale.h> #include <locale.h>
...@@ -275,8 +271,6 @@ search_help[] = N_( ...@@ -275,8 +271,6 @@ search_help[] = N_(
"\n"); "\n");
static int indent; static int indent;
static struct termios ios_org;
static int rows = 0, cols = 0;
static struct menu *current_menu; static struct menu *current_menu;
static int child_count; static int child_count;
static int single_menu_mode; static int single_menu_mode;
...@@ -290,51 +284,16 @@ static void show_textbox(const char *title, const char *text, int r, int c); ...@@ -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_helptext(const char *title, const char *text);
static void show_help(struct menu *menu); 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) static void get_prompt_str(struct gstr *r, struct property *prop)
{ {
int i, j; int i, j;
struct menu *submenu[8], *menu; struct menu *submenu[8], *menu;
str_printf(r, "Prompt: %s\n", prop->text); str_printf(r, _("Prompt: %s\n"), _(prop->text));
str_printf(r, " Defined at %s:%d\n", prop->menu->file->name, str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name,
prop->menu->lineno); prop->menu->lineno);
if (!expr_is_yes(prop->visible.expr)) { if (!expr_is_yes(prop->visible.expr)) {
str_append(r, " Depends on: "); str_append(r, _(" Depends on: "));
expr_gstr_print(prop->visible.expr, r); expr_gstr_print(prop->visible.expr, r);
str_append(r, "\n"); str_append(r, "\n");
} }
...@@ -342,13 +301,13 @@ static void get_prompt_str(struct gstr *r, struct property *prop) ...@@ -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) for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent)
submenu[i++] = menu; submenu[i++] = menu;
if (i > 0) { if (i > 0) {
str_printf(r, " Location:\n"); str_printf(r, _(" Location:\n"));
for (j = 4; --i >= 0; j += 2) { for (j = 4; --i >= 0; j += 2) {
menu = submenu[i]; 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) { if (menu->sym) {
str_printf(r, " (%s [=%s])", menu->sym->name ? str_printf(r, " (%s [=%s])", menu->sym->name ?
menu->sym->name : "<choice>", menu->sym->name : _("<choice>"),
sym_get_string_value(menu->sym)); sym_get_string_value(menu->sym));
} }
str_append(r, "\n"); str_append(r, "\n");
...@@ -378,7 +337,7 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym) ...@@ -378,7 +337,7 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym)
if (hit) if (hit)
str_append(r, "\n"); str_append(r, "\n");
if (sym->rev_dep.expr) { if (sym->rev_dep.expr) {
str_append(r, " Selected by: "); str_append(r, _(" Selected by: "));
expr_gstr_print(sym->rev_dep.expr, r); expr_gstr_print(sym->rev_dep.expr, r);
str_append(r, "\n"); str_append(r, "\n");
} }
...@@ -394,7 +353,7 @@ static struct gstr get_relations_str(struct symbol **sym_arr) ...@@ -394,7 +353,7 @@ static struct gstr get_relations_str(struct symbol **sym_arr)
for (i = 0; sym_arr && (sym = sym_arr[i]); i++) for (i = 0; sym_arr && (sym = sym_arr[i]); i++)
get_symbol_str(&res, sym); get_symbol_str(&res, sym);
if (!i) if (!i)
str_append(&res, "No matches found.\n"); str_append(&res, _("No matches found.\n"));
return res; return res;
} }
...@@ -474,6 +433,7 @@ static void build_conf(struct menu *menu) ...@@ -474,6 +433,7 @@ static void build_conf(struct menu *menu)
switch (prop->type) { switch (prop->type) {
case P_MENU: case P_MENU:
child_count++; child_count++;
prompt = _(prompt);
if (single_menu_mode) { if (single_menu_mode) {
item_make("%s%*c%s", item_make("%s%*c%s",
menu->data ? "-->" : "++>", menu->data ? "-->" : "++>",
...@@ -489,7 +449,7 @@ static void build_conf(struct menu *menu) ...@@ -489,7 +449,7 @@ static void build_conf(struct menu *menu)
case P_COMMENT: case P_COMMENT:
if (prompt) { if (prompt) {
child_count++; child_count++;
item_make(" %*c*** %s ***", indent + 1, ' ', prompt); item_make(" %*c*** %s ***", indent + 1, ' ', _(prompt));
item_set_tag(':'); item_set_tag(':');
item_set_data(menu); item_set_data(menu);
} }
...@@ -497,7 +457,7 @@ static void build_conf(struct menu *menu) ...@@ -497,7 +457,7 @@ static void build_conf(struct menu *menu)
default: default:
if (prompt) { if (prompt) {
child_count++; child_count++;
item_make("---%*c%s", indent + 1, ' ', prompt); item_make("---%*c%s", indent + 1, ' ', _(prompt));
item_set_tag(':'); item_set_tag(':');
item_set_data(menu); item_set_data(menu);
} }
...@@ -541,10 +501,10 @@ static void build_conf(struct menu *menu) ...@@ -541,10 +501,10 @@ static void build_conf(struct menu *menu)
item_set_data(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 (val == yes) {
if (def_menu) { if (def_menu) {
item_add_str(" (%s)", menu_get_prompt(def_menu)); item_add_str(" (%s)", _(menu_get_prompt(def_menu)));
item_add_str(" --->"); item_add_str(" --->");
if (def_menu->list) { if (def_menu->list) {
indent += 2; indent += 2;
...@@ -556,7 +516,7 @@ static void build_conf(struct menu *menu) ...@@ -556,7 +516,7 @@ static void build_conf(struct menu *menu)
} }
} else { } else {
if (menu == current_menu) { 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_tag(':');
item_set_data(menu); item_set_data(menu);
goto conf_childs; goto conf_childs;
...@@ -599,17 +559,17 @@ static void build_conf(struct menu *menu) ...@@ -599,17 +559,17 @@ static void build_conf(struct menu *menu)
tmp = indent - tmp + 4; tmp = indent - tmp + 4;
if (tmp < 0) if (tmp < 0)
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)) ? (sym_has_value(sym) || !sym_is_changable(sym)) ?
"" : " (NEW)"); "" : _(" (NEW)"));
item_set_tag('s'); item_set_tag('s');
item_set_data(menu); item_set_data(menu);
goto conf_childs; 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)) ? (sym_has_value(sym) || !sym_is_changable(sym)) ?
"" : " (NEW)"); "" : _(" (NEW)"));
if (menu->prompt->type == P_MENU) { if (menu->prompt->type == P_MENU) {
item_add_str(" --->"); item_add_str(" --->");
return; return;
...@@ -647,7 +607,7 @@ static void conf(struct menu *menu) ...@@ -647,7 +607,7 @@ static void conf(struct menu *menu)
item_set_tag('S'); item_set_tag('S');
} }
dialog_clear(); dialog_clear();
res = dialog_menu(prompt ? prompt : _("Main Menu"), res = dialog_menu(prompt ? _(prompt) : _("Main Menu"),
_(menu_instructions), _(menu_instructions),
active_menu, &s_scroll); active_menu, &s_scroll);
if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL) if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL)
...@@ -694,7 +654,7 @@ static void conf(struct menu *menu) ...@@ -694,7 +654,7 @@ static void conf(struct menu *menu)
if (sym) if (sym)
show_help(submenu); show_help(submenu);
else else
show_helptext("README", _(mconf_readme)); show_helptext(_("README"), _(mconf_readme));
break; break;
case 3: case 3:
if (item_is_tag('t')) { if (item_is_tag('t')) {
...@@ -752,13 +712,13 @@ static void show_help(struct menu *menu) ...@@ -752,13 +712,13 @@ static void show_help(struct menu *menu)
str_append(&help, nohelp_text); str_append(&help, nohelp_text);
} }
get_symbol_str(&help, sym); 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); str_free(&help);
} }
static void conf_choice(struct menu *menu) 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 menu *child;
struct symbol *active; struct symbol *active;
...@@ -772,7 +732,7 @@ static void conf_choice(struct menu *menu) ...@@ -772,7 +732,7 @@ static void conf_choice(struct menu *menu)
for (child = menu->list; child; child = child->next) { for (child = menu->list; child; child = child->next) {
if (!menu_is_visible(child)) if (!menu_is_visible(child))
continue; continue;
item_make("%s", menu_get_prompt(child)); item_make("%s", _(menu_get_prompt(child)));
item_set_data(child); item_set_data(child);
if (child->sym == active) if (child->sym == active)
item_set_selected(1); item_set_selected(1);
...@@ -780,7 +740,7 @@ static void conf_choice(struct menu *menu) ...@@ -780,7 +740,7 @@ static void conf_choice(struct menu *menu)
item_set_tag('X'); item_set_tag('X');
} }
dialog_clear(); dialog_clear();
res = dialog_checklist(prompt ? prompt : _("Main Menu"), res = dialog_checklist(prompt ? _(prompt) : _("Main Menu"),
_(radiolist_instructions), _(radiolist_instructions),
15, 70, 6); 15, 70, 6);
selected = item_activate_selected(); selected = item_activate_selected();
...@@ -826,10 +786,10 @@ static void conf_string(struct menu *menu) ...@@ -826,10 +786,10 @@ static void conf_string(struct menu *menu)
heading = _(inputbox_instructions_string); heading = _(inputbox_instructions_string);
break; break;
default: default:
heading = "Internal mconf error!"; heading = _("Internal mconf error!");
} }
dialog_clear(); dialog_clear();
res = dialog_inputbox(prompt ? prompt : _("Main Menu"), res = dialog_inputbox(prompt ? _(prompt) : _("Main Menu"),
heading, 10, 75, heading, 10, 75,
sym_get_string_value(menu->sym)); sym_get_string_value(menu->sym));
switch (res) { switch (res) {
...@@ -900,13 +860,9 @@ static void conf_save(void) ...@@ -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 main(int ac, char **av)
{ {
int saved_x, saved_y;
char *mode; char *mode;
int res; int res;
...@@ -923,11 +879,13 @@ int main(int ac, char **av) ...@@ -923,11 +879,13 @@ int main(int ac, char **av)
single_menu_mode = 1; single_menu_mode = 1;
} }
tcgetattr(1, &ios_org); getyx(stdscr, saved_y, saved_x);
atexit(conf_cleanup); if (init_dialog(NULL)) {
init_wsize(); fprintf(stderr, N_("Your display is too small to run Menuconfig!\n"));
reset_dialog(); fprintf(stderr, N_("It must be at least 19 lines by 80 columns.\n"));
init_dialog(NULL); return 1;
}
set_config_filename(conf_get_configname()); set_config_filename(conf_get_configname());
do { do {
conf(&rootmenu); conf(&rootmenu);
...@@ -941,7 +899,7 @@ int main(int ac, char **av) ...@@ -941,7 +899,7 @@ int main(int ac, char **av)
else else
res = -1; res = -1;
} while (res == KEY_ESC); } while (res == KEY_ESC);
end_dialog(); end_dialog(saved_x, saved_y);
switch (res) { switch (res) {
case 0: case 0:
......
...@@ -15,7 +15,7 @@ static struct menu **last_entry_ptr; ...@@ -15,7 +15,7 @@ static struct menu **last_entry_ptr;
struct file *file_list; struct file *file_list;
struct file *current_file; 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_list ap;
va_start(ap, fmt); va_start(ap, fmt);
...@@ -172,6 +172,9 @@ void menu_add_option(int token, char *arg) ...@@ -172,6 +172,9 @@ void menu_add_option(int token, char *arg)
else if (sym_defconfig_list != current_entry->sym) else if (sym_defconfig_list != current_entry->sym)
zconf_error("trying to redefine defconfig symbol"); zconf_error("trying to redefine defconfig symbol");
break; break;
case T_OPT_ENV:
prop_add_env(arg);
break;
} }
} }
...@@ -239,9 +242,11 @@ void menu_finalize(struct menu *parent) ...@@ -239,9 +242,11 @@ void menu_finalize(struct menu *parent)
for (menu = parent->list; menu; menu = menu->next) { for (menu = parent->list; menu; menu = menu->next) {
if (menu->sym) { if (menu->sym) {
current_entry = parent; current_entry = parent;
menu_set_type(menu->sym->type); if (sym->type == S_UNKNOWN)
menu_set_type(menu->sym->type);
current_entry = menu; current_entry = menu;
menu_set_type(sym->type); if (menu->sym->type == S_UNKNOWN)
menu_set_type(sym->type);
break; break;
} }
} }
...@@ -326,12 +331,42 @@ void menu_finalize(struct menu *parent) ...@@ -326,12 +331,42 @@ void menu_finalize(struct menu *parent)
"values not supported"); "values not supported");
} }
current_entry = menu; 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); menu_add_symbol(P_CHOICE, sym, NULL);
prop = sym_get_choice_prop(sym); prop = sym_get_choice_prop(sym);
for (ep = &prop->expr; *ep; ep = &(*ep)->left.expr) 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; (*ep)->right.sym = menu->sym;
} }
if (menu->list && (!menu->prompt || !menu->prompt->text)) { if (menu->list && (!menu->prompt || !menu->prompt->text)) {
...@@ -394,9 +429,9 @@ bool menu_is_visible(struct menu *menu) ...@@ -394,9 +429,9 @@ bool menu_is_visible(struct menu *menu)
const char *menu_get_prompt(struct menu *menu) const char *menu_get_prompt(struct menu *menu)
{ {
if (menu->prompt) if (menu->prompt)
return _(menu->prompt->text); return menu->prompt->text;
else if (menu->sym) else if (menu->sym)
return _(menu->sym->name); return menu->sym->name;
return NULL; return NULL;
} }
......
This diff is collapsed.
...@@ -34,6 +34,8 @@ struct symbol *sym_defconfig_list; ...@@ -34,6 +34,8 @@ struct symbol *sym_defconfig_list;
struct symbol *modules_sym; struct symbol *modules_sym;
tristate modules_val; tristate modules_val;
struct expr *sym_env_list;
void sym_add_default(struct symbol *sym, const char *def) void sym_add_default(struct symbol *sym, const char *def)
{ {
struct property *prop = prop_alloc(P_DEFAULT, sym); struct property *prop = prop_alloc(P_DEFAULT, sym);
...@@ -45,7 +47,6 @@ void sym_init(void) ...@@ -45,7 +47,6 @@ void sym_init(void)
{ {
struct symbol *sym; struct symbol *sym;
struct utsname uts; struct utsname uts;
char *p;
static bool inited = false; static bool inited = false;
if (inited) if (inited)
...@@ -54,20 +55,6 @@ void sym_init(void) ...@@ -54,20 +55,6 @@ void sym_init(void)
uname(&uts); 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 = sym_lookup("UNAME_RELEASE", 0);
sym->type = S_STRING; sym->type = S_STRING;
sym->flags |= SYMBOL_AUTO; sym->flags |= SYMBOL_AUTO;
...@@ -117,6 +104,15 @@ struct property *sym_get_choice_prop(struct symbol *sym) ...@@ -117,6 +104,15 @@ struct property *sym_get_choice_prop(struct symbol *sym)
return NULL; 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 *sym_get_default_prop(struct symbol *sym)
{ {
struct property *prop; struct property *prop;
...@@ -199,7 +195,7 @@ static void sym_calc_visibility(struct symbol *sym) ...@@ -199,7 +195,7 @@ static void sym_calc_visibility(struct symbol *sym)
tri = no; tri = no;
for_all_prompts(sym, prop) { for_all_prompts(sym, prop) {
prop->visible.tri = expr_calc_value(prop->visible.expr); 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)) if (tri == mod && (sym->type != S_TRISTATE || modules_val == no))
tri = yes; tri = yes;
...@@ -247,8 +243,7 @@ static struct symbol *sym_calc_choice(struct symbol *sym) ...@@ -247,8 +243,7 @@ static struct symbol *sym_calc_choice(struct symbol *sym)
/* just get the first visible value */ /* just get the first visible value */
prop = sym_get_choice_prop(sym); prop = sym_get_choice_prop(sym);
for (e = prop->expr; e; e = e->left.expr) { expr_list_for_each_sym(prop->expr, e, def_sym) {
def_sym = e->right.sym;
sym_calc_visibility(def_sym); sym_calc_visibility(def_sym);
if (def_sym->visible != no) if (def_sym->visible != no)
return def_sym; return def_sym;
...@@ -303,7 +298,7 @@ void sym_calc_value(struct symbol *sym) ...@@ -303,7 +298,7 @@ void sym_calc_value(struct symbol *sym)
if (sym_is_choice_value(sym) && sym->visible == yes) { if (sym_is_choice_value(sym) && sym->visible == yes) {
prop = sym_get_choice_prop(sym); prop = sym_get_choice_prop(sym);
newval.tri = (prop_get_symbol(prop)->curr.val == sym) ? yes : no; 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; sym->flags |= SYMBOL_WRITE;
if (sym_has_value(sym)) if (sym_has_value(sym))
newval.tri = sym->def[S_DEF_USER].tri; newval.tri = sym->def[S_DEF_USER].tri;
...@@ -312,7 +307,7 @@ void sym_calc_value(struct symbol *sym) ...@@ -312,7 +307,7 @@ void sym_calc_value(struct symbol *sym)
if (prop) if (prop)
newval.tri = expr_calc_value(prop->expr); 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)) { } else if (!sym_is_choice(sym)) {
prop = sym_get_default_prop(sym); prop = sym_get_default_prop(sym);
if (prop) { if (prop) {
...@@ -347,6 +342,9 @@ void sym_calc_value(struct symbol *sym) ...@@ -347,6 +342,9 @@ void sym_calc_value(struct symbol *sym)
; ;
} }
if (sym->flags & SYMBOL_AUTO)
sym->flags &= ~SYMBOL_WRITE;
sym->curr = newval; sym->curr = newval;
if (sym_is_choice(sym) && newval.tri == yes) if (sym_is_choice(sym) && newval.tri == yes)
sym->curr.val = sym_calc_choice(sym); sym->curr.val = sym_calc_choice(sym);
...@@ -361,12 +359,14 @@ void sym_calc_value(struct symbol *sym) ...@@ -361,12 +359,14 @@ void sym_calc_value(struct symbol *sym)
} }
if (sym_is_choice(sym)) { if (sym_is_choice(sym)) {
struct symbol *choice_sym;
int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE); int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE);
prop = sym_get_choice_prop(sym); prop = sym_get_choice_prop(sym);
for (e = prop->expr; e; e = e->left.expr) { expr_list_for_each_sym(prop->expr, e, choice_sym) {
e->right.sym->flags |= flags; choice_sym->flags |= flags;
if (flags & SYMBOL_CHANGED) 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) ...@@ -849,7 +849,7 @@ struct property *prop_alloc(enum prop_type type, struct symbol *sym)
struct symbol *prop_get_symbol(struct property *prop) struct symbol *prop_get_symbol(struct property *prop)
{ {
if (prop->expr && (prop->expr->type == E_SYMBOL || if (prop->expr && (prop->expr->type == E_SYMBOL ||
prop->expr->type == E_CHOICE)) prop->expr->type == E_LIST))
return prop->expr->left.sym; return prop->expr->left.sym;
return NULL; return NULL;
} }
...@@ -859,6 +859,8 @@ const char *prop_get_type_name(enum prop_type type) ...@@ -859,6 +859,8 @@ const char *prop_get_type_name(enum prop_type type)
switch (type) { switch (type) {
case P_PROMPT: case P_PROMPT:
return "prompt"; return "prompt";
case P_ENV:
return "env";
case P_COMMENT: case P_COMMENT:
return "comment"; return "comment";
case P_MENU: case P_MENU:
...@@ -876,3 +878,32 @@ const char *prop_get_type_name(enum prop_type type) ...@@ -876,3 +878,32 @@ const char *prop_get_type_name(enum prop_type type)
} }
return "unknown"; 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);
}
...@@ -29,6 +29,8 @@ struct file *file_lookup(const char *name) ...@@ -29,6 +29,8 @@ struct file *file_lookup(const char *name)
/* write a dependency file as used by kbuild to track dependencies */ /* write a dependency file as used by kbuild to track dependencies */
int file_write_dep(const char *name) int file_write_dep(const char *name)
{ {
struct symbol *sym, *env_sym;
struct expr *e;
struct file *file; struct file *file;
FILE *out; FILE *out;
...@@ -45,8 +47,25 @@ int file_write_dep(const char *name) ...@@ -45,8 +47,25 @@ int file_write_dep(const char *name)
fprintf(out, "\t%s\n", file->name); fprintf(out, "\t%s\n", file->name);
} }
fprintf(out, "\ninclude/config/auto.conf: \\\n" fprintf(out, "\ninclude/config/auto.conf: \\\n"
"\t$(deps_config)\n\n" "\t$(deps_config)\n\n");
"$(deps_config): ;\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); fclose(out);
rename("..config.tmp", name); rename("..config.tmp", name);
return 0; return 0;
......
...@@ -35,10 +35,10 @@ int, T_TYPE, TF_COMMAND, S_INT ...@@ -35,10 +35,10 @@ int, T_TYPE, TF_COMMAND, S_INT
hex, T_TYPE, TF_COMMAND, S_HEX hex, T_TYPE, TF_COMMAND, S_HEX
string, T_TYPE, TF_COMMAND, S_STRING string, T_TYPE, TF_COMMAND, S_STRING
select, T_SELECT, TF_COMMAND select, T_SELECT, TF_COMMAND
enable, T_SELECT, TF_COMMAND
range, T_RANGE, TF_COMMAND range, T_RANGE, TF_COMMAND
option, T_OPTION, TF_COMMAND option, T_OPTION, TF_COMMAND
on, T_ON, TF_PARAM on, T_ON, TF_PARAM
modules, T_OPT_MODULES, TF_OPTION modules, T_OPT_MODULES, TF_OPTION
defconfig_list, T_OPT_DEFCONFIG_LIST,TF_OPTION defconfig_list, T_OPT_DEFCONFIG_LIST,TF_OPTION
env, T_OPT_ENV, TF_OPTION
%% %%
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment