xref: /OK3568_Linux_fs/buildroot/package/qoriq-rcw/qoriq-rcw.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1################################################################################
2#
3# qoriq-rcw
4#
5################################################################################
6
7QORIQ_RCW_VERSION = LSDK-20.12
8QORIQ_RCW_SITE = https://source.codeaurora.org/external/qoriq/qoriq-components/rcw
9QORIQ_RCW_SITE_METHOD = git
10QORIQ_RCW_LICENSE = BSD-3-Clause
11QORIQ_RCW_LICENSE_FILES = LICENSE
12
13HOST_QORIQ_RCW_DEPENDENCIES = $(BR2_PYTHON3_HOST_DEPENDENCY)
14
15QORIQ_RCW_FILES = $(call qstrip,$(BR2_PACKAGE_HOST_QORIQ_RCW_CUSTOM_PATH))
16
17ifneq ($(QORIQ_RCW_FILES),)
18QORIQ_RCW_INCLUDES = $(filter-out %.rcw,$(QORIQ_RCW_FILES))
19# Get the name of the custom rcw file from the custom list
20QORIQ_RCW_PROJECT = $(notdir $(filter %.rcw,$(QORIQ_RCW_FILES)))
21
22# Error if there are no or more than one .rcw file
23ifeq ($(BR_BUILDING),y)
24ifneq ($(words $(QORIQ_RCW_PROJECT)),1)
25$(error BR2_PACKAGE_HOST_QORIQ_RCW_CUSTOM_PATH must have exactly one .rcw file)
26endif
27endif
28
29ifneq ($(QORIQ_RCW_INCLUDES),)
30define HOST_QORIQ_RCW_ADD_CUSTOM_RCW_INCLUDES
31	mkdir -p $(@D)/custom_board
32	cp -f $(QORIQ_RCW_INCLUDES) $(@D)/custom_board
33endef
34HOST_QORIQ_RCW_POST_PATCH_HOOKS += HOST_QORIQ_RCW_ADD_CUSTOM_RCW_INCLUDES
35endif
36
37define HOST_QORIQ_RCW_ADD_CUSTOM_RCW_FILES
38	mkdir -p $(@D)/custom_board/rcw
39	cp -f $(filter %.rcw,$(QORIQ_RCW_FILES)) $(@D)/custom_board/rcw
40endef
41HOST_QORIQ_RCW_POST_PATCH_HOOKS += HOST_QORIQ_RCW_ADD_CUSTOM_RCW_FILES
42
43# rcw.py is a python3-only script, and we can be using either the
44# system-provided python3, or our own built with host-python3.
45# Fortunately, rcw.py uses #!/usr/bin/env python3, so it will
46# easily find it from PATH.
47define HOST_QORIQ_RCW_BUILD_CMDS
48	PATH=$(BR_PATH) \
49	$(@D)/rcw.py \
50		-i $(@D)/custom_board/rcw/$(QORIQ_RCW_PROJECT) \
51		-I $(@D)/custom_board -o $(@D)/PBL.bin
52endef
53
54define HOST_QORIQ_RCW_INSTALL_DELIVERY_FILE
55	$(INSTALL) -D -m 0644 $(@D)/PBL.bin $(BINARIES_DIR)/PBL.bin
56endef
57endif
58
59# Copy source files and script into $(HOST_DIR)/share/rcw/ so a developer
60# could use a post image or SDK to build/install PBL files.
61define HOST_QORIQ_RCW_INSTALL_CMDS
62	mkdir -p $(HOST_DIR)/share/rcw
63	cp -a $(@D)/* $(HOST_DIR)/share/rcw
64	$(HOST_QORIQ_RCW_INSTALL_DELIVERY_FILE)
65endef
66
67$(eval $(host-generic-package))
68