2018-08-27 10:27:15 +00:00
|
|
|
# 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
|
|
|
|
|
2018-11-02 14:21:04 +00:00
|
|
|
# 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), "")
|
2019-05-02 10:05:51 +00:00
|
|
|
KEY=""
|
2019-04-12 16:54:46 +00:00
|
|
|
# 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
|
2018-11-02 14:21:04 +00:00
|
|
|
else
|
2018-12-19 07:23:31 +00:00
|
|
|
KEY=$(patsubst "%",$(srctree)/%,$(CONFIG_SYS_K3_KEY))
|
2018-11-02 14:21:04 +00:00
|
|
|
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
|
|
|
|
|
2019-05-02 10:05:51 +00:00
|
|
|
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)
|
2018-11-02 14:21:04 +00:00
|
|
|
|
2020-07-19 19:56:01 +00:00
|
|
|
INPUTS-y += tiboot3.bin
|
2018-11-02 14:21:04 +00:00
|
|
|
endif
|
|
|
|
|
2018-08-27 10:27:15 +00:00
|
|
|
ifdef CONFIG_ARM64
|
2020-07-01 18:09:40 +00:00
|
|
|
|
2019-04-12 16:54:46 +00:00
|
|
|
ifeq ($(CONFIG_TI_SECURE_DEVICE),y)
|
|
|
|
SPL_ITS := u-boot-spl-k3_HS.its
|
2020-07-01 18:09:40 +00:00
|
|
|
$(SPL_ITS): export IS_HS=1
|
2020-07-19 19:56:01 +00:00
|
|
|
INPUTS-y += tispl.bin_HS
|
2019-04-12 16:54:46 +00:00
|
|
|
else
|
2018-08-27 10:27:15 +00:00
|
|
|
SPL_ITS := u-boot-spl-k3.its
|
2020-07-19 19:56:01 +00:00
|
|
|
INPUTS-y += tispl.bin
|
2020-07-01 18:09:40 +00:00
|
|
|
endif
|
|
|
|
|
2020-08-05 17:14:16 +00:00
|
|
|
ifeq ($(CONFIG_SPL_OF_LIST),)
|
|
|
|
LIST_OF_DTB := $(CONFIG_DEFAULT_DEVICE_TREE)
|
|
|
|
else
|
|
|
|
LIST_OF_DTB := $(CONFIG_SPL_OF_LIST)
|
|
|
|
endif
|
|
|
|
|
2020-07-01 18:09:40 +00:00
|
|
|
quiet_cmd_k3_mkits = MKITS $@
|
|
|
|
cmd_k3_mkits = \
|
2018-08-27 10:27:15 +00:00
|
|
|
$(srctree)/tools/k3_fit_atf.sh \
|
2020-08-05 17:14:16 +00:00
|
|
|
$(patsubst %,$(obj)/dts/%.dtb,$(subst ",,$(LIST_OF_DTB))) > $@
|
2018-08-27 10:27:15 +00:00
|
|
|
|
2020-07-01 18:09:40 +00:00
|
|
|
$(SPL_ITS): FORCE
|
|
|
|
$(call cmd,k3_mkits)
|
2019-04-12 16:54:46 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
else
|
2018-08-27 10:27:15 +00:00
|
|
|
|
2019-04-12 16:54:46 +00:00
|
|
|
ifeq ($(CONFIG_TI_SECURE_DEVICE),y)
|
2020-07-19 19:56:01 +00:00
|
|
|
INPUTS-y += u-boot.img_HS
|
2018-08-27 10:27:15 +00:00
|
|
|
else
|
2020-07-19 19:56:01 +00:00
|
|
|
INPUTS-y += u-boot.img
|
2018-08-27 10:27:15 +00:00
|
|
|
endif
|
2019-04-12 16:54:46 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
include $(srctree)/arch/arm/mach-k3/config_secure.mk
|