blob: 1638ef8fd8d4d908bbf1084a5f2beb3af511d44f [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001# SPDX-License-Identifier: GPL-2.0+
Marek Vasutc140e982011-11-08 23:18:08 +00002#
3# (C) Copyright 2000-2006
4# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
Marek Vasutc140e982011-11-08 23:18:08 +00005
Masahiro Yamada65aac042013-10-17 17:34:49 +09006extra-$(CONFIG_SPL_BUILD) := start.o
Marek Vasutc140e982011-11-08 23:18:08 +00007
Masahiro Yamada65aac042013-10-17 17:34:49 +09008obj-y = clock.o mxs.o iomux.o timer.o
Marek Vasutc140e982011-11-08 23:18:08 +00009
Marek Vasut151f49d2011-12-02 03:47:40 +000010ifdef CONFIG_SPL_BUILD
Masahiro Yamada65aac042013-10-17 17:34:49 +090011obj-y += spl_boot.o spl_lradc_init.o spl_mem_init.o spl_power_init.o
Marek Vasut151f49d2011-12-02 03:47:40 +000012endif
13
Marek Vasute07153e2013-04-28 14:18:49 +000014# Specify the target for use in elftosb call
Mans Rullgard65d21902018-04-21 16:11:10 +010015MKIMAGE_TARGET-$(CONFIG_MX23) = mxsimage$(CONFIG_SPL_FRAMEWORK:%=-spl).mx23.cfg
16MKIMAGE_TARGET-$(CONFIG_MX28) = mxsimage$(CONFIG_SPL_FRAMEWORK:%=-spl).mx28.cfg
Marek Vasute07153e2013-04-28 14:18:49 +000017
Marek Vasut266003a2014-04-03 19:12:21 +020018# Generate HAB-capable IVT
19#
20# Note on computing the post-IVT size field value for the U-Boot binary.
21# The value is the result of adding the following:
22# -> The size of U-Boot binary aligned to 64B (u-boot.bin)
23# -> The size of IVT block aligned to 64B (u-boot.ivt)
24# -> The size of U-Boot signature (u-boot.sig), 3904 B
25# -> The 64B hole in front of U-Boot binary for 'struct mxs_spl_data' passing
26#
27quiet_cmd_mkivt_mxs = MXSIVT $@
28cmd_mkivt_mxs = \
29 sz=`expr \`stat -c "%s" $^\` + 64 + 3904 + 128` ; \
30 echo -n "0x402000d1 $2 0 0 0 $3 $4 0 $$sz 0 0 0 0 0 0 0" | \
31 tr -s " " | xargs -d " " -i printf "%08x\n" "{}" | rev | \
32 sed "s/\(.\)\(.\)/\\\\\\\\x\2\1\n/g" | xargs -i printf "{}" >$@
33
34# Align binary to 64B
35quiet_cmd_mkalign_mxs = MXSALGN $@
36cmd_mkalign_mxs = \
37 dd if=$^ of=$@ ibs=64 conv=sync 2>/dev/null && \
38 mv $@ $^
39
40# Assemble the CSF file
41quiet_cmd_mkcsfreq_mxs = MXSCSFR $@
42cmd_mkcsfreq_mxs = \
43 ivt=$(word 1,$^) ; \
44 bin=$(word 2,$^) ; \
45 csf=$(word 3,$^) ; \
46 sed "s@VENDOR@$(VENDOR)@g;s@BOARD@$(BOARD)@g" "$$csf" | \
47 sed '/^\#\#Blocks/ d' > $@ ; \
48 echo " Blocks = $2 0x0 `stat -c '%s' $$bin` \"$$bin\" , \\" >> $@ ; \
49 echo " $3 0x0 0x40 \"$$ivt\"" >> $@
50
51# Sign files
52quiet_cmd_mkcst_mxs = MXSCST $@
53cmd_mkcst_mxs = cst -o $@ < $^ \
54 $(if $(KBUILD_VERBOSE:1=), >/dev/null)
55
56spl/u-boot-spl.ivt: spl/u-boot-spl.bin
57 $(call if_changed,mkalign_mxs)
58 $(call if_changed,mkivt_mxs,$(CONFIG_SPL_TEXT_BASE),\
59 0x00008000,0x00008040)
60
61u-boot.ivt: u-boot.bin
62 $(call if_changed,mkalign_mxs)
Simon Glass72cc5382022-10-20 18:22:39 -060063 $(call if_changed,mkivt_mxs,$(CONFIG_TEXT_BASE),\
Marek Vasut266003a2014-04-03 19:12:21 +020064 0x40001000,0x40001040)
65
66spl/u-boot-spl.csf: spl/u-boot-spl.ivt spl/u-boot-spl.bin board/$(VENDOR)/$(BOARD)/sign/u-boot-spl.csf
67 $(call if_changed,mkcsfreq_mxs,$(CONFIG_SPL_TEXT_BASE),0x8000)
68
69u-boot.csf: u-boot.ivt u-boot.bin board/$(VENDOR)/$(BOARD)/sign/u-boot.csf
Simon Glass72cc5382022-10-20 18:22:39 -060070 $(call if_changed,mkcsfreq_mxs,$(CONFIG_TEXT_BASE),0x40001000)
Marek Vasut266003a2014-04-03 19:12:21 +020071
72%.sig: %.csf
73 $(call if_changed,mkcst_mxs)
74
Marek Vasutc58b7ef2015-08-11 03:08:07 +020075MKIMAGEFLAGS_u-boot.sb = -n $< -T mxsimage
Masahiro Yamadaa0b3de02014-03-11 11:05:11 +090076u-boot.sb: $(src)/$(MKIMAGE_TARGET-y) u-boot.bin spl/u-boot-spl.bin FORCE
Marek Vasutc58b7ef2015-08-11 03:08:07 +020077 $(call if_changed,mkimage)
Marek Vasut266003a2014-04-03 19:12:21 +020078
Marek Vasutc58b7ef2015-08-11 03:08:07 +020079MKIMAGEFLAGS_u-boot-signed.sb = -n $< -T mxsimage
Marek Vasut266003a2014-04-03 19:12:21 +020080u-boot-signed.sb: $(src)/mxsimage-signed.cfg u-boot.ivt u-boot.sig spl/u-boot-spl.ivt spl/u-boot-spl.sig FORCE
Marek Vasutc58b7ef2015-08-11 03:08:07 +020081 $(call if_changed,mkimage)