blob: d0e9a63b1b33aeb2ae4878ed3c3e650ef36b571b [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
50define RAINIER_2U_XML_FILTER_UNWANTED_ATTRIBUTES
51 chmod +x $(RAINIER_2U_XML_MRW_HB_TOOLS)/filter_out_unwanted_attributes.pl
52
53 $(RAINIER_2U_XML_MRW_HB_TOOLS)/filter_out_unwanted_attributes.pl \
54 --tgt-xml $(RAINIER_2U_XML_MRW_HB_TOOLS)/target_types_merged.xml \
55 --tgt-xml $(RAINIER_2U_XML_MRW_HB_TOOLS)/target_types_hb.xml \
56 --tgt-xml $(RAINIER_2U_XML_MRW_HB_TOOLS)/target_types_oppowervm.xml \
57 --tgt-xml $(RAINIER_2U_XML_MRW_HB_TOOLS)/target_types_openpower.xml \
58 --mrw-xml $(RAINIER_2U_XML_MRW_SCRATCH)/$(call qstrip, \
59 $(BR2_RAINIER_2U_XML_TARGETING_FILENAME))
60
61 cp $(call qstrip, $(RAINIER_2U_XML_MRW_SCRATCH)/$(BR2_RAINIER_2U_XML_TARGETING_FILENAME)).updated \
62 $(call qstrip,$(RAINIER_2U_XML_MRW_SCRATCH)/$(BR2_RAINIER_2U_XML_TARGETING_FILENAME))
63endef
64
65define RAINIER_2U_XML_BUILD_CMDS
66 # copy the machine xml where the common lives
67 $(INSTALL) -m 0644 -D $(@D)/$(call qstrip,$(BR2_RAINIER_2U_XML_FILENAME)) \
68 $(RAINIER_2U_XML_MRW_SCRATCH)/$(call qstrip,$(BR2_RAINIER_2U_XML_FILENAME))
69 $(INSTALL) -m 0644 -D $(@D)/$(call qstrip,$(BR2_RAINIER_2U_XML_BIOS_FILENAME)) \
70 $(RAINIER_2U_XML_MRW_SCRATCH)/$(call qstrip,$(BR2_RAINIER_2U_XML_BIOS_FILENAME))
chenduibmf2b143d2021-10-26 15:28:15 -050071 $(eval WOF_SETS_DIR = $$(patsubst %.xml,%.WofSetBins,$(call qstrip,$(BR2_RAINIER_2U_XML_FILENAME))))
72 $(eval WOF_SETS_TAR = $(WOF_SETS_DIR).tar.gz)
73 if [ -e $(@D)/$(call qstrip,$(WOF_SETS_TAR)) ]; then \
74 $(INSTALL) -m 0644 -D $(@D)/$(call qstrip,$(WOF_SETS_TAR)) \
75 $(RAINIER_2U_XML_MRW_SCRATCH)/$(call qstrip,$(WOF_SETS_TAR)); \
76 fi
Klaus Heinrich Kiwid2551242020-07-16 16:59:04 -030077
78 # generate the system mrw xml
79 perl -I $(RAINIER_2U_XML_MRW_HB_TOOLS) \
80 $(RAINIER_2U_XML_MRW_HB_TOOLS)/processMrw.pl -x \
Klaus Heinrich Kiwi02b26362021-01-04 10:13:25 -060081 $(call qstrip,$(RAINIER_2U_XML_MRW_SCRATCH)/$(BR2_RAINIER_2U_XML_FILENAME)) \
82 -o $(call qstrip,$(RAINIER_2U_XML_MRW_SCRATCH)/$(BR2_RAINIER_2U_XML_TARGETING_FILENAME))$
Klaus Heinrich Kiwid2551242020-07-16 16:59:04 -030083
84 $(if $(BR2_RAINIER_2U_XML_FILTER_UNWANTED_ATTRIBUTES), $(call RAINIER_2U_XML_FILTER_UNWANTED_ATTRIBUTES))
85
86 # merge in any system specific attributes, hostboot attributes
87 $(RAINIER_2U_XML_MRW_HB_TOOLS)/mergexml.sh \
88 $(call qstrip,$(RAINIER_2U_XML_MRW_SCRATCH)/$(BR2_RAINIER_2U_XML_SYSTEM_FILENAME)) \
89 $(RAINIER_2U_XML_MRW_HB_TOOLS)/attribute_types.xml \
90 $(RAINIER_2U_XML_MRW_HB_TOOLS)/attribute_types_hb.xml \
91 $(RAINIER_2U_XML_OPPOWERVM_ATTR_XML) \
92 $(RAINIER_2U_XML_MRW_HB_TOOLS)/attribute_types_openpower.xml \
93 $(RAINIER_2U_XML_MRW_HB_TOOLS)/target_types_merged.xml \
94 $(RAINIER_2U_XML_MRW_HB_TOOLS)/target_types_hb.xml \
95 $(RAINIER_2U_XML_OPPOWERVM_TARGET_XML) \
96 $(RAINIER_2U_XML_TARGET_TYPES_OPENPOWER_XML) \
97 $(call qstrip, \
98 $(RAINIER_2U_XML_MRW_SCRATCH)/$(BR2_RAINIER_2U_XML_TARGETING_FILENAME)) \
99 > $(RAINIER_2U_XML_MRW_HB_TOOLS)/$(call qstrip, \
100 $(BR2_RAINIER_2U_XML_TARGETING_FILENAME))_temporary_hb.hb.xml;
101
102 # creating the targeting binary
103 # XXX TODO: xmltohb.pl creates a 'targeting.bin' in the output directory, we want
104 # that file to be unique if we don't want to risk collisions on eventual
105 # parallel builds
106 $(RAINIER_2U_XML_MRW_HB_TOOLS)/xmltohb.pl \
107 --hb-xml-file=$(RAINIER_2U_XML_MRW_HB_TOOLS)/$(call qstrip, \
108 $(BR2_RAINIER_2U_XML_TARGETING_FILENAME))_temporary_hb.hb.xml \
109 --fapi-attributes-xml-file=$(RAINIER_2U_XML_MRW_HB_TOOLS)/fapiattrs.xml \
110 --src-output-dir=$(RAINIER_2U_XML_MRW_HB_TOOLS)/ \
111 --img-output-dir=$(RAINIER_2U_XML_MRW_HB_TOOLS)/ \
112 --vmm-consts-file=$(RAINIER_2U_XML_MRW_HB_TOOLS)/vmmconst.h --noshort-enums \
113 --bios-xml-file=$(RAINIER_2U_XML_BIOS_CONFIG_FILE) \
114 --bios-schema-file=$(RAINIER_2U_XML_BIOS_SCHEMA_FILE) \
115 --bios-output-file=$(RAINIER_2U_XML_BIOS_METADATA_FILE)
116
117 # Transform BIOS XML into Petitboot specific BIOS XML via the schema
118 xsltproc -o \
119 $(RAINIER_2U_XML_PETITBOOT_BIOS_METADATA_FILE) \
120 $(RAINIER_2U_XML_PETITBOOT_XSLT_FILE) \
121 $(RAINIER_2U_XML_BIOS_METADATA_FILE)
122
123 # Create the wofdata
chenduibmf2b143d2021-10-26 15:28:15 -0500124 if [ -e $(RAINIER_2U_XML_MRW_HB_TOOLS)/$(WOF_TOOL) ]; then \
125 chmod +x $(RAINIER_2U_XML_MRW_HB_TOOLS)/$(WOF_TOOL); \
Klaus Heinrich Kiwid2551242020-07-16 16:59:04 -0300126 fi
127
chenduibmf2b143d2021-10-26 15:28:15 -0500128 # Create WOF override image
129 $(eval WOF_OVERRIDE_BIN = $$(patsubst %.xml,%.wofdata,$(call qstrip,$(BR2_RAINIER_2U_XML_FILENAME))))
130 if [ -e $(RAINIER_2U_XML_MRW_SCRATCH)/$(WOF_SETS_TAR) ]; then \
131 rm $(RAINIER_2U_XML_MRW_SCRATCH)/$(WOF_OVERRIDE_BIN); \
132 cd $(RAINIER_2U_XML_MRW_SCRATCH) && mkdir $(WOF_SETS_DIR); \
133 cd $(RAINIER_2U_XML_MRW_SCRATCH)/$(WOF_SETS_DIR) && tar -xzvf $(RAINIER_2U_XML_MRW_SCRATCH)/$(WOF_SETS_TAR); \
134 cd $(RAINIER_2U_XML_MRW_SCRATCH)/$(WOF_SETS_DIR)/WofSetBins && ls | grep -i "\.bin" > $(WOF_BIN_OVERRIDE_LIST); \
135 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); \
136 fi
Klaus Heinrich Kiwid2551242020-07-16 16:59:04 -0300137
138 # Create the MEMD binary
139 if [ -e $(RAINIER_2U_XML_MRW_HB_TOOLS)/memd_creation.pl ]; then \
140 chmod +x $(RAINIER_2U_XML_MRW_HB_TOOLS)/memd_creation.pl; \
141 fi
142
143 if [ -d $(RAINIER_2U_XML_MRW_SCRATCH)/$(call qstrip, \
144 $(BR2_RAINIER_2U_XML_FILENAME:.xml=.memd_binaries)) ]; then \
145 $(RAINIER_2U_XML_MRW_HB_TOOLS)/memd_creation.pl \
146 -memd_dir $(RAINIER_2U_XML_MRW_SCRATCH)/$(call qstrip, \
147 $(BR2_RAINIER_2U_XML_FILENAME:.xml=.memd_binaries)) \
148 -memd_output $(RAINIER_2U_XML_MRW_SCRATCH)/$(call qstrip, \
149 $(BR2_RAINIER_2U_XML_FILENAME:.xml=.memd_output.dat)); \
150 fi
151
152endef
153
154define RAINIER_2U_XML_INSTALL_IMAGES_CMDS
155 mv $(RAINIER_2U_XML_MRW_HB_TOOLS)/targeting.bin $(call qstrip, \
156 $(RAINIER_2U_XML_MRW_HB_TOOLS)/$(BR2_RAINIER_2U_XML_TARGETING_BIN_FILENAME))
157 if [ -e $(RAINIER_2U_XML_MRW_HB_TOOLS)/targeting.bin.protected ]; then \
158 mv -v $(RAINIER_2U_XML_MRW_HB_TOOLS)/targeting.bin.protected \
159 $(call qstrip, \
160 $(RAINIER_2U_XML_MRW_HB_TOOLS)/$(BR2_RAINIER_2U_XML_TARGETING_BIN_FILENAME)).protected; \
161 fi
162 if [ -e $(RAINIER_2U_XML_MRW_HB_TOOLS)/targeting.bin.unprotected ]; then \
163 mv -v $(RAINIER_2U_XML_MRW_HB_TOOLS)/targeting.bin.unprotected \
164 $(call qstrip, \
165 $(RAINIER_2U_XML_MRW_HB_TOOLS)/$(BR2_RAINIER_2U_XML_TARGETING_BIN_FILENAME)).unprotected; \
166 fi
167endef
168
169define RAINIER_2U_XML_INSTALL_TARGET_CMDS
170 # Install Petitboot specific BIOS XML into initramfs's usr/share/ dir
171 $(INSTALL) -D -m 0644 \
172 $(RAINIER_2U_XML_PETITBOOT_BIOS_METADATA_FILE) \
173 $(RAINIER_2U_XML_PETITBOOT_BIOS_INITRAMFS_FILE)
174endef
175
176$(eval $(generic-package))