Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 1 | ################################################################################ |
| 2 | # rainier-2u-xml |
| 3 | # |
| 4 | ################################################################################ |
| 5 | |
| 6 | RAINIER_2U_XML_VERSION ?= $(call qstrip,$(BR2_RAINIER_2U_XML_VERSION)) |
| 7 | ifeq ($(BR2_RAINIER_2U_XML_GITHUB_PROJECT),y) |
| 8 | RAINIER_2U_XML_SITE = $(call github,open-power,$(BR2_RAINIER_2U_XML_GITHUB_PROJECT_VALUE),$(RAINIER_2U_XML_VERSION)) |
| 9 | else ifeq ($(BR2_RAINIER_2U_XML_CUSTOM_GIT),y) |
| 10 | RAINIER_2U_XML_SITE_METHOD = git |
| 11 | RAINIER_2U_XML_SITE = $(BR2_RAINIER_2U_XML_CUSTOM_GIT_VALUE) |
| 12 | endif |
| 13 | |
| 14 | RAINIER_2U_XML_LICENSE = Apache-2.0 |
| 15 | RAINIER_2U_XML_LICENSE_FILES = LICENSE |
| 16 | RAINIER_2U_XML_DEPENDENCIES += hostboot-p10 |
| 17 | |
| 18 | RAINIER_2U_XML_INSTALL_IMAGES = YES |
| 19 | RAINIER_2U_XML_INSTALL_TARGET = YES |
| 20 | |
| 21 | RAINIER_2U_XML_MRW_SCRATCH=$(STAGING_DIR)/openpower_mrw_scratch |
| 22 | RAINIER_2U_XML_MRW_HB_TOOLS=$(STAGING_DIR)/hostboot_build_images |
| 23 | |
| 24 | # Defines for BIOS metadata creation |
| 25 | RAINIER_2U_XML_BIOS_SCHEMA_FILE = $(RAINIER_2U_XML_MRW_HB_TOOLS)/bios.xsd |
| 26 | RAINIER_2U_XML_BIOS_CONFIG_FILE = \ |
| 27 | $(call qstrip,$(RAINIER_2U_XML_MRW_SCRATCH)/$(BR2_RAINIER_2U_XML_BIOS_FILENAME)) |
| 28 | RAINIER_2U_XML_BIOS_METADATA_FILE = \ |
| 29 | $(call qstrip,$(RAINIER_2U_XML_MRW_HB_TOOLS)/$(BR2_OPENPOWER_P10_CONFIG_NAME)_bios_metadata.xml) |
| 30 | RAINIER_2U_XML_PETITBOOT_XSLT_FILE = $(RAINIER_2U_XML_MRW_HB_TOOLS)/bios_metadata_petitboot.xslt |
| 31 | RAINIER_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. |
| 37 | RAINIER_2U_XML_PETITBOOT_BIOS_INITRAMFS_FILE = \ |
| 38 | $(TARGET_DIR)/usr/share/bios_metadata.xml |
| 39 | |
| 40 | ifeq ($(BR2_RAINIER_2U_XML_OPPOWERVM_ATTRIBUTES),y) |
| 41 | RAINIER_2U_XML_OPPOWERVM_ATTR_XML = $(RAINIER_2U_XML_MRW_HB_TOOLS)/attribute_types_oppowervm.xml |
| 42 | RAINIER_2U_XML_OPPOWERVM_TARGET_XML = $(RAINIER_2U_XML_MRW_HB_TOOLS)/target_types_oppowervm.xml |
| 43 | endif |
| 44 | ifeq ($(BR2_RAINIER_2U_XML_TARGET_TYPES_OPENPOWER_XML),y) |
| 45 | RAINIER_2U_XML_TARGET_TYPES_OPENPOWER_XML = $(RAINIER_2U_XML_MRW_HB_TOOLS)/target_types_openpower.xml |
| 46 | endif |
chenduibm | f2b143d | 2021-10-26 15:28:15 -0500 | [diff] [blame] | 47 | WOF_TOOL = wof_data_xlator.pl |
| 48 | WOF_BIN_OVERRIDE_LIST = wof_bins_for_override.txt |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 49 | |
Deb McLemore | b58b93b | 2022-11-10 16:19:36 -0600 | [diff] [blame] | 50 | NEXT_EC=10 |
| 51 | IMAGE_TOKEN=--ecImg_10 |
| 52 | |
| 53 | define 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)) |
| 57 | endef |
| 58 | |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 59 | define 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)) |
| 72 | endef |
| 73 | |
| 74 | define 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)) |
chenduibm | f2b143d | 2021-10-26 15:28:15 -0500 | [diff] [blame] | 80 | $(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 Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 86 | |
| 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 Kiwi | 02b2636 | 2021-01-04 10:13:25 -0600 | [diff] [blame] | 90 | $(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 Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 92 | |
| 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 |
chenduibm | f2b143d | 2021-10-26 15:28:15 -0500 | [diff] [blame] | 133 | if [ -e $(RAINIER_2U_XML_MRW_HB_TOOLS)/$(WOF_TOOL) ]; then \ |
| 134 | chmod +x $(RAINIER_2U_XML_MRW_HB_TOOLS)/$(WOF_TOOL); \ |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 135 | fi |
| 136 | |
chenduibm | f2b143d | 2021-10-26 15:28:15 -0500 | [diff] [blame] | 137 | # 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); \ |
chenduibm | d09d0fe | 2022-03-24 03:49:39 -0500 | [diff] [blame] | 145 | else \ |
| 146 | cd $(RAINIER_2U_XML_MRW_SCRATCH) && dd if=/dev/zero of=$(WOF_OVERRIDE_BIN) bs=4096 count=1; \ |
chenduibm | f2b143d | 2021-10-26 15:28:15 -0500 | [diff] [blame] | 147 | fi |
Klaus Heinrich Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 148 | |
Deb McLemore | b58b93b | 2022-11-10 16:19:36 -0600 | [diff] [blame] | 149 | $(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 Kiwi | d255124 | 2020-07-16 16:59:04 -0300 | [diff] [blame] | 174 | # 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 | |
| 188 | endef |
| 189 | |
| 190 | define 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 |
| 203 | endef |
| 204 | |
| 205 | define 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) |
| 210 | endef |
| 211 | |
| 212 | $(eval $(generic-package)) |