blob: 5ac4bc2a6a6e4ae7b58ce39b35b28f33c9f72e2c [file] [log] [blame]
Stewart Smithcd986e42017-05-15 12:14:59 +10001################################################################################
2# machine_xml
3#
4################################################################################
5
6MACHINE_XML_VERSION ?= $(BR2_OPENPOWER_MACHINE_XML_VERSION)
7ifeq ($(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
16MACHINE_XML_DEPENDENCIES = hostboot openpower-mrw common-p8-xml
17
18MACHINE_XML_INSTALL_IMAGES = YES
19MACHINE_XML_INSTALL_TARGET = YES
20
21MRW_SCRATCH=$(STAGING_DIR)/openpower_mrw_scratch
22MRW_HB_TOOLS=$(STAGING_DIR)/hostboot_build_images
23
24# Defines for BIOS metadata creation
25BIOS_SCHEMA_FILE = $(MRW_HB_TOOLS)/bios.xsd
26OPENPOWER_BIOS_XML_CONFIG_FILE = $(MRW_SCRATCH)/$(BR2_OPENPOWER_BIOS_XML_FILENAME)
27BIOS_XML_METADATA_FILE = \
28 $(MRW_HB_TOOLS)/$(BR2_OPENPOWER_CONFIG_NAME)_bios_metadata.xml
29PETITBOOT_XSLT_FILE = $(MRW_HB_TOOLS)/bios_metadata_petitboot.xslt
30PETITBOOT_BIOS_XML_METADATA_FILE = \
31 $(MRW_HB_TOOLS)/$(BR2_OPENPOWER_CONFIG_NAME)_bios_metadata_petitboot.xml
32PETITBOOT_BIOS_XML_METADATA_INITRAMFS_FILE = \
33 $(TARGET_DIR)/usr/share/bios_metadata.xml
34
35ifeq ($(BR2_OPENPOWER_MACHINE_XML_OPPOWERVM_ATTRIBUTES),y)
36MACHINE_XML_OPPOWERVM_ATTR_XML = $(MRW_HB_TOOLS)/attribute_types_oppowervm.xml
37MACHINE_XML_OPPOWERVM_TARGET_XML = $(MRW_HB_TOOLS)/target_types_oppowervm.xml
38endif
39ifeq ($(BR2_OPENPOWER_MACHINE_XML_TARGET_TYPES_OPENPOWER_XML),y)
40MACHINE_XML_TARGET_TYPES_OPENPOWER_XML = $(MRW_HB_TOOLS)/target_types_openpower.xml
41endif
42
43define MACHINE_XML_FILTER_UNWANTED_ATTRIBUTES
44 chmod +x $(MRW_HB_TOOLS)/filter_out_unwanted_attributes.pl
45
46 $(MRW_HB_TOOLS)/filter_out_unwanted_attributes.pl \
47 --tgt-xml $(MRW_HB_TOOLS)/target_types_merged.xml \
48 --tgt-xml $(MRW_HB_TOOLS)/target_types_hb.xml \
49 --tgt-xml $(MRW_HB_TOOLS)/target_types_oppowervm.xml \
50 --tgt-xml $(MRW_HB_TOOLS)/target_types_openpower.xml \
51 --mrw-xml $(MRW_SCRATCH)/$(BR2_OPENPOWER_MRW_XML_FILENAME)
52
53 cp $(MRW_SCRATCH)/$(BR2_OPENPOWER_MRW_XML_FILENAME).updated $(MRW_SCRATCH)/$(BR2_OPENPOWER_MRW_XML_FILENAME)
54endef
55
56define MACHINE_XML_BUILD_CMDS
57 # copy the machine xml where the common lives
58 bash -c 'mkdir -p $(MRW_SCRATCH) && cp -r $(@D)/* $(MRW_SCRATCH)'
59
60 # generate the system mrw xml
61 perl -I $(MRW_HB_TOOLS) \
62 $(MRW_HB_TOOLS)/processMrw.pl -x $(MRW_SCRATCH)/$(BR2_OPENPOWER_MACHINE_XML_FILENAME)
63
64 $(if $(BR2_OPENPOWER_MACHINE_XML_FILTER_UNWANTED_ATTRIBUTES), $(call MACHINE_XML_FILTER_UNWANTED_ATTRIBUTES))
65
66 # merge in any system specific attributes, hostboot attributes
67 $(MRW_HB_TOOLS)/mergexml.sh $(MRW_SCRATCH)/$(BR2_OPENPOWER_SYSTEM_XML_FILENAME) \
68 $(MRW_HB_TOOLS)/attribute_types.xml \
69 $(MRW_HB_TOOLS)/attribute_types_hb.xml \
70 $(MACHINE_XML_OPPOWERVM_ATTR_XML) \
71 $(MRW_HB_TOOLS)/attribute_types_openpower.xml \
72 $(MRW_HB_TOOLS)/target_types_merged.xml \
73 $(MRW_HB_TOOLS)/target_types_hb.xml \
74 $(MACHINE_XML_OPPOWERVM_TARGET_XML) \
75 $(MACHINE_XML_TARGET_TYPES_OPENPOWER_XML) \
76 $(MRW_SCRATCH)/$(BR2_OPENPOWER_MRW_XML_FILENAME) > $(MRW_HB_TOOLS)/temporary_hb.hb.xml;
77
78 # creating the targeting binary
79 $(MRW_HB_TOOLS)/xmltohb.pl \
80 --hb-xml-file=$(MRW_HB_TOOLS)/temporary_hb.hb.xml \
81 --fapi-attributes-xml-file=$(MRW_HB_TOOLS)/fapiattrs.xml \
82 --src-output-dir=none \
83 --img-output-dir=$(MRW_HB_TOOLS)/ \
84 --vmm-consts-file=$(MRW_HB_TOOLS)/vmmconst.h --noshort-enums \
85 --bios-xml-file=$(OPENPOWER_BIOS_XML_CONFIG_FILE) \
86 --bios-schema-file=$(BIOS_SCHEMA_FILE) \
87 --bios-output-file=$(BIOS_XML_METADATA_FILE)
88
89 # Transform BIOS XML into Petitboot specific BIOS XML via the schema
90 xsltproc -o \
91 $(PETITBOOT_BIOS_XML_METADATA_FILE) \
92 $(PETITBOOT_XSLT_FILE) \
93 $(BIOS_XML_METADATA_FILE)
94endef
95
96define MACHINE_XML_INSTALL_IMAGES_CMDS
97 mv $(MRW_HB_TOOLS)/targeting.bin $(MRW_HB_TOOLS)/$(BR2_OPENPOWER_TARGETING_BIN_FILENAME)
98endef
99
100define MACHINE_XML_INSTALL_TARGET_CMDS
101 # Install Petitboot specific BIOS XML into initramfs's usr/share/ dir
102 $(INSTALL) -D -m 0644 \
103 $(PETITBOOT_BIOS_XML_METADATA_FILE) \
104 $(PETITBOOT_BIOS_XML_METADATA_INITRAMFS_FILE)
105endef
106
107$(eval $(generic-package))