diff --git a/Makefile b/Makefile index 413ce46be..26636c8c9 100644 --- a/Makefile +++ b/Makefile @@ -1638,6 +1638,21 @@ endif #(NEED_BL2U) # Expand build macros for the different images ifeq (${NEED_FDT},yes) $(eval $(call MAKE_DTBS,$(BUILD_PLAT)/fdts,$(FDT_SOURCES))) + + ifneq (${INITRD_SIZE}${INITRD_PATH},) + ifndef INITRD_BASE + $(error INITRD_BASE must be set when inserting initrd properties to the DTB.) + endif + + INITRD_SIZE ?= $(shell printf "0x%x\n" $$(stat -Lc %s $(INITRD_PATH))) + initrd_end = $(shell printf "0x%x\n" $$(expr $$(($(INITRD_BASE) + $(INITRD_SIZE))))) + + define $(HW_CONFIG)-after += + $(s)echo " INITRD $(HW_CONFIG)" + $(q)fdtput -t x $@ /chosen linux,initrd-start $(INITRD_BASE) + $(q)fdtput -t x $@ /chosen linux,initrd-end $(initrd_end) + endef + endif endif #(NEED_FDT) # Add Secure Partition packages diff --git a/make_helpers/build_macros.mk b/make_helpers/build_macros.mk index b1b299cd9..aa1675193 100644 --- a/make_helpers/build_macros.mk +++ b/make_helpers/build_macros.mk @@ -604,6 +604,7 @@ $(DPRE): $(2) | $$$$(@D)/ $(DOBJ): $(DPRE) $(filter-out %.d,$(MAKEFILE_LIST)) | $$$$(@D)/ $$(s)echo " DTC $$<" $$(q)$($(ARCH)-dtc) $$(DTC_FLAGS) -d $(DTBDEP) -o $$@ $$< + $$($$@-after) -include $(DTBDEP) -include $(DTSDEP) diff --git a/plat/arm/board/fvp/platform.mk b/plat/arm/board/fvp/platform.mk index 1dd0b4930..5472a327e 100644 --- a/plat/arm/board/fvp/platform.mk +++ b/plat/arm/board/fvp/platform.mk @@ -367,6 +367,10 @@ FVP_HW_CONFIG_DTS := fdts/${FVP_DT_PREFIX}.dts FDT_SOURCES += ${FVP_HW_CONFIG_DTS} $(eval FVP_HW_CONFIG := ${BUILD_PLAT}/$(patsubst %.dts,%.dtb,$(FVP_HW_CONFIG_DTS))) +HW_CONFIG := ${FVP_HW_CONFIG} + +# Set default initrd base 128MiB offset of the default kernel address in FVP +INITRD_BASE ?= 0x90000000 ifeq (${TRANSFER_LIST}, 0) FDT_SOURCES += $(addprefix plat/arm/board/fvp/fdts/, \ @@ -419,7 +423,6 @@ ifeq (${TRANSFER_LIST}, 1) include lib/transfer_list/transfer_list.mk ifeq ($(RESET_TO_BL31), 1) -HW_CONFIG := ${FVP_HW_CONFIG} FW_HANDOFF_SIZE := 20000 TRANSFER_LIST_DTB_OFFSET := 0x20