blob: 9b07cde12415c5add4777eb6b8db82ad7ec8990a [file] [log] [blame]
Klaus Heinrich Kiwid2551242020-07-16 16:59:04 -03001################################################################################
2# rainier-2u-xml
3#
4################################################################################
5
6RAINIER_2U_XML_VERSION ?= $(call qstrip,$(BR2_RAINIER_2U_XML_VERSION))
7ifeq ($(BR2_RAINIER_2U_XML_GITHUB_PROJECT),y)
8RAINIER_2U_XML_SITE = $(call github,open-power,$(BR2_RAINIER_2U_XML_GITHUB_PROJECT_VALUE),$(RAINIER_2U_XML_VERSION))
9else ifeq ($(BR2_RAINIER_2U_XML_CUSTOM_GIT),y)
10RAINIER_2U_XML_SITE_METHOD = git
11RAINIER_2U_XML_SITE = $(BR2_RAINIER_2U_XML_CUSTOM_GIT_VALUE)
12endif
13
14RAINIER_2U_XML_LICENSE = Apache-2.0
15RAINIER_2U_XML_LICENSE_FILES = LICENSE
16RAINIER_2U_XML_DEPENDENCIES += hostboot-p10
17
18RAINIER_2U_XML_INSTALL_IMAGES = YES
19RAINIER_2U_XML_INSTALL_TARGET = YES
20
21RAINIER_2U_XML_MRW_SCRATCH=$(STAGING_DIR)/openpower_mrw_scratch
22RAINIER_2U_XML_MRW_HB_TOOLS=$(STAGING_DIR)/hostboot_build_images
23
24# Defines for BIOS metadata creation
25RAINIER_2U_XML_BIOS_SCHEMA_FILE = $(RAINIER_2U_XML_MRW_HB_TOOLS)/bios.xsd
26RAINIER_2U_XML_BIOS_CONFIG_FILE = \
27 $(call qstrip,$(RAINIER_2U_XML_MRW_SCRATCH)/$(BR2_RAINIER_2U_XML_BIOS_FILENAME))
28RAINIER_2U_XML_BIOS_METADATA_FILE = \
29 $(call qstrip,$(RAINIER_2U_XML_MRW_HB_TOOLS)/$(BR2_OPENPOWER_P10_CONFIG_NAME)_bios_metadata.xml)
30RAINIER_2U_XML_PETITBOOT_XSLT_FILE = $(RAINIER_2U_XML_MRW_HB_TOOLS)/bios_metadata_petitboot.xslt
31RAINIER_2U_XML_PETITBOOT_BIOS_METADATA_FILE = \
32 $(call qstrip, \
33 $(RAINIER_2U_XML_MRW_HB_TOOLS)/$(BR2_OPENPOWER_P10_CONFIG_NAME)_bios_metadata_petitboot.xml)
34# XXX TODO: Figure out what to do with the bios_metadata.xml. Right now, the last xml
35# package file processed 'wins' and all previously processed xml packages are
36# overriden.
37RAINIER_2U_XML_PETITBOOT_BIOS_INITRAMFS_FILE = \
38 $(TARGET_DIR)/usr/share/bios_metadata.xml
39
40ifeq ($(BR2_RAINIER_2U_XML_OPPOWERVM_ATTRIBUTES),y)
41RAINIER_2U_XML_OPPOWERVM_ATTR_XML = $(RAINIER_2U_XML_MRW_HB_TOOLS)/attribute_types_oppowervm.xml
42RAINIER_2U_XML_OPPOWERVM_TARGET_XML = $(RAINIER_2U_XML_MRW_HB_TOOLS)/target_types_oppowervm.xml
43endif
44ifeq ($(BR2_RAINIER_2U_XML_TARGET_TYPES_OPENPOWER_XML),y)
45RAINIER_2U_XML_TARGET_TYPES_OPENPOWER_XML = $(RAINIER_2U_XML_MRW_HB_TOOLS)/target_types_openpower.xml
46endif
47
48define RAINIER_2U_XML_FILTER_UNWANTED_ATTRIBUTES
49 chmod +x $(RAINIER_2U_XML_MRW_HB_TOOLS)/filter_out_unwanted_attributes.pl
50
51 $(RAINIER_2U_XML_MRW_HB_TOOLS)/filter_out_unwanted_attributes.pl \
52 --tgt-xml $(RAINIER_2U_XML_MRW_HB_TOOLS)/target_types_merged.xml \
53 --tgt-xml $(RAINIER_2U_XML_MRW_HB_TOOLS)/target_types_hb.xml \
54 --tgt-xml $(RAINIER_2U_XML_MRW_HB_TOOLS)/target_types_oppowervm.xml \
55 --tgt-xml $(RAINIER_2U_XML_MRW_HB_TOOLS)/target_types_openpower.xml \
56 --mrw-xml $(RAINIER_2U_XML_MRW_SCRATCH)/$(call qstrip, \
57 $(BR2_RAINIER_2U_XML_TARGETING_FILENAME))
58
59 cp $(call qstrip, $(RAINIER_2U_XML_MRW_SCRATCH)/$(BR2_RAINIER_2U_XML_TARGETING_FILENAME)).updated \
60 $(call qstrip,$(RAINIER_2U_XML_MRW_SCRATCH)/$(BR2_RAINIER_2U_XML_TARGETING_FILENAME))
61endef
62
63define RAINIER_2U_XML_BUILD_CMDS
64 # copy the machine xml where the common lives
65 $(INSTALL) -m 0644 -D $(@D)/$(call qstrip,$(BR2_RAINIER_2U_XML_FILENAME)) \
66 $(RAINIER_2U_XML_MRW_SCRATCH)/$(call qstrip,$(BR2_RAINIER_2U_XML_FILENAME))
67 $(INSTALL) -m 0644 -D $(@D)/$(call qstrip,$(BR2_RAINIER_2U_XML_BIOS_FILENAME)) \
68 $(RAINIER_2U_XML_MRW_SCRATCH)/$(call qstrip,$(BR2_RAINIER_2U_XML_BIOS_FILENAME))
69
70 # generate the system mrw xml
71 perl -I $(RAINIER_2U_XML_MRW_HB_TOOLS) \
72 $(RAINIER_2U_XML_MRW_HB_TOOLS)/processMrw.pl -x \
Klaus Heinrich Kiwi02b26362021-01-04 10:13:25 -060073 $(call qstrip,$(RAINIER_2U_XML_MRW_SCRATCH)/$(BR2_RAINIER_2U_XML_FILENAME)) \
74 -o $(call qstrip,$(RAINIER_2U_XML_MRW_SCRATCH)/$(BR2_RAINIER_2U_XML_TARGETING_FILENAME))$
Klaus Heinrich Kiwid2551242020-07-16 16:59:04 -030075
76 $(if $(BR2_RAINIER_2U_XML_FILTER_UNWANTED_ATTRIBUTES), $(call RAINIER_2U_XML_FILTER_UNWANTED_ATTRIBUTES))
77
78 # merge in any system specific attributes, hostboot attributes
79 $(RAINIER_2U_XML_MRW_HB_TOOLS)/mergexml.sh \
80 $(call qstrip,$(RAINIER_2U_XML_MRW_SCRATCH)/$(BR2_RAINIER_2U_XML_SYSTEM_FILENAME)) \
81 $(RAINIER_2U_XML_MRW_HB_TOOLS)/attribute_types.xml \
82 $(RAINIER_2U_XML_MRW_HB_TOOLS)/attribute_types_hb.xml \
83 $(RAINIER_2U_XML_OPPOWERVM_ATTR_XML) \
84 $(RAINIER_2U_XML_MRW_HB_TOOLS)/attribute_types_openpower.xml \
85 $(RAINIER_2U_XML_MRW_HB_TOOLS)/target_types_merged.xml \
86 $(RAINIER_2U_XML_MRW_HB_TOOLS)/target_types_hb.xml \
87 $(RAINIER_2U_XML_OPPOWERVM_TARGET_XML) \
88 $(RAINIER_2U_XML_TARGET_TYPES_OPENPOWER_XML) \
89 $(call qstrip, \
90 $(RAINIER_2U_XML_MRW_SCRATCH)/$(BR2_RAINIER_2U_XML_TARGETING_FILENAME)) \
91 > $(RAINIER_2U_XML_MRW_HB_TOOLS)/$(call qstrip, \
92 $(BR2_RAINIER_2U_XML_TARGETING_FILENAME))_temporary_hb.hb.xml;
93
94 # creating the targeting binary
95 # XXX TODO: xmltohb.pl creates a 'targeting.bin' in the output directory, we want
96 # that file to be unique if we don't want to risk collisions on eventual
97 # parallel builds
98 $(RAINIER_2U_XML_MRW_HB_TOOLS)/xmltohb.pl \
99 --hb-xml-file=$(RAINIER_2U_XML_MRW_HB_TOOLS)/$(call qstrip, \
100 $(BR2_RAINIER_2U_XML_TARGETING_FILENAME))_temporary_hb.hb.xml \
101 --fapi-attributes-xml-file=$(RAINIER_2U_XML_MRW_HB_TOOLS)/fapiattrs.xml \
102 --src-output-dir=$(RAINIER_2U_XML_MRW_HB_TOOLS)/ \
103 --img-output-dir=$(RAINIER_2U_XML_MRW_HB_TOOLS)/ \
104 --vmm-consts-file=$(RAINIER_2U_XML_MRW_HB_TOOLS)/vmmconst.h --noshort-enums \
105 --bios-xml-file=$(RAINIER_2U_XML_BIOS_CONFIG_FILE) \
106 --bios-schema-file=$(RAINIER_2U_XML_BIOS_SCHEMA_FILE) \
107 --bios-output-file=$(RAINIER_2U_XML_BIOS_METADATA_FILE)
108
109 # Transform BIOS XML into Petitboot specific BIOS XML via the schema
110 xsltproc -o \
111 $(RAINIER_2U_XML_PETITBOOT_BIOS_METADATA_FILE) \
112 $(RAINIER_2U_XML_PETITBOOT_XSLT_FILE) \
113 $(RAINIER_2U_XML_BIOS_METADATA_FILE)
114
115 # Create the wofdata
116 if [ -e $(RAINIER_2U_XML_MRW_HB_TOOLS)/wof-tables-img ]; then \
117 chmod +x $(RAINIER_2U_XML_MRW_HB_TOOLS)/wof-tables-img; \
118 fi
119
120 if [ -d $(RAINIER_2U_XML_MRW_SCRATCH)/$(call qstrip, \
121 $(BR2_RAINIER_2U_XML_FILENAME:.xml=.wofdata)) ]; then \
122 $(RAINIER_2U_XML_MRW_HB_TOOLS)/wof-tables-img \
123 --create $(RAINIER_2U_XML_MRW_SCRATCH)/$(call qstrip, \
124 $(RAINIER_2U_XML_FILENAME:.xml=.wof_output)) \
125 $(RAINIER_2U_XML_MRW_SCRATCH)/$(call qstrip, \
126 $(BR2_RAINIER_2U_XML_FILENAME:.xml=wofdata)); \
127 fi
128
129 # Create the MEMD binary
130 if [ -e $(RAINIER_2U_XML_MRW_HB_TOOLS)/memd_creation.pl ]; then \
131 chmod +x $(RAINIER_2U_XML_MRW_HB_TOOLS)/memd_creation.pl; \
132 fi
133
134 if [ -d $(RAINIER_2U_XML_MRW_SCRATCH)/$(call qstrip, \
135 $(BR2_RAINIER_2U_XML_FILENAME:.xml=.memd_binaries)) ]; then \
136 $(RAINIER_2U_XML_MRW_HB_TOOLS)/memd_creation.pl \
137 -memd_dir $(RAINIER_2U_XML_MRW_SCRATCH)/$(call qstrip, \
138 $(BR2_RAINIER_2U_XML_FILENAME:.xml=.memd_binaries)) \
139 -memd_output $(RAINIER_2U_XML_MRW_SCRATCH)/$(call qstrip, \
140 $(BR2_RAINIER_2U_XML_FILENAME:.xml=.memd_output.dat)); \
141 fi
142
143endef
144
145define RAINIER_2U_XML_INSTALL_IMAGES_CMDS
146 mv $(RAINIER_2U_XML_MRW_HB_TOOLS)/targeting.bin $(call qstrip, \
147 $(RAINIER_2U_XML_MRW_HB_TOOLS)/$(BR2_RAINIER_2U_XML_TARGETING_BIN_FILENAME))
148 if [ -e $(RAINIER_2U_XML_MRW_HB_TOOLS)/targeting.bin.protected ]; then \
149 mv -v $(RAINIER_2U_XML_MRW_HB_TOOLS)/targeting.bin.protected \
150 $(call qstrip, \
151 $(RAINIER_2U_XML_MRW_HB_TOOLS)/$(BR2_RAINIER_2U_XML_TARGETING_BIN_FILENAME)).protected; \
152 fi
153 if [ -e $(RAINIER_2U_XML_MRW_HB_TOOLS)/targeting.bin.unprotected ]; then \
154 mv -v $(RAINIER_2U_XML_MRW_HB_TOOLS)/targeting.bin.unprotected \
155 $(call qstrip, \
156 $(RAINIER_2U_XML_MRW_HB_TOOLS)/$(BR2_RAINIER_2U_XML_TARGETING_BIN_FILENAME)).unprotected; \
157 fi
158endef
159
160define RAINIER_2U_XML_INSTALL_TARGET_CMDS
161 # Install Petitboot specific BIOS XML into initramfs's usr/share/ dir
162 $(INSTALL) -D -m 0644 \
163 $(RAINIER_2U_XML_PETITBOOT_BIOS_METADATA_FILE) \
164 $(RAINIER_2U_XML_PETITBOOT_BIOS_INITRAMFS_FILE)
165endef
166
167$(eval $(generic-package))