blob: 9f6da2a49c00ca100553aec01fbf17a0970c88bb [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
chenduibmf2b143d2021-10-26 15:28:15 -050047WOF_TOOL = wof_data_xlator.pl
48WOF_BIN_OVERRIDE_LIST = wof_bins_for_override.txt
Klaus Heinrich Kiwid2551242020-07-16 16:59:04 -030049
Deb McLemoreb58b93b2022-11-10 16:19:36 -060050NEXT_EC=10
51IMAGE_TOKEN=--ecImg_10
52
53define build_ecImgs
54 $(eval SPD_FILES_TOKENED += $$(addprefix $(2) , $(1)))
55 $(eval NEXT_EC=$(shell echo $$(($(NEXT_EC)+10))))
56 $(eval IMAGE_TOKEN = --ecImg_$(NEXT_EC))
57endef
58
Klaus Heinrich Kiwid2551242020-07-16 16:59:04 -030059define RAINIER_2U_XML_FILTER_UNWANTED_ATTRIBUTES
60 chmod +x $(RAINIER_2U_XML_MRW_HB_TOOLS)/filter_out_unwanted_attributes.pl
61
62 $(RAINIER_2U_XML_MRW_HB_TOOLS)/filter_out_unwanted_attributes.pl \
63 --tgt-xml $(RAINIER_2U_XML_MRW_HB_TOOLS)/target_types_merged.xml \
64 --tgt-xml $(RAINIER_2U_XML_MRW_HB_TOOLS)/target_types_hb.xml \
65 --tgt-xml $(RAINIER_2U_XML_MRW_HB_TOOLS)/target_types_oppowervm.xml \
66 --tgt-xml $(RAINIER_2U_XML_MRW_HB_TOOLS)/target_types_openpower.xml \
67 --mrw-xml $(RAINIER_2U_XML_MRW_SCRATCH)/$(call qstrip, \
68 $(BR2_RAINIER_2U_XML_TARGETING_FILENAME))
69
70 cp $(call qstrip, $(RAINIER_2U_XML_MRW_SCRATCH)/$(BR2_RAINIER_2U_XML_TARGETING_FILENAME)).updated \
71 $(call qstrip,$(RAINIER_2U_XML_MRW_SCRATCH)/$(BR2_RAINIER_2U_XML_TARGETING_FILENAME))
72endef
73
74define RAINIER_2U_XML_BUILD_CMDS
75 # copy the machine xml where the common lives
76 $(INSTALL) -m 0644 -D $(@D)/$(call qstrip,$(BR2_RAINIER_2U_XML_FILENAME)) \
77 $(RAINIER_2U_XML_MRW_SCRATCH)/$(call qstrip,$(BR2_RAINIER_2U_XML_FILENAME))
78 $(INSTALL) -m 0644 -D $(@D)/$(call qstrip,$(BR2_RAINIER_2U_XML_BIOS_FILENAME)) \
79 $(RAINIER_2U_XML_MRW_SCRATCH)/$(call qstrip,$(BR2_RAINIER_2U_XML_BIOS_FILENAME))
chenduibmf2b143d2021-10-26 15:28:15 -050080 $(eval WOF_SETS_DIR = $$(patsubst %.xml,%.WofSetBins,$(call qstrip,$(BR2_RAINIER_2U_XML_FILENAME))))
81 $(eval WOF_SETS_TAR = $(WOF_SETS_DIR).tar.gz)
82 if [ -e $(@D)/$(call qstrip,$(WOF_SETS_TAR)) ]; then \
83 $(INSTALL) -m 0644 -D $(@D)/$(call qstrip,$(WOF_SETS_TAR)) \
84 $(RAINIER_2U_XML_MRW_SCRATCH)/$(call qstrip,$(WOF_SETS_TAR)); \
85 fi
Klaus Heinrich Kiwid2551242020-07-16 16:59:04 -030086
87 # generate the system mrw xml
88 perl -I $(RAINIER_2U_XML_MRW_HB_TOOLS) \
89 $(RAINIER_2U_XML_MRW_HB_TOOLS)/processMrw.pl -x \
Klaus Heinrich Kiwi02b26362021-01-04 10:13:25 -060090 $(call qstrip,$(RAINIER_2U_XML_MRW_SCRATCH)/$(BR2_RAINIER_2U_XML_FILENAME)) \
91 -o $(call qstrip,$(RAINIER_2U_XML_MRW_SCRATCH)/$(BR2_RAINIER_2U_XML_TARGETING_FILENAME))$
Klaus Heinrich Kiwid2551242020-07-16 16:59:04 -030092
93 $(if $(BR2_RAINIER_2U_XML_FILTER_UNWANTED_ATTRIBUTES), $(call RAINIER_2U_XML_FILTER_UNWANTED_ATTRIBUTES))
94
95 # merge in any system specific attributes, hostboot attributes
96 $(RAINIER_2U_XML_MRW_HB_TOOLS)/mergexml.sh \
97 $(call qstrip,$(RAINIER_2U_XML_MRW_SCRATCH)/$(BR2_RAINIER_2U_XML_SYSTEM_FILENAME)) \
98 $(RAINIER_2U_XML_MRW_HB_TOOLS)/attribute_types.xml \
99 $(RAINIER_2U_XML_MRW_HB_TOOLS)/attribute_types_hb.xml \
100 $(RAINIER_2U_XML_OPPOWERVM_ATTR_XML) \
101 $(RAINIER_2U_XML_MRW_HB_TOOLS)/attribute_types_openpower.xml \
102 $(RAINIER_2U_XML_MRW_HB_TOOLS)/target_types_merged.xml \
103 $(RAINIER_2U_XML_MRW_HB_TOOLS)/target_types_hb.xml \
104 $(RAINIER_2U_XML_OPPOWERVM_TARGET_XML) \
105 $(RAINIER_2U_XML_TARGET_TYPES_OPENPOWER_XML) \
106 $(call qstrip, \
107 $(RAINIER_2U_XML_MRW_SCRATCH)/$(BR2_RAINIER_2U_XML_TARGETING_FILENAME)) \
108 > $(RAINIER_2U_XML_MRW_HB_TOOLS)/$(call qstrip, \
109 $(BR2_RAINIER_2U_XML_TARGETING_FILENAME))_temporary_hb.hb.xml;
110
111 # creating the targeting binary
112 # XXX TODO: xmltohb.pl creates a 'targeting.bin' in the output directory, we want
113 # that file to be unique if we don't want to risk collisions on eventual
114 # parallel builds
115 $(RAINIER_2U_XML_MRW_HB_TOOLS)/xmltohb.pl \
116 --hb-xml-file=$(RAINIER_2U_XML_MRW_HB_TOOLS)/$(call qstrip, \
117 $(BR2_RAINIER_2U_XML_TARGETING_FILENAME))_temporary_hb.hb.xml \
118 --fapi-attributes-xml-file=$(RAINIER_2U_XML_MRW_HB_TOOLS)/fapiattrs.xml \
119 --src-output-dir=$(RAINIER_2U_XML_MRW_HB_TOOLS)/ \
120 --img-output-dir=$(RAINIER_2U_XML_MRW_HB_TOOLS)/ \
121 --vmm-consts-file=$(RAINIER_2U_XML_MRW_HB_TOOLS)/vmmconst.h --noshort-enums \
122 --bios-xml-file=$(RAINIER_2U_XML_BIOS_CONFIG_FILE) \
123 --bios-schema-file=$(RAINIER_2U_XML_BIOS_SCHEMA_FILE) \
124 --bios-output-file=$(RAINIER_2U_XML_BIOS_METADATA_FILE)
125
126 # Transform BIOS XML into Petitboot specific BIOS XML via the schema
127 xsltproc -o \
128 $(RAINIER_2U_XML_PETITBOOT_BIOS_METADATA_FILE) \
129 $(RAINIER_2U_XML_PETITBOOT_XSLT_FILE) \
130 $(RAINIER_2U_XML_BIOS_METADATA_FILE)
131
132 # Create the wofdata
chenduibmf2b143d2021-10-26 15:28:15 -0500133 if [ -e $(RAINIER_2U_XML_MRW_HB_TOOLS)/$(WOF_TOOL) ]; then \
134 chmod +x $(RAINIER_2U_XML_MRW_HB_TOOLS)/$(WOF_TOOL); \
Klaus Heinrich Kiwid2551242020-07-16 16:59:04 -0300135 fi
136
chenduibmf2b143d2021-10-26 15:28:15 -0500137 # Create WOF override image
138 $(eval WOF_OVERRIDE_BIN = $$(patsubst %.xml,%.wofdata,$(call qstrip,$(BR2_RAINIER_2U_XML_FILENAME))))
139 if [ -e $(RAINIER_2U_XML_MRW_SCRATCH)/$(WOF_SETS_TAR) ]; then \
140 rm $(RAINIER_2U_XML_MRW_SCRATCH)/$(WOF_OVERRIDE_BIN); \
141 cd $(RAINIER_2U_XML_MRW_SCRATCH) && mkdir $(WOF_SETS_DIR); \
142 cd $(RAINIER_2U_XML_MRW_SCRATCH)/$(WOF_SETS_DIR) && tar -xzvf $(RAINIER_2U_XML_MRW_SCRATCH)/$(WOF_SETS_TAR); \
143 cd $(RAINIER_2U_XML_MRW_SCRATCH)/$(WOF_SETS_DIR)/WofSetBins && ls | grep -i "\.bin" > $(WOF_BIN_OVERRIDE_LIST); \
144 cd $(RAINIER_2U_XML_MRW_SCRATCH)/$(WOF_SETS_DIR)/WofSetBins && $(RAINIER_2U_XML_MRW_HB_TOOLS)/$(WOF_TOOL) --create $(RAINIER_2U_XML_MRW_SCRATCH)/$(WOF_OVERRIDE_BIN) --combine $(RAINIER_2U_XML_MRW_SCRATCH)/$(WOF_SETS_DIR)/WofSetBins/$(WOF_BIN_OVERRIDE_LIST); \
chenduibmd09d0fe2022-03-24 03:49:39 -0500145 else \
146 cd $(RAINIER_2U_XML_MRW_SCRATCH) && dd if=/dev/zero of=$(WOF_OVERRIDE_BIN) bs=4096 count=1; \
chenduibmf2b143d2021-10-26 15:28:15 -0500147 fi
Klaus Heinrich Kiwid2551242020-07-16 16:59:04 -0300148
Deb McLemoreb58b93b2022-11-10 16:19:36 -0600149 $(eval PSPD_BIN = $$(patsubst %.xml,%.PSPD.bin,$(call qstrip,$(BR2_RAINIER_2U_XML_FILENAME))))
150 $(eval SPD_IMAGE_FILES = $$(wildcard $(RAINIER_2U_XML_MRW_SCRATCH)/*.pspddata*))
151
152 # Cleanup old PSPD.bin
153 if [ -e "$(RAINIER_2U_XML_MRW_SCRATCH)/$(PSPD_BIN)" ]; then \
154 rm $(RAINIER_2U_XML_MRW_SCRATCH)/$(PSPD_BIN); \
155 fi
156
157 $(foreach spd_image_file, $(SPD_IMAGE_FILES), \
158 $(call build_ecImgs,$(spd_image_file),$(IMAGE_TOKEN)))
159
160 # SPD_FILES_TOKENED is what is used as input for the --ecImg_'s to buildSPDImages.pl
161 #
162 # If SPD_FILES_TOKENED is empty we get zero SPD Images built (tocCount=0)
163 #
164 # SPD_ARG_ITEMS (will only output debug info if buildSPDImages.pl will result in tocCount more than zero)
165 $(foreach spd_arg, $(SPD_FILES_TOKENED), echo SPD_ARG_ITEMS $(spd_arg);)
166
167 # If we have SPD images the PSPD.bin will be built containing the data, otherwise we get PSPD.bin with all FF's
168 if [ -e "$(RAINIER_2U_XML_MRW_HB_TOOLS)/buildSPDImages.pl" ] && [ -n "$(SPD_IMAGE_FILES)" ]; then \
169 chmod +x $(RAINIER_2U_XML_MRW_HB_TOOLS)/buildSPDImages.pl; \
170 echo "*** RUNNING buildSPDImages.pl ***";\
171 $(RAINIER_2U_XML_MRW_HB_TOOLS)/buildSPDImages.pl --spdOutBin $(RAINIER_2U_XML_MRW_SCRATCH)/$(PSPD_BIN) $(SPD_FILES_TOKENED); \
172 fi
173
Klaus Heinrich Kiwid2551242020-07-16 16:59:04 -0300174 # Create the MEMD binary
175 if [ -e $(RAINIER_2U_XML_MRW_HB_TOOLS)/memd_creation.pl ]; then \
176 chmod +x $(RAINIER_2U_XML_MRW_HB_TOOLS)/memd_creation.pl; \
177 fi
178
179 if [ -d $(RAINIER_2U_XML_MRW_SCRATCH)/$(call qstrip, \
180 $(BR2_RAINIER_2U_XML_FILENAME:.xml=.memd_binaries)) ]; then \
181 $(RAINIER_2U_XML_MRW_HB_TOOLS)/memd_creation.pl \
182 -memd_dir $(RAINIER_2U_XML_MRW_SCRATCH)/$(call qstrip, \
183 $(BR2_RAINIER_2U_XML_FILENAME:.xml=.memd_binaries)) \
184 -memd_output $(RAINIER_2U_XML_MRW_SCRATCH)/$(call qstrip, \
185 $(BR2_RAINIER_2U_XML_FILENAME:.xml=.memd_output.dat)); \
186 fi
187
188endef
189
190define RAINIER_2U_XML_INSTALL_IMAGES_CMDS
191 mv $(RAINIER_2U_XML_MRW_HB_TOOLS)/targeting.bin $(call qstrip, \
192 $(RAINIER_2U_XML_MRW_HB_TOOLS)/$(BR2_RAINIER_2U_XML_TARGETING_BIN_FILENAME))
193 if [ -e $(RAINIER_2U_XML_MRW_HB_TOOLS)/targeting.bin.protected ]; then \
194 mv -v $(RAINIER_2U_XML_MRW_HB_TOOLS)/targeting.bin.protected \
195 $(call qstrip, \
196 $(RAINIER_2U_XML_MRW_HB_TOOLS)/$(BR2_RAINIER_2U_XML_TARGETING_BIN_FILENAME)).protected; \
197 fi
198 if [ -e $(RAINIER_2U_XML_MRW_HB_TOOLS)/targeting.bin.unprotected ]; then \
199 mv -v $(RAINIER_2U_XML_MRW_HB_TOOLS)/targeting.bin.unprotected \
200 $(call qstrip, \
201 $(RAINIER_2U_XML_MRW_HB_TOOLS)/$(BR2_RAINIER_2U_XML_TARGETING_BIN_FILENAME)).unprotected; \
202 fi
203endef
204
205define RAINIER_2U_XML_INSTALL_TARGET_CMDS
206 # Install Petitboot specific BIOS XML into initramfs's usr/share/ dir
207 $(INSTALL) -D -m 0644 \
208 $(RAINIER_2U_XML_PETITBOOT_BIOS_METADATA_FILE) \
209 $(RAINIER_2U_XML_PETITBOOT_BIOS_INITRAMFS_FILE)
210endef
211
212$(eval $(generic-package))