# Uncomment for debugging
# This shows all the files that were considered and the one that we chose.
-# u_boot_dtsi_options_debug = $(u_boot_dtsi_options_raw)
+ifdef DEVICE_TREE_DEBUG
+u_boot_dtsi_options_debug = $(warning $(u_boot_dtsi_options_raw))
+endif
# We use the first match
u_boot_dtsi = $(strip $(u_boot_dtsi_options_debug) \
# Modified for U-Boot
dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \
+ $(UBOOTINCLUDE) \
-I$(srctree)/arch/$(ARCH)/dts \
-I$(srctree)/arch/$(ARCH)/dts/include \
- -Iinclude \
-I$(srctree)/include \
- -I$(srctree)/arch/$(ARCH)/include \
- -include $(srctree)/include/linux/kconfig.h \
-D__ASSEMBLY__ \
-undef -D__DTS__
$(obj)/%.dtb.S: $(obj)/%.dtb
$(call cmd,dt_S_dtb)
-ifeq ($(CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY),y)
+ifeq ($(CONFIG_OF_LIBFDT_OVERLAY),y)
DTC_FLAGS += -@
endif
quiet_cmd_dtc = DTC $@
# Modified for U-Boot
# Bring in any U-Boot-specific include at the end of the file
+# And finally any custom .dtsi fragments specified with CONFIG_DEVICE_TREE_INCLUDES
cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
(cat $<; $(if $(u_boot_dtsi),echo '$(pound)include "$(u_boot_dtsi)"')) > $(pre-tmp); \
- $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $(pre-tmp) ; \
+ $(foreach f,$(subst $(quote),,$(CONFIG_DEVICE_TREE_INCLUDES)), \
+ echo '$(pound)include "$(f)"' >> $(pre-tmp);) \
+ $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $(pre-tmp) ; \
$(DTC) -O dtb -o $@ -b 0 \
-i $(dir $<) $(DTC_FLAGS) \
-d $(depfile).dtc.tmp $(dtc-tmp) || \
(echo "Check $(shell pwd)/$(pre-tmp) for errors" && false) \
; \
- cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) ; \
- sed -i "s:$(pre-tmp):$(<):" $(depfile)
+ sed "s:$(pre-tmp):$(<):" $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
$(obj)/%.dtb: $(src)/%.dts FORCE
$(call if_changed_dep,dtc)
$(obj)/%.S: $(src)/%.ttf
$(call cmd,S_ttf)
+# Splash logos
+# ---------------------------------------------------------------------------
+
+# Generate an assembly file to wrap the splash data
+quiet_cmd_S_splash= TTF $@
+# Modified for U-Boot
+cmd_S_splash= \
+( \
+ echo '.section .rodata.splash.init,"a"'; \
+ echo '.balign 16'; \
+ echo '.global __splash_$(*F)_begin'; \
+ echo '__splash_$(*F)_begin:'; \
+ echo '.incbin "$<" '; \
+ echo '__splash_$(*F)_end:'; \
+ echo '.global __splash_$(*F)_end'; \
+ echo '.balign 16'; \
+) > $@
+
+$(obj)/%.S: $(src)/%.bmp
+ $(call cmd,S_splash)
+
# EFI applications
# A Makefile target *.efi is built as EFI application.
# A Makefile target *_efi.S wraps *.efi as built-in EFI application.
$(obj)/%.efi: $(obj)/%_efi.so
$(call cmd,efi_objcopy)
+KBUILD_EFILDFLAGS = -nostdlib -zexecstack -znocombreloc -znorelro
+KBUILD_EFILDFLAGS += $(call ld-option,--no-warn-rwx-segments)
quiet_cmd_efi_ld = LD $@
-cmd_efi_ld = $(LD) -nostdlib -znocombreloc -T $(EFI_LDS_PATH) -shared \
- -Bsymbolic -s $^ -o $@
+cmd_efi_ld = $(LD) $(KBUILD_EFILDFLAGS) -T $(EFI_LDS_PATH) \
+ -shared -Bsymbolic -s $^ -o $@
EFI_LDS_PATH = $(srctree)/arch/$(ARCH)/lib/$(EFI_LDS)
targets += $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_freestanding.o
+CFLAGS_REMOVE_efi_reloc.o := $(LTO_CFLAGS)
+CFLAGS_REMOVE_efi_freestanding.o := $(LTO_CFLAGS)
+
# ACPI
# ---------------------------------------------------------------------------
#
# which is pure ASL code. The Intel ASL (ACPI (Advanced Configuration and Power
# Interface) Source Language compiler (iasl) then converts this ASL code into a
# C file containing the hex data to build into U-Boot. This file is called
-# dsdt.hex (despite us setting the prefix to .../dsdt.asl.tmp) so must be
-# renamed to dsdt.c for consumption by the build system.
+# dsdt_generated.hex (despite us setting the prefix to .../dsdt_generated.asl.tmp)
+# so must be renamed to dsdt_generated.c for consumption by the build system.
ASL_TMP = $(patsubst %.c,%.asl.tmp,$@)
quiet_cmd_acpi_c_asl= ASL $<
cmd_acpi_c_asl= \
$(CPP) -x assembler-with-cpp -D__ASSEMBLY__ -D__ACPI__ \
-P $(UBOOTINCLUDE) -o $(ASL_TMP) $< && \
- iasl -p $@ -tc $(ASL_TMP) $(if $(KBUILD_VERBOSE:1=), >/dev/null) && \
+ iasl -p $@ -I $(srctree)/board/$(BOARDDIR) -tc $(ASL_TMP) \
+ $(if $(KBUILD_VERBOSE:1=), >/dev/null) && \
mv $(patsubst %.c,%.hex,$@) $@
-$(obj)/dsdt.c: $(src)/dsdt.asl
+$(obj)/dsdt_generated.c: $(src)/dsdt.asl
$(call cmd,acpi_c_asl)
- $(Q)sed -i -e "s,dsdt_aml_code,AmlCode," $@
+ $(Q)sed -i -e "s,dsdt_generated_aml_code,AmlCode," $@
# Bzip2
# ---------------------------------------------------------------------------
# Additional commands for U-Boot
#
+# bin2c
+# ---------------------------------------------------------------------------
+quiet_cmd_bin2c = BIN2C $@
+ cmd_bin2c = $(objtree)/scripts/bin2c $2 < $< > $@
+
# mkimage
# ---------------------------------------------------------------------------
MKIMAGEOUTPUT ?= /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
+# 'bootph-all' 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.
+
+ifdef CONFIG_OF_TAG_MIGRATE
+# Support the old tags for a migration period
+migrate_tpl := -b u-boot,dm-pre-reloc -b u-boot,dm-tpl
+migrate_vpl := -b u-boot,dm-pre-reloc -b u-boot,dm-vpl
+migrate_spl := -b u-boot,dm-pre-reloc -b u-boot,dm-spl
+migrate_all := -P u-boot,dm-pre-reloc \
+ -P u-boot,dm-spl -P u-boot,dm-tpl -P u-boot,dm-vpl
+endif
+
+ifeq ($(CONFIG_VPL_BUILD),y)
+fdtgrep_props := -b bootph-all -b bootph-verify $(migrate_vpl)
+else
ifeq ($(CONFIG_TPL_BUILD),y)
-fdtgrep_props := -b u-boot,dm-pre-reloc -b u-boot,dm-tpl
+fdtgrep_props := -b bootph-all -b bootph-pre-sram $(migrate_tpl)
else
-fdtgrep_props := -b u-boot,dm-pre-reloc -b u-boot,dm-spl
+fdtgrep_props := -b bootph-all -b bootph-pre-ram $(migrate_spl)
+endif
endif
quiet_cmd_fdtgrep = FDTGREP $@
cmd_fdtgrep = $(objtree)/tools/fdtgrep $(fdtgrep_props) -RT $< \
-n /chosen -n /config -O dtb | \
$(objtree)/tools/fdtgrep -r -O dtb - -o $@ \
- -P u-boot,dm-pre-reloc -P u-boot,dm-spl -P u-boot,dm-tpl \
+ -P bootph-all -P bootph-pre-ram -P bootph-pre-sram \
+ -P bootph-verify \
+ $(migrate_all) \
$(addprefix -P ,$(subst $\",,$(CONFIG_OF_SPL_REMOVE_PROPS)))
# fdt_rm_props