X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=scripts%2FMakefile.lib;h=8decb0e451d4c29c6f1ec8ca7ae4d08e0f675e08;hb=587e4a4296982f85b2a40fc8a704db65079e0aac;hp=4facb76aceb7f736445f6697427ad030fd4872fd;hpb=2013c6850e169bfd5ef662a5fb49fdba2860c4f1;p=oweals%2Fu-boot.git diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 4facb76ace..8decb0e451 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -144,9 +144,10 @@ else # $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files # and locates generated .h files # FIXME: Replace both with specific CFLAGS* statements in the makefiles -__c_flags = $(call addtree,-I$(obj)) $(call flags,_c_flags) -__a_flags = $(call flags,_a_flags) -__cpp_flags = $(call flags,_cpp_flags) +__c_flags = $(if $(obj),$(call addtree,-I$(src)) -I$(obj)) \ + $(call flags,_c_flags) +__a_flags = $(call flags,_a_flags) +__cpp_flags = $(call flags,_cpp_flags) endif # Modified for U-Boot: LINUXINCLUDE -> UBOOTINCLUDE @@ -160,7 +161,7 @@ a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \ cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \ $(__cpp_flags) -ld_flags = $(LDFLAGS) $(ldflags-y) +ld_flags = $(KBUILD_LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F)) # Try these files in order to find the U-Boot-specific .dtsi include file u_boot_dtsi_options = $(strip $(wildcard $(dir $<)$(basename $(notdir $<))-u-boot.dtsi) \ @@ -255,8 +256,7 @@ $(obj)/%: $(src)/%_shipped # --------------------------------------------------------------------------- quiet_cmd_ld = LD $@ -cmd_ld = $(LD) $(LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F)) \ - $(filter-out FORCE,$^) -o $@ +cmd_ld = $(LD) $(ld_flags) $(filter-out FORCE,$^) -o $@ # Objcopy # --------------------------------------------------------------------------- @@ -274,6 +274,30 @@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -n -f -9 > $@) || \ # DTC # --------------------------------------------------------------------------- +# Disable noisy checks by default +ifeq ($(findstring 1,$(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),) +DTC_FLAGS += -Wno-unit_address_vs_reg \ + -Wno-unit_address_format \ + -Wno-avoid_unnecessary_addr_size \ + -Wno-alias_paths \ + -Wno-graph_child_address \ + -Wno-graph_port \ + -Wno-unique_unit_address \ + -Wno-simple_bus_reg \ + -Wno-pci_device_reg + +# U-Boot specific disables +DTC_FLAGS += -Wno-pci_bridge \ + -Wno-pci_device_bus_num +endif + +ifneq ($(findstring 2,$(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),) +DTC_FLAGS += -Wnode_name_chars_strict \ + -Wproperty_name_chars_strict +endif + +DTC_FLAGS += $(DTC_FLAGS_$(basetarget)) + # Generate an assembly file to wrap the output of the device tree compiler quiet_cmd_dt_S_dtb= DTB $@ # Modified for U-Boot @@ -292,6 +316,10 @@ cmd_dt_S_dtb= \ $(obj)/%.dtb.S: $(obj)/%.dtb $(call cmd,dt_S_dtb) +ifeq ($(CONFIG_SPL_LOAD_FIT_APPLY_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 @@ -300,8 +328,11 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \ $(CPP) $(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) ; \ - cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) + -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) $(obj)/%.dtb: $(src)/%.dts FORCE $(call if_changed_dep,dtc) @@ -317,7 +348,7 @@ quiet_cmd_dtco = DTCO $@ # No generation of assembly file either # Modified for U-Boot cmd_dtco = mkdir -p $(dir ${dtc-tmp}) ; \ - $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) - ; \ + $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ $(DTC) -@ -O dtb -o $@ -b 0 \ -i $(dir $<) $(DTC_FLAGS) \ -d $(depfile).dtc.tmp $(dtc-tmp) ; \ @@ -382,7 +413,7 @@ cmd_efi_ld = $(LD) -nostdlib -znocombreloc -T $(EFI_LDS_PATH) -shared \ EFI_LDS_PATH = $(srctree)/arch/$(ARCH)/lib/$(EFI_LDS) -$(obj)/efi_crt0.o: $(srctree)/arch/$(ARCH)/lib/$(EFI_CRT0:.o=.S) +$(obj)/efi_crt0.o: $(srctree)/arch/$(ARCH)/lib/$(EFI_CRT0:.o=.S) FORCE $(call if_changed_dep,as_o_S) $(obj)/efi_reloc.o: $(srctree)/arch/$(ARCH)/lib/$(EFI_RELOC:.o=.c) $(recordmcount_source) FORCE @@ -394,11 +425,22 @@ $(obj)/%_efi.so: $(obj)/%.o $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_free # ACPI # --------------------------------------------------------------------------- +# +# This first sends the file (typically dsdt.asl) through the preprocessor +# resolve includes and any CONFIG options used. This produces dsdt.asl.tmp +# 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. +ASL_TMP = $(patsubst %.c,%.asl.tmp,$@) + quiet_cmd_acpi_c_asl= ASL $< cmd_acpi_c_asl= \ - $(CPP) -x assembler-with-cpp -D__ASSEMBLY__ -P $(UBOOTINCLUDE) -o $<.tmp $<; \ - iasl -p $< -tc $<.tmp $(if $(KBUILD_VERBOSE:1=), >/dev/null) && \ - mv $(patsubst %.asl,%.hex,$<) $@ + $(CPP) -x assembler-with-cpp -D__ASSEMBLY__ -P $(UBOOTINCLUDE) \ + -o $(ASL_TMP) $< && \ + iasl -p $@ -tc $(ASL_TMP) $(if $(KBUILD_VERBOSE:1=), >/dev/null) && \ + mv $(patsubst %.c,%.hex,$@) $@ $(obj)/dsdt.c: $(src)/dsdt.asl $(call cmd,acpi_c_asl) @@ -524,4 +566,13 @@ 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 \ $(addprefix -P ,$(subst $\",,$(CONFIG_OF_SPL_REMOVE_PROPS))) + +# fdt_rm_props +# --------------------------------------------------------------------------- +# Pass the original device tree file through fdtgrep. This removes various +# unused properties. The output is typically a smaller device tree file. +quiet_cmd_fdt_rm_props = FDTGREP $@ + cmd_fdt_rm_props = cat $< | $(objtree)/tools/fdtgrep -r -O dtb - -o $@ \ + $(addprefix -P ,$(subst $\",,$(CONFIG_OF_REMOVE_PROPS)))