config.mk 2.29 KB
Newer Older
1
2
3
4
5
6
7
# SPDX-License-Identifier:	GPL-2.0+
#
# Copyright (C) 2017-2018 Texas Instruments Incorporated - http://www.ti.com/
#	Lokesh Vutla <lokeshvutla@ti.com>

ifdef CONFIG_SPL_BUILD

8
9
10
11
12
13
14
15
16
17
# Openssl is required to generate x509 certificate.
# Error out if openssl is not available.
ifeq ($(shell which openssl),)
$(error "No openssl in $(PATH), consider installing openssl")
endif

IMAGE_SIZE= $(shell cat $(obj)/u-boot-spl.bin | wc -c)
MAX_SIZE= $(shell printf "%d" $(CONFIG_SYS_K3_MAX_DOWNLODABLE_IMAGE_SIZE))

ifeq ($(CONFIG_SYS_K3_KEY), "")
18
KEY=""
19
20
21
22
23
24
25
26
# On HS use real key or warn if not available
ifeq ($(CONFIG_TI_SECURE_DEVICE),y)
ifneq ($(wildcard $(TI_SECURE_DEV_PKG)/keys/custMpk.pem),)
KEY=$(TI_SECURE_DEV_PKG)/keys/custMpk.pem
else
$(warning "WARNING: signing key not found. Random key will NOT work on HS hardware!")
endif
endif
27
else
28
KEY=$(patsubst "%",$(srctree)/%,$(CONFIG_SYS_K3_KEY))
29
30
31
32
33
34
35
36
37
38
39
40
41
42
endif

# tiboot3.bin is mandated by ROM and ROM only supports R5 boot.
# So restrict tiboot3.bin creation for CPU_V7R.
ifdef CONFIG_CPU_V7R
image_check: $(obj)/u-boot-spl.bin FORCE
	@if [ $(IMAGE_SIZE) -gt $(MAX_SIZE) ]; then			    \
		echo "===============================================" >&2; \
		echo "ERROR: Final Image too big. " >&2;		    \
		echo "$< size = $(IMAGE_SIZE), max size = $(MAX_SIZE)" >&2; \
		echo "===============================================" >&2; \
		exit 1;							    \
	fi

43
44
45
tiboot3.bin: image_check FORCE
	$(srctree)/tools/k3_gen_x509_cert.sh -c 16 -b $(obj)/u-boot-spl.bin \
				-o $@ -l $(CONFIG_SPL_TEXT_BASE) -k $(KEY)
46

47
INPUTS-y	+= tiboot3.bin
48
49
endif

50
ifdef CONFIG_ARM64
51

52
53
54
55
ifeq ($(CONFIG_SOC_K3_J721E),)
export DM := /dev/null
endif

56
57
ifeq ($(CONFIG_TI_SECURE_DEVICE),y)
SPL_ITS := u-boot-spl-k3_HS.its
58
$(SPL_ITS): export IS_HS=1
59
INPUTS-y	+= tispl.bin_HS
60
else
61
SPL_ITS := u-boot-spl-k3.its
62
INPUTS-y	+= tispl.bin
63
64
endif

65
66
67
68
69
70
ifeq ($(CONFIG_SPL_OF_LIST),)
LIST_OF_DTB := $(CONFIG_DEFAULT_DEVICE_TREE)
else
LIST_OF_DTB := $(CONFIG_SPL_OF_LIST)
endif

71
72
quiet_cmd_k3_mkits = MKITS   $@
cmd_k3_mkits = \
73
	$(srctree)/tools/k3_fit_atf.sh \
74
	$(CONFIG_K3_ATF_LOAD_ADDR) \
75
	$(patsubst %,$(obj)/dts/%.dtb,$(subst ",,$(LIST_OF_DTB))) > $@
76

77
78
$(SPL_ITS): FORCE
	$(call cmd,k3_mkits)
79
80
81
endif

else
82

83
ifeq ($(CONFIG_TI_SECURE_DEVICE),y)
84
INPUTS-y	+= u-boot.img_HS
85
else
86
INPUTS-y	+= u-boot.img
87
endif
88
89
90
endif

include $(srctree)/arch/arm/mach-k3/config_secure.mk