1
0
mirror of https://github.com/google/cpu_features.git synced 2025-04-27 15:12:30 +02:00

Improve CI (Aarch64, Power) (#285)

* scripts: Fix shellcheck

* script: Bump qemu 5.2.0 -> 7.1.0

* scripts: add bootlin aarch64 toolchains

* scripts: Add PowerPC bootlin toolchain

* scripts: cleanup linaro toolchains

* scripts: cleanup codespace

* cmake(ci): Add aarch64 bootlin support

* cmake(ci): Add PowerPC bootlin support

* ci: Add aarch64 bootlin jobs

* ci: Add PowerPC bootlin jobs

* Remove conflict with compiler generated preprocessor

Co-authored-by: Guillaume Chatelet <gchatelet@google.com>
This commit is contained in:
Mizux 2022-11-03 10:06:38 +01:00 committed by GitHub
parent 981fbe3914
commit 16ca56fcb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 106 additions and 20 deletions

View File

@ -14,6 +14,8 @@ jobs:
strategy:
matrix:
targets: [
[aarch64],
[aarch64be],
[aarch64-linux-gnu],
[aarch64_be-linux-gnu]
]

29
.github/workflows/power_linux_cmake.yml vendored Normal file
View File

@ -0,0 +1,29 @@
name: POWER Linux CMake
on:
push:
pull_request:
schedule:
# min hours day(month) month day(week)
- cron: '0 0 7,22 * *'
jobs:
# Building using the github runner environement directly.
make:
runs-on: ubuntu-latest
strategy:
matrix:
targets: [
[ppc],
[ppc64],
[ppc64le],
]
fail-fast: false
env:
TARGET: ${{ matrix.targets[0] }}
steps:
- uses: actions/checkout@v2
- name: Build
run: make --directory=cmake/ci ${TARGET}_build
- name: Test
run: make --directory=cmake/ci ${TARGET}_test

View File

@ -45,11 +45,16 @@ help:
@echo -e "\t\t${BOLD}armeb-linux-gnueabihf${RESET} (linaro toolchain)"
@echo -e "\t\t${BOLD}armeb-linux-gnueabi${RESET} (linaro toolchain)"
@echo -e "\t\t${BOLD}aarch64-linux-gnu${RESET} (linaro toolchain)"
@echo -e "\t\t${BOLD}aarch64${RESET} (bootlin toolchain)"
@echo -e "\t\t${BOLD}aarch64_be-linux-gnu${RESET} (linaro toolchain)"
@echo -e "\t\t${BOLD}aarch64be${RESET} (bootlin toolchain)"
@echo -e "\t\t${BOLD}mips32${RESET} (codespace toolchain)"
@echo -e "\t\t${BOLD}mips64${RESET} (codespace toolchain)"
@echo -e "\t\t${BOLD}mips32el${RESET} (codespace toolchain)"
@echo -e "\t\t${BOLD}mips64el${RESET} (codespace toolchain)"
@echo -e "\t\t${BOLD}ppc${RESET} (bootlin toolchain)"
@echo -e "\t\t${BOLD}ppc64${RESET} (bootlin toolchain)"
@echo -e "\t\t${BOLD}ppc64le${RESET} (bootlin toolchain)"
@echo -e "\t\t${BOLD}s390x${RESET} (bootlin toolchain)"
@echo
@echo -e "\tWith ${BOLD}<toolchain_stage>${RESET}:"
@ -144,9 +149,11 @@ $(clean_targets_amd64): clean_amd64_%:
## TOOLCHAIN ##
###############
TOOLCHAIN_TARGETS = \
aarch64 aarch64be \
arm-linux-gnueabihf armv8l-linux-gnueabihf arm-linux-gnueabi armeb-linux-gnueabihf armeb-linux-gnueabi \
aarch64-linux-gnu aarch64_be-linux-gnu \
mips32 mips32el mips64 mips64el \
ppc ppc64 ppc64le \
s390x
TOOLCHAIN_STAGES = env devel build test
define toolchain-stage-target =

View File

@ -22,7 +22,7 @@ function unpack() {
if [[ ! -d "${DESTINATION}" ]] ; then
echo "Downloading ${URL}..."
local -r ARCHIVE_NAME=$(basename "${URL}")
test -f "${ARCHIVE_NAME}" || wget --no-verbose "${URL}"
[[ -f "${ARCHIVE_NAME}" ]] || wget --no-verbose "${URL}"
extract "${ARCHIVE_NAME}"
rm -f "${ARCHIVE_NAME}"
fi
@ -33,7 +33,7 @@ function install_qemu() {
>&2 echo 'QEMU is disabled !'
return 0
fi
local -r QEMU_VERSION=${QEMU_VERSION:=5.2.0}
local -r QEMU_VERSION=${QEMU_VERSION:=7.1.0}
local -r QEMU_TARGET=${QEMU_ARCH}-linux-user
if echo "${QEMU_VERSION} ${QEMU_TARGET}" | cmp --silent "${QEMU_INSTALL}/.build" -; then
@ -70,11 +70,7 @@ function install_qemu() {
--disable-opengl \
--disable-sdl \
--disable-virglrenderer \
--disable-vte \
--enable-modules
# --static Not supported on Archlinux
# so we use --enable-modules
--disable-vte
# wrapper on ninja
make -j8
@ -145,6 +141,27 @@ function expand_bootlin_config() {
local -r GCC_DIR=${ARCHIVE_DIR}/${GCC_RELATIVE_DIR}
case "${TARGET}" in
"aarch64")
local -r POWER_URL="https://toolchains.bootlin.com/downloads/releases/toolchains/aarch64/tarballs/aarch64--glibc--stable-2021.11-1.tar.bz2"
local -r GCC_PREFIX="aarch64"
;;
"aarch64be")
local -r POWER_URL="https://toolchains.bootlin.com/downloads/releases/toolchains/aarch64be/tarballs/aarch64be--glibc--stable-2021.11-1.tar.bz2"
local -r GCC_PREFIX="aarch64_be"
;;
"ppc64le")
local -r POWER_URL="https://toolchains.bootlin.com/downloads/releases/toolchains/powerpc64le-power8/tarballs/powerpc64le-power8--glibc--stable-2021.11-1.tar.bz2"
local -r GCC_PREFIX="powerpc64le"
;;
"ppc64")
local -r POWER_URL="https://toolchains.bootlin.com/downloads/releases/toolchains/powerpc64-power8/tarballs/powerpc64-power8--glibc--stable-2021.11-1.tar.bz2"
local -r GCC_PREFIX="powerpc64"
;;
"ppc")
#local -r POWER_URL="https://toolchains.bootlin.com/downloads/releases/toolchains/powerpc-e500mc/tarballs/powerpc-e500mc--glibc--stable-2021.11-1.tar.bz2"
local -r POWER_URL="https://toolchains.bootlin.com/downloads/releases/toolchains/powerpc-440fp/tarballs/powerpc-440fp--glibc--stable-2021.11-1.tar.bz2"
local -r GCC_PREFIX="powerpc"
;;
"s390x")
local -r POWER_URL="https://toolchains.bootlin.com/downloads/releases/toolchains/s390x-z13/tarballs/s390x-z13--glibc--stable-2022.08-1.tar.bz2"
local -r GCC_PREFIX="s390x"
@ -197,15 +214,21 @@ QEMU_ARGS+=( -E LD_PRELOAD="${SYSROOT_DIR}/usr/lib/libstdc++.so.6:${SYSROOT_DIR}
}
function expand_codescape_config() {
# https://www.mips.com/develop/tools/codescape-mips-sdk/mips-toolchain-configurations/
# mips-mti: MIPS32R6 and MIPS64R6
# mips-img: MIPS32R2 and MIPS64R2
# ref: https://codescape.mips.com/components/toolchain/2020.06-01/downloads.html
# ref: https://codescape.mips.com/components/toolchain/2019.02-04/downloads.html
local -r DATE=2020.06-01
#local -r DATE=2019.02-04
local -r CODESCAPE_URL=https://codescape.mips.com/components/toolchain/${DATE}/Codescape.GNU.Tools.Package.${DATE}.for.MIPS.MTI.Linux.CentOS-6.x86_64.tar.gz
#local -r CODESCAPE_URL=https://codescape.mips.com/components/toolchain/${DATE}/Codescape.GNU.Tools.Package.${DATE}.for.MIPS.IMG.Linux.CentOS-6.x86_64.tar.gz
local -r GCC_URL=${CODESCAPE_URL}
local -r GCC_RELATIVE_DIR="mips-mti-linux-gnu/${DATE}"
# ref: https://codescape.mips.com/components/toolchain/2019.02-04/downloads.html
#local -r DATE=2019.02-04
#local -r CODESCAPE_URL=https://codescape.mips.com/components/toolchain/${DATE}/Codescape.GNU.Tools.Package.${DATE}.for.MIPS.IMG.Linux.CentOS-6.x86_64.tar.gz
#local -r GCC_RELATIVE_DIR="mips-img-linux-gnu/${DATE}"
local -r GCC_URL=${CODESCAPE_URL}
unpack "${GCC_URL}" "${GCC_RELATIVE_DIR}"
local -r GCC_DIR=${ARCHIVE_DIR}/${GCC_RELATIVE_DIR}
@ -230,12 +253,14 @@ function expand_codescape_config() {
"mips64")
MIPS_FLAGS="-EB -mips64r6 -mabi=64"
FLAVOUR="mips-r6-hard"
#MIPS_FLAGS="-EB -mips64r2 -mabi=64"
#FLAVOUR="mips-r2-hard"
LIBC_DIR_SUFFIX="lib64"
;;
"mips64el")
MIPS_FLAGS="-EL -mips64r6 -mabi=64"
FLAVOUR="mipsel-r6-hard"
#MIPS_FLAGS="-EL -mips64r2 -mabi=64"
#FLAVOUR="mipsel-r2-hard"
LIBC_DIR_SUFFIX="lib64"
;;
@ -259,13 +284,17 @@ set(CMAKE_STAGING_PREFIX ${STAGING_DIR})
set(tools ${GCC_DIR})
# R6
set(CMAKE_C_COMPILER \${tools}/bin/mips-mti-linux-gnu-gcc)
#set(CMAKE_C_COMPILER \${tools}/bin/mips-img-linux-gnu-gcc)
set(CMAKE_C_FLAGS "${MIPS_FLAGS}")
set(CMAKE_CXX_COMPILER \${tools}/bin/mips-mti-linux-gnu-g++)
set(CMAKE_CXX_FLAGS "${MIPS_FLAGS} -L${SYSROOT_DIR}/usr/lib64")
# R2
#set(CMAKE_C_COMPILER \${tools}/bin/mips-img-linux-gnu-gcc)
#set(CMAKE_C_FLAGS "${MIPS_FLAGS}")
#set(CMAKE_CXX_COMPILER \${tools}/bin/mips-img-linux-gnu-g++)
set(CMAKE_CXX_FLAGS "${MIPS_FLAGS}")
#set(CMAKE_CXX_FLAGS "${MIPS_FLAGS}")
set(CMAKE_FIND_ROOT_PATH ${GCC_DIR})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
@ -320,11 +349,14 @@ DESCRIPTION
\tYou MUST define the following variables before running this script:
\t* TARGET:
\t\tx86_64
\t\taarch64-linux-gnu aarch64_be-linux-gnu
\t\tarm-linux-gnueabihf armv8l-linux-gnueabihf arm-linux-gnueabi
\t\tarmeb-linux-gnueabihf armeb-linux-gnueabi
\t\tmips32 mips32el
\t\tmips64 mips64el
\t\taarch64 aarch64be (bootlin)
\t\taarch64-linux-gnu aarch64_be-linux-gnu (linaro)
\t\tarm-linux-gnueabihf armv8l-linux-gnueabihf arm-linux-gnueabi (linaro)
\t\tarmeb-linux-gnueabihf armeb-linux-gnueabi (linaro)
\t\tmips32 mips32el (codespace)
\t\tmips64 mips64el (codespace)
\t\tppc (bootlin)
\t\tppc64 ppc64le (bootlin)
\t\ts390x (bootlin)
OPTIONS
@ -383,7 +415,13 @@ function main() {
declare -r QEMU_ARCH=aarch64 ;;
aarch64_be-linux-gnu)
expand_linaro_config
declare -r QEMU_ARCH=DISABLED ;;
declare -r QEMU_ARCH=aarch64_be ;;
aarch64)
expand_bootlin_config
declare -r QEMU_ARCH=aarch64 ;;
aarch64be)
expand_bootlin_config
declare -r QEMU_ARCH=aarch64_be ;;
mips32)
expand_codescape_config
declare -r QEMU_ARCH=mips ;;
@ -396,6 +434,15 @@ function main() {
mips64el)
expand_codescape_config
declare -r QEMU_ARCH=mips64el ;;
ppc64le)
expand_bootlin_config
declare -r QEMU_ARCH=ppc64le ;;
ppc64)
expand_bootlin_config
declare -r QEMU_ARCH=ppc64 ;;
ppc)
expand_bootlin_config
declare -r QEMU_ARCH=ppc ;;
s390x)
expand_bootlin_config
declare -r QEMU_ARCH=s390x ;;

View File

@ -69,6 +69,7 @@
LINE(PPC_SCV, scv, "scv", 0, PPC_FEATURE2_SCV) \
LINE(PPC_HTM_NO_SUSPEND, htm_no_suspend, "htm-no-suspend", 0, \
PPC_FEATURE2_HTM_NO_SUSPEND)
#undef PPC // Remove conflict with compiler generated preprocessor
#define INTROSPECTION_PREFIX PPC
#define INTROSPECTION_ENUM_PREFIX PPC
#include "define_introspection_and_hwcaps.inl"