ALL-y += u-boot.srec u-boot.bin System.map binary_size_check
u-boot.srec: u-boot FORCE
$(call if_changed,objcopy)
u-boot.bin: u-boot FORCE
$(call if_changed,objcopy)
$(call DO_STATIC_RELA,$<,$@,$(CONFIG_SYS_TEXT_BASE))
$(BOARD_SIZE_CHECK)
System.map: u-boot
@$(call SYSTEM_MAP,$<) > $@
@file_size=$(shell wc -c u-boot.bin | awk ‘{print $$1}‘) ; \
map_size=$(shell cat u-boot.map | \
awk ‘/_image_copy_start/ {start = $$1} /_image_binary_end/ {end = $$1} END {if (start != "" && end != "") print "ibase=16; " toupper(end) " - " toupper(start)}‘ \
| sed ‘s/0X//g‘ \
| bc); \
if [ "" != "$$map_size" ]; then \
if test $$map_size -ne $$file_size; then \
echo "u-boot.map shows a binary size of $$map_size" >&2 ; \
echo " but u-boot.bin shows $$file_size" >&2 ; \
exit 1; \
fi \
fi
u-boot:$(u-boot-init) $(u-boot-main) u-boot.lds
$(call if_changed,u-boot__)
u-boot-init := $(head-y)
head-y := $(CPUDIR)/start.o
u-boot-main := $(libs-y)
libs-y += lib/
libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/
libs-y += $(CPUDIR)/
ifdef SOC
libs-y += $(CPUDIR)/$(SOC)/
endif
libs-y += arch/$(ARCH)/lib/
include$(srctree)/config.mk
u-boot.lds: $(LDSCRIPT) prepare FORCE
$(call if_changed_dep,cpp_lds)
514 # If there is no specified link script, we look in a number of places for it
515 ifndef LDSCRIPT
516 ifeq ($(wildcard $(LDSCRIPT)),)
517 LDSCRIPT := $(srctree)/board/$(BOARDDIR)/u-boot.lds
518 endif
519 ifeq ($(wildcard $(LDSCRIPT)),)
520 LDSCRIPT := $(srctree)/$(CPUDIR)/u-boot.lds
521 endif
522 ifeq ($(wildcard $(LDSCRIPT)),)
523 LDSCRIPT := $(srctree)/arch/$(ARCH)/cpu/u-boot.lds
524 endif
525 endif
prepare:prepare0
prepare0: archprepare FORCE
$(Q)$(MAKE)$(build)=.
archprepare: prepare1 scripts_basic
$(version_h): include/config/uboot.release FORCE
$(call filechk,version.h)
version_h:= include/generated/version_autogenerated.h
$(timestamp_h): $(srctree)/Makefile FORCE
$(call filechk,timestamp.h)
timestamp_h := include/generated/timestamp_autogenerated.h
prepare2: prepare3 outputmakefile
prepare3: include/config/uboot.release
include/config/%.conf:$(KCONFIG_CONFIG) include/config/auto.conf.cmd
$(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig
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
原文:http://www.cnblogs.com/humaoxiao/p/4189411.html