2011-07-18 07:48:07 +00:00
|
|
|
#
|
|
|
|
# (C) Copyright 2000-2011
|
|
|
|
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
|
|
|
#
|
|
|
|
# (C) Copyright 2011
|
|
|
|
# Daniel Schwierzeck, daniel.schwierzeck@googlemail.com.
|
|
|
|
#
|
|
|
|
# (C) Copyright 2011
|
|
|
|
# Texas Instruments Incorporated - http://www.ti.com/
|
|
|
|
# Aneesh V <aneesh@ti.com>
|
|
|
|
#
|
2013-07-08 07:37:19 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0+
|
2011-07-18 07:48:07 +00:00
|
|
|
#
|
|
|
|
# Based on top-level Makefile.
|
|
|
|
#
|
|
|
|
|
2014-02-04 08:24:24 +00:00
|
|
|
src := $(obj)
|
|
|
|
|
|
|
|
# Create output directory if not already present
|
|
|
|
_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
|
|
|
|
|
2014-02-04 08:24:18 +00:00
|
|
|
include $(srctree)/scripts/Kbuild.include
|
|
|
|
|
kconfig: switch to single .config configuration
When Kconfig for U-boot was examined, one of the biggest issues was
how to support multiple images (Normal, SPL, TPL). There were
actually two options, "single .config" and "multiple .config".
After some discussions and thought experiments, I chose the latter,
i.e. to create ".config", "spl/.config", "tpl/.config" for Normal,
SPL, TPL, respectively.
It is true that the "multiple .config" strategy provided us the
maximum flexibility and helped to avoid duplicating CONFIGs among
Normal, SPL, TPL, but I have noticed some fatal problems:
[1] It is impossible to share CONFIG options across the images.
If you change the configuration of Main image, you often have to
adjust some SPL configurations correspondingly. Currently, we
cannot handle the dependencies between them. It means one of the
biggest advantages of Kconfig is lost.
[2] It is too painful to change both ".config" and "spl/.config".
Sunxi guys started to work around this problem by creating a new
configuration target. Commit cbdd9a9737cc (sunxi: kconfig: Add
%_felconfig rule to enable FEL build of sunxi platforms.) added
"make *_felconfig" to enable CONFIG_SPL_FEL on both images.
Changing the configuration of multiple images in one command is a
generic demand. The current implementation cannot propose any
good solution about this.
[3] Kconfig files are getting ugly and difficult to understand.
Commit b724bd7d6349 (dm: Kconfig: Move CONFIG_SYS_MALLOC_F_LEN to
Kconfig) has sprinkled "if !SPL_BUILD" over the Kconfig files.
[4] The build system got more complicated than it should be.
To adjust Linux-originated Kconfig to U-Boot, the helper script
"scripts/multiconfig.sh" was introduced. Writing a complicated
text processor is a shell script sometimes caused problems.
Now I believe the "single .config" will serve us better. With it,
all the problems above would go away. Instead, we will have to add
some CONFIG_SPL_* (and CONFIG_TPL_*) options such as CONFIG_SPL_DM,
but we will not have much. Anyway, this is what we do now in
scripts/Makefile.spl.
I admit my mistake with my apology and this commit switches to the
single .config configuration.
It is not so difficult to do that:
- Remove unnecessary processings from scripts/multiconfig.sh
This file will remain for a while to support the current defconfig
format. It will be removed after more cleanups are done.
- Adjust some makefiles and Kconfigs
- Add some entries to include/config_uncmd_spl.h and the new file
scripts/Makefile.uncmd_spl. Some CONFIG options that are not
supported on SPL must be disabled because one .config is shared
between SPL and U-Boot proper going forward. I know this is not
a beautiful solution and I think we can do better, but let's see
how much we will have to describe them.
- update doc/README.kconfig
More cleaning up patches will follow this.
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2015-02-24 13:26:20 +00:00
|
|
|
-include include/config/auto.conf
|
kconfig: switch to Kconfig
This commit enables Kconfig.
Going forward, we use Kconfig for the board configuration.
mkconfig will never be used. Nor will include/config.mk be generated.
Kconfig must be adjusted for U-Boot because our situation is
a little more complicated than Linux Kernel.
We have to generate multiple boot images (Normal, SPL, TPL)
from one source tree.
Each image needs its own configuration input.
Usage:
Run "make <board>_defconfig" to do the board configuration.
It will create the .config file and additionally spl/.config, tpl/.config
if SPL, TPL is enabled, respectively.
You can use "make config", "make menuconfig" etc. to create
a new .config or modify the existing one.
Use "make spl/config", "make spl/menuconfig" etc. for spl/.config
and do likewise for tpl/.config file.
The generic syntax of configuration targets for SPL, TPL is:
<target_image>/<config_command>
Here, <target_image> is either 'spl' or 'tpl'
<config_command> is 'config', 'menuconfig', 'xconfig', etc.
When the configuration is done, run "make".
(Or "make <board>_defconfig all" will do the configuration and build
in one time.)
For futher information of how Kconfig works in U-Boot,
please read the comment block of scripts/multiconfig.py.
By the way, there is another item worth remarking here:
coexistence of Kconfig and board herder files.
Prior to Kconfig, we used C headers to define a set of configs.
We expect a very long term to migrate from C headers to Kconfig.
Two different infractructure must coexist in the interim.
In our former configuration scheme, include/autoconf.mk was generated
for use in makefiles.
It is still generated under include/, spl/include/, tpl/include/ directory
for the Normal, SPL, TPL image, respectively.
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
2014-07-30 05:08:17 +00:00
|
|
|
-include $(obj)/include/autoconf.mk
|
2014-02-04 08:24:22 +00:00
|
|
|
|
kconfig: switch to single .config configuration
When Kconfig for U-boot was examined, one of the biggest issues was
how to support multiple images (Normal, SPL, TPL). There were
actually two options, "single .config" and "multiple .config".
After some discussions and thought experiments, I chose the latter,
i.e. to create ".config", "spl/.config", "tpl/.config" for Normal,
SPL, TPL, respectively.
It is true that the "multiple .config" strategy provided us the
maximum flexibility and helped to avoid duplicating CONFIGs among
Normal, SPL, TPL, but I have noticed some fatal problems:
[1] It is impossible to share CONFIG options across the images.
If you change the configuration of Main image, you often have to
adjust some SPL configurations correspondingly. Currently, we
cannot handle the dependencies between them. It means one of the
biggest advantages of Kconfig is lost.
[2] It is too painful to change both ".config" and "spl/.config".
Sunxi guys started to work around this problem by creating a new
configuration target. Commit cbdd9a9737cc (sunxi: kconfig: Add
%_felconfig rule to enable FEL build of sunxi platforms.) added
"make *_felconfig" to enable CONFIG_SPL_FEL on both images.
Changing the configuration of multiple images in one command is a
generic demand. The current implementation cannot propose any
good solution about this.
[3] Kconfig files are getting ugly and difficult to understand.
Commit b724bd7d6349 (dm: Kconfig: Move CONFIG_SYS_MALLOC_F_LEN to
Kconfig) has sprinkled "if !SPL_BUILD" over the Kconfig files.
[4] The build system got more complicated than it should be.
To adjust Linux-originated Kconfig to U-Boot, the helper script
"scripts/multiconfig.sh" was introduced. Writing a complicated
text processor is a shell script sometimes caused problems.
Now I believe the "single .config" will serve us better. With it,
all the problems above would go away. Instead, we will have to add
some CONFIG_SPL_* (and CONFIG_TPL_*) options such as CONFIG_SPL_DM,
but we will not have much. Anyway, this is what we do now in
scripts/Makefile.spl.
I admit my mistake with my apology and this commit switches to the
single .config configuration.
It is not so difficult to do that:
- Remove unnecessary processings from scripts/multiconfig.sh
This file will remain for a while to support the current defconfig
format. It will be removed after more cleanups are done.
- Adjust some makefiles and Kconfigs
- Add some entries to include/config_uncmd_spl.h and the new file
scripts/Makefile.uncmd_spl. Some CONFIG options that are not
supported on SPL must be disabled because one .config is shared
between SPL and U-Boot proper going forward. I know this is not
a beautiful solution and I think we can do better, but let's see
how much we will have to describe them.
- update doc/README.kconfig
More cleaning up patches will follow this.
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2015-02-24 13:26:20 +00:00
|
|
|
KBUILD_CPPFLAGS += -DCONFIG_SPL_BUILD
|
|
|
|
ifeq ($(CONFIG_TPL_BUILD),y)
|
|
|
|
KBUILD_CPPFLAGS += -DCONFIG_TPL_BUILD
|
|
|
|
endif
|
|
|
|
|
2013-08-16 07:16:15 +00:00
|
|
|
ifeq ($(CONFIG_TPL_BUILD),y)
|
|
|
|
SPL_BIN := u-boot-tpl
|
|
|
|
else
|
|
|
|
SPL_BIN := u-boot-spl
|
|
|
|
endif
|
|
|
|
|
2014-03-11 02:05:19 +00:00
|
|
|
include $(srctree)/config.mk
|
2014-11-21 22:51:33 +00:00
|
|
|
include $(srctree)/arch/$(ARCH)/Makefile
|
2011-07-18 07:48:07 +00:00
|
|
|
|
2014-03-05 07:59:40 +00:00
|
|
|
# Enable garbage collection of un-used sections for SPL
|
|
|
|
KBUILD_CFLAGS += -ffunction-sections -fdata-sections
|
|
|
|
LDFLAGS_FINAL += --gc-sections
|
|
|
|
|
2014-02-04 08:24:33 +00:00
|
|
|
# FIX ME
|
2014-03-05 07:59:40 +00:00
|
|
|
cpp_flags := $(KBUILD_CPPFLAGS) $(PLATFORM_CPPFLAGS) $(UBOOTINCLUDE) \
|
|
|
|
$(NOSTDINC_FLAGS)
|
2014-02-04 08:24:33 +00:00
|
|
|
|
2014-03-11 02:05:20 +00:00
|
|
|
HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makefile),y,n)
|
2011-07-18 07:48:07 +00:00
|
|
|
|
2014-04-25 12:54:31 +00:00
|
|
|
libs-y += $(if $(BOARDDIR),board/$(BOARDDIR)/)
|
2014-02-04 08:24:37 +00:00
|
|
|
libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/
|
|
|
|
|
|
|
|
libs-$(CONFIG_SPL_FRAMEWORK) += common/spl/
|
2015-10-19 12:49:56 +00:00
|
|
|
libs-y += common/init/
|
2014-02-04 08:24:37 +00:00
|
|
|
libs-$(CONFIG_SPL_LIBCOMMON_SUPPORT) += common/
|
|
|
|
libs-$(CONFIG_SPL_LIBDISK_SUPPORT) += disk/
|
2015-08-11 22:31:44 +00:00
|
|
|
libs-y += drivers/
|
2015-11-09 09:45:07 +00:00
|
|
|
libs-y += dts/
|
2014-02-04 08:24:37 +00:00
|
|
|
libs-y += fs/
|
|
|
|
libs-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/
|
|
|
|
libs-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/
|
|
|
|
libs-$(CONFIG_SPL_NET_SUPPORT) += net/
|
2011-07-13 05:11:08 +00:00
|
|
|
|
2014-02-04 08:24:37 +00:00
|
|
|
head-y := $(addprefix $(obj)/,$(head-y))
|
|
|
|
libs-y := $(addprefix $(obj)/,$(libs-y))
|
|
|
|
u-boot-spl-dirs := $(patsubst %/,%,$(filter %/, $(libs-y)))
|
|
|
|
|
|
|
|
libs-y := $(patsubst %/, %/built-in.o, $(libs-y))
|
2013-11-11 05:36:00 +00:00
|
|
|
|
2012-08-31 08:30:14 +00:00
|
|
|
# Add GCC lib
|
2014-03-05 07:59:38 +00:00
|
|
|
ifeq ($(CONFIG_USE_PRIVATE_LIBGCC),y)
|
2014-02-27 13:40:34 +00:00
|
|
|
PLATFORM_LIBGCC = arch/$(ARCH)/lib/lib.a
|
2014-02-24 11:44:14 +00:00
|
|
|
PLATFORM_LIBS := $(filter-out %/lib.a, $(filter-out -lgcc, $(PLATFORM_LIBS))) $(PLATFORM_LIBGCC)
|
2012-08-31 08:30:14 +00:00
|
|
|
endif
|
|
|
|
|
2014-02-04 08:24:37 +00:00
|
|
|
u-boot-spl-init := $(head-y)
|
|
|
|
u-boot-spl-main := $(libs-y)
|
2011-07-18 07:48:07 +00:00
|
|
|
|
|
|
|
# Linker Script
|
|
|
|
ifdef CONFIG_SPL_LDSCRIPT
|
|
|
|
# need to strip off double quotes
|
2014-03-11 02:05:20 +00:00
|
|
|
LDSCRIPT := $(addprefix $(srctree)/,$(CONFIG_SPL_LDSCRIPT:"%"=%))
|
2011-07-18 07:48:07 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(wildcard $(LDSCRIPT)),)
|
2014-03-11 02:05:19 +00:00
|
|
|
LDSCRIPT := $(srctree)/board/$(BOARDDIR)/u-boot-spl.lds
|
2011-07-18 07:48:07 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(wildcard $(LDSCRIPT)),)
|
2014-03-11 02:05:19 +00:00
|
|
|
LDSCRIPT := $(srctree)/$(CPUDIR)/u-boot-spl.lds
|
2011-07-18 07:48:07 +00:00
|
|
|
endif
|
2011-11-21 10:49:37 +00:00
|
|
|
ifeq ($(wildcard $(LDSCRIPT)),)
|
2014-03-11 02:05:19 +00:00
|
|
|
LDSCRIPT := $(srctree)/arch/$(ARCH)/cpu/u-boot-spl.lds
|
2011-11-21 10:49:37 +00:00
|
|
|
endif
|
2011-07-18 07:48:07 +00:00
|
|
|
ifeq ($(wildcard $(LDSCRIPT)),)
|
|
|
|
$(error could not find linker script)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Special flags for CPP when processing the linker script.
|
|
|
|
# Pass the version down so we can handle backwards compatibility
|
|
|
|
# on the fly.
|
|
|
|
LDPPFLAGS += \
|
2014-03-11 02:05:19 +00:00
|
|
|
-include $(srctree)/include/u-boot/u-boot.lds.h \
|
2014-03-11 02:05:21 +00:00
|
|
|
-include $(objtree)/include/config.h \
|
2011-11-21 10:49:40 +00:00
|
|
|
-DCPUDIR=$(CPUDIR) \
|
2011-07-18 07:48:07 +00:00
|
|
|
$(shell $(LD) --version | \
|
|
|
|
sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p')
|
|
|
|
|
2014-03-14 04:00:14 +00:00
|
|
|
quiet_cmd_mkimage = MKIMAGE $@
|
2014-02-24 02:12:15 +00:00
|
|
|
cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $< $@ \
|
|
|
|
$(if $(KBUILD_VERBOSE:1=), >/dev/null)
|
2012-10-16 13:06:06 +00:00
|
|
|
|
2014-02-24 02:12:15 +00:00
|
|
|
MKIMAGEFLAGS_MLO = -T omapimage -a $(CONFIG_SPL_TEXT_BASE)
|
|
|
|
|
|
|
|
MKIMAGEFLAGS_MLO.byteswap = -T omapimage -n byteswap -a $(CONFIG_SPL_TEXT_BASE)
|
|
|
|
|
|
|
|
MLO MLO.byteswap: $(obj)/u-boot-spl.bin
|
|
|
|
$(call if_changed,mkimage)
|
2011-07-21 13:10:30 +00:00
|
|
|
|
2015-11-17 12:56:57 +00:00
|
|
|
ifeq ($(CONFIG_SYS_SOC),"at91")
|
2014-05-19 12:23:40 +00:00
|
|
|
MKIMAGEFLAGS_boot.bin = -T atmelimage
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER),y)
|
|
|
|
MKIMAGEFLAGS_boot.bin += -n $(shell $(obj)/../tools/atmel_pmecc_params)
|
|
|
|
|
|
|
|
boot.bin: $(obj)/../tools/atmel_pmecc_params
|
|
|
|
endif
|
|
|
|
|
|
|
|
boot.bin: $(obj)/u-boot-spl.bin
|
|
|
|
$(call if_changed,mkimage)
|
2015-11-17 12:56:57 +00:00
|
|
|
else
|
|
|
|
MKIMAGEFLAGS_boot.bin = -T zynqimage
|
|
|
|
|
|
|
|
spl/boot.bin: $(obj)/u-boot-spl-dtb.bin
|
|
|
|
$(call if_changed,mkimage)
|
|
|
|
endif
|
2014-05-19 12:23:40 +00:00
|
|
|
|
2015-02-06 05:06:10 +00:00
|
|
|
ALL-y += $(obj)/$(SPL_BIN).bin $(obj)/$(SPL_BIN).cfg
|
2011-07-18 07:48:07 +00:00
|
|
|
|
2015-10-18 01:41:18 +00:00
|
|
|
ifdef CONFIG_SPL_OF_CONTROL
|
2015-06-23 21:38:29 +00:00
|
|
|
ALL-$(CONFIG_OF_SEPARATE) += $(obj)/$(SPL_BIN)-pad.bin $(obj)/$(SPL_BIN)-dtb.bin
|
2015-10-18 01:41:18 +00:00
|
|
|
endif
|
2015-06-23 21:38:29 +00:00
|
|
|
|
2011-08-18 22:37:20 +00:00
|
|
|
ifdef CONFIG_SAMSUNG
|
2014-02-04 08:24:24 +00:00
|
|
|
ALL-y += $(obj)/$(BOARD)-spl.bin
|
2011-08-18 22:37:20 +00:00
|
|
|
endif
|
|
|
|
|
2015-07-15 00:53:45 +00:00
|
|
|
ifdef CONFIG_ARCH_SOCFPGA
|
|
|
|
ALL-y += $(obj)/$(SPL_BIN)-dtb.sfp
|
|
|
|
endif
|
|
|
|
|
2014-05-05 10:52:30 +00:00
|
|
|
ifdef CONFIG_SUNXI
|
|
|
|
ALL-y += $(obj)/sunxi-spl.bin
|
|
|
|
endif
|
|
|
|
|
2014-10-30 08:59:59 +00:00
|
|
|
ifeq ($(CONFIG_SYS_SOC),"at91")
|
|
|
|
ALL-y += boot.bin
|
|
|
|
endif
|
|
|
|
|
2015-11-17 12:56:57 +00:00
|
|
|
ifdef CONFIG_ARCH_ZYNQ
|
|
|
|
ALL-y += $(obj)/boot.bin
|
|
|
|
endif
|
|
|
|
|
2011-07-18 07:48:07 +00:00
|
|
|
all: $(ALL-y)
|
|
|
|
|
2015-06-23 21:38:29 +00:00
|
|
|
quiet_cmd_cat = CAT $@
|
|
|
|
cmd_cat = cat $(filter-out $(PHONY), $^) > $@
|
|
|
|
|
|
|
|
$(obj)/$(SPL_BIN)-dtb.bin: $(obj)/$(SPL_BIN).bin $(obj)/$(SPL_BIN)-pad.bin \
|
|
|
|
$(obj)/$(SPL_BIN).dtb FORCE
|
|
|
|
$(call if_changed,cat)
|
|
|
|
|
|
|
|
# Create a file that pads from the end of u-boot-spl.bin to bss_end
|
|
|
|
$(obj)/$(SPL_BIN)-pad.bin: $(obj)/$(SPL_BIN)
|
|
|
|
@bss_size_str=$(shell $(NM) $< | awk 'BEGIN {size = 0} /__bss_size/ {size = $$1} END {print "ibase=16; " toupper(size)}' | bc); \
|
|
|
|
dd if=/dev/zero of=$@ bs=1 count=$${bss_size_str} 2>/dev/null;
|
|
|
|
|
|
|
|
# Pass the original device tree file through fdtgrep twice. The first pass
|
|
|
|
# removes any unwanted nodes (i.e. those which don't have the
|
|
|
|
# 'u-boot,dm-pre-reloc' property and thus are not needed by SPL. The second
|
|
|
|
# pass removes various unused properties from the remaining nodes.
|
|
|
|
# The output is typically a much smaller device tree file.
|
|
|
|
quiet_cmd_fdtgrep = FDTGREP $@
|
|
|
|
cmd_fdtgrep = $(objtree)/tools/fdtgrep -b u-boot,dm-pre-reloc -RT $< \
|
|
|
|
-n /chosen -O dtb | \
|
|
|
|
$(objtree)/tools/fdtgrep -r -O dtb - -o $@ \
|
|
|
|
$(addprefix -P ,$(subst $\",,$(CONFIG_OF_SPL_REMOVE_PROPS)))
|
|
|
|
|
|
|
|
$(obj)/$(SPL_BIN).dtb: dts/dt.dtb
|
|
|
|
$(call cmd,fdtgrep)
|
|
|
|
|
2015-02-06 05:06:10 +00:00
|
|
|
quiet_cmd_cpp_cfg = CFG $@
|
|
|
|
cmd_cpp_cfg = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) -ansi \
|
2015-05-26 03:51:25 +00:00
|
|
|
-DDO_DEPS_ONLY -D__ASSEMBLY__ -x assembler-with-cpp -P -dM -E -o $@ $<
|
2015-02-06 05:06:10 +00:00
|
|
|
|
|
|
|
$(obj)/$(SPL_BIN).cfg: include/config.h
|
|
|
|
$(call if_changed,cpp_cfg)
|
|
|
|
|
2011-08-18 22:37:20 +00:00
|
|
|
ifdef CONFIG_SAMSUNG
|
2013-12-26 04:14:27 +00:00
|
|
|
ifdef CONFIG_VAR_SIZE_SPL
|
|
|
|
VAR_SIZE_PARAM = --vs
|
|
|
|
else
|
|
|
|
VAR_SIZE_PARAM =
|
|
|
|
endif
|
2014-02-04 08:24:24 +00:00
|
|
|
$(obj)/$(BOARD)-spl.bin: $(obj)/u-boot-spl.bin
|
2014-03-11 02:05:21 +00:00
|
|
|
$(if $(wildcard $(objtree)/spl/board/samsung/$(BOARD)/tools/mk$(BOARD)spl),\
|
|
|
|
$(objtree)/spl/board/samsung/$(BOARD)/tools/mk$(BOARD)spl,\
|
|
|
|
$(objtree)/tools/mkexynosspl) $(VAR_SIZE_PARAM) $< $@
|
2011-08-18 22:37:20 +00:00
|
|
|
endif
|
|
|
|
|
2014-02-24 02:12:14 +00:00
|
|
|
quiet_cmd_objcopy = OBJCOPY $@
|
|
|
|
cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@
|
|
|
|
|
|
|
|
OBJCOPYFLAGS_$(SPL_BIN).bin = $(SPL_OBJCFLAGS) -O binary
|
|
|
|
|
|
|
|
$(obj)/$(SPL_BIN).bin: $(obj)/$(SPL_BIN) FORCE
|
|
|
|
$(call if_changed,objcopy)
|
2011-07-18 07:48:07 +00:00
|
|
|
|
2014-02-04 08:24:24 +00:00
|
|
|
LDFLAGS_$(SPL_BIN) += -T u-boot-spl.lds $(LDFLAGS_FINAL)
|
2014-02-04 08:24:22 +00:00
|
|
|
ifneq ($(CONFIG_SPL_TEXT_BASE),)
|
|
|
|
LDFLAGS_$(SPL_BIN) += -Ttext $(CONFIG_SPL_TEXT_BASE)
|
|
|
|
endif
|
|
|
|
|
2015-07-15 00:53:45 +00:00
|
|
|
ifdef CONFIG_ARCH_SOCFPGA
|
|
|
|
MKIMAGEFLAGS_$(SPL_BIN)-dtb.sfp = -T socfpgaimage
|
|
|
|
$(obj)/$(SPL_BIN)-dtb.sfp: $(obj)/$(SPL_BIN)-dtb.bin FORCE
|
|
|
|
$(call if_changed,mkimage)
|
|
|
|
endif
|
|
|
|
|
2014-05-05 10:52:30 +00:00
|
|
|
ifdef CONFIG_SUNXI
|
|
|
|
quiet_cmd_mksunxiboot = MKSUNXI $@
|
|
|
|
cmd_mksunxiboot = $(objtree)/tools/mksunxiboot $< $@
|
|
|
|
$(obj)/sunxi-spl.bin: $(obj)/$(SPL_BIN).bin
|
|
|
|
$(call if_changed,mksunxiboot)
|
|
|
|
endif
|
|
|
|
|
2014-02-04 08:24:37 +00:00
|
|
|
quiet_cmd_u-boot-spl = LD $@
|
2014-10-23 16:30:44 +00:00
|
|
|
cmd_u-boot-spl = (cd $(obj) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) \
|
2014-02-04 08:24:37 +00:00
|
|
|
$(patsubst $(obj)/%,%,$(u-boot-spl-init)) --start-group \
|
|
|
|
$(patsubst $(obj)/%,%,$(u-boot-spl-main)) --end-group \
|
2014-10-23 16:30:44 +00:00
|
|
|
$(PLATFORM_LIBS) -Map $(SPL_BIN).map -o $(SPL_BIN))
|
2011-07-18 07:48:07 +00:00
|
|
|
|
2014-10-23 16:30:44 +00:00
|
|
|
$(obj)/$(SPL_BIN): $(u-boot-spl-init) $(u-boot-spl-main) $(obj)/u-boot-spl.lds FORCE
|
|
|
|
$(call if_changed,u-boot-spl)
|
2011-07-18 07:48:07 +00:00
|
|
|
|
2014-02-04 08:24:37 +00:00
|
|
|
$(sort $(u-boot-spl-init) $(u-boot-spl-main)): $(u-boot-spl-dirs) ;
|
2011-07-18 07:48:07 +00:00
|
|
|
|
2014-02-04 08:24:37 +00:00
|
|
|
PHONY += $(u-boot-spl-dirs)
|
|
|
|
$(u-boot-spl-dirs):
|
|
|
|
$(Q)$(MAKE) $(build)=$@
|
2011-07-18 07:48:07 +00:00
|
|
|
|
2014-02-24 02:12:19 +00:00
|
|
|
quiet_cmd_cpp_lds = LDS $@
|
2014-04-09 11:10:43 +00:00
|
|
|
cmd_cpp_lds = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) -ansi \
|
|
|
|
-D__ASSEMBLY__ -x assembler-with-cpp -P -o $@ $<
|
2014-02-24 02:12:19 +00:00
|
|
|
|
kbuild: use Linux Kernel build scripts
Now we are ready to switch over to real Kbuild.
This commit disables temporary scripts:
scripts/{Makefile.build.tmp, Makefile.host.tmp}
and enables real Kbuild scripts:
scripts/{Makefile.build,Makefile.host,Makefile.lib}.
This switch is triggered by the line in scripts/Kbuild.include
-build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build.tmp obj
+build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
We need to adjust some build scripts for U-Boot.
But smaller amount of modification is preferable.
Additionally, we need to fix compiler flags which are
locally added or removed.
In Kbuild, it is not allowed to change CFLAGS locally.
Instead, ccflags-y, asflags-y, cppflags-y,
CFLAGS_$(basetarget).o, CFLAGS_REMOVE_$(basetarget).o
are prepared for that purpose.
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Gerhard Sittig <gsi@denx.de>
2014-02-04 08:24:28 +00:00
|
|
|
$(obj)/u-boot-spl.lds: $(LDSCRIPT) FORCE
|
2014-04-09 11:10:43 +00:00
|
|
|
$(call if_changed_dep,cpp_lds)
|
2011-07-18 07:48:07 +00:00
|
|
|
|
2014-02-24 02:12:14 +00:00
|
|
|
# read all saved command lines
|
|
|
|
|
|
|
|
targets := $(wildcard $(sort $(targets)))
|
|
|
|
cmd_files := $(wildcard $(obj)/.*.cmd $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
|
|
|
|
|
|
|
|
ifneq ($(cmd_files),)
|
|
|
|
$(cmd_files): ; # Do not try to update included dependency files
|
|
|
|
include $(cmd_files)
|
|
|
|
endif
|
|
|
|
|
kbuild: use Linux Kernel build scripts
Now we are ready to switch over to real Kbuild.
This commit disables temporary scripts:
scripts/{Makefile.build.tmp, Makefile.host.tmp}
and enables real Kbuild scripts:
scripts/{Makefile.build,Makefile.host,Makefile.lib}.
This switch is triggered by the line in scripts/Kbuild.include
-build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build.tmp obj
+build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
We need to adjust some build scripts for U-Boot.
But smaller amount of modification is preferable.
Additionally, we need to fix compiler flags which are
locally added or removed.
In Kbuild, it is not allowed to change CFLAGS locally.
Instead, ccflags-y, asflags-y, cppflags-y,
CFLAGS_$(basetarget).o, CFLAGS_REMOVE_$(basetarget).o
are prepared for that purpose.
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Gerhard Sittig <gsi@denx.de>
2014-02-04 08:24:28 +00:00
|
|
|
PHONY += FORCE
|
|
|
|
FORCE:
|
|
|
|
|
|
|
|
# Declare the contents of the .PHONY variable as phony. We keep that
|
|
|
|
# information in a variable so we can use it in if_changed and friends.
|
|
|
|
.PHONY: $(PHONY)
|