blob: cca8630a71b03ffceb0fe66742c5faf42182f8ae [file] [log] [blame]
Stewart Smithcd986e42017-05-15 12:14:59 +10001################################################################################
2# machine_xml
3#
4################################################################################
5
Stewart Smith45ad99b2017-05-23 17:40:42 +10006MACHINE_XML_VERSION ?= $(call qstrip,$(BR2_OPENPOWER_MACHINE_XML_VERSION))
Stewart Smithcd986e42017-05-15 12:14:59 +10007ifeq ($(BR2_OPENPOWER_MACHINE_XML_GITHUB_PROJECT),y)
8MACHINE_XML_SITE = $(call github,open-power,$(BR2_OPENPOWER_MACHINE_XML_GITHUB_PROJECT_VALUE),$(MACHINE_XML_VERSION))
9else ifeq ($(BR2_OPENPOWER_MACHINE_XML_CUSTOM_GIT),y)
10MACHINE_XML_SITE_METHOD = git
11MACHINE_XML_SITE = $(BR2_OPENPOWER_MACHINE_XML_CUSTOM_GIT_VALUE)
12endif
13
14MACHINE_XML_LICENSE = Apache-2.0
15MACHINE_XML_LICENSE_FILES = LICENSE
Brandon Bergrenf714d762018-09-20 23:58:50 +000016MACHINE_XML_DEPENDENCIES =
Stewart Smith03671c02017-02-17 14:57:57 +110017
18ifeq ($(BR2_OPENPOWER_POWER9),y)
19MACHINE_XML_DEPENDENCIES += hostboot
20endif
Stewart Smithcd986e42017-05-15 12:14:59 +100021
22MACHINE_XML_INSTALL_IMAGES = YES
23MACHINE_XML_INSTALL_TARGET = YES
24
25MRW_SCRATCH=$(STAGING_DIR)/openpower_mrw_scratch
26MRW_HB_TOOLS=$(STAGING_DIR)/hostboot_build_images
27
28# Defines for BIOS metadata creation
29BIOS_SCHEMA_FILE = $(MRW_HB_TOOLS)/bios.xsd
30OPENPOWER_BIOS_XML_CONFIG_FILE = $(MRW_SCRATCH)/$(BR2_OPENPOWER_BIOS_XML_FILENAME)
31BIOS_XML_METADATA_FILE = \
32 $(MRW_HB_TOOLS)/$(BR2_OPENPOWER_CONFIG_NAME)_bios_metadata.xml
33PETITBOOT_XSLT_FILE = $(MRW_HB_TOOLS)/bios_metadata_petitboot.xslt
34PETITBOOT_BIOS_XML_METADATA_FILE = \
35 $(MRW_HB_TOOLS)/$(BR2_OPENPOWER_CONFIG_NAME)_bios_metadata_petitboot.xml
36PETITBOOT_BIOS_XML_METADATA_INITRAMFS_FILE = \
37 $(TARGET_DIR)/usr/share/bios_metadata.xml
38
Elizabeth Linerd1a29c12017-05-15 18:03:21 -050039WOFDATA_FILE = `ls $(MRW_SCRATCH)/wofdata`
40
Stewart Smithcd986e42017-05-15 12:14:59 +100041ifeq ($(BR2_OPENPOWER_MACHINE_XML_OPPOWERVM_ATTRIBUTES),y)
42MACHINE_XML_OPPOWERVM_ATTR_XML = $(MRW_HB_TOOLS)/attribute_types_oppowervm.xml
43MACHINE_XML_OPPOWERVM_TARGET_XML = $(MRW_HB_TOOLS)/target_types_oppowervm.xml
44endif
45ifeq ($(BR2_OPENPOWER_MACHINE_XML_TARGET_TYPES_OPENPOWER_XML),y)
46MACHINE_XML_TARGET_TYPES_OPENPOWER_XML = $(MRW_HB_TOOLS)/target_types_openpower.xml
47endif
48
49define MACHINE_XML_FILTER_UNWANTED_ATTRIBUTES
50 chmod +x $(MRW_HB_TOOLS)/filter_out_unwanted_attributes.pl
51
52 $(MRW_HB_TOOLS)/filter_out_unwanted_attributes.pl \
53 --tgt-xml $(MRW_HB_TOOLS)/target_types_merged.xml \
54 --tgt-xml $(MRW_HB_TOOLS)/target_types_hb.xml \
55 --tgt-xml $(MRW_HB_TOOLS)/target_types_oppowervm.xml \
56 --tgt-xml $(MRW_HB_TOOLS)/target_types_openpower.xml \
57 --mrw-xml $(MRW_SCRATCH)/$(BR2_OPENPOWER_MRW_XML_FILENAME)
58
59 cp $(MRW_SCRATCH)/$(BR2_OPENPOWER_MRW_XML_FILENAME).updated $(MRW_SCRATCH)/$(BR2_OPENPOWER_MRW_XML_FILENAME)
60endef
61
62define MACHINE_XML_BUILD_CMDS
63 # copy the machine xml where the common lives
64 bash -c 'mkdir -p $(MRW_SCRATCH) && cp -r $(@D)/* $(MRW_SCRATCH)'
65
66 # generate the system mrw xml
67 perl -I $(MRW_HB_TOOLS) \
68 $(MRW_HB_TOOLS)/processMrw.pl -x $(MRW_SCRATCH)/$(BR2_OPENPOWER_MACHINE_XML_FILENAME)
69
70 $(if $(BR2_OPENPOWER_MACHINE_XML_FILTER_UNWANTED_ATTRIBUTES), $(call MACHINE_XML_FILTER_UNWANTED_ATTRIBUTES))
71
72 # merge in any system specific attributes, hostboot attributes
73 $(MRW_HB_TOOLS)/mergexml.sh $(MRW_SCRATCH)/$(BR2_OPENPOWER_SYSTEM_XML_FILENAME) \
74 $(MRW_HB_TOOLS)/attribute_types.xml \
75 $(MRW_HB_TOOLS)/attribute_types_hb.xml \
76 $(MACHINE_XML_OPPOWERVM_ATTR_XML) \
77 $(MRW_HB_TOOLS)/attribute_types_openpower.xml \
78 $(MRW_HB_TOOLS)/target_types_merged.xml \
79 $(MRW_HB_TOOLS)/target_types_hb.xml \
80 $(MACHINE_XML_OPPOWERVM_TARGET_XML) \
81 $(MACHINE_XML_TARGET_TYPES_OPENPOWER_XML) \
82 $(MRW_SCRATCH)/$(BR2_OPENPOWER_MRW_XML_FILENAME) > $(MRW_HB_TOOLS)/temporary_hb.hb.xml;
83
84 # creating the targeting binary
85 $(MRW_HB_TOOLS)/xmltohb.pl \
86 --hb-xml-file=$(MRW_HB_TOOLS)/temporary_hb.hb.xml \
87 --fapi-attributes-xml-file=$(MRW_HB_TOOLS)/fapiattrs.xml \
Prachi Guptafa13cc42017-06-28 00:29:03 -050088 --src-output-dir=$(MRW_HB_TOOLS)/ \
Stewart Smithcd986e42017-05-15 12:14:59 +100089 --img-output-dir=$(MRW_HB_TOOLS)/ \
90 --vmm-consts-file=$(MRW_HB_TOOLS)/vmmconst.h --noshort-enums \
91 --bios-xml-file=$(OPENPOWER_BIOS_XML_CONFIG_FILE) \
92 --bios-schema-file=$(BIOS_SCHEMA_FILE) \
93 --bios-output-file=$(BIOS_XML_METADATA_FILE)
94
95 # Transform BIOS XML into Petitboot specific BIOS XML via the schema
96 xsltproc -o \
97 $(PETITBOOT_BIOS_XML_METADATA_FILE) \
98 $(PETITBOOT_XSLT_FILE) \
99 $(BIOS_XML_METADATA_FILE)
Elizabeth Linerd1a29c12017-05-15 18:03:21 -0500100
101 # Create the wofdata
102 if [ -e $(MRW_HB_TOOLS)/wof-tables-img ]; then \
103 chmod +x $(MRW_HB_TOOLS)/wof-tables-img; \
104 fi
Elizabeth Liner02c88192017-08-10 23:50:34 -0500105
106 if [ -d $(MRW_SCRATCH)/wofdata ]; then \
107 $(MRW_HB_TOOLS)/wof-tables-img --create $(MRW_SCRATCH)/wof_output $(MRW_SCRATCH)/wofdata; \
Elizabeth Linerd1a29c12017-05-15 18:03:21 -0500108 fi
109
Elizabeth Liner02c88192017-08-10 23:50:34 -0500110 # Create the MEMD binary
111 if [ -e $(MRW_HB_TOOLS)/memd_creation.pl ]; then \
112 chmod +x $(MRW_HB_TOOLS)/memd_creation.pl; \
113 fi
Elizabeth Linerd1a29c12017-05-15 18:03:21 -0500114
Elizabeth Liner02c88192017-08-10 23:50:34 -0500115 if [ -d $(MRW_SCRATCH)/memd_binaries ]; then \
116 $(MRW_HB_TOOLS)/memd_creation.pl -memd_dir $(MRW_SCRATCH)/memd_binaries -memd_output $(MRW_SCRATCH)/memd_output.dat; \
117 fi
Elizabeth Linerd1a29c12017-05-15 18:03:21 -0500118
Stewart Smithcd986e42017-05-15 12:14:59 +1000119endef
120
121define MACHINE_XML_INSTALL_IMAGES_CMDS
122 mv $(MRW_HB_TOOLS)/targeting.bin $(MRW_HB_TOOLS)/$(BR2_OPENPOWER_TARGETING_BIN_FILENAME)
Nick Bofferding54deceb2017-06-28 23:07:35 -0500123 if [ -e $(MRW_HB_TOOLS)/targeting.bin.protected ]; then \
124 mv -v $(MRW_HB_TOOLS)/targeting.bin.protected $(MRW_HB_TOOLS)/$(BR2_OPENPOWER_TARGETING_BIN_FILENAME).protected; \
125 fi
126 if [ -e $(MRW_HB_TOOLS)/targeting.bin.unprotected ]; then \
127 mv -v $(MRW_HB_TOOLS)/targeting.bin.unprotected $(MRW_HB_TOOLS)/$(BR2_OPENPOWER_TARGETING_BIN_FILENAME).unprotected; \
128 fi
Stewart Smithcd986e42017-05-15 12:14:59 +1000129endef
130
131define MACHINE_XML_INSTALL_TARGET_CMDS
132 # Install Petitboot specific BIOS XML into initramfs's usr/share/ dir
133 $(INSTALL) -D -m 0644 \
134 $(PETITBOOT_BIOS_XML_METADATA_FILE) \
135 $(PETITBOOT_BIOS_XML_METADATA_INITRAMFS_FILE)
136endef
137
138$(eval $(generic-package))