Enable ppe42-{gcc,binutils} as external toolchain
Create the infrastructure necessary to bundle ppe42-gcc and
ppe42-binutils as part of the sdk build, allowing it to be
re-inserted as part of an external sdk.
Signed-off-by: Klaus Heinrich Kiwi <klaus@linux.vnet.ibm.com>
diff --git a/openpower/configs/zz_defconfig b/openpower/configs/zz_defconfig
index db28ca4..9e52abd 100644
--- a/openpower/configs/zz_defconfig
+++ b/openpower/configs/zz_defconfig
@@ -45,6 +45,7 @@
BR2_TARGET_ROOTFS_CPIO_XZ=y
BR2_OPENPOWER_PLATFORM=y
BR2_OPENPOWER_POWER9=y
+# BR2_PACKAGE_PPE42_TOOLCHAIN is not set
# BR2_PACKAGE_HOST_OPENPOWER_FFS is not set
# BR2_PACKAGE_HOSTBOOT is not set
# BR2_PACKAGE_HOSTBOOT_BINARIES is not set
@@ -56,7 +57,5 @@
BR2_PACKAGE_PETITBOOT_MTD=y
# BR2_PACKAGE_CAPP_UCODE is not set
BR2_PACKAGE_LOADKEYS=y
-# BR2_PACKAGE_HOST_PPE42_BINUTILS is not set
-# BR2_PACKAGE_HOST_PPE42_GCC is not set
# BR2_PACKAGE_IMA_CATALOG is not set
# BR2_PACKAGE_HOST_SB_SIGNING_UTILS is not set
diff --git a/openpower/package/Config.in b/openpower/package/Config.in
index 52662e6..34468f5 100755
--- a/openpower/package/Config.in
+++ b/openpower/package/Config.in
@@ -14,8 +14,6 @@
source "$BR2_EXTERNAL_OP_BUILD_PATH/package/skiboot/Config.in"
source "$BR2_EXTERNAL_OP_BUILD_PATH/package/libflash/Config.in"
source "$BR2_EXTERNAL_OP_BUILD_PATH/package/loadkeys/Config.in"
-source "$BR2_EXTERNAL_OP_BUILD_PATH/package/ppe42-binutils/Config.in"
-source "$BR2_EXTERNAL_OP_BUILD_PATH/package/ppe42-gcc/Config.in"
source "$BR2_EXTERNAL_OP_BUILD_PATH/package/ima-catalog/Config.in"
source "$BR2_EXTERNAL_OP_BUILD_PATH/package/sbe/Config.in"
source "$BR2_EXTERNAL_OP_BUILD_PATH/package/sb-signing-utils/Config.in"
diff --git a/openpower/package/ppe42-binutils/Config.in b/openpower/package/ppe42-binutils/Config.in
index 824e557..a878732 100644
--- a/openpower/package/ppe42-binutils/Config.in
+++ b/openpower/package/ppe42-binutils/Config.in
@@ -1,6 +1,5 @@
config BR2_PACKAGE_HOST_PPE42_BINUTILS
bool "ppe42-binutils"
- default y if (BR2_OPENPOWER_PLATFORM && BR2_OPENPOWER_POWER9)
select BR2_CPP
help
Project to build the PPE42 PORE binutils
diff --git a/openpower/package/ppe42-binutils/ppe42-binutils.mk b/openpower/package/ppe42-binutils/ppe42-binutils.mk
index 0c365b8..90abbf4 100644
--- a/openpower/package/ppe42-binutils/ppe42-binutils.mk
+++ b/openpower/package/ppe42-binutils/ppe42-binutils.mk
@@ -10,8 +10,8 @@
PPE42_BINUTILS_DEPENDENCIES = host-binutils
-PPE42_BINUTILS_DIR = $(STAGING_DIR)/ppe42-binutils
-PPE42_BINUTILS_BIN = $(STAGING_DIR)/ppe42-binutils/linux
+PPE42_BINUTILS_DIR = $(HOST_DIR)/$(PPE42_TOOLCHAIN_DIR)
+PPE42_BINUTILS_BIN = $(HOST_DIR)/$(PPE42_TOOLCHAIN_BIN)
define HOST_PPE42_BINUTILS_BUILD_CMDS
cd $(@D) && \
diff --git a/openpower/package/ppe42-gcc/Config.in b/openpower/package/ppe42-gcc/Config.in
index 33f5276..b7361bb 100644
--- a/openpower/package/ppe42-gcc/Config.in
+++ b/openpower/package/ppe42-gcc/Config.in
@@ -1,7 +1,7 @@
config BR2_PACKAGE_HOST_PPE42_GCC
bool "ppe42-gcc"
- default y if (BR2_OPENPOWER_PLATFORM && BR2_OPENPOWER_POWER9)
select BR2_PACKAGE_HAS_PPE42_TOOLCHAIN
+ select BR2_PACKAGE_PPE42_BINUTILS
select BR2_CPP
help
Project to build the PPE42 gcc
diff --git a/openpower/package/ppe42-gcc/ppe42-gcc.mk b/openpower/package/ppe42-gcc/ppe42-gcc.mk
index a59071d..8aa73ce 100644
--- a/openpower/package/ppe42-gcc/ppe42-gcc.mk
+++ b/openpower/package/ppe42-gcc/ppe42-gcc.mk
@@ -12,8 +12,8 @@
HOST_PPE42_GCC_DEPENDENCIES = host-ppe42-binutils host-gmp host-mpfr host-mpc
PPE42_GCC_PROVIDES = ppe42-toolchain
-PPE42_GCC_DIR = $(STAGING_DIR)/ppe42-binutils
-PPE42_GCC_BIN = $(STAGING_DIR)/ppe42-binutils/linux
+PPE42_GCC_DIR = $(HOST_DIR)/$(PPE42_TOOLCHAIN_DIR)
+PPE42_GCC_BIN = $(HOST_DIR)/$(PPE42_TOOLCHAIN_BIN)
define HOST_PPE42_GCC_BUILD_CMDS
cd $(@D) && \
diff --git a/openpower/package/ppe42-toolchain-external/Config.in b/openpower/package/ppe42-toolchain-external/Config.in
new file mode 100644
index 0000000..10b58db
--- /dev/null
+++ b/openpower/package/ppe42-toolchain-external/Config.in
@@ -0,0 +1,18 @@
+config BR2_PACKAGE_PPE42_TOOLCHAIN_EXTERNAL
+ bool "ppe42-toolchain-external"
+ select BR2_PACKAGE_HAS_PPE42_TOOLCHAIN
+ help
+ Use an external PPE42 toolchain
+
+if BR2_PACKAGE_PPE42_TOOLCHAIN_EXTERNAL
+config BR2_PACKAGE_PROVIDES_PPE42_TOOLCHAIN
+ default "ppe42-toolchain-external"
+
+config BR2_PPE42_TOOLCHAIN_EXTERNAL_PATH
+ string "External PPE42 toolchain path"
+ help
+ Pathname to where the external PPE42 toolchain is
+ installed. The compiler is expected to be fully
+ contained within the "sysroot/ppe42-toolchain"
+ directory
+endif
diff --git a/openpower/package/ppe42-toolchain-external/ppe42-toolchain-external.mk b/openpower/package/ppe42-toolchain-external/ppe42-toolchain-external.mk
new file mode 100644
index 0000000..1fb9f00
--- /dev/null
+++ b/openpower/package/ppe42-toolchain-external/ppe42-toolchain-external.mk
@@ -0,0 +1,23 @@
+################################################################################
+#
+# ppe42-toolchain-external
+#
+################################################################################
+PPE42_TOOLCHAIN_EXTERNAL_REDISTRIBUTE = NO
+PPE42_TOOLCHAIN_EXTERNAL_SITE =
+PPE42_TOOLCHAIN_EXTERNAL_SOURCE =
+PPE42_TOOLCHAIN_EXTERNAL_PROVIDES = ppe42-toolchain
+PPE42_TOOLCHAIN_EXTERNAL_PATH = \
+ $(call qstrip,$(BR2_PPE42_TOOLCHAIN_EXTERNAL_PATH))/$(PPE42_TOOLCHAIN_DIR)
+
+define HOST_PPE42_TOOLCHAIN_EXTERNAL_CONFIGURE_CMDS
+ test -e $(PPE42_TOOLCHAIN_EXTERNAL_PATH)
+endef
+
+define HOST_PPE42_TOOLCHAIN_EXTERNAL_INSTALL_CMDS
+ ln -snf $(PPE42_TOOLCHAIN_EXTERNAL_PATH) $(HOST_DIR)/$(PPE42_TOOLCHAIN_DIR)
+
+endef
+
+$(eval $(host-generic-package))
+
diff --git a/openpower/toolchain/ppe42-toolchain/Config.in b/openpower/toolchain/ppe42-toolchain/Config.in
index baf4375..a2d6aa3 100644
--- a/openpower/toolchain/ppe42-toolchain/Config.in
+++ b/openpower/toolchain/ppe42-toolchain/Config.in
@@ -1,6 +1,33 @@
+
+menuconfig BR2_PACKAGE_PPE42_TOOLCHAIN
+ bool "ppe42-toolchain"
+ default y if (BR2_OPENPOWER_POWER9)
+ help
+ Build the PPE42 toolchain required to build the
+ POWER9 firmware for OCC, SBE and HCODE
+
+if BR2_PACKAGE_PPE42_TOOLCHAIN
+
+choice
+ prompt "PPE42 Toolchain Type"
+ help
+ Select whether to build the PPE42 toolchain or
+ provide an external one
+
+source "$BR2_EXTERNAL_OP_BUILD_PATH/package/ppe42-gcc/Config.in"
+source "$BR2_EXTERNAL_OP_BUILD_PATH/package/ppe42-toolchain-external/Config.in"
+
+endchoice
+
+if BR2_PACKAGE_HOST_PPE42_GCC
+source "$BR2_EXTERNAL_OP_BUILD_PATH/package/ppe42-binutils/Config.in"
+endif
+
config BR2_PACKAGE_HAS_PPE42_TOOLCHAIN
bool
config BR2_PACKAGE_PROVIDES_PPE42_TOOLCHAIN
depends on BR2_PACKAGE_HAS_PPE42_TOOLCHAIN
string
+
+endif
diff --git a/openpower/toolchain/ppe42-toolchain/ppe42-toolchain.mk b/openpower/toolchain/ppe42-toolchain/ppe42-toolchain.mk
index f841657..cca0af3 100644
--- a/openpower/toolchain/ppe42-toolchain/ppe42-toolchain.mk
+++ b/openpower/toolchain/ppe42-toolchain/ppe42-toolchain.mk
@@ -3,5 +3,7 @@
# ppe42-toolchain
#
################################################################################
+PPE42_TOOLCHAIN_DIR = $(STAGING_SUBDIR)/ppe42-toolchain
+PPE42_TOOLCHAIN_BIN = $(STAGING_SUBDIR)/ppe42-toolchain/linux
$(eval $(host-virtual-package))