Commit 0748cb3e1fbd89c03a98c15e91ad65797981de77

Authored by Sam Ravnborg
Committed by Michal Marek
1 parent d595cea624

kconfig: add alldefconfig

alldefconfig create a configuration with all values set
to their default value (form the Kconfig files).

This may be useful when we try to use more sensible default
values and may also be used in combination with
the minimal defconfigs.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>

Showing 3 changed files with 15 additions and 7 deletions Inline Diff

Documentation/kbuild/kconfig.txt
1 This file contains some assistance for using "make *config". 1 This file contains some assistance for using "make *config".
2 2
3 Use "make help" to list all of the possible configuration targets. 3 Use "make help" to list all of the possible configuration targets.
4 4
5 The xconfig ('qconf') and menuconfig ('mconf') programs also 5 The xconfig ('qconf') and menuconfig ('mconf') programs also
6 have embedded help text. Be sure to check it for navigation, 6 have embedded help text. Be sure to check it for navigation,
7 search, and other general help text. 7 search, and other general help text.
8 8
9 ====================================================================== 9 ======================================================================
10 General 10 General
11 -------------------------------------------------- 11 --------------------------------------------------
12 12
13 New kernel releases often introduce new config symbols. Often more 13 New kernel releases often introduce new config symbols. Often more
14 important, new kernel releases may rename config symbols. When 14 important, new kernel releases may rename config symbols. When
15 this happens, using a previously working .config file and running 15 this happens, using a previously working .config file and running
16 "make oldconfig" won't necessarily produce a working new kernel 16 "make oldconfig" won't necessarily produce a working new kernel
17 for you, so you may find that you need to see what NEW kernel 17 for you, so you may find that you need to see what NEW kernel
18 symbols have been introduced. 18 symbols have been introduced.
19 19
20 To see a list of new config symbols when using "make oldconfig", use 20 To see a list of new config symbols when using "make oldconfig", use
21 21
22 cp user/some/old.config .config 22 cp user/some/old.config .config
23 yes "" | make oldconfig >conf.new 23 yes "" | make oldconfig >conf.new
24 24
25 and the config program will list as (NEW) any new symbols that have 25 and the config program will list as (NEW) any new symbols that have
26 unknown values. Of course, the .config file is also updated with 26 unknown values. Of course, the .config file is also updated with
27 new (default) values, so you can use: 27 new (default) values, so you can use:
28 28
29 grep "(NEW)" conf.new 29 grep "(NEW)" conf.new
30 30
31 to see the new config symbols or you can 'diff' the previous and 31 to see the new config symbols or you can 'diff' the previous and
32 new .config files to see the differences: 32 new .config files to see the differences:
33 33
34 diff .config.old .config | less 34 diff .config.old .config | less
35 35
36 (Yes, we need something better here.) 36 (Yes, we need something better here.)
37 37
38 ______________________________________________________________________ 38 ______________________________________________________________________
39 Environment variables for '*config' 39 Environment variables for '*config'
40 40
41 KCONFIG_CONFIG 41 KCONFIG_CONFIG
42 -------------------------------------------------- 42 --------------------------------------------------
43 This environment variable can be used to specify a default kernel config 43 This environment variable can be used to specify a default kernel config
44 file name to override the default name of ".config". 44 file name to override the default name of ".config".
45 45
46 KCONFIG_OVERWRITECONFIG 46 KCONFIG_OVERWRITECONFIG
47 -------------------------------------------------- 47 --------------------------------------------------
48 If you set KCONFIG_OVERWRITECONFIG in the environment, Kconfig will not 48 If you set KCONFIG_OVERWRITECONFIG in the environment, Kconfig will not
49 break symlinks when .config is a symlink to somewhere else. 49 break symlinks when .config is a symlink to somewhere else.
50 50
51 KCONFIG_NOTIMESTAMP 51 KCONFIG_NOTIMESTAMP
52 -------------------------------------------------- 52 --------------------------------------------------
53 If this environment variable exists and is non-null, the timestamp line 53 If this environment variable exists and is non-null, the timestamp line
54 in generated .config files is omitted. 54 in generated .config files is omitted.
55 55
56 ______________________________________________________________________ 56 ______________________________________________________________________
57 Environment variables for '{allyes/allmod/allno/rand}config' 57 Environment variables for '{allyes/allmod/allno/rand}config'
58 58
59 KCONFIG_ALLCONFIG 59 KCONFIG_ALLCONFIG
60 -------------------------------------------------- 60 --------------------------------------------------
61 (partially based on lkml email from/by Rob Landley, re: miniconfig) 61 (partially based on lkml email from/by Rob Landley, re: miniconfig)
62 -------------------------------------------------- 62 --------------------------------------------------
63 The allyesconfig/allmodconfig/allnoconfig/randconfig variants can 63 The allyesconfig/allmodconfig/allnoconfig/randconfig variants can
64 also use the environment variable KCONFIG_ALLCONFIG as a flag or a 64 also use the environment variable KCONFIG_ALLCONFIG as a flag or a
65 filename that contains config symbols that the user requires to be 65 filename that contains config symbols that the user requires to be
66 set to a specific value. If KCONFIG_ALLCONFIG is used without a 66 set to a specific value. If KCONFIG_ALLCONFIG is used without a
67 filename, "make *config" checks for a file named 67 filename, "make *config" checks for a file named
68 "all{yes/mod/no/random}.config" (corresponding to the *config command 68 "all{yes/mod/no/def/random}.config" (corresponding to the *config command
69 that was used) for symbol values that are to be forced. If this file 69 that was used) for symbol values that are to be forced. If this file
70 is not found, it checks for a file named "all.config" to contain forced 70 is not found, it checks for a file named "all.config" to contain forced
71 values. 71 values.
72 72
73 This enables you to create "miniature" config (miniconfig) or custom 73 This enables you to create "miniature" config (miniconfig) or custom
74 config files containing just the config symbols that you are interested 74 config files containing just the config symbols that you are interested
75 in. Then the kernel config system generates the full .config file, 75 in. Then the kernel config system generates the full .config file,
76 including symbols of your miniconfig file. 76 including symbols of your miniconfig file.
77 77
78 This 'KCONFIG_ALLCONFIG' file is a config file which contains 78 This 'KCONFIG_ALLCONFIG' file is a config file which contains
79 (usually a subset of all) preset config symbols. These variable 79 (usually a subset of all) preset config symbols. These variable
80 settings are still subject to normal dependency checks. 80 settings are still subject to normal dependency checks.
81 81
82 Examples: 82 Examples:
83 KCONFIG_ALLCONFIG=custom-notebook.config make allnoconfig 83 KCONFIG_ALLCONFIG=custom-notebook.config make allnoconfig
84 or 84 or
85 KCONFIG_ALLCONFIG=mini.config make allnoconfig 85 KCONFIG_ALLCONFIG=mini.config make allnoconfig
86 or 86 or
87 make KCONFIG_ALLCONFIG=mini.config allnoconfig 87 make KCONFIG_ALLCONFIG=mini.config allnoconfig
88 88
89 These examples will disable most options (allnoconfig) but enable or 89 These examples will disable most options (allnoconfig) but enable or
90 disable the options that are explicitly listed in the specified 90 disable the options that are explicitly listed in the specified
91 mini-config files. 91 mini-config files.
92 92
93 ______________________________________________________________________ 93 ______________________________________________________________________
94 Environment variables for 'silentoldconfig' 94 Environment variables for 'silentoldconfig'
95 95
96 KCONFIG_NOSILENTUPDATE 96 KCONFIG_NOSILENTUPDATE
97 -------------------------------------------------- 97 --------------------------------------------------
98 If this variable has a non-blank value, it prevents silent kernel 98 If this variable has a non-blank value, it prevents silent kernel
99 config udpates (requires explicit updates). 99 config udpates (requires explicit updates).
100 100
101 KCONFIG_AUTOCONFIG 101 KCONFIG_AUTOCONFIG
102 -------------------------------------------------- 102 --------------------------------------------------
103 This environment variable can be set to specify the path & name of the 103 This environment variable can be set to specify the path & name of the
104 "auto.conf" file. Its default value is "include/config/auto.conf". 104 "auto.conf" file. Its default value is "include/config/auto.conf".
105 105
106 KCONFIG_TRISTATE 106 KCONFIG_TRISTATE
107 -------------------------------------------------- 107 --------------------------------------------------
108 This environment variable can be set to specify the path & name of the 108 This environment variable can be set to specify the path & name of the
109 "tristate.conf" file. Its default value is "include/config/tristate.conf". 109 "tristate.conf" file. Its default value is "include/config/tristate.conf".
110 110
111 KCONFIG_AUTOHEADER 111 KCONFIG_AUTOHEADER
112 -------------------------------------------------- 112 --------------------------------------------------
113 This environment variable can be set to specify the path & name of the 113 This environment variable can be set to specify the path & name of the
114 "autoconf.h" (header) file. 114 "autoconf.h" (header) file.
115 Its default value is "include/generated/autoconf.h". 115 Its default value is "include/generated/autoconf.h".
116 116
117 117
118 ====================================================================== 118 ======================================================================
119 menuconfig 119 menuconfig
120 -------------------------------------------------- 120 --------------------------------------------------
121 121
122 SEARCHING for CONFIG symbols 122 SEARCHING for CONFIG symbols
123 123
124 Searching in menuconfig: 124 Searching in menuconfig:
125 125
126 The Search function searches for kernel configuration symbol 126 The Search function searches for kernel configuration symbol
127 names, so you have to know something close to what you are 127 names, so you have to know something close to what you are
128 looking for. 128 looking for.
129 129
130 Example: 130 Example:
131 /hotplug 131 /hotplug
132 This lists all config symbols that contain "hotplug", 132 This lists all config symbols that contain "hotplug",
133 e.g., HOTPLUG, HOTPLUG_CPU, MEMORY_HOTPLUG. 133 e.g., HOTPLUG, HOTPLUG_CPU, MEMORY_HOTPLUG.
134 134
135 For search help, enter / followed TAB-TAB-TAB (to highlight 135 For search help, enter / followed TAB-TAB-TAB (to highlight
136 <Help>) and Enter. This will tell you that you can also use 136 <Help>) and Enter. This will tell you that you can also use
137 regular expressions (regexes) in the search string, so if you 137 regular expressions (regexes) in the search string, so if you
138 are not interested in MEMORY_HOTPLUG, you could try 138 are not interested in MEMORY_HOTPLUG, you could try
139 139
140 /^hotplug 140 /^hotplug
141 141
142 ______________________________________________________________________ 142 ______________________________________________________________________
143 User interface options for 'menuconfig' 143 User interface options for 'menuconfig'
144 144
145 MENUCONFIG_COLOR 145 MENUCONFIG_COLOR
146 -------------------------------------------------- 146 --------------------------------------------------
147 It is possible to select different color themes using the variable 147 It is possible to select different color themes using the variable
148 MENUCONFIG_COLOR. To select a theme use: 148 MENUCONFIG_COLOR. To select a theme use:
149 149
150 make MENUCONFIG_COLOR=<theme> menuconfig 150 make MENUCONFIG_COLOR=<theme> menuconfig
151 151
152 Available themes are: 152 Available themes are:
153 mono => selects colors suitable for monochrome displays 153 mono => selects colors suitable for monochrome displays
154 blackbg => selects a color scheme with black background 154 blackbg => selects a color scheme with black background
155 classic => theme with blue background. The classic look 155 classic => theme with blue background. The classic look
156 bluetitle => a LCD friendly version of classic. (default) 156 bluetitle => a LCD friendly version of classic. (default)
157 157
158 MENUCONFIG_MODE 158 MENUCONFIG_MODE
159 -------------------------------------------------- 159 --------------------------------------------------
160 This mode shows all sub-menus in one large tree. 160 This mode shows all sub-menus in one large tree.
161 161
162 Example: 162 Example:
163 make MENUCONFIG_MODE=single_menu menuconfig 163 make MENUCONFIG_MODE=single_menu menuconfig
164 164
165 165
166 ====================================================================== 166 ======================================================================
167 xconfig 167 xconfig
168 -------------------------------------------------- 168 --------------------------------------------------
169 169
170 Searching in xconfig: 170 Searching in xconfig:
171 171
172 The Search function searches for kernel configuration symbol 172 The Search function searches for kernel configuration symbol
173 names, so you have to know something close to what you are 173 names, so you have to know something close to what you are
174 looking for. 174 looking for.
175 175
176 Example: 176 Example:
177 Ctrl-F hotplug 177 Ctrl-F hotplug
178 or 178 or
179 Menu: File, Search, hotplug 179 Menu: File, Search, hotplug
180 180
181 lists all config symbol entries that contain "hotplug" in 181 lists all config symbol entries that contain "hotplug" in
182 the symbol name. In this Search dialog, you may change the 182 the symbol name. In this Search dialog, you may change the
183 config setting for any of the entries that are not grayed out. 183 config setting for any of the entries that are not grayed out.
184 You can also enter a different search string without having 184 You can also enter a different search string without having
185 to return to the main menu. 185 to return to the main menu.
186 186
187 187
188 ====================================================================== 188 ======================================================================
189 gconfig 189 gconfig
190 -------------------------------------------------- 190 --------------------------------------------------
191 191
192 Searching in gconfig: 192 Searching in gconfig:
193 193
194 None (gconfig isn't maintained as well as xconfig or menuconfig); 194 None (gconfig isn't maintained as well as xconfig or menuconfig);
195 however, gconfig does have a few more viewing choices than 195 however, gconfig does have a few more viewing choices than
196 xconfig does. 196 xconfig does.
197 197
198 ### 198 ###
199 199
scripts/kconfig/Makefile
1 # =========================================================================== 1 # ===========================================================================
2 # Kernel configuration targets 2 # Kernel configuration targets
3 # These targets are used from top-level makefile 3 # These targets are used from top-level makefile
4 4
5 PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config \ 5 PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config \
6 localmodconfig localyesconfig 6 localmodconfig localyesconfig
7 7
8 ifdef KBUILD_KCONFIG 8 ifdef KBUILD_KCONFIG
9 Kconfig := $(KBUILD_KCONFIG) 9 Kconfig := $(KBUILD_KCONFIG)
10 else 10 else
11 Kconfig := arch/$(SRCARCH)/Kconfig 11 Kconfig := arch/$(SRCARCH)/Kconfig
12 endif 12 endif
13 13
14 xconfig: $(obj)/qconf 14 xconfig: $(obj)/qconf
15 $< $(Kconfig) 15 $< $(Kconfig)
16 16
17 gconfig: $(obj)/gconf 17 gconfig: $(obj)/gconf
18 $< $(Kconfig) 18 $< $(Kconfig)
19 19
20 menuconfig: $(obj)/mconf 20 menuconfig: $(obj)/mconf
21 $< $(Kconfig) 21 $< $(Kconfig)
22 22
23 config: $(obj)/conf 23 config: $(obj)/conf
24 $< --oldaskconfig $(Kconfig) 24 $< --oldaskconfig $(Kconfig)
25 25
26 nconfig: $(obj)/nconf 26 nconfig: $(obj)/nconf
27 $< $(Kconfig) 27 $< $(Kconfig)
28 28
29 oldconfig: $(obj)/conf 29 oldconfig: $(obj)/conf
30 $< --$@ $(Kconfig) 30 $< --$@ $(Kconfig)
31 31
32 silentoldconfig: $(obj)/conf 32 silentoldconfig: $(obj)/conf
33 $(Q)mkdir -p include/generated 33 $(Q)mkdir -p include/generated
34 $< --$@ $(Kconfig) 34 $< --$@ $(Kconfig)
35 35
36 localmodconfig: $(obj)/streamline_config.pl $(obj)/conf 36 localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
37 $(Q)perl $< $(srctree) $(Kconfig) > .tmp.config 37 $(Q)perl $< $(srctree) $(Kconfig) > .tmp.config
38 $(Q)if [ -f .config ]; then \ 38 $(Q)if [ -f .config ]; then \
39 cmp -s .tmp.config .config || \ 39 cmp -s .tmp.config .config || \
40 (mv -f .config .config.old.1; \ 40 (mv -f .config .config.old.1; \
41 mv -f .tmp.config .config; \ 41 mv -f .tmp.config .config; \
42 $(obj)/conf --silentoldconfig $(Kconfig); \ 42 $(obj)/conf --silentoldconfig $(Kconfig); \
43 mv -f .config.old.1 .config.old) \ 43 mv -f .config.old.1 .config.old) \
44 else \ 44 else \
45 mv -f .tmp.config .config; \ 45 mv -f .tmp.config .config; \
46 $(obj)/conf --silentoldconfig $(Kconfig); \ 46 $(obj)/conf --silentoldconfig $(Kconfig); \
47 fi 47 fi
48 $(Q)rm -f .tmp.config 48 $(Q)rm -f .tmp.config
49 49
50 localyesconfig: $(obj)/streamline_config.pl $(obj)/conf 50 localyesconfig: $(obj)/streamline_config.pl $(obj)/conf
51 $(Q)perl $< $(srctree) $(Kconfig) > .tmp.config 51 $(Q)perl $< $(srctree) $(Kconfig) > .tmp.config
52 $(Q)sed -i s/=m/=y/ .tmp.config 52 $(Q)sed -i s/=m/=y/ .tmp.config
53 $(Q)if [ -f .config ]; then \ 53 $(Q)if [ -f .config ]; then \
54 cmp -s .tmp.config .config || \ 54 cmp -s .tmp.config .config || \
55 (mv -f .config .config.old.1; \ 55 (mv -f .config .config.old.1; \
56 mv -f .tmp.config .config; \ 56 mv -f .tmp.config .config; \
57 $(obj)/conf --silentoldconfig $(Kconfig); \ 57 $(obj)/conf --silentoldconfig $(Kconfig); \
58 mv -f .config.old.1 .config.old) \ 58 mv -f .config.old.1 .config.old) \
59 else \ 59 else \
60 mv -f .tmp.config .config; \ 60 mv -f .tmp.config .config; \
61 $(obj)/conf --silentoldconfig $(Kconfig); \ 61 $(obj)/conf --silentoldconfig $(Kconfig); \
62 fi 62 fi
63 $(Q)rm -f .tmp.config 63 $(Q)rm -f .tmp.config
64 64
65 # Create new linux.pot file 65 # Create new linux.pot file
66 # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files 66 # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
67 # The symlink is used to repair a deficiency in arch/um 67 # The symlink is used to repair a deficiency in arch/um
68 update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h 68 update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h
69 $(Q)echo " GEN config" 69 $(Q)echo " GEN config"
70 $(Q)xgettext --default-domain=linux \ 70 $(Q)xgettext --default-domain=linux \
71 --add-comments --keyword=_ --keyword=N_ \ 71 --add-comments --keyword=_ --keyword=N_ \
72 --from-code=UTF-8 \ 72 --from-code=UTF-8 \
73 --files-from=scripts/kconfig/POTFILES.in \ 73 --files-from=scripts/kconfig/POTFILES.in \
74 --output $(obj)/config.pot 74 --output $(obj)/config.pot
75 $(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot 75 $(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot
76 $(Q)ln -fs Kconfig.i386 arch/um/Kconfig.arch 76 $(Q)ln -fs Kconfig.i386 arch/um/Kconfig.arch
77 $(Q)(for i in `ls arch/*/Kconfig`; \ 77 $(Q)(for i in `ls arch/*/Kconfig`; \
78 do \ 78 do \
79 echo " GEN $$i"; \ 79 echo " GEN $$i"; \
80 $(obj)/kxgettext $$i \ 80 $(obj)/kxgettext $$i \
81 >> $(obj)/config.pot; \ 81 >> $(obj)/config.pot; \
82 done ) 82 done )
83 $(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \ 83 $(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \
84 --output $(obj)/linux.pot 84 --output $(obj)/linux.pot
85 $(Q)rm -f arch/um/Kconfig.arch 85 $(Q)rm -f arch/um/Kconfig.arch
86 $(Q)rm -f $(obj)/config.pot 86 $(Q)rm -f $(obj)/config.pot
87 87
88 PHONY += allnoconfig allyesconfig allmodconfig randconfig 88 PHONY += allnoconfig allyesconfig allmodconfig alldefconfig randconfig
89 89
90 allnoconfig allyesconfig allmodconfig randconfig: $(obj)/conf 90 allnoconfig allyesconfig allmodconfig alldefconfig randconfig: $(obj)/conf
91 $< --$@ $(Kconfig) 91 $< --$@ $(Kconfig)
92 92
93 PHONY += listnewconfig oldnoconfig defconfig 93 PHONY += listnewconfig oldnoconfig defconfig
94 94
95 listnewconfig oldnoconfig: $(obj)/conf 95 listnewconfig oldnoconfig: $(obj)/conf
96 $< --$@ $(Kconfig) 96 $< --$@ $(Kconfig)
97 97
98 defconfig: $(obj)/conf 98 defconfig: $(obj)/conf
99 ifeq ($(KBUILD_DEFCONFIG),) 99 ifeq ($(KBUILD_DEFCONFIG),)
100 $< --defconfig $(Kconfig) 100 $< --defconfig $(Kconfig)
101 else 101 else
102 @echo "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'" 102 @echo "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'"
103 $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig) 103 $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
104 endif 104 endif
105 105
106 %_defconfig: $(obj)/conf 106 %_defconfig: $(obj)/conf
107 $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig) 107 $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig)
108 108
109 # Help text used by make help 109 # Help text used by make help
110 help: 110 help:
111 @echo ' config - Update current config utilising a line-oriented program' 111 @echo ' config - Update current config utilising a line-oriented program'
112 @echo ' nconfig - Update current config utilising a ncurses menu based program' 112 @echo ' nconfig - Update current config utilising a ncurses menu based program'
113 @echo ' menuconfig - Update current config utilising a menu based program' 113 @echo ' menuconfig - Update current config utilising a menu based program'
114 @echo ' xconfig - Update current config utilising a QT based front-end' 114 @echo ' xconfig - Update current config utilising a QT based front-end'
115 @echo ' gconfig - Update current config utilising a GTK based front-end' 115 @echo ' gconfig - Update current config utilising a GTK based front-end'
116 @echo ' oldconfig - Update current config utilising a provided .config as base' 116 @echo ' oldconfig - Update current config utilising a provided .config as base'
117 @echo ' localmodconfig - Update current config disabling modules not loaded' 117 @echo ' localmodconfig - Update current config disabling modules not loaded'
118 @echo ' localyesconfig - Update current config converting local mods to core' 118 @echo ' localyesconfig - Update current config converting local mods to core'
119 @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps' 119 @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps'
120 @echo ' randconfig - New config with random answer to all options' 120 @echo ' defconfig - New config with default from ARCH supplied defconfig'
121 @echo ' defconfig - New config with default answer to all options'
122 @echo ' allmodconfig - New config selecting modules when possible'
123 @echo ' allyesconfig - New config where all options are accepted with yes'
124 @echo ' allnoconfig - New config where all options are answered with no' 121 @echo ' allnoconfig - New config where all options are answered with no'
122 @echo ' allyesconfig - New config where all options are accepted with yes'
123 @echo ' allmodconfig - New config selecting modules when possible'
124 @echo ' alldefconfig - New config with all symbols set to default'
125 @echo ' randconfig - New config with random answer to all options'
125 @echo ' listnewconfig - List new options' 126 @echo ' listnewconfig - List new options'
126 @echo ' oldnoconfig - Same as silentoldconfig but set new symbols to n (unset)' 127 @echo ' oldnoconfig - Same as silentoldconfig but set new symbols to n (unset)'
127 128
128 # lxdialog stuff 129 # lxdialog stuff
129 check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh 130 check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh
130 131
131 # Use recursively expanded variables so we do not call gcc unless 132 # Use recursively expanded variables so we do not call gcc unless
132 # we really need to do so. (Do not call gcc as part of make mrproper) 133 # we really need to do so. (Do not call gcc as part of make mrproper)
133 HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) 134 HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
134 HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) 135 HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
135 136
136 HOST_EXTRACFLAGS += -DLOCALE 137 HOST_EXTRACFLAGS += -DLOCALE
137 138
138 139
139 # =========================================================================== 140 # ===========================================================================
140 # Shared Makefile for the various kconfig executables: 141 # Shared Makefile for the various kconfig executables:
141 # conf: Used for defconfig, oldconfig and related targets 142 # conf: Used for defconfig, oldconfig and related targets
142 # nconf: Used for the nconfig target. 143 # nconf: Used for the nconfig target.
143 # Utilizes ncurses 144 # Utilizes ncurses
144 # mconf: Used for the menuconfig target 145 # mconf: Used for the menuconfig target
145 # Utilizes the lxdialog package 146 # Utilizes the lxdialog package
146 # qconf: Used for the xconfig target 147 # qconf: Used for the xconfig target
147 # Based on QT which needs to be installed to compile it 148 # Based on QT which needs to be installed to compile it
148 # gconf: Used for the gconfig target 149 # gconf: Used for the gconfig target
149 # Based on GTK which needs to be installed to compile it 150 # Based on GTK which needs to be installed to compile it
150 # object files used by all kconfig flavours 151 # object files used by all kconfig flavours
151 152
152 lxdialog := lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o 153 lxdialog := lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o
153 lxdialog += lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o 154 lxdialog += lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o
154 155
155 conf-objs := conf.o zconf.tab.o 156 conf-objs := conf.o zconf.tab.o
156 mconf-objs := mconf.o zconf.tab.o $(lxdialog) 157 mconf-objs := mconf.o zconf.tab.o $(lxdialog)
157 nconf-objs := nconf.o zconf.tab.o nconf.gui.o 158 nconf-objs := nconf.o zconf.tab.o nconf.gui.o
158 kxgettext-objs := kxgettext.o zconf.tab.o 159 kxgettext-objs := kxgettext.o zconf.tab.o
159 160
160 hostprogs-y := conf qconf gconf kxgettext 161 hostprogs-y := conf qconf gconf kxgettext
161 162
162 ifeq ($(MAKECMDGOALS),nconfig) 163 ifeq ($(MAKECMDGOALS),nconfig)
163 hostprogs-y += nconf 164 hostprogs-y += nconf
164 endif 165 endif
165 166
166 ifeq ($(MAKECMDGOALS),menuconfig) 167 ifeq ($(MAKECMDGOALS),menuconfig)
167 hostprogs-y += mconf 168 hostprogs-y += mconf
168 endif 169 endif
169 170
170 ifeq ($(MAKECMDGOALS),xconfig) 171 ifeq ($(MAKECMDGOALS),xconfig)
171 qconf-target := 1 172 qconf-target := 1
172 endif 173 endif
173 ifeq ($(MAKECMDGOALS),gconfig) 174 ifeq ($(MAKECMDGOALS),gconfig)
174 gconf-target := 1 175 gconf-target := 1
175 endif 176 endif
176 177
177 178
178 ifeq ($(qconf-target),1) 179 ifeq ($(qconf-target),1)
179 qconf-cxxobjs := qconf.o 180 qconf-cxxobjs := qconf.o
180 qconf-objs := kconfig_load.o zconf.tab.o 181 qconf-objs := kconfig_load.o zconf.tab.o
181 endif 182 endif
182 183
183 ifeq ($(gconf-target),1) 184 ifeq ($(gconf-target),1)
184 gconf-objs := gconf.o kconfig_load.o zconf.tab.o 185 gconf-objs := gconf.o kconfig_load.o zconf.tab.o
185 endif 186 endif
186 187
187 clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \ 188 clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \
188 .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c gconf.glade.h 189 .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c gconf.glade.h
189 clean-files += mconf qconf gconf nconf 190 clean-files += mconf qconf gconf nconf
190 clean-files += config.pot linux.pot 191 clean-files += config.pot linux.pot
191 192
192 # Check that we have the required ncurses stuff installed for lxdialog (menuconfig) 193 # Check that we have the required ncurses stuff installed for lxdialog (menuconfig)
193 PHONY += $(obj)/dochecklxdialog 194 PHONY += $(obj)/dochecklxdialog
194 $(addprefix $(obj)/,$(lxdialog)): $(obj)/dochecklxdialog 195 $(addprefix $(obj)/,$(lxdialog)): $(obj)/dochecklxdialog
195 $(obj)/dochecklxdialog: 196 $(obj)/dochecklxdialog:
196 $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOST_LOADLIBES) 197 $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOST_LOADLIBES)
197 198
198 always := dochecklxdialog 199 always := dochecklxdialog
199 200
200 # Add environment specific flags 201 # Add environment specific flags
201 HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS)) 202 HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS))
202 203
203 # generated files seem to need this to find local include files 204 # generated files seem to need this to find local include files
204 HOSTCFLAGS_lex.zconf.o := -I$(src) 205 HOSTCFLAGS_lex.zconf.o := -I$(src)
205 HOSTCFLAGS_zconf.tab.o := -I$(src) 206 HOSTCFLAGS_zconf.tab.o := -I$(src)
206 207
207 HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -ldl 208 HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -ldl
208 HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK 209 HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK
209 210
210 HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` 211 HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0`
211 HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ 212 HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
212 -D LKC_DIRECT_LINK 213 -D LKC_DIRECT_LINK
213 214
214 HOSTLOADLIBES_nconf = -lmenu -lpanel -lncurses 215 HOSTLOADLIBES_nconf = -lmenu -lpanel -lncurses
215 $(obj)/qconf.o: $(obj)/.tmp_qtcheck 216 $(obj)/qconf.o: $(obj)/.tmp_qtcheck
216 217
217 ifeq ($(qconf-target),1) 218 ifeq ($(qconf-target),1)
218 $(obj)/.tmp_qtcheck: $(src)/Makefile 219 $(obj)/.tmp_qtcheck: $(src)/Makefile
219 -include $(obj)/.tmp_qtcheck 220 -include $(obj)/.tmp_qtcheck
220 221
221 # QT needs some extra effort... 222 # QT needs some extra effort...
222 $(obj)/.tmp_qtcheck: 223 $(obj)/.tmp_qtcheck:
223 @set -e; echo " CHECK qt"; dir=""; pkg=""; \ 224 @set -e; echo " CHECK qt"; dir=""; pkg=""; \
224 pkg-config --exists qt 2> /dev/null && pkg=qt; \ 225 pkg-config --exists qt 2> /dev/null && pkg=qt; \
225 pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \ 226 pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
226 if [ -n "$$pkg" ]; then \ 227 if [ -n "$$pkg" ]; then \
227 cflags="\$$(shell pkg-config $$pkg --cflags)"; \ 228 cflags="\$$(shell pkg-config $$pkg --cflags)"; \
228 libs="\$$(shell pkg-config $$pkg --libs)"; \ 229 libs="\$$(shell pkg-config $$pkg --libs)"; \
229 moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \ 230 moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
230 dir="$$(pkg-config $$pkg --variable=prefix)"; \ 231 dir="$$(pkg-config $$pkg --variable=prefix)"; \
231 else \ 232 else \
232 for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \ 233 for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
233 if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \ 234 if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
234 done; \ 235 done; \
235 if [ -z "$$dir" ]; then \ 236 if [ -z "$$dir" ]; then \
236 echo "*"; \ 237 echo "*"; \
237 echo "* Unable to find the QT3 installation. Please make sure that"; \ 238 echo "* Unable to find the QT3 installation. Please make sure that"; \
238 echo "* the QT3 development package is correctly installed and"; \ 239 echo "* the QT3 development package is correctly installed and"; \
239 echo "* either install pkg-config or set the QTDIR environment"; \ 240 echo "* either install pkg-config or set the QTDIR environment"; \
240 echo "* variable to the correct location."; \ 241 echo "* variable to the correct location."; \
241 echo "*"; \ 242 echo "*"; \
242 false; \ 243 false; \
243 fi; \ 244 fi; \
244 libpath=$$dir/lib; lib=qt; osdir=""; \ 245 libpath=$$dir/lib; lib=qt; osdir=""; \
245 $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \ 246 $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
246 osdir=x$$($(HOSTCXX) -print-multi-os-directory); \ 247 osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
247 test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \ 248 test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
248 test -f $$libpath/libqt-mt.so && lib=qt-mt; \ 249 test -f $$libpath/libqt-mt.so && lib=qt-mt; \
249 cflags="-I$$dir/include"; \ 250 cflags="-I$$dir/include"; \
250 libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \ 251 libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
251 moc="$$dir/bin/moc"; \ 252 moc="$$dir/bin/moc"; \
252 fi; \ 253 fi; \
253 if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \ 254 if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
254 echo "*"; \ 255 echo "*"; \
255 echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \ 256 echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
256 echo "*"; \ 257 echo "*"; \
257 moc="/usr/bin/moc"; \ 258 moc="/usr/bin/moc"; \
258 fi; \ 259 fi; \
259 echo "KC_QT_CFLAGS=$$cflags" > $@; \ 260 echo "KC_QT_CFLAGS=$$cflags" > $@; \
260 echo "KC_QT_LIBS=$$libs" >> $@; \ 261 echo "KC_QT_LIBS=$$libs" >> $@; \
261 echo "KC_QT_MOC=$$moc" >> $@ 262 echo "KC_QT_MOC=$$moc" >> $@
262 endif 263 endif
263 264
264 $(obj)/gconf.o: $(obj)/.tmp_gtkcheck 265 $(obj)/gconf.o: $(obj)/.tmp_gtkcheck
265 266
266 ifeq ($(gconf-target),1) 267 ifeq ($(gconf-target),1)
267 -include $(obj)/.tmp_gtkcheck 268 -include $(obj)/.tmp_gtkcheck
268 269
269 # GTK needs some extra effort, too... 270 # GTK needs some extra effort, too...
270 $(obj)/.tmp_gtkcheck: 271 $(obj)/.tmp_gtkcheck:
271 @if `pkg-config --exists gtk+-2.0 gmodule-2.0 libglade-2.0`; then \ 272 @if `pkg-config --exists gtk+-2.0 gmodule-2.0 libglade-2.0`; then \
272 if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then \ 273 if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then \
273 touch $@; \ 274 touch $@; \
274 else \ 275 else \
275 echo "*"; \ 276 echo "*"; \
276 echo "* GTK+ is present but version >= 2.0.0 is required."; \ 277 echo "* GTK+ is present but version >= 2.0.0 is required."; \
277 echo "*"; \ 278 echo "*"; \
278 false; \ 279 false; \
279 fi \ 280 fi \
280 else \ 281 else \
281 echo "*"; \ 282 echo "*"; \
282 echo "* Unable to find the GTK+ installation. Please make sure that"; \ 283 echo "* Unable to find the GTK+ installation. Please make sure that"; \
283 echo "* the GTK+ 2.0 development package is correctly installed..."; \ 284 echo "* the GTK+ 2.0 development package is correctly installed..."; \
284 echo "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \ 285 echo "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \
285 echo "*"; \ 286 echo "*"; \
286 false; \ 287 false; \
287 fi 288 fi
288 endif 289 endif
289 290
290 $(obj)/zconf.tab.o: $(obj)/lex.zconf.c $(obj)/zconf.hash.c 291 $(obj)/zconf.tab.o: $(obj)/lex.zconf.c $(obj)/zconf.hash.c
291 292
292 $(obj)/kconfig_load.o: $(obj)/lkc_defs.h 293 $(obj)/kconfig_load.o: $(obj)/lkc_defs.h
293 294
294 $(obj)/qconf.o: $(obj)/qconf.moc $(obj)/lkc_defs.h 295 $(obj)/qconf.o: $(obj)/qconf.moc $(obj)/lkc_defs.h
295 296
296 $(obj)/gconf.o: $(obj)/lkc_defs.h 297 $(obj)/gconf.o: $(obj)/lkc_defs.h
297 298
298 $(obj)/%.moc: $(src)/%.h 299 $(obj)/%.moc: $(src)/%.h
299 $(KC_QT_MOC) -i $< -o $@ 300 $(KC_QT_MOC) -i $< -o $@
300 301
301 $(obj)/lkc_defs.h: $(src)/lkc_proto.h 302 $(obj)/lkc_defs.h: $(src)/lkc_proto.h
302 sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/' 303 sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
303 304
304 # Extract gconf menu items for I18N support 305 # Extract gconf menu items for I18N support
305 $(obj)/gconf.glade.h: $(obj)/gconf.glade 306 $(obj)/gconf.glade.h: $(obj)/gconf.glade
306 intltool-extract --type=gettext/glade $(obj)/gconf.glade 307 intltool-extract --type=gettext/glade $(obj)/gconf.glade
307 308
308 ### 309 ###
309 # The following requires flex/bison/gperf 310 # The following requires flex/bison/gperf
310 # By default we use the _shipped versions, uncomment the following line if 311 # By default we use the _shipped versions, uncomment the following line if
311 # you are modifying the flex/bison src. 312 # you are modifying the flex/bison src.
312 # LKC_GENPARSER := 1 313 # LKC_GENPARSER := 1
313 314
314 ifdef LKC_GENPARSER 315 ifdef LKC_GENPARSER
315 316
316 $(obj)/zconf.tab.c: $(src)/zconf.y 317 $(obj)/zconf.tab.c: $(src)/zconf.y
317 $(obj)/lex.zconf.c: $(src)/zconf.l 318 $(obj)/lex.zconf.c: $(src)/zconf.l
318 $(obj)/zconf.hash.c: $(src)/zconf.gperf 319 $(obj)/zconf.hash.c: $(src)/zconf.gperf
319 320
320 %.tab.c: %.y 321 %.tab.c: %.y
321 bison -l -b $* -p $(notdir $*) $< 322 bison -l -b $* -p $(notdir $*) $<
322 cp $@ $@_shipped 323 cp $@ $@_shipped
323 324
324 lex.%.c: %.l 325 lex.%.c: %.l
325 flex -L -P$(notdir $*) -o$@ $< 326 flex -L -P$(notdir $*) -o$@ $<
326 cp $@ $@_shipped 327 cp $@ $@_shipped
327 328
328 %.hash.c: %.gperf 329 %.hash.c: %.gperf
329 gperf < $< > $@ 330 gperf < $< > $@
330 cp $@ $@_shipped 331 cp $@ $@_shipped
scripts/kconfig/conf.c
1 /* 1 /*
2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> 2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3 * Released under the terms of the GNU GPL v2.0. 3 * Released under the terms of the GNU GPL v2.0.
4 */ 4 */
5 5
6 #include <locale.h> 6 #include <locale.h>
7 #include <ctype.h> 7 #include <ctype.h>
8 #include <stdio.h> 8 #include <stdio.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <string.h> 10 #include <string.h>
11 #include <time.h> 11 #include <time.h>
12 #include <unistd.h> 12 #include <unistd.h>
13 #include <getopt.h> 13 #include <getopt.h>
14 #include <sys/stat.h> 14 #include <sys/stat.h>
15 #include <sys/time.h> 15 #include <sys/time.h>
16 16
17 #define LKC_DIRECT_LINK 17 #define LKC_DIRECT_LINK
18 #include "lkc.h" 18 #include "lkc.h"
19 19
20 static void conf(struct menu *menu); 20 static void conf(struct menu *menu);
21 static void check_conf(struct menu *menu); 21 static void check_conf(struct menu *menu);
22 22
23 enum input_mode { 23 enum input_mode {
24 oldaskconfig, 24 oldaskconfig,
25 silentoldconfig, 25 silentoldconfig,
26 oldconfig, 26 oldconfig,
27 allnoconfig, 27 allnoconfig,
28 allyesconfig, 28 allyesconfig,
29 allmodconfig, 29 allmodconfig,
30 alldefconfig,
30 randconfig, 31 randconfig,
31 defconfig, 32 defconfig,
32 listnewconfig, 33 listnewconfig,
33 oldnoconfig, 34 oldnoconfig,
34 } input_mode = oldaskconfig; 35 } input_mode = oldaskconfig;
35 36
36 char *defconfig_file; 37 char *defconfig_file;
37 38
38 static int indent = 1; 39 static int indent = 1;
39 static int valid_stdin = 1; 40 static int valid_stdin = 1;
40 static int sync_kconfig; 41 static int sync_kconfig;
41 static int conf_cnt; 42 static int conf_cnt;
42 static char line[128]; 43 static char line[128];
43 static struct menu *rootEntry; 44 static struct menu *rootEntry;
44 45
45 static void print_help(struct menu *menu) 46 static void print_help(struct menu *menu)
46 { 47 {
47 struct gstr help = str_new(); 48 struct gstr help = str_new();
48 49
49 menu_get_ext_help(menu, &help); 50 menu_get_ext_help(menu, &help);
50 51
51 printf("\n%s\n", str_get(&help)); 52 printf("\n%s\n", str_get(&help));
52 str_free(&help); 53 str_free(&help);
53 } 54 }
54 55
55 static void strip(char *str) 56 static void strip(char *str)
56 { 57 {
57 char *p = str; 58 char *p = str;
58 int l; 59 int l;
59 60
60 while ((isspace(*p))) 61 while ((isspace(*p)))
61 p++; 62 p++;
62 l = strlen(p); 63 l = strlen(p);
63 if (p != str) 64 if (p != str)
64 memmove(str, p, l + 1); 65 memmove(str, p, l + 1);
65 if (!l) 66 if (!l)
66 return; 67 return;
67 p = str + l - 1; 68 p = str + l - 1;
68 while ((isspace(*p))) 69 while ((isspace(*p)))
69 *p-- = 0; 70 *p-- = 0;
70 } 71 }
71 72
72 static void check_stdin(void) 73 static void check_stdin(void)
73 { 74 {
74 if (!valid_stdin) { 75 if (!valid_stdin) {
75 printf(_("aborted!\n\n")); 76 printf(_("aborted!\n\n"));
76 printf(_("Console input/output is redirected. ")); 77 printf(_("Console input/output is redirected. "));
77 printf(_("Run 'make oldconfig' to update configuration.\n\n")); 78 printf(_("Run 'make oldconfig' to update configuration.\n\n"));
78 exit(1); 79 exit(1);
79 } 80 }
80 } 81 }
81 82
82 static int conf_askvalue(struct symbol *sym, const char *def) 83 static int conf_askvalue(struct symbol *sym, const char *def)
83 { 84 {
84 enum symbol_type type = sym_get_type(sym); 85 enum symbol_type type = sym_get_type(sym);
85 86
86 if (!sym_has_value(sym)) 87 if (!sym_has_value(sym))
87 printf(_("(NEW) ")); 88 printf(_("(NEW) "));
88 89
89 line[0] = '\n'; 90 line[0] = '\n';
90 line[1] = 0; 91 line[1] = 0;
91 92
92 if (!sym_is_changable(sym)) { 93 if (!sym_is_changable(sym)) {
93 printf("%s\n", def); 94 printf("%s\n", def);
94 line[0] = '\n'; 95 line[0] = '\n';
95 line[1] = 0; 96 line[1] = 0;
96 return 0; 97 return 0;
97 } 98 }
98 99
99 switch (input_mode) { 100 switch (input_mode) {
100 case oldconfig: 101 case oldconfig:
101 case silentoldconfig: 102 case silentoldconfig:
102 if (sym_has_value(sym)) { 103 if (sym_has_value(sym)) {
103 printf("%s\n", def); 104 printf("%s\n", def);
104 return 0; 105 return 0;
105 } 106 }
106 check_stdin(); 107 check_stdin();
107 case oldaskconfig: 108 case oldaskconfig:
108 fflush(stdout); 109 fflush(stdout);
109 fgets(line, 128, stdin); 110 fgets(line, 128, stdin);
110 return 1; 111 return 1;
111 default: 112 default:
112 break; 113 break;
113 } 114 }
114 115
115 switch (type) { 116 switch (type) {
116 case S_INT: 117 case S_INT:
117 case S_HEX: 118 case S_HEX:
118 case S_STRING: 119 case S_STRING:
119 printf("%s\n", def); 120 printf("%s\n", def);
120 return 1; 121 return 1;
121 default: 122 default:
122 ; 123 ;
123 } 124 }
124 printf("%s", line); 125 printf("%s", line);
125 return 1; 126 return 1;
126 } 127 }
127 128
128 static int conf_string(struct menu *menu) 129 static int conf_string(struct menu *menu)
129 { 130 {
130 struct symbol *sym = menu->sym; 131 struct symbol *sym = menu->sym;
131 const char *def; 132 const char *def;
132 133
133 while (1) { 134 while (1) {
134 printf("%*s%s ", indent - 1, "", _(menu->prompt->text)); 135 printf("%*s%s ", indent - 1, "", _(menu->prompt->text));
135 printf("(%s) ", sym->name); 136 printf("(%s) ", sym->name);
136 def = sym_get_string_value(sym); 137 def = sym_get_string_value(sym);
137 if (sym_get_string_value(sym)) 138 if (sym_get_string_value(sym))
138 printf("[%s] ", def); 139 printf("[%s] ", def);
139 if (!conf_askvalue(sym, def)) 140 if (!conf_askvalue(sym, def))
140 return 0; 141 return 0;
141 switch (line[0]) { 142 switch (line[0]) {
142 case '\n': 143 case '\n':
143 break; 144 break;
144 case '?': 145 case '?':
145 /* print help */ 146 /* print help */
146 if (line[1] == '\n') { 147 if (line[1] == '\n') {
147 print_help(menu); 148 print_help(menu);
148 def = NULL; 149 def = NULL;
149 break; 150 break;
150 } 151 }
151 default: 152 default:
152 line[strlen(line)-1] = 0; 153 line[strlen(line)-1] = 0;
153 def = line; 154 def = line;
154 } 155 }
155 if (def && sym_set_string_value(sym, def)) 156 if (def && sym_set_string_value(sym, def))
156 return 0; 157 return 0;
157 } 158 }
158 } 159 }
159 160
160 static int conf_sym(struct menu *menu) 161 static int conf_sym(struct menu *menu)
161 { 162 {
162 struct symbol *sym = menu->sym; 163 struct symbol *sym = menu->sym;
163 tristate oldval, newval; 164 tristate oldval, newval;
164 165
165 while (1) { 166 while (1) {
166 printf("%*s%s ", indent - 1, "", _(menu->prompt->text)); 167 printf("%*s%s ", indent - 1, "", _(menu->prompt->text));
167 if (sym->name) 168 if (sym->name)
168 printf("(%s) ", sym->name); 169 printf("(%s) ", sym->name);
169 putchar('['); 170 putchar('[');
170 oldval = sym_get_tristate_value(sym); 171 oldval = sym_get_tristate_value(sym);
171 switch (oldval) { 172 switch (oldval) {
172 case no: 173 case no:
173 putchar('N'); 174 putchar('N');
174 break; 175 break;
175 case mod: 176 case mod:
176 putchar('M'); 177 putchar('M');
177 break; 178 break;
178 case yes: 179 case yes:
179 putchar('Y'); 180 putchar('Y');
180 break; 181 break;
181 } 182 }
182 if (oldval != no && sym_tristate_within_range(sym, no)) 183 if (oldval != no && sym_tristate_within_range(sym, no))
183 printf("/n"); 184 printf("/n");
184 if (oldval != mod && sym_tristate_within_range(sym, mod)) 185 if (oldval != mod && sym_tristate_within_range(sym, mod))
185 printf("/m"); 186 printf("/m");
186 if (oldval != yes && sym_tristate_within_range(sym, yes)) 187 if (oldval != yes && sym_tristate_within_range(sym, yes))
187 printf("/y"); 188 printf("/y");
188 if (menu_has_help(menu)) 189 if (menu_has_help(menu))
189 printf("/?"); 190 printf("/?");
190 printf("] "); 191 printf("] ");
191 if (!conf_askvalue(sym, sym_get_string_value(sym))) 192 if (!conf_askvalue(sym, sym_get_string_value(sym)))
192 return 0; 193 return 0;
193 strip(line); 194 strip(line);
194 195
195 switch (line[0]) { 196 switch (line[0]) {
196 case 'n': 197 case 'n':
197 case 'N': 198 case 'N':
198 newval = no; 199 newval = no;
199 if (!line[1] || !strcmp(&line[1], "o")) 200 if (!line[1] || !strcmp(&line[1], "o"))
200 break; 201 break;
201 continue; 202 continue;
202 case 'm': 203 case 'm':
203 case 'M': 204 case 'M':
204 newval = mod; 205 newval = mod;
205 if (!line[1]) 206 if (!line[1])
206 break; 207 break;
207 continue; 208 continue;
208 case 'y': 209 case 'y':
209 case 'Y': 210 case 'Y':
210 newval = yes; 211 newval = yes;
211 if (!line[1] || !strcmp(&line[1], "es")) 212 if (!line[1] || !strcmp(&line[1], "es"))
212 break; 213 break;
213 continue; 214 continue;
214 case 0: 215 case 0:
215 newval = oldval; 216 newval = oldval;
216 break; 217 break;
217 case '?': 218 case '?':
218 goto help; 219 goto help;
219 default: 220 default:
220 continue; 221 continue;
221 } 222 }
222 if (sym_set_tristate_value(sym, newval)) 223 if (sym_set_tristate_value(sym, newval))
223 return 0; 224 return 0;
224 help: 225 help:
225 print_help(menu); 226 print_help(menu);
226 } 227 }
227 } 228 }
228 229
229 static int conf_choice(struct menu *menu) 230 static int conf_choice(struct menu *menu)
230 { 231 {
231 struct symbol *sym, *def_sym; 232 struct symbol *sym, *def_sym;
232 struct menu *child; 233 struct menu *child;
233 bool is_new; 234 bool is_new;
234 235
235 sym = menu->sym; 236 sym = menu->sym;
236 is_new = !sym_has_value(sym); 237 is_new = !sym_has_value(sym);
237 if (sym_is_changable(sym)) { 238 if (sym_is_changable(sym)) {
238 conf_sym(menu); 239 conf_sym(menu);
239 sym_calc_value(sym); 240 sym_calc_value(sym);
240 switch (sym_get_tristate_value(sym)) { 241 switch (sym_get_tristate_value(sym)) {
241 case no: 242 case no:
242 return 1; 243 return 1;
243 case mod: 244 case mod:
244 return 0; 245 return 0;
245 case yes: 246 case yes:
246 break; 247 break;
247 } 248 }
248 } else { 249 } else {
249 switch (sym_get_tristate_value(sym)) { 250 switch (sym_get_tristate_value(sym)) {
250 case no: 251 case no:
251 return 1; 252 return 1;
252 case mod: 253 case mod:
253 printf("%*s%s\n", indent - 1, "", _(menu_get_prompt(menu))); 254 printf("%*s%s\n", indent - 1, "", _(menu_get_prompt(menu)));
254 return 0; 255 return 0;
255 case yes: 256 case yes:
256 break; 257 break;
257 } 258 }
258 } 259 }
259 260
260 while (1) { 261 while (1) {
261 int cnt, def; 262 int cnt, def;
262 263
263 printf("%*s%s\n", indent - 1, "", _(menu_get_prompt(menu))); 264 printf("%*s%s\n", indent - 1, "", _(menu_get_prompt(menu)));
264 def_sym = sym_get_choice_value(sym); 265 def_sym = sym_get_choice_value(sym);
265 cnt = def = 0; 266 cnt = def = 0;
266 line[0] = 0; 267 line[0] = 0;
267 for (child = menu->list; child; child = child->next) { 268 for (child = menu->list; child; child = child->next) {
268 if (!menu_is_visible(child)) 269 if (!menu_is_visible(child))
269 continue; 270 continue;
270 if (!child->sym) { 271 if (!child->sym) {
271 printf("%*c %s\n", indent, '*', _(menu_get_prompt(child))); 272 printf("%*c %s\n", indent, '*', _(menu_get_prompt(child)));
272 continue; 273 continue;
273 } 274 }
274 cnt++; 275 cnt++;
275 if (child->sym == def_sym) { 276 if (child->sym == def_sym) {
276 def = cnt; 277 def = cnt;
277 printf("%*c", indent, '>'); 278 printf("%*c", indent, '>');
278 } else 279 } else
279 printf("%*c", indent, ' '); 280 printf("%*c", indent, ' ');
280 printf(" %d. %s", cnt, _(menu_get_prompt(child))); 281 printf(" %d. %s", cnt, _(menu_get_prompt(child)));
281 if (child->sym->name) 282 if (child->sym->name)
282 printf(" (%s)", child->sym->name); 283 printf(" (%s)", child->sym->name);
283 if (!sym_has_value(child->sym)) 284 if (!sym_has_value(child->sym))
284 printf(_(" (NEW)")); 285 printf(_(" (NEW)"));
285 printf("\n"); 286 printf("\n");
286 } 287 }
287 printf(_("%*schoice"), indent - 1, ""); 288 printf(_("%*schoice"), indent - 1, "");
288 if (cnt == 1) { 289 if (cnt == 1) {
289 printf("[1]: 1\n"); 290 printf("[1]: 1\n");
290 goto conf_childs; 291 goto conf_childs;
291 } 292 }
292 printf("[1-%d", cnt); 293 printf("[1-%d", cnt);
293 if (menu_has_help(menu)) 294 if (menu_has_help(menu))
294 printf("?"); 295 printf("?");
295 printf("]: "); 296 printf("]: ");
296 switch (input_mode) { 297 switch (input_mode) {
297 case oldconfig: 298 case oldconfig:
298 case silentoldconfig: 299 case silentoldconfig:
299 if (!is_new) { 300 if (!is_new) {
300 cnt = def; 301 cnt = def;
301 printf("%d\n", cnt); 302 printf("%d\n", cnt);
302 break; 303 break;
303 } 304 }
304 check_stdin(); 305 check_stdin();
305 case oldaskconfig: 306 case oldaskconfig:
306 fflush(stdout); 307 fflush(stdout);
307 fgets(line, 128, stdin); 308 fgets(line, 128, stdin);
308 strip(line); 309 strip(line);
309 if (line[0] == '?') { 310 if (line[0] == '?') {
310 print_help(menu); 311 print_help(menu);
311 continue; 312 continue;
312 } 313 }
313 if (!line[0]) 314 if (!line[0])
314 cnt = def; 315 cnt = def;
315 else if (isdigit(line[0])) 316 else if (isdigit(line[0]))
316 cnt = atoi(line); 317 cnt = atoi(line);
317 else 318 else
318 continue; 319 continue;
319 break; 320 break;
320 default: 321 default:
321 break; 322 break;
322 } 323 }
323 324
324 conf_childs: 325 conf_childs:
325 for (child = menu->list; child; child = child->next) { 326 for (child = menu->list; child; child = child->next) {
326 if (!child->sym || !menu_is_visible(child)) 327 if (!child->sym || !menu_is_visible(child))
327 continue; 328 continue;
328 if (!--cnt) 329 if (!--cnt)
329 break; 330 break;
330 } 331 }
331 if (!child) 332 if (!child)
332 continue; 333 continue;
333 if (line[strlen(line) - 1] == '?') { 334 if (line[strlen(line) - 1] == '?') {
334 print_help(child); 335 print_help(child);
335 continue; 336 continue;
336 } 337 }
337 sym_set_choice_value(sym, child->sym); 338 sym_set_choice_value(sym, child->sym);
338 for (child = child->list; child; child = child->next) { 339 for (child = child->list; child; child = child->next) {
339 indent += 2; 340 indent += 2;
340 conf(child); 341 conf(child);
341 indent -= 2; 342 indent -= 2;
342 } 343 }
343 return 1; 344 return 1;
344 } 345 }
345 } 346 }
346 347
347 static void conf(struct menu *menu) 348 static void conf(struct menu *menu)
348 { 349 {
349 struct symbol *sym; 350 struct symbol *sym;
350 struct property *prop; 351 struct property *prop;
351 struct menu *child; 352 struct menu *child;
352 353
353 if (!menu_is_visible(menu)) 354 if (!menu_is_visible(menu))
354 return; 355 return;
355 356
356 sym = menu->sym; 357 sym = menu->sym;
357 prop = menu->prompt; 358 prop = menu->prompt;
358 if (prop) { 359 if (prop) {
359 const char *prompt; 360 const char *prompt;
360 361
361 switch (prop->type) { 362 switch (prop->type) {
362 case P_MENU: 363 case P_MENU:
363 if ((input_mode == silentoldconfig || 364 if ((input_mode == silentoldconfig ||
364 input_mode == listnewconfig || 365 input_mode == listnewconfig ||
365 input_mode == oldnoconfig) && 366 input_mode == oldnoconfig) &&
366 rootEntry != menu) { 367 rootEntry != menu) {
367 check_conf(menu); 368 check_conf(menu);
368 return; 369 return;
369 } 370 }
370 case P_COMMENT: 371 case P_COMMENT:
371 prompt = menu_get_prompt(menu); 372 prompt = menu_get_prompt(menu);
372 if (prompt) 373 if (prompt)
373 printf("%*c\n%*c %s\n%*c\n", 374 printf("%*c\n%*c %s\n%*c\n",
374 indent, '*', 375 indent, '*',
375 indent, '*', _(prompt), 376 indent, '*', _(prompt),
376 indent, '*'); 377 indent, '*');
377 default: 378 default:
378 ; 379 ;
379 } 380 }
380 } 381 }
381 382
382 if (!sym) 383 if (!sym)
383 goto conf_childs; 384 goto conf_childs;
384 385
385 if (sym_is_choice(sym)) { 386 if (sym_is_choice(sym)) {
386 conf_choice(menu); 387 conf_choice(menu);
387 if (sym->curr.tri != mod) 388 if (sym->curr.tri != mod)
388 return; 389 return;
389 goto conf_childs; 390 goto conf_childs;
390 } 391 }
391 392
392 switch (sym->type) { 393 switch (sym->type) {
393 case S_INT: 394 case S_INT:
394 case S_HEX: 395 case S_HEX:
395 case S_STRING: 396 case S_STRING:
396 conf_string(menu); 397 conf_string(menu);
397 break; 398 break;
398 default: 399 default:
399 conf_sym(menu); 400 conf_sym(menu);
400 break; 401 break;
401 } 402 }
402 403
403 conf_childs: 404 conf_childs:
404 if (sym) 405 if (sym)
405 indent += 2; 406 indent += 2;
406 for (child = menu->list; child; child = child->next) 407 for (child = menu->list; child; child = child->next)
407 conf(child); 408 conf(child);
408 if (sym) 409 if (sym)
409 indent -= 2; 410 indent -= 2;
410 } 411 }
411 412
412 static void check_conf(struct menu *menu) 413 static void check_conf(struct menu *menu)
413 { 414 {
414 struct symbol *sym; 415 struct symbol *sym;
415 struct menu *child; 416 struct menu *child;
416 417
417 if (!menu_is_visible(menu)) 418 if (!menu_is_visible(menu))
418 return; 419 return;
419 420
420 sym = menu->sym; 421 sym = menu->sym;
421 if (sym && !sym_has_value(sym)) { 422 if (sym && !sym_has_value(sym)) {
422 if (sym_is_changable(sym) || 423 if (sym_is_changable(sym) ||
423 (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) { 424 (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) {
424 if (input_mode == listnewconfig) { 425 if (input_mode == listnewconfig) {
425 if (sym->name && !sym_is_choice_value(sym)) { 426 if (sym->name && !sym_is_choice_value(sym)) {
426 printf("CONFIG_%s\n", sym->name); 427 printf("CONFIG_%s\n", sym->name);
427 } 428 }
428 } else { 429 } else {
429 if (!conf_cnt++) 430 if (!conf_cnt++)
430 printf(_("*\n* Restart config...\n*\n")); 431 printf(_("*\n* Restart config...\n*\n"));
431 rootEntry = menu_get_parent_menu(menu); 432 rootEntry = menu_get_parent_menu(menu);
432 conf(rootEntry); 433 conf(rootEntry);
433 } 434 }
434 } 435 }
435 } 436 }
436 437
437 for (child = menu->list; child; child = child->next) 438 for (child = menu->list; child; child = child->next)
438 check_conf(child); 439 check_conf(child);
439 } 440 }
440 441
441 static struct option long_opts[] = { 442 static struct option long_opts[] = {
442 {"oldaskconfig", no_argument, NULL, oldaskconfig}, 443 {"oldaskconfig", no_argument, NULL, oldaskconfig},
443 {"oldconfig", no_argument, NULL, oldconfig}, 444 {"oldconfig", no_argument, NULL, oldconfig},
444 {"silentoldconfig", no_argument, NULL, silentoldconfig}, 445 {"silentoldconfig", no_argument, NULL, silentoldconfig},
445 {"defconfig", optional_argument, NULL, defconfig}, 446 {"defconfig", optional_argument, NULL, defconfig},
446 {"allnoconfig", no_argument, NULL, allnoconfig}, 447 {"allnoconfig", no_argument, NULL, allnoconfig},
447 {"allyesconfig", no_argument, NULL, allyesconfig}, 448 {"allyesconfig", no_argument, NULL, allyesconfig},
448 {"allmodconfig", no_argument, NULL, allmodconfig}, 449 {"allmodconfig", no_argument, NULL, allmodconfig},
450 {"alldefconfig", no_argument, NULL, alldefconfig},
449 {"randconfig", no_argument, NULL, randconfig}, 451 {"randconfig", no_argument, NULL, randconfig},
450 {"listnewconfig", no_argument, NULL, listnewconfig}, 452 {"listnewconfig", no_argument, NULL, listnewconfig},
451 {"oldnoconfig", no_argument, NULL, oldnoconfig}, 453 {"oldnoconfig", no_argument, NULL, oldnoconfig},
452 {NULL, 0, NULL, 0} 454 {NULL, 0, NULL, 0}
453 }; 455 };
454 456
455 int main(int ac, char **av) 457 int main(int ac, char **av)
456 { 458 {
457 int opt; 459 int opt;
458 const char *name; 460 const char *name;
459 struct stat tmpstat; 461 struct stat tmpstat;
460 462
461 setlocale(LC_ALL, ""); 463 setlocale(LC_ALL, "");
462 bindtextdomain(PACKAGE, LOCALEDIR); 464 bindtextdomain(PACKAGE, LOCALEDIR);
463 textdomain(PACKAGE); 465 textdomain(PACKAGE);
464 466
465 while ((opt = getopt_long_only(ac, av, "", long_opts, NULL)) != -1) { 467 while ((opt = getopt_long_only(ac, av, "", long_opts, NULL)) != -1) {
466 input_mode = (enum input_mode)opt; 468 input_mode = (enum input_mode)opt;
467 switch (opt) { 469 switch (opt) {
468 case silentoldconfig: 470 case silentoldconfig:
469 sync_kconfig = 1; 471 sync_kconfig = 1;
470 break; 472 break;
471 case defconfig: 473 case defconfig:
472 defconfig_file = optarg; 474 defconfig_file = optarg;
473 break; 475 break;
474 case randconfig: 476 case randconfig:
475 { 477 {
476 struct timeval now; 478 struct timeval now;
477 unsigned int seed; 479 unsigned int seed;
478 480
479 /* 481 /*
480 * Use microseconds derived seed, 482 * Use microseconds derived seed,
481 * compensate for systems where it may be zero 483 * compensate for systems where it may be zero
482 */ 484 */
483 gettimeofday(&now, NULL); 485 gettimeofday(&now, NULL);
484 486
485 seed = (unsigned int)((now.tv_sec + 1) * (now.tv_usec + 1)); 487 seed = (unsigned int)((now.tv_sec + 1) * (now.tv_usec + 1));
486 srand(seed); 488 srand(seed);
487 break; 489 break;
488 } 490 }
489 case '?': 491 case '?':
490 fprintf(stderr, _("See README for usage info\n")); 492 fprintf(stderr, _("See README for usage info\n"));
491 exit(1); 493 exit(1);
492 break; 494 break;
493 } 495 }
494 } 496 }
495 if (ac == optind) { 497 if (ac == optind) {
496 printf(_("%s: Kconfig file missing\n"), av[0]); 498 printf(_("%s: Kconfig file missing\n"), av[0]);
497 exit(1); 499 exit(1);
498 } 500 }
499 name = av[optind]; 501 name = av[optind];
500 conf_parse(name); 502 conf_parse(name);
501 //zconfdump(stdout); 503 //zconfdump(stdout);
502 if (sync_kconfig) { 504 if (sync_kconfig) {
503 name = conf_get_configname(); 505 name = conf_get_configname();
504 if (stat(name, &tmpstat)) { 506 if (stat(name, &tmpstat)) {
505 fprintf(stderr, _("***\n" 507 fprintf(stderr, _("***\n"
506 "*** You have not yet configured your kernel!\n" 508 "*** You have not yet configured your kernel!\n"
507 "*** (missing kernel config file \"%s\")\n" 509 "*** (missing kernel config file \"%s\")\n"
508 "***\n" 510 "***\n"
509 "*** Please run some configurator (e.g. \"make oldconfig\" or\n" 511 "*** Please run some configurator (e.g. \"make oldconfig\" or\n"
510 "*** \"make menuconfig\" or \"make xconfig\").\n" 512 "*** \"make menuconfig\" or \"make xconfig\").\n"
511 "***\n"), name); 513 "***\n"), name);
512 exit(1); 514 exit(1);
513 } 515 }
514 } 516 }
515 517
516 switch (input_mode) { 518 switch (input_mode) {
517 case defconfig: 519 case defconfig:
518 if (!defconfig_file) 520 if (!defconfig_file)
519 defconfig_file = conf_get_default_confname(); 521 defconfig_file = conf_get_default_confname();
520 if (conf_read(defconfig_file)) { 522 if (conf_read(defconfig_file)) {
521 printf(_("***\n" 523 printf(_("***\n"
522 "*** Can't find default configuration \"%s\"!\n" 524 "*** Can't find default configuration \"%s\"!\n"
523 "***\n"), defconfig_file); 525 "***\n"), defconfig_file);
524 exit(1); 526 exit(1);
525 } 527 }
526 break; 528 break;
527 case silentoldconfig: 529 case silentoldconfig:
528 case oldaskconfig: 530 case oldaskconfig:
529 case oldconfig: 531 case oldconfig:
530 case listnewconfig: 532 case listnewconfig:
531 case oldnoconfig: 533 case oldnoconfig:
532 conf_read(NULL); 534 conf_read(NULL);
533 break; 535 break;
534 case allnoconfig: 536 case allnoconfig:
535 case allyesconfig: 537 case allyesconfig:
536 case allmodconfig: 538 case allmodconfig:
539 case alldefconfig:
537 case randconfig: 540 case randconfig:
538 name = getenv("KCONFIG_ALLCONFIG"); 541 name = getenv("KCONFIG_ALLCONFIG");
539 if (name && !stat(name, &tmpstat)) { 542 if (name && !stat(name, &tmpstat)) {
540 conf_read_simple(name, S_DEF_USER); 543 conf_read_simple(name, S_DEF_USER);
541 break; 544 break;
542 } 545 }
543 switch (input_mode) { 546 switch (input_mode) {
544 case allnoconfig: name = "allno.config"; break; 547 case allnoconfig: name = "allno.config"; break;
545 case allyesconfig: name = "allyes.config"; break; 548 case allyesconfig: name = "allyes.config"; break;
546 case allmodconfig: name = "allmod.config"; break; 549 case allmodconfig: name = "allmod.config"; break;
550 case alldefconfig: name = "alldef.config"; break;
547 case randconfig: name = "allrandom.config"; break; 551 case randconfig: name = "allrandom.config"; break;
548 default: break; 552 default: break;
549 } 553 }
550 if (!stat(name, &tmpstat)) 554 if (!stat(name, &tmpstat))
551 conf_read_simple(name, S_DEF_USER); 555 conf_read_simple(name, S_DEF_USER);
552 else if (!stat("all.config", &tmpstat)) 556 else if (!stat("all.config", &tmpstat))
553 conf_read_simple("all.config", S_DEF_USER); 557 conf_read_simple("all.config", S_DEF_USER);
554 break; 558 break;
555 default: 559 default:
556 break; 560 break;
557 } 561 }
558 562
559 if (sync_kconfig) { 563 if (sync_kconfig) {
560 if (conf_get_changed()) { 564 if (conf_get_changed()) {
561 name = getenv("KCONFIG_NOSILENTUPDATE"); 565 name = getenv("KCONFIG_NOSILENTUPDATE");
562 if (name && *name) { 566 if (name && *name) {
563 fprintf(stderr, 567 fprintf(stderr,
564 _("\n*** Kernel configuration requires explicit update.\n\n")); 568 _("\n*** Kernel configuration requires explicit update.\n\n"));
565 return 1; 569 return 1;
566 } 570 }
567 } 571 }
568 valid_stdin = isatty(0) && isatty(1) && isatty(2); 572 valid_stdin = isatty(0) && isatty(1) && isatty(2);
569 } 573 }
570 574
571 switch (input_mode) { 575 switch (input_mode) {
572 case allnoconfig: 576 case allnoconfig:
573 conf_set_all_new_symbols(def_no); 577 conf_set_all_new_symbols(def_no);
574 break; 578 break;
575 case allyesconfig: 579 case allyesconfig:
576 conf_set_all_new_symbols(def_yes); 580 conf_set_all_new_symbols(def_yes);
577 break; 581 break;
578 case allmodconfig: 582 case allmodconfig:
579 conf_set_all_new_symbols(def_mod); 583 conf_set_all_new_symbols(def_mod);
584 break;
585 case alldefconfig:
586 conf_set_all_new_symbols(def_default);
580 break; 587 break;
581 case randconfig: 588 case randconfig:
582 conf_set_all_new_symbols(def_random); 589 conf_set_all_new_symbols(def_random);
583 break; 590 break;
584 case defconfig: 591 case defconfig:
585 conf_set_all_new_symbols(def_default); 592 conf_set_all_new_symbols(def_default);
586 break; 593 break;
587 case oldconfig: 594 case oldconfig:
588 case oldaskconfig: 595 case oldaskconfig:
589 rootEntry = &rootmenu; 596 rootEntry = &rootmenu;
590 conf(&rootmenu); 597 conf(&rootmenu);
591 input_mode = silentoldconfig; 598 input_mode = silentoldconfig;
592 /* fall through */ 599 /* fall through */
593 case listnewconfig: 600 case listnewconfig:
594 case oldnoconfig: 601 case oldnoconfig:
595 case silentoldconfig: 602 case silentoldconfig:
596 /* Update until a loop caused no more changes */ 603 /* Update until a loop caused no more changes */
597 do { 604 do {
598 conf_cnt = 0; 605 conf_cnt = 0;
599 check_conf(&rootmenu); 606 check_conf(&rootmenu);
600 } while (conf_cnt && 607 } while (conf_cnt &&
601 (input_mode != listnewconfig && 608 (input_mode != listnewconfig &&
602 input_mode != oldnoconfig)); 609 input_mode != oldnoconfig));
603 break; 610 break;
604 } 611 }
605 612
606 if (sync_kconfig) { 613 if (sync_kconfig) {
607 /* silentoldconfig is used during the build so we shall update autoconf. 614 /* silentoldconfig is used during the build so we shall update autoconf.
608 * All other commands are only used to generate a config. 615 * All other commands are only used to generate a config.
609 */ 616 */
610 if (conf_get_changed() && conf_write(NULL)) { 617 if (conf_get_changed() && conf_write(NULL)) {
611 fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); 618 fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
612 exit(1); 619 exit(1);
613 } 620 }
614 if (conf_write_autoconf()) { 621 if (conf_write_autoconf()) {
615 fprintf(stderr, _("\n*** Error during update of the kernel configuration.\n\n")); 622 fprintf(stderr, _("\n*** Error during update of the kernel configuration.\n\n"));
616 return 1; 623 return 1;
617 } 624 }
618 } else if (input_mode != listnewconfig) { 625 } else if (input_mode != listnewconfig) {
619 if (conf_write(NULL)) { 626 if (conf_write(NULL)) {
620 fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); 627 fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
621 exit(1); 628 exit(1);
622 } 629 }
623 } 630 }
624 return 0; 631 return 0;
625 } 632 }
626 633