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