diff options
Diffstat (limited to 'scripts/Makefile.lib')
-rw-r--r-- | scripts/Makefile.lib | 89 |
1 files changed, 49 insertions, 40 deletions
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 16308497b8..6b1f0ccbc0 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -156,6 +156,25 @@ _c_flags += $(if $(patsubst n%,, \ PBL_CPPFLAGS += $(call cc-option,-fno-sanitize=all) endif +ifeq ($(CONFIG_DEBUG_PBL),y) +PBL_CPPFLAGS += -DDEBUG +endif + +_stackp_flags-y := -fno-stack-protector +_stackp_flags-$(CONFIG_STACKPROTECTOR_STRONG) := -fstack-protector-strong +_stackp_flags-$(CONFIG_STACKPROTECTOR_ALL) := -fstack-protector-all + +_stackp_flags_pbl-y := -fno-stack-protector +_stackp_flags_pbl-$(CONFIG_PBL_STACKPROTECTOR_STRONG) := -fstack-protector-strong +_stackp_flags_pbl-$(CONFIG_PBL_STACKPROTECTOR_ALL) := -fstack-protector-all + +_c_flags += $(if $(part-of-pbl),$(_stackp_flags_pbl-y),$(_stackp_flags-y)) + +ifeq ($(CONFIG_PBL_FULLY_PIC),y) +include scripts/Makefile.pic +PBL_CPPFLAGS += $(picflags-y) +endif + # If building barebox in a separate objtree expand all occurrences # of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/'). @@ -206,7 +225,7 @@ dtc_cpp_flags = -Wp,-MD,$(depfile).pre -nostdinc \ -I$(srctree)/include \ -I$(srctree)/dts/include \ -I$(srctree)/dts/src/ \ - $(DTC_CPP_FLAGS_$(basetarget).dtb) \ + $(DTC_CPP_FLAGS_$(basetarget)$(suffix $@)) \ -undef -D__DTS__ ifdef CONFIG_BOOTM_FITIMAGE_PUBKEY @@ -231,6 +250,12 @@ endef # Shipped files # =========================================================================== +quiet_cmd_0size = 0SIZE $@ +cmd_0size = : > $@ + +quiet_cmd_delete = DELETE $@ + cmd_delete = rm -f $@ + quiet_cmd_shipped = SHIPPED $@ cmd_shipped = cat $< > $@ @@ -281,7 +306,7 @@ quiet_cmd_sha256bin ?= SHA-BIN $@ while read -r byte; do printf '\%o' $$byte; done)" > $@ quiet_cmd_sha256sum ?= SHA $@ - cmd_sha256sum ?= sha256sum $< > $@ + cmd_sha256sum ?= sha256sum $2 > $@ # Decompressor for barebox proper binary when using PBL # --------------------------------------------------------------------------- @@ -341,37 +366,47 @@ DTC_FLAGS += -Wno-unit_address_vs_reg \ -Wno-unit_address_format \ -Wno-avoid_unnecessary_addr_size \ -Wno-alias_paths \ - -Wno-alias_paths \ -Wno-graph_child_address \ -Wno-simple_bus_reg \ -Wno-unique_unit_address \ - -Wno-pci_device_reg + -Wno-pci_device_reg \ + -Wno-interrupt_provider ifeq ($(CONFIG_OF_OVERLAY_LIVE), y) -DTC_FLAGS += -@ +DTC_FLAGS.dtb += -@ endif +DTC_FLAGS.dtbo += -Wno-avoid_default_addr_size -Wno-reg_format + # Generate an assembly file to wrap the output of the device tree compiler quiet_cmd_dt_S_dtb = DTB $@ cmd_dt_S_dtb = $(srctree)/scripts/gen-dtb-s $(subst -,_,$(*F)) $< $(CONFIG_IMD) > $@ $(obj)/%.dtb.S: $(obj)/%.dtb $(obj)/%.dtb.z $(srctree)/scripts/gen-dtb-s FORCE $(call if_changed,dt_S_dtb) +quiet_cmd_dt_S_dtbo = DTBO $@ +cmd_dt_S_dtbo = $(srctree)/scripts/gen-dtbo-s $(subst -,_,$(*F)) $< > $@ +$(obj)/%.dtbo.S: $(obj)/%.dtbo $(srctree)/scripts/gen-dtbo-s FORCE + $(call if_changed,dt_S_dtbo) + $(obj)/%.dtb.z: $(obj)/%.dtb FORCE $(call if_changed,$(suffix_y)) dts-frags = $(subst $(quote),,$(CONFIG_EXTERNAL_DTS_FRAGMENTS)) quiet_cmd_dtc = DTC $@ -# For compatibility between make 4.2 and 4.3 -cmd_dtc = /usr/bin/env echo -e '$(pound)define $(subst -,_,$(*F))_dts 1\n'$(foreach f,$< $(dts-frags),'$(pound)include "$(f)"\n') | \ - $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) - ; \ +cmd_dtc = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) \ + -D'$(subst -,_,$(*F))_dts=1' $(foreach f,$< $(2),-include '$(f)') /dev/null ; \ $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 \ - -i $(srctree)/arch/$(SRCARCH)/dts $(DTC_FLAGS) \ + -i $(srctree)/arch/$(SRCARCH)/dts $(DTC_FLAGS) $(DTC_FLAGS$(suffix $@)) \ -i $(srctree)/dts/src/$(SRCARCH) \ + -i $(srctree)/dts/src/arm/ti/omap \ -d $(depfile).dtc $(dtc-tmp) ; \ cat $(depfile).pre $(depfile).dtc > $(depfile) $(obj)/%.dtb: $(src)/%.dts FORCE + $(call if_changed_dep,dtc,$(dts-frags)) + +$(obj)/%.dtbo: $(src)/%.dtso $(DTC) FORCE $(call if_changed_dep,dtc) dtc-tmp = $(subst $(comma),_,$(dot-target).dts) @@ -379,7 +414,8 @@ dtc-tmp = $(subst $(comma),_,$(dot-target).dts) quiet_cmd_env_S = ENV.S $@ cmd_env_S = \ ( \ - echo '\#include <asm-generic/barebox.lds.h>'; \ + echo '\#include <asm/barebox.lds.h>'; \ + echo '.section .note.GNU-stack,"",%progbits'; \ echo '.section .bbenv.rodata.$(subst -,_,$(*F)),"a"'; \ echo '.balign STRUCT_ALIGNMENT'; \ echo '.global __bbenv_$(subst -,_,$(*F))_start'; \ @@ -451,34 +487,6 @@ cmd_lzo = (cat $(filter-out FORCE,$^) | \ %.lzo: % $(call if_changed,lzo) -# XZ -# --------------------------------------------------------------------------- -# Use xzkern to compress the kernel image and xzmisc to compress other things. -# -# xzkern uses a big LZMA2 dictionary since it doesn't increase memory usage -# of the kernel decompressor. A BCJ filter is used if it is available for -# the target architecture. xzkern also appends uncompressed size of the data -# using size_append. The .xz format has the size information available at -# the end of the file too, but it's in more complex format and it's good to -# avoid changing the part of the boot code that reads the uncompressed size. -# Note that the bytes added by size_append will make the xz tool think that -# the file is corrupt. This is expected. -# -# xzmisc doesn't use size_append, so it can be used to create normal .xz -# files. xzmisc uses smaller LZMA2 dictionary than xzkern, because a very -# big dictionary would increase the memory usage too much in the multi-call -# decompression mode. A BCJ filter isn't used either. -quiet_cmd_xzkern = XZKERN $@ -cmd_xzkern = (cat $(filter-out FORCE,$^) | \ - sh $(srctree)/scripts/xz_wrap.sh && \ - $(call size_append, $(filter-out FORCE,$^))) > $@ || \ - (rm -f $@ ; false) - -quiet_cmd_xzmisc = XZMISC $@ -cmd_xzmisc = (cat $(filter-out FORCE,$^) | \ - xz --check=crc32 --lzma2=dict=1MiB) > $@ || \ - (rm -f $@ ; false) - # lz4 # --------------------------------------------------------------------------- @@ -528,7 +536,8 @@ quiet_cmd_check_file_size = CHKFILESIZE $2 quiet_cmd_imximage__S_dcd= DCD_S $@ cmd_imximage_S_dcd= \ ( \ - echo '\#include <asm-generic/barebox.lds.h>'; \ + echo '\#include <asm/barebox.lds.h>'; \ + echo '.section .note.GNU-stack,"",%progbits'; \ echo '.balign STRUCT_ALIGNMENT'; \ echo '.global $(subst -,_,$(*F))_start'; \ echo '$(subst -,_,$(*F))_start:'; \ @@ -605,7 +614,7 @@ quiet_cmd_b64dec = B64DEC $@ # target file. quiet_cmd_rsa_keys = RSAKEY $@ cmd_rsa_keys = \ - $(objtree)/scripts/rsatoc -o $@.tmp $(2) && \ + $(objtree)/scripts/rsatoc -o $@.tmp "$(2)" $(3) && \ if cmp -s $@.tmp $@; then \ rm $@.tmp; \ else \ |