X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=scripts%2FMakefile.spl;h=e8cf9f3865618adb0124a6150cd27a798e373d52;hb=6e67f176bb0531903d4b443fe7ad477382d0eacc;hp=239ee48816634b450541383b032d218ae19b3c5b;hpb=333b7209ed486f5a9cba2b9727edd6170fdace70;p=platform%2Fkernel%2Fu-boot.git diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index 239ee48..e8cf9f3 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -45,6 +45,7 @@ LDFLAGS_FINAL += --gc-sections # FIX ME cpp_flags := $(KBUILD_CPPFLAGS) $(PLATFORM_CPPFLAGS) $(UBOOTINCLUDE) \ $(NOSTDINC_FLAGS) +c_flags := $(KBUILD_CFLAGS) $(cpp_flags) HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makefile),y,n) @@ -52,42 +53,27 @@ libs-y += $(if $(BOARDDIR),board/$(BOARDDIR)/) libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/ libs-$(CONFIG_SPL_FRAMEWORK) += common/spl/ -libs-$(CONFIG_SPL_LIBCOMMON_SUPPORT) += common/ +libs-y += common/init/ + +# Special handling for a few options which support SPL/TPL +ifeq ($(CONFIG_TPL_BUILD),y) +libs-$(CONFIG_TPL_LIBCOMMON_SUPPORT) += common/ cmd/ +libs-$(CONFIG_TPL_LIBGENERIC_SUPPORT) += lib/ +else +libs-$(CONFIG_SPL_LIBCOMMON_SUPPORT) += common/ cmd/ +libs-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/ +endif + libs-$(CONFIG_SPL_LIBDISK_SUPPORT) += disk/ -libs-$(CONFIG_SPL_CLK_SUPPORT) += drivers/clk/ -libs-$(CONFIG_SPL_DM) += drivers/core/ -libs-$(CONFIG_SPL_I2C_SUPPORT) += drivers/i2c/ -libs-$(CONFIG_SPL_GPIO_SUPPORT) += drivers/gpio/ -libs-$(CONFIG_SPL_MMC_SUPPORT) += drivers/mmc/ -libs-$(CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT) += drivers/ddr/fsl/ -libs-$(CONFIG_SYS_MVEBU_DDR_A38X) += drivers/ddr/marvell/a38x/ -libs-$(CONFIG_SYS_MVEBU_DDR_AXP) += drivers/ddr/marvell/axp/ -libs-$(CONFIG_ALTERA_SDRAM) += drivers/ddr/altera/ -libs-$(CONFIG_SPL_SERIAL_SUPPORT) += drivers/serial/ -libs-$(CONFIG_SPL_SPI_FLASH_SUPPORT) += drivers/mtd/spi/ -libs-$(CONFIG_SPL_SPI_SUPPORT) += drivers/spi/ +libs-y += drivers/ +libs-$(CONFIG_SPL_DFU_SUPPORT) += drivers/dfu/ +libs-$(CONFIG_SPL_DFU_SUPPORT) += drivers/usb/gadget/ +libs-$(CONFIG_SPL_DFU_SUPPORT) += drivers/usb/gadget/udc/ +libs-$(CONFIG_SPL_DFU_SUPPORT) += drivers/usb/dwc3/ +libs-y += dts/ libs-y += fs/ -libs-$(CONFIG_SPL_LED_SUPPORT) += drivers/led/ -libs-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/ -libs-$(CONFIG_SPL_POWER_SUPPORT) += drivers/power/ drivers/power/pmic/ -libs-$(CONFIG_SPL_POWER_SUPPORT) += drivers/power/regulator/ -libs-$(CONFIG_SPL_MTD_SUPPORT) += drivers/mtd/ -libs-$(CONFIG_SPL_NAND_SUPPORT) += drivers/mtd/nand/ -libs-$(CONFIG_SPL_DRIVERS_MISC_SUPPORT) += drivers/misc/ -libs-$(CONFIG_SPL_ONENAND_SUPPORT) += drivers/mtd/onenand/ -libs-$(CONFIG_SPL_DMA_SUPPORT) += drivers/dma/ libs-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/ libs-$(CONFIG_SPL_NET_SUPPORT) += net/ -libs-$(CONFIG_SPL_ETH_SUPPORT) += drivers/net/ -libs-$(CONFIG_SPL_ETH_SUPPORT) += drivers/net/phy/ -libs-$(CONFIG_SPL_USBETH_SUPPORT) += drivers/net/phy/ -libs-$(CONFIG_SPL_RAM_SUPPORT) += drivers/ram/ -libs-$(CONFIG_SPL_MUSB_NEW_SUPPORT) += drivers/usb/musb-new/ -libs-$(CONFIG_SPL_USBETH_SUPPORT) += drivers/usb/gadget/ -libs-$(CONFIG_SPL_WATCHDOG_SUPPORT) += drivers/watchdog/ -libs-$(CONFIG_SPL_USB_HOST_SUPPORT) += drivers/usb/host/ -libs-$(CONFIG_OMAP_USB_PHY) += drivers/usb/phy/ -libs-$(CONFIG_SPL_SATA_SUPPORT) += drivers/block/ head-y := $(addprefix $(obj)/,$(head-y)) libs-y := $(addprefix $(obj)/,$(libs-y)) @@ -103,6 +89,9 @@ endif u-boot-spl-init := $(head-y) u-boot-spl-main := $(libs-y) +ifdef CONFIG_SPL_OF_PLATDATA +u-boot-spl-platdata := $(obj)/dts/dt-platdata.o +endif # Linker Script ifdef CONFIG_SPL_LDSCRIPT @@ -141,9 +130,10 @@ 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 +MLO MLO.byteswap: $(obj)/u-boot-spl.bin FORCE $(call if_changed,mkimage) +ifeq ($(CONFIG_SYS_SOC),"at91") MKIMAGEFLAGS_boot.bin = -T atmelimage ifeq ($(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER),y) @@ -152,19 +142,28 @@ 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 +boot.bin: $(obj)/u-boot-spl.bin FORCE $(call if_changed,mkimage) +else +ifdef CONFIG_ARCH_ZYNQ +MKIMAGEFLAGS_boot.bin = -T zynqimage +endif +ifdef CONFIG_ARCH_ZYNQMP +MKIMAGEFLAGS_boot.bin = -T zynqmpimage +endif -ALL-y += $(obj)/$(SPL_BIN).bin $(obj)/$(SPL_BIN).cfg +spl/boot.bin: $(obj)/u-boot-spl.bin FORCE + $(call if_changed,mkimage) +endif -ALL-$(CONFIG_OF_SEPARATE) += $(obj)/$(SPL_BIN)-pad.bin $(obj)/$(SPL_BIN)-dtb.bin +ALL-y += $(obj)/$(SPL_BIN).bin ifdef CONFIG_SAMSUNG ALL-y += $(obj)/$(BOARD)-spl.bin endif ifdef CONFIG_ARCH_SOCFPGA -ALL-y += $(obj)/$(SPL_BIN)-dtb.sfp +ALL-y += $(obj)/$(SPL_BIN).sfp endif ifdef CONFIG_SUNXI @@ -175,16 +174,30 @@ ifeq ($(CONFIG_SYS_SOC),"at91") ALL-y += boot.bin endif +ALL-$(CONFIG_ARCH_ZYNQ) += $(obj)/boot.bin +ALL-$(CONFIG_ARCH_ZYNQMP) += $(obj)/boot.bin + all: $(ALL-y) quiet_cmd_cat = CAT $@ cmd_cat = cat $(filter-out $(PHONY), $^) > $@ -$(obj)/$(SPL_BIN)-dtb.bin: $(obj)/$(SPL_BIN).bin $(obj)/$(SPL_BIN)-pad.bin \ +quiet_cmd_copy = COPY $@ + cmd_copy = cp $< $@ + +ifeq ($(CONFIG_SPL_OF_CONTROL)$(CONFIG_OF_SEPARATE)$(CONFIG_SPL_OF_PLATDATA),yy) +$(obj)/$(SPL_BIN)-dtb.bin: $(obj)/$(SPL_BIN)-nodtb.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).bin: $(obj)/$(SPL_BIN)-dtb.bin FORCE + $(call if_changed,copy) +else +$(obj)/$(SPL_BIN).bin: $(obj)/$(SPL_BIN)-nodtb.bin FORCE + $(call if_changed,copy) +endif + +# Create a file that pads from the end of u-boot-spl-nodtb.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; @@ -200,15 +213,34 @@ quiet_cmd_fdtgrep = FDTGREP $@ $(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) +$(obj)/$(SPL_BIN).dtb: dts/dt.dtb $(objtree)/tools/fdtgrep FORCE + $(call if_changed,fdtgrep) + +pythonpath = PYTHONPATH=tools + +quiet_cmd_dtocc = DTOC C $@ +cmd_dtocc = $(pythonpath) $(srctree)/tools/dtoc/dtoc -d $(obj)/$(SPL_BIN).dtb -o $@ platdata + +quiet_cmd_dtoch = DTOC H $@ +cmd_dtoch = $(pythonpath) $(srctree)/tools/dtoc/dtoc -d $(obj)/$(SPL_BIN).dtb -o $@ struct + +quiet_cmd_plat = PLAT $@ +cmd_plat = $(CC) $(c_flags) -c $< -o $@ -quiet_cmd_cpp_cfg = CFG $@ -cmd_cpp_cfg = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) -ansi \ - -DDO_DEPS_ONLY -D__ASSEMBLY__ -x assembler-with-cpp -P -dM -E -o $@ $< +$(obj)/dts/dt-platdata.o: $(obj)/dts/dt-platdata.c include/generated/dt-structs.h + $(call if_changed,plat) -$(obj)/$(SPL_BIN).cfg: include/config.h - $(call if_changed,cpp_cfg) +PHONY += dts_dir +dts_dir: + $(shell [ -d $(obj)/dts ] || mkdir -p $(obj)/dts) + +include/generated/dt-structs.h: $(obj)/$(SPL_BIN).dtb dts_dir dtoc + $(call if_changed,dtoch) + +$(obj)/dts/dt-platdata.c: $(obj)/$(SPL_BIN).dtb dts_dir dtoc + $(call if_changed,dtocc) + +dtoc: #$(objtree)/tools/_libfdt.so ifdef CONFIG_SAMSUNG ifdef CONFIG_VAR_SIZE_SPL @@ -225,9 +257,9 @@ endif quiet_cmd_objcopy = OBJCOPY $@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@ -OBJCOPYFLAGS_$(SPL_BIN).bin = $(SPL_OBJCFLAGS) -O binary +OBJCOPYFLAGS_$(SPL_BIN)-nodtb.bin = $(SPL_OBJCFLAGS) -O binary -$(obj)/$(SPL_BIN).bin: $(obj)/$(SPL_BIN) FORCE +$(obj)/$(SPL_BIN)-nodtb.bin: $(obj)/$(SPL_BIN) FORCE $(call if_changed,objcopy) LDFLAGS_$(SPL_BIN) += -T u-boot-spl.lds $(LDFLAGS_FINAL) @@ -235,32 +267,33 @@ ifneq ($(CONFIG_SPL_TEXT_BASE),) LDFLAGS_$(SPL_BIN) += -Ttext $(CONFIG_SPL_TEXT_BASE) endif -ifdef CONFIG_ARCH_SOCFPGA -MKIMAGEFLAGS_$(SPL_BIN)-dtb.sfp = -T socfpgaimage -$(obj)/$(SPL_BIN)-dtb.sfp: $(obj)/$(SPL_BIN)-dtb.bin FORCE +MKIMAGEFLAGS_$(SPL_BIN).sfp = -T socfpgaimage +$(obj)/$(SPL_BIN).sfp: $(obj)/$(SPL_BIN).bin FORCE $(call if_changed,mkimage) -endif -ifdef CONFIG_SUNXI quiet_cmd_mksunxiboot = MKSUNXI $@ cmd_mksunxiboot = $(objtree)/tools/mksunxiboot $< $@ -$(obj)/sunxi-spl.bin: $(obj)/$(SPL_BIN).bin +$(obj)/sunxi-spl.bin: $(obj)/$(SPL_BIN).bin FORCE $(call if_changed,mksunxiboot) -endif -quiet_cmd_u-boot-spl = LD $@ - cmd_u-boot-spl = (cd $(obj) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) \ +# Rule to link u-boot-spl +# May be overridden by arch/$(ARCH)/config.mk +quiet_cmd_u-boot-spl ?= LD $@ + cmd_u-boot-spl ?= (cd $(obj) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) \ $(patsubst $(obj)/%,%,$(u-boot-spl-init)) --start-group \ - $(patsubst $(obj)/%,%,$(u-boot-spl-main)) --end-group \ + $(patsubst $(obj)/%,%,$(u-boot-spl-main)) \ + $(patsubst $(obj)/%,%,$(u-boot-spl-platdata)) \ + --end-group \ $(PLATFORM_LIBS) -Map $(SPL_BIN).map -o $(SPL_BIN)) -$(obj)/$(SPL_BIN): $(u-boot-spl-init) $(u-boot-spl-main) $(obj)/u-boot-spl.lds FORCE +$(obj)/$(SPL_BIN): $(u-boot-spl-platdata) $(u-boot-spl-init) \ + $(u-boot-spl-main) $(obj)/u-boot-spl.lds FORCE $(call if_changed,u-boot-spl) $(sort $(u-boot-spl-init) $(u-boot-spl-main)): $(u-boot-spl-dirs) ; PHONY += $(u-boot-spl-dirs) -$(u-boot-spl-dirs): +$(u-boot-spl-dirs): $(u-boot-spl-platdata) $(Q)$(MAKE) $(build)=$@ quiet_cmd_cpp_lds = LDS $@