Stewart Smith | cd986e4 | 2017-05-15 12:14:59 +1000 | [diff] [blame] | 1 | ################################################################################ |
| 2 | # machine_xml |
| 3 | # |
| 4 | ################################################################################ |
| 5 | |
Stewart Smith | 45ad99b | 2017-05-23 17:40:42 +1000 | [diff] [blame] | 6 | MACHINE_XML_VERSION ?= $(call qstrip,$(BR2_OPENPOWER_MACHINE_XML_VERSION)) |
Stewart Smith | cd986e4 | 2017-05-15 12:14:59 +1000 | [diff] [blame] | 7 | ifeq ($(BR2_OPENPOWER_MACHINE_XML_GITHUB_PROJECT),y) |
| 8 | MACHINE_XML_SITE = $(call github,open-power,$(BR2_OPENPOWER_MACHINE_XML_GITHUB_PROJECT_VALUE),$(MACHINE_XML_VERSION)) |
| 9 | else ifeq ($(BR2_OPENPOWER_MACHINE_XML_CUSTOM_GIT),y) |
| 10 | MACHINE_XML_SITE_METHOD = git |
| 11 | MACHINE_XML_SITE = $(BR2_OPENPOWER_MACHINE_XML_CUSTOM_GIT_VALUE) |
| 12 | endif |
| 13 | |
| 14 | MACHINE_XML_LICENSE = Apache-2.0 |
| 15 | MACHINE_XML_LICENSE_FILES = LICENSE |
| 16 | MACHINE_XML_DEPENDENCIES = hostboot openpower-mrw common-p8-xml |
| 17 | |
| 18 | MACHINE_XML_INSTALL_IMAGES = YES |
| 19 | MACHINE_XML_INSTALL_TARGET = YES |
| 20 | |
| 21 | MRW_SCRATCH=$(STAGING_DIR)/openpower_mrw_scratch |
| 22 | MRW_HB_TOOLS=$(STAGING_DIR)/hostboot_build_images |
| 23 | |
| 24 | # Defines for BIOS metadata creation |
| 25 | BIOS_SCHEMA_FILE = $(MRW_HB_TOOLS)/bios.xsd |
| 26 | OPENPOWER_BIOS_XML_CONFIG_FILE = $(MRW_SCRATCH)/$(BR2_OPENPOWER_BIOS_XML_FILENAME) |
| 27 | BIOS_XML_METADATA_FILE = \ |
| 28 | $(MRW_HB_TOOLS)/$(BR2_OPENPOWER_CONFIG_NAME)_bios_metadata.xml |
| 29 | PETITBOOT_XSLT_FILE = $(MRW_HB_TOOLS)/bios_metadata_petitboot.xslt |
| 30 | PETITBOOT_BIOS_XML_METADATA_FILE = \ |
| 31 | $(MRW_HB_TOOLS)/$(BR2_OPENPOWER_CONFIG_NAME)_bios_metadata_petitboot.xml |
| 32 | PETITBOOT_BIOS_XML_METADATA_INITRAMFS_FILE = \ |
| 33 | $(TARGET_DIR)/usr/share/bios_metadata.xml |
| 34 | |
Elizabeth Liner | d1a29c1 | 2017-05-15 18:03:21 -0500 | [diff] [blame] | 35 | WOFDATA_FILE = `ls $(MRW_SCRATCH)/wofdata` |
| 36 | |
Stewart Smith | cd986e4 | 2017-05-15 12:14:59 +1000 | [diff] [blame] | 37 | ifeq ($(BR2_OPENPOWER_MACHINE_XML_OPPOWERVM_ATTRIBUTES),y) |
| 38 | MACHINE_XML_OPPOWERVM_ATTR_XML = $(MRW_HB_TOOLS)/attribute_types_oppowervm.xml |
| 39 | MACHINE_XML_OPPOWERVM_TARGET_XML = $(MRW_HB_TOOLS)/target_types_oppowervm.xml |
| 40 | endif |
| 41 | ifeq ($(BR2_OPENPOWER_MACHINE_XML_TARGET_TYPES_OPENPOWER_XML),y) |
| 42 | MACHINE_XML_TARGET_TYPES_OPENPOWER_XML = $(MRW_HB_TOOLS)/target_types_openpower.xml |
| 43 | endif |
| 44 | |
| 45 | define MACHINE_XML_FILTER_UNWANTED_ATTRIBUTES |
| 46 | chmod +x $(MRW_HB_TOOLS)/filter_out_unwanted_attributes.pl |
| 47 | |
| 48 | $(MRW_HB_TOOLS)/filter_out_unwanted_attributes.pl \ |
| 49 | --tgt-xml $(MRW_HB_TOOLS)/target_types_merged.xml \ |
| 50 | --tgt-xml $(MRW_HB_TOOLS)/target_types_hb.xml \ |
| 51 | --tgt-xml $(MRW_HB_TOOLS)/target_types_oppowervm.xml \ |
| 52 | --tgt-xml $(MRW_HB_TOOLS)/target_types_openpower.xml \ |
| 53 | --mrw-xml $(MRW_SCRATCH)/$(BR2_OPENPOWER_MRW_XML_FILENAME) |
| 54 | |
| 55 | cp $(MRW_SCRATCH)/$(BR2_OPENPOWER_MRW_XML_FILENAME).updated $(MRW_SCRATCH)/$(BR2_OPENPOWER_MRW_XML_FILENAME) |
| 56 | endef |
| 57 | |
| 58 | define MACHINE_XML_BUILD_CMDS |
| 59 | # copy the machine xml where the common lives |
| 60 | bash -c 'mkdir -p $(MRW_SCRATCH) && cp -r $(@D)/* $(MRW_SCRATCH)' |
| 61 | |
| 62 | # generate the system mrw xml |
| 63 | perl -I $(MRW_HB_TOOLS) \ |
| 64 | $(MRW_HB_TOOLS)/processMrw.pl -x $(MRW_SCRATCH)/$(BR2_OPENPOWER_MACHINE_XML_FILENAME) |
| 65 | |
| 66 | $(if $(BR2_OPENPOWER_MACHINE_XML_FILTER_UNWANTED_ATTRIBUTES), $(call MACHINE_XML_FILTER_UNWANTED_ATTRIBUTES)) |
| 67 | |
| 68 | # merge in any system specific attributes, hostboot attributes |
| 69 | $(MRW_HB_TOOLS)/mergexml.sh $(MRW_SCRATCH)/$(BR2_OPENPOWER_SYSTEM_XML_FILENAME) \ |
| 70 | $(MRW_HB_TOOLS)/attribute_types.xml \ |
| 71 | $(MRW_HB_TOOLS)/attribute_types_hb.xml \ |
| 72 | $(MACHINE_XML_OPPOWERVM_ATTR_XML) \ |
| 73 | $(MRW_HB_TOOLS)/attribute_types_openpower.xml \ |
| 74 | $(MRW_HB_TOOLS)/target_types_merged.xml \ |
| 75 | $(MRW_HB_TOOLS)/target_types_hb.xml \ |
| 76 | $(MACHINE_XML_OPPOWERVM_TARGET_XML) \ |
| 77 | $(MACHINE_XML_TARGET_TYPES_OPENPOWER_XML) \ |
| 78 | $(MRW_SCRATCH)/$(BR2_OPENPOWER_MRW_XML_FILENAME) > $(MRW_HB_TOOLS)/temporary_hb.hb.xml; |
| 79 | |
| 80 | # creating the targeting binary |
| 81 | $(MRW_HB_TOOLS)/xmltohb.pl \ |
| 82 | --hb-xml-file=$(MRW_HB_TOOLS)/temporary_hb.hb.xml \ |
| 83 | --fapi-attributes-xml-file=$(MRW_HB_TOOLS)/fapiattrs.xml \ |
Prachi Gupta | fa13cc4 | 2017-06-28 00:29:03 -0500 | [diff] [blame] | 84 | --src-output-dir=$(MRW_HB_TOOLS)/ \ |
Stewart Smith | cd986e4 | 2017-05-15 12:14:59 +1000 | [diff] [blame] | 85 | --img-output-dir=$(MRW_HB_TOOLS)/ \ |
| 86 | --vmm-consts-file=$(MRW_HB_TOOLS)/vmmconst.h --noshort-enums \ |
| 87 | --bios-xml-file=$(OPENPOWER_BIOS_XML_CONFIG_FILE) \ |
| 88 | --bios-schema-file=$(BIOS_SCHEMA_FILE) \ |
| 89 | --bios-output-file=$(BIOS_XML_METADATA_FILE) |
| 90 | |
| 91 | # Transform BIOS XML into Petitboot specific BIOS XML via the schema |
| 92 | xsltproc -o \ |
| 93 | $(PETITBOOT_BIOS_XML_METADATA_FILE) \ |
| 94 | $(PETITBOOT_XSLT_FILE) \ |
| 95 | $(BIOS_XML_METADATA_FILE) |
Elizabeth Liner | d1a29c1 | 2017-05-15 18:03:21 -0500 | [diff] [blame] | 96 | |
| 97 | # Create the wofdata |
| 98 | if [ -e $(MRW_HB_TOOLS)/wof-tables-img ]; then \ |
| 99 | chmod +x $(MRW_HB_TOOLS)/wof-tables-img; \ |
| 100 | fi |
Elizabeth Liner | 02c8819 | 2017-08-10 23:50:34 -0500 | [diff] [blame^] | 101 | |
| 102 | if [ -d $(MRW_SCRATCH)/wofdata ]; then \ |
| 103 | $(MRW_HB_TOOLS)/wof-tables-img --create $(MRW_SCRATCH)/wof_output $(MRW_SCRATCH)/wofdata; \ |
Elizabeth Liner | d1a29c1 | 2017-05-15 18:03:21 -0500 | [diff] [blame] | 104 | fi |
| 105 | |
Elizabeth Liner | 02c8819 | 2017-08-10 23:50:34 -0500 | [diff] [blame^] | 106 | # Create the MEMD binary |
| 107 | if [ -e $(MRW_HB_TOOLS)/memd_creation.pl ]; then \ |
| 108 | chmod +x $(MRW_HB_TOOLS)/memd_creation.pl; \ |
| 109 | fi |
Elizabeth Liner | d1a29c1 | 2017-05-15 18:03:21 -0500 | [diff] [blame] | 110 | |
Elizabeth Liner | 02c8819 | 2017-08-10 23:50:34 -0500 | [diff] [blame^] | 111 | if [ -d $(MRW_SCRATCH)/memd_binaries ]; then \ |
| 112 | $(MRW_HB_TOOLS)/memd_creation.pl -memd_dir $(MRW_SCRATCH)/memd_binaries -memd_output $(MRW_SCRATCH)/memd_output.dat; \ |
| 113 | fi |
Elizabeth Liner | d1a29c1 | 2017-05-15 18:03:21 -0500 | [diff] [blame] | 114 | |
Stewart Smith | cd986e4 | 2017-05-15 12:14:59 +1000 | [diff] [blame] | 115 | endef |
| 116 | |
| 117 | define MACHINE_XML_INSTALL_IMAGES_CMDS |
| 118 | mv $(MRW_HB_TOOLS)/targeting.bin $(MRW_HB_TOOLS)/$(BR2_OPENPOWER_TARGETING_BIN_FILENAME) |
| 119 | endef |
| 120 | |
| 121 | define MACHINE_XML_INSTALL_TARGET_CMDS |
| 122 | # Install Petitboot specific BIOS XML into initramfs's usr/share/ dir |
| 123 | $(INSTALL) -D -m 0644 \ |
| 124 | $(PETITBOOT_BIOS_XML_METADATA_FILE) \ |
| 125 | $(PETITBOOT_BIOS_XML_METADATA_INITRAMFS_FILE) |
| 126 | endef |
| 127 | |
| 128 | $(eval $(generic-package)) |