Merge pull request #614 from ploetzma/occSupport
Add support for P9 occ compile
diff --git a/openpower/package/occ/occ.mk b/openpower/package/occ/occ.mk
index 7b8c960..c2f4f59 100644
--- a/openpower/package/occ/occ.mk
+++ b/openpower/package/occ/occ.mk
@@ -4,25 +4,56 @@
#
################################################################################
-OCC_VERSION ?= bb092e95266788920751389f7df189425f1ec1d6
+OCC_VERSION_BRANCH_MASTER_P8 ?= bb092e95266788920751389f7df189425f1ec1d6
+OCC_VERSION_BRANCH_MASTER ?= 30ed7685e39b12255247d0c30db8660f4e42eadb
+
+OCC_VERSION ?= $(if $(BR2_OPENPOWER_POWER9),$(OCC_VERSION_BRANCH_MASTER),$(OCC_VERSION_BRANCH_MASTER_P8))
OCC_SITE ?= $(call github,open-power,occ,$(OCC_VERSION))
OCC_LICENSE = Apache-2.0
-OCC_DEPENDENCIES = host-binutils host-p8-pore-binutils
OCC_INSTALL_IMAGES = YES
OCC_INSTALL_TARGET = NO
OCC_STAGING_DIR = $(STAGING_DIR)/occ
-define OCC_BUILD_CMDS
+OCC_IMAGE_BIN_PATH = $(if $(BR2_OPENPOWER_POWER9),obj/image.bin,src/image.bin)
+
+OCC_DEPENDENCIES_P8 = host-binutils host-p8-pore-binutils
+OCC_DEPENDENCIES_P9 = host-binutils host-ppe42-gcc
+OCC_DEPENDENCIES ?= $(if $(BR2_OPENPOWER_POWER9),$(OCC_DEPENDENCIES_P9),$(OCC_DEPENDENCIES_P8))
+
+define OCC_APPLY_PATCHES
+ if [ "$(BR2_OPENPOWER_POWER9)" == "y" ]; then \
+ $(APPLY_PATCHES) $(@D) $(BR2_EXTERNAL)/package/occ/p9Patches \*.patch; \
+ if [ -d $(BR2_EXTERNAL)/custom/patches/occ/p9Patches ]; then \
+ $(APPLY_PATCHES) $(@D) $(BR2_EXTERNAL)/custom/patches/occ/p9Patches \*.patch; \
+ fi; \
+ fi; \
+ if [ "$(BR2_OPENPOWER_POWER8)" == "y" ]; then \
+ $(APPLY_PATCHES) $(@D) $(BR2_EXTERNAL)/package/occ/p8Patches \*.patch; \
+ if [ -d $(BR2_EXTERNAL)/custom/patches/occ/p8Patches ]; then \
+ $(APPLY_PATCHES) $(@D) $(BR2_EXTERNAL)/custom/patches/occ/p8Patches \*.patch; \
+ fi; \
+ fi;
+endef
+
+OCC_POST_PATCH_HOOKS += OCC_APPLY_PATCHES
+
+define OCC_BUILD_CMDS_P8
cd $(@D)/src && \
make POREPATH=$(P8_PORE_BINUTILS_BIN)/bin/ OCC_OP_BUILD=1 CROSS_PREFIX=$(TARGET_CROSS) all && \
+ make tracehash && \
make combineImage
endef
+define OCC_BUILD_CMDS_P9
+ cd $(@D)/src && \
+ make PPE_TOOL_PATH=$(PPE42_GCC_BIN) OCC_OP_BUILD=1 CROSS_PREFIX=$(TARGET_CROSS) LD_LIBRARY_PATH=$(HOST_DIR)/usr/lib all
+endef
+OCC_BUILD_CMDS ?= $(if $(BR2_OPENPOWER_POWER9),$(OCC_BUILD_CMDS_P9),$(OCC_BUILD_CMDS_P8))
define OCC_INSTALL_IMAGES_CMDS
mkdir -p $(STAGING_DIR)/occ
- cp $(@D)/src/image.bin $(OCC_STAGING_DIR)/$(BR2_OCC_BIN_FILENAME)
+ cp $(@D)/$(OCC_IMAGE_BIN_PATH) $(OCC_STAGING_DIR)/$(BR2_OCC_BIN_FILENAME)
endef
$(eval $(generic-package))