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