blob: 9d46006e7c44d3fb5e14525b4e90a6fc10ab0966 [file] [log] [blame]
Bill Hoffa5f93f1d2014-06-26 21:02:48 -05001################################################################################
2#
3# openpower_pnor
4#
5################################################################################
6
hostboot027f6a52020-03-25 00:45:04 -05007OPENPOWER_PNOR_VERSION ?= 175f00d9c6dc395faf39a7abc81110aea7114645
Nick Bofferdingb82aaef2014-11-07 14:29:18 -06008OPENPOWER_PNOR_SITE ?= $(call github,open-power,pnor,$(OPENPOWER_PNOR_VERSION))
Brian Silvercb565552014-12-11 12:51:36 -06009
Bill Hoffa5f93f1d2014-06-26 21:02:48 -050010OPENPOWER_PNOR_LICENSE = Apache-2.0
Stewart Smithb16ba5b2017-01-10 12:55:55 +110011OPENPOWER_PNOR_LICENSE_FILES = LICENSE
Lei YU98c3c062019-03-06 16:09:02 +080012OPENPOWER_PNOR_DEPENDENCIES = hostboot-binaries machine-xml skiboot host-openpower-ffs capp-ucode host-openpower-pnor-util
Bill Hoffa5f93f1d2014-06-26 21:02:48 -050013
Richard J. Knight3f0e29c2017-10-13 10:39:01 -050014ifeq ($(BR2_OPENPOWER_POWER9),y)
15OPENPOWER_PNOR_DEPENDENCIES += hcode
16endif
17
William A. Kennington III036c7d72017-03-17 12:58:56 -070018ifeq ($(BR2_PACKAGE_IMA_CATALOG),y)
19OPENPOWER_PNOR_DEPENDENCIES += ima-catalog
20endif
21
Stewart Smith898245e2016-03-30 15:26:23 +110022ifeq ($(BR2_PACKAGE_SKIBOOT_EMBED_PAYLOAD),n)
Joel Stanley2aff5ba2015-02-01 14:49:18 +103023
24ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),y)
Stewart Smith906bdba2015-08-26 16:05:20 +100025OPENPOWER_PNOR_DEPENDENCIES += linux-rebuild-with-initramfs
Joel Stanley2aff5ba2015-02-01 14:49:18 +103026else
27OPENPOWER_PNOR_DEPENDENCIES += linux
28endif
29
30endif
31
Elizabeth Linerfbd6c452016-03-31 10:38:17 -050032ifeq ($(BR2_OPENPOWER_PNOR_XZ_ENABLED),y)
Jeremy Kerrc7800842016-07-22 14:01:17 +080033OPENPOWER_PNOR_DEPENDENCIES += host-xz
Nick Bofferding54deceb2017-06-28 23:07:35 -050034XZ_ARG=-xz_compression
35endif
36
37OPENPOWER_PNOR_DEPENDENCIES += host-sb-signing-utils
38
39ifeq ($(BR2_OPENPOWER_SECUREBOOT_KEY_TRANSITION_TO_DEV),y)
40KEY_TRANSITION_ARG=-key_transition imprint
41else ifeq ($(BR2_OPENPOWER_SECUREBOOT_KEY_TRANSITION_TO_PROD),y)
42KEY_TRANSITION_ARG=-key_transition production
43endif
44
45ifneq ($(BR2_OPENPOWER_SECUREBOOT_SIGN_MODE),"")
46SIGN_MODE_ARG=-sign_mode $(BR2_OPENPOWER_SECUREBOOT_SIGN_MODE)
Elizabeth Linerfbd6c452016-03-31 10:38:17 -050047endif
48
Matt Ploetzb4d85b12016-09-29 20:24:14 -050049ifeq ($(BR2_OPENPOWER_POWER9),y)
50 OPENPOWER_RELEASE=p9
51else
52 OPENPOWER_RELEASE=p8
53endif
54
Bill Hoffa5f93f1d2014-06-26 21:02:48 -050055OPENPOWER_PNOR_INSTALL_IMAGES = YES
56OPENPOWER_PNOR_INSTALL_TARGET = NO
57
Bill Hoffa5f93f1d2014-06-26 21:02:48 -050058HOSTBOOT_IMAGE_DIR=$(STAGING_DIR)/hostboot_build_images/
Richard J. Knight3f0e29c2017-10-13 10:39:01 -050059HOSTBOOT_BINARY_DIR = $(STAGING_DIR)/hostboot_binaries
60
61HCODE_STAGING_DIR = $(STAGING_DIR)/hcode
62
Sachin Guptadf0b6a02017-03-16 08:59:51 -050063SBE_BINARY_DIR = $(STAGING_DIR)/sbe_binaries/
Bill Hoffa5f93f1d2014-06-26 21:02:48 -050064OPENPOWER_PNOR_SCRATCH_DIR = $(STAGING_DIR)/openpower_pnor_scratch/
Stephen Cpreke7254c72015-02-19 14:33:38 -060065OPENPOWER_VERSION_DIR = $(STAGING_DIR)/openpower_version
Elizabeth Linerd1a29c12017-05-15 18:03:21 -050066OPENPOWER_MRW_SCRATCH_DIR = $(STAGING_DIR)/openpower_mrw_scratch
Ilya Smirnov2e3ba642017-09-15 12:18:35 -050067OUTPUT_BUILD_DIR = $(STAGING_DIR)/../../../build/
68OUTPUT_IMAGES_DIR = $(STAGING_DIR)/../../../images/
Joel Stanley7bfd1202019-03-05 16:11:44 +103069HOSTBOOT_BUILD_IMAGES_DIR = $(STAGING_DIR)/hostboot_build_images/
Luis Fernandezdcc24ec2019-10-01 23:52:35 -050070# See Open-Power's Hostboot repo, file: src/build/buildpnor/PnorUtils.pm,
71# function: loadPnorLayout(); at the end of that function the generated XML file
72# is concatenated with "WithOffsets.xml"
73GENERATED_PNOR_LAYOUT_FILES = $(shell find "$(OPENPOWER_PNOR_SCRATCH_DIR)" -maxdepth 1 -name "*WithOffsets.xml")
Ilya Smirnov2e3ba642017-09-15 12:18:35 -050074
75FILES_TO_TAR = $(HOSTBOOT_BUILD_IMAGES_DIR)/* \
Klaus Heinrich Kiwi1a083ef2020-05-20 15:06:13 -030076 $(OUTPUT_BUILD_DIR)/skiboot-$(SKIBOOT_VERSION)/skiboot.elf \
77 $(OUTPUT_BUILD_DIR)/skiboot-$(SKIBOOT_VERSION)/skiboot.map \
78 $(OUTPUT_BUILD_DIR)/linux-$(LINUX_VERSION)/.config \
79 $(OUTPUT_BUILD_DIR)/linux-$(LINUX_VERSION)/vmlinux \
80 $(OUTPUT_BUILD_DIR)/linux-$(LINUX_VERSION)/System.map \
Luis Fernandezdcc24ec2019-10-01 23:52:35 -050081 $(OUTPUT_IMAGES_DIR)/zImage.epapr \
82 $(GENERATED_PNOR_LAYOUT_FILES)
Stephen Cpreke7254c72015-02-19 14:33:38 -060083
84# Subpackages we want to include in the version info (do not include openpower-pnor)
Stewart Smith03671c02017-02-17 14:57:57 +110085OPENPOWER_VERSIONED_SUBPACKAGES = skiboot
86ifeq ($(BR2_PACKAGE_HOSTBOOT_P8),y)
87OPENPOWER_VERSIONED_SUBPACKAGES += hostboot-p8 occ-p8
88endif
89ifeq ($(BR2_PACKAGE_HOSTBOOT),y)
90OPENPOWER_VERSIONED_SUBPACKAGES += hostboot occ
91endif
Bill Hoffa4bbdddb2020-06-17 23:04:16 -050092ifeq ($(BR2_PACKAGE_OCMB_EXPLORER_FW),y)
93OPENPOWER_VERSIONED_SUBPACKAGES += ocmb-explorer-fw
94endif
Stewart Smith03671c02017-02-17 14:57:57 +110095OPENPOWER_VERSIONED_SUBPACKAGES += linux petitboot machine-xml hostboot-binaries capp-ucode
Stephen Cpreke7254c72015-02-19 14:33:38 -060096OPENPOWER_PNOR = openpower-pnor
Bill Hoffa5f93f1d2014-06-26 21:02:48 -050097
Sachin Guptadf0b6a02017-03-16 08:59:51 -050098ifeq ($(BR2_OPENPOWER_POWER9),y)
Stewart Smith736a08b2018-04-19 19:00:26 -050099 OPENPOWER_PNOR_DEPENDENCIES += sbe hcode
100 OPENPOWER_VERSIONED_SUBPACKAGES += sbe hcode
Sachin Guptadf0b6a02017-03-16 08:59:51 -0500101endif
102
Stewart Smith03671c02017-02-17 14:57:57 +1100103ifeq ($(BR2_PACKAGE_OCC_P8),y)
104 OCC_BIN_FILENAME=$(BR2_OCC_P8_BIN_FILENAME)
105else
106 OCC_BIN_FILENAME=$(BR2_OCC_BIN_FILENAME)
107endif
108
Bill Hoffa5f93f1d2014-06-26 21:02:48 -0500109define OPENPOWER_PNOR_INSTALL_IMAGES_CMDS
110 mkdir -p $(OPENPOWER_PNOR_SCRATCH_DIR)
Brian Silver015b5912014-08-07 15:50:15 -0500111
Brian Silver137a00a2014-11-11 12:09:53 -0600112 $(TARGET_MAKE_ENV) $(@D)/update_image.pl \
Matt Ploetzb4d85b12016-09-29 20:24:14 -0500113 -release $(OPENPOWER_RELEASE) \
Brian Silver015b5912014-08-07 15:50:15 -0500114 -op_target_dir $(HOSTBOOT_IMAGE_DIR) \
Brian Silver131189b2014-11-10 08:11:22 -0600115 -hb_image_dir $(HOSTBOOT_IMAGE_DIR) \
116 -scratch_dir $(OPENPOWER_PNOR_SCRATCH_DIR) \
117 -hb_binary_dir $(HOSTBOOT_BINARY_DIR) \
Richard J. Knight3f0e29c2017-10-13 10:39:01 -0500118 -hcode_dir $(HCODE_STAGING_DIR) \
Brian Silver131189b2014-11-10 08:11:22 -0600119 -targeting_binary_filename $(BR2_OPENPOWER_TARGETING_ECC_FILENAME) \
Brian Silver137a00a2014-11-11 12:09:53 -0600120 -targeting_binary_source $(BR2_OPENPOWER_TARGETING_BIN_FILENAME) \
Mike Baiocchi027044e2018-11-13 10:15:11 -0600121 -targeting_RO_binary_filename $(BR2_OPENPOWER_TARGETING_ECC_FILENAME).protected \
122 -targeting_RO_binary_source $(BR2_OPENPOWER_TARGETING_BIN_FILENAME).protected \
123 -targeting_RW_binary_filename $(BR2_OPENPOWER_TARGETING_ECC_FILENAME).unprotected \
124 -targeting_RW_binary_source $(BR2_OPENPOWER_TARGETING_BIN_FILENAME).unprotected \
Brian Silver137a00a2014-11-11 12:09:53 -0600125 -sbe_binary_filename $(BR2_HOSTBOOT_BINARY_SBE_FILENAME) \
Sachin Guptadf0b6a02017-03-16 08:59:51 -0500126 -sbe_binary_dir $(SBE_BINARY_DIR) \
Brian Silvercb565552014-12-11 12:51:36 -0600127 -sbec_binary_filename $(BR2_HOSTBOOT_BINARY_SBEC_FILENAME) \
Matt Ploetzaf3f64e2015-05-14 14:49:55 -0500128 -wink_binary_filename $(BR2_HOSTBOOT_BINARY_WINK_FILENAME) \
Stewart Smith03671c02017-02-17 14:57:57 +1100129 -occ_binary_filename $(OCC_STAGING_DIR)/$(OCC_BIN_FILENAME) \
Stephen Cpreke7254c72015-02-19 14:33:38 -0600130 -capp_binary_filename $(BINARIES_DIR)/$(BR2_CAPP_UCODE_BIN_FILENAME) \
Matt Ploetzdfd5a472017-01-19 13:13:55 -0600131 -ima_catalog_binary_filename $(BINARIES_DIR)/$(BR2_IMA_CATALOG_FILENAME) \
Elizabeth Linerfbd6c452016-03-31 10:38:17 -0500132 -openpower_version_filename $(OPENPOWER_PNOR_VERSION_FILE) \
Elizabeth Linerd1a29c12017-05-15 18:03:21 -0500133 -wof_binary_filename $(OPENPOWER_MRW_SCRATCH_DIR)/$(BR2_WOFDATA_FILENAME) \
Elizabeth Linerfa069312017-08-07 23:33:01 -0500134 -memd_binary_filename $(OPENPOWER_MRW_SCRATCH_DIR)/$(BR2_MEMDDATA_FILENAME) \
Elizabeth Linerfbd6c452016-03-31 10:38:17 -0500135 -payload $(BINARIES_DIR)/$(BR2_SKIBOOT_LID_NAME) \
Nick Bofferding54deceb2017-06-28 23:07:35 -0500136 -payload_filename $(BR2_SKIBOOT_LID_XZ_NAME) \
137 -binary_dir $(BINARIES_DIR) \
138 -bootkernel_filename $(LINUX_IMAGE_NAME) \
Klaus Heinrich Kiwi1a083ef2020-05-20 15:06:13 -0300139 -ocmbfw_version $(OCMB_EXPLORER_FW_VERSION) \
Bill Hoffa128bda42019-07-10 16:34:55 -0500140 -ocmbfw_url $(BR2_OCMB_EXPLORER_FW_URL) \
141 -ocmbfw_original_filename $(BINARIES_DIR)/$(BR2_OCMBFW_FILENAME) \
Bill Hoffaa48d7fa2019-06-10 08:59:10 -0500142 -ocmbfw_binary_filename $(OPENPOWER_PNOR_SCRATCH_DIR)/$(BR2_OCMBFW_PROCESSED_FILENAME) \
Nick Bofferding54deceb2017-06-28 23:07:35 -0500143 -pnor_layout $(@D)/"$(OPENPOWER_RELEASE)"Layouts/$(BR2_OPENPOWER_PNOR_XML_LAYOUT_FILENAME) \
144 $(XZ_ARG) $(KEY_TRANSITION_ARG) $(SIGN_MODE_ARG) \
Bill Hoffa5f93f1d2014-06-26 21:02:48 -0500145
146 mkdir -p $(STAGING_DIR)/pnor/
Brian Silver131189b2014-11-10 08:11:22 -0600147 $(TARGET_MAKE_ENV) $(@D)/create_pnor_image.pl \
Matt Ploetzb4d85b12016-09-29 20:24:14 -0500148 -release $(OPENPOWER_RELEASE) \
149 -xml_layout_file $(@D)/"$(OPENPOWER_RELEASE)"Layouts/$(BR2_OPENPOWER_PNOR_XML_LAYOUT_FILENAME) \
Brian Silver131189b2014-11-10 08:11:22 -0600150 -pnor_filename $(STAGING_DIR)/pnor/$(BR2_OPENPOWER_PNOR_FILENAME) \
151 -hb_image_dir $(HOSTBOOT_IMAGE_DIR) \
152 -scratch_dir $(OPENPOWER_PNOR_SCRATCH_DIR) \
153 -outdir $(STAGING_DIR)/pnor/ \
Nick Bofferding54deceb2017-06-28 23:07:35 -0500154 -payload $(OPENPOWER_PNOR_SCRATCH_DIR)/$(BR2_SKIBOOT_LID_XZ_NAME) \
155 -bootkernel $(OPENPOWER_PNOR_SCRATCH_DIR)/$(LINUX_IMAGE_NAME) \
Brian Silver131189b2014-11-10 08:11:22 -0600156 -sbe_binary_filename $(BR2_HOSTBOOT_BINARY_SBE_FILENAME) \
157 -sbec_binary_filename $(BR2_HOSTBOOT_BINARY_SBEC_FILENAME) \
Matt Ploetzaf3f64e2015-05-14 14:49:55 -0500158 -wink_binary_filename $(BR2_HOSTBOOT_BINARY_WINK_FILENAME) \
Stewart Smith03671c02017-02-17 14:57:57 +1100159 -occ_binary_filename $(OCC_STAGING_DIR)/$(OCC_BIN_FILENAME) \
Stephen Cpreke7254c72015-02-19 14:33:38 -0600160 -targeting_binary_filename $(BR2_OPENPOWER_TARGETING_ECC_FILENAME) \
Mike Baiocchi027044e2018-11-13 10:15:11 -0600161 -targeting_RO_binary_filename $(BR2_OPENPOWER_TARGETING_ECC_FILENAME).protected \
162 -targeting_RW_binary_filename $(BR2_OPENPOWER_TARGETING_ECC_FILENAME).unprotected \
Elizabeth Linerd1a29c12017-05-15 18:03:21 -0500163 -wofdata_binary_filename $(OPENPOWER_PNOR_SCRATCH_DIR)/$(BR2_WOFDATA_BINARY_FILENAME) \
Elizabeth Linerfa069312017-08-07 23:33:01 -0500164 -memddata_binary_filename $(OPENPOWER_PNOR_SCRATCH_DIR)/$(BR2_MEMDDATA_BINARY_FILENAME) \
Bill Hoffaa48d7fa2019-06-10 08:59:10 -0500165 -ocmbfw_binary_filename $(OPENPOWER_PNOR_SCRATCH_DIR)/$(BR2_OCMBFW_PROCESSED_FILENAME) \
Nick Bofferdingc92d4512018-10-10 11:46:46 -0500166 -openpower_version_filename $(OPENPOWER_PNOR_SCRATCH_DIR)/openpower_pnor_version.bin
Bill Hoffa5f93f1d2014-06-26 21:02:48 -0500167
Brian Silver131189b2014-11-10 08:11:22 -0600168 $(INSTALL) $(STAGING_DIR)/pnor/$(BR2_OPENPOWER_PNOR_FILENAME) $(BINARIES_DIR)
Brian Horton06c2a882015-04-09 13:32:55 -0500169
170 # if this config has an UPDATE_FILENAME defined, create a 32M (1/2 size)
171 # image that only updates the non-golden side
172 if [ "$(BR2_OPENPOWER_PNOR_UPDATE_FILENAME)" != "" ]; then \
173 dd if=$(STAGING_DIR)/pnor/$(BR2_OPENPOWER_PNOR_FILENAME) of=$(STAGING_DIR)/pnor/$(BR2_OPENPOWER_PNOR_UPDATE_FILENAME) bs=32M count=1; \
174 $(INSTALL) $(STAGING_DIR)/pnor/$(BR2_OPENPOWER_PNOR_UPDATE_FILENAME) $(BINARIES_DIR); \
175 fi
Charles P. Hofer0ca27df2017-08-10 14:20:00 -0500176
Lei YU98c3c062019-03-06 16:09:02 +0800177 # If this is a VPNOR system, run the generate-tar command and
Charles P. Hofer0ca27df2017-08-10 14:20:00 -0500178 # create a tarball
179 if [ "$(BR2_BUILD_PNOR_SQUASHFS)" == "y" ]; then \
Adriana Kobylak7577ea32020-02-07 13:44:16 -0600180 PATH=$(HOST_DIR)/usr/bin:$(PATH) $(HOST_DIR)/usr/bin/generate-tar -i squashfs -m $(BR2_OPENPOWER_CONFIG_NAME) -f $(STAGING_DIR)/pnor/$(BR2_OPENPOWER_PNOR_FILENAME).squashfs.tar $(STAGING_DIR)/pnor/$(BR2_OPENPOWER_PNOR_FILENAME) -s; \
Charles P. Hofer0ca27df2017-08-10 14:20:00 -0500181 $(INSTALL) $(STAGING_DIR)/pnor/$(BR2_OPENPOWER_PNOR_FILENAME).squashfs.tar $(BINARIES_DIR); \
Lei YU98c3c062019-03-06 16:09:02 +0800182 else \
Adriana Kobylak7577ea32020-02-07 13:44:16 -0600183 PATH=$(HOST_DIR)/usr/bin:$(PATH) $(HOST_DIR)/usr/bin/generate-tar -i static -m $(BR2_OPENPOWER_CONFIG_NAME) -f $(STAGING_DIR)/pnor/$(BR2_OPENPOWER_PNOR_FILENAME).static.tar.gz $(STAGING_DIR)/pnor/$(BR2_OPENPOWER_PNOR_FILENAME) -s; \
Lei YU98c3c062019-03-06 16:09:02 +0800184 $(INSTALL) $(STAGING_DIR)/pnor/$(BR2_OPENPOWER_PNOR_FILENAME).static.tar.gz $(BINARIES_DIR); \
Charles P. Hofer0ca27df2017-08-10 14:20:00 -0500185 fi
Ilya Smirnov2e3ba642017-09-15 12:18:35 -0500186
Bill Hoffa70375bd2018-08-31 15:53:59 -0500187 #Create Debug Tarball
188 mkdir -p $(STAGING_DIR)/pnor/host_fw_debug_tarball_files/
189 cp -r $(FILES_TO_TAR) $(STAGING_DIR)/pnor/host_fw_debug_tarball_files/
190 tar -zcvf $(OUTPUT_IMAGES_DIR)/host_fw_debug.tar -C $(STAGING_DIR)/pnor/host_fw_debug_tarball_files/ .
Ilya Smirnov2e3ba642017-09-15 12:18:35 -0500191
Bill Hoffa5f93f1d2014-06-26 21:02:48 -0500192endef
193
194$(eval $(generic-package))
Stephen Cpreke7254c72015-02-19 14:33:38 -0600195# Generate openPOWER pnor version string by combining subpackage version string files
196$(eval $(call OPENPOWER_VERSION,$(OPENPOWER_PNOR)))