-include include/config/auto.conf
-include include/config/auto.conf.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
ifeq
(
$(dot-config)
,1)
# Read in config
-
include
include
/config/auto
.conf
ifeq
(
$(KBUILD_EXTMOD)
,)
# Read in dependencies to all Kconfig* files, make sure to run
# oldconfig if changes are detected.
-
include
include
/config/auto
.conf.cmd
# To avoid any implicit rule to kick in, define an empty command
$(KCONFIG_CONFIG)
include
/config/auto
.conf.cmd: ;
# If .config is newer than include/config/auto.conf, someone tinkered
# with it and forgot to run make oldconfig.
# if auto.conf.cmd is missing then we are probably in a cleaned tree so
# we execute the config step to be sure to catch updated Kconfig files
include
/config/
%.conf:
$(KCONFIG_CONFIG)
include
/config/auto
.conf.cmd
$(Q)
$(MAKE)
-f
$(srctree)
/Makefile
silentoldconfig
|
引用-include include/config/auto.conf
-include include/config/auto.conf.cmd
1
2
3
|
%config: scripts_basic outputmakefile FORCE
$(Q)
mkdir
-p
include
/linux
include
/config
$(Q)
$(MAKE)
$(build)
=scripts
/kconfig
$@
|
1
2
3
|
silentoldconfig:
$(obj)
/conf
$(Q)
mkdir
-p
include
/generated
$< -s
$(Kconfig)
|
1
2
3
4
5
6
7
8
9
10
|
while
((opt = getopt(ac, av,
"osdD:nmyrh"
)) != -1) {
switch
(opt) {
case
'o'
:
input_mode = ask_silent;
break
;
case
's'
:
input_mode = ask_silent;
sync_kconfig = 1;
break
;
... ...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
if
(sync_kconfig) {
name = conf_get_configname();
if
(stat(name, &tmpstat)) {
fprintf
(stderr, _(
"***\n"
"*** You have not yet configured your kernel!\n"
"*** (missing kernel config file \"%s\")\n"
"***\n"
"*** Please run some configurator (e.g. \"make oldconfig\" or\n"
"*** \"make menuconfig\" or \"make xconfig\").\n"
"***\n"
), name);
exit
(1);
}
}
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
switch
(input_mode) {
case
set_default:
if
(!defconfig_file)
defconfig_file = conf_get_default_confname();
if
(conf_read(defconfig_file)) {
printf
(_(
"***\n"
"*** Can't find default configuration \"%s\"!\n"
"***\n"
), defconfig_file);
exit
(1);
}
break
;
case
ask_silent:
case
ask_all:
case
ask_new:
conf_read(NULL);
break
;
... ...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
if
(sync_kconfig) {
/* silentoldconfig is used during the build so we shall update autoconf.
* All other commands are only used to generate a config.
*/
if
(conf_get_changed() && conf_write(NULL)) {
fprintf
(stderr, _(
"\n*** Error during writing of the kernel configuration.\n\n"
));
exit
(1);
}
if
(conf_write_autoconf()) {
fprintf
(stderr, _(
"\n*** Error during update of the kernel configuration.\n\n"
));
return
1;
}
}
else
{
if
(conf_write(NULL)) {
fprintf
(stderr, _(
"\n*** Error during writing of the kernel configuration.\n\n"
));
exit
(1);
}
}
|
1
2
|
include
/config/auto
.conf: \
$(deps_config)
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
out =
fopen
(
".tmpconfig"
,
"w"
);
if
(!out)
return
1;
tristate =
fopen
(
".tmpconfig_tristate"
,
"w"
);
if
(!tristate) {
fclose
(out);
return
1;
}
out_h =
fopen
(
".tmpconfig.h"
,
"w"
);
if
(!out_h) {
fclose
(out);
fclose
(tristate);
return
1;
}
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
sym = sym_lookup(
"KERNELVERSION"
, 0);
sym_calc_value(sym);
time
(&now);
fprintf
(out,
"#\n"
"# Automatically generated make config: don't edit\n"
"# Linux kernel version: %s\n"
"# %s"
"#\n"
,
sym_get_string_value(sym),
ctime
(&now));
fprintf
(tristate,
"#\n"
"# Automatically generated - do not edit\n"
"\n"
);
fprintf
(out_h,
"/*\n"
" * Automatically generated C config: don't edit\n"
" * Linux kernel version: %s\n"
" * %s"
" */\n"
"#define AUTOCONF_INCLUDED\n"
,
sym_get_string_value(sym),
ctime
(&now));
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
name =
getenv
(
"KCONFIG_AUTOHEADER"
);
if
(!name)
name =
"include/generated/autoconf.h"
;
if
(
rename
(
".tmpconfig.h"
, name))
return
1;
name =
getenv
(
"KCONFIG_TRISTATE"
);
if
(!name)
name =
"include/config/tristate.conf"
;
if
(
rename
(
".tmpconfig_tristate"
, name))
return
1;
name = conf_get_autoconfig_name();
/*
* This must be the last step, kbuild has a dependency on auto.conf
* and this marks the successful completion of the previous steps.
*/
if
(
rename
(
".tmpconfig"
, name))
return
1;
|
1
2
3
4
5
6
|
const
char
*conf_get_autoconfig_name(
void
)
{
char
*name =
getenv
(
"KCONFIG_AUTOCONFIG"
);
return
name ? name :
"include/config/auto.conf"
;
}
|
引用include/generated/autoconf.h
include/config/tristate.conf
include/config/auto.conf