From patchwork Mon Mar 8 13:50:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 395426 Delivered-To: patch@linaro.org Received: by 2002:a17:906:a383:0:0:0:0 with SMTP id k3csp1842095ejz; Mon, 8 Mar 2021 06:03:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJz2st6xuy70UCVXpLXYjNGrCRdd7f+lZS08y7BmH8oO7kUw/rxtdXH6d027+pD7P4Punik5 X-Received: by 2002:a05:6638:1192:: with SMTP id f18mr23534219jas.19.1615212214828; Mon, 08 Mar 2021 06:03:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615212214; cv=none; d=google.com; s=arc-20160816; b=mmT0iyxA4sMm/QStRnAJSXcZ//zbY59tw6auEdQGobbd3JnWn65cA/x7F8UG6ef5Sd 3LBz3CloOGy1BvxT53WTb+nu6Q4/taWA7pQLDAFhfG7BiChXD/sYOTNbUaObSncuPwAf TPdQTfMIu6m6/ISqrk2XnKF9JZveQiaD8dNC0oZnZ/zu0rbV3w1rCvOlyHuzqXhEAx17 F2VqGLOa0Na0PFoeaqMJi5oTNVLhdKlLLYwZ9CLNbrr0DtfmMOHJybSC7u+AqXX8d0Kj cAS6B5Ank54ELNNG1qHOtt/o7NHqsc+GwhI7+miXcxaRaJudAzpNJ1OXrJo0/gfPLJum Lpaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=G76SoJtpg/utI3pi7yuaH54pQQHht3OmiN4w23IPZNk=; b=VFko/z2thc5iPE67EEFj875KqcCgniqjD00UqcuSzIbGIF+WeZn/sMvKDnWDNziE7X ppxb1037cdebswQqGPdEZgAekLj3CyaxqqJ05lW9XoctquJJR0KwOiQoXTrsjohg4N26 HaW1zGKTXvt6rOOHHRwf4VmC6TP++vD7uo2VQMq4REsA2jzVLy8tLoPKK6S/KBWBTS/M SOZ+hb3+If89X6cMCfwPGnr5Krv2T7dO3FIPHKJewuOeSeV1gAcinBZ+qZ7J77uJJcfa u8KtKLTxD3GE3M8nhBpIFgPGtZ5F+8WrA4708Hn3+MN0dxiyWuqciLboxS1mY2MV+MKR BEsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=scKbVmgG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d1si9573173jam.28.2021.03.08.06.03.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 08 Mar 2021 06:03:34 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=scKbVmgG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:45136 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lJGTu-0004cY-4o for patch@linaro.org; Mon, 08 Mar 2021 09:03:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53460) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lJGHz-0006Ph-4C for qemu-devel@nongnu.org; Mon, 08 Mar 2021 08:51:15 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:36381) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lJGHw-0001AL-El for qemu-devel@nongnu.org; Mon, 08 Mar 2021 08:51:14 -0500 Received: by mail-wr1-x435.google.com with SMTP id u14so11550766wri.3 for ; Mon, 08 Mar 2021 05:51:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=G76SoJtpg/utI3pi7yuaH54pQQHht3OmiN4w23IPZNk=; b=scKbVmgGM4Rf0NqeHE7I8S1aaZXnfsVoJVEKzd32dpSgngZVw/UL3NsaOuwvX/HSsm qrPxy2Tdbs+opE4KnOA6RxxdSRl7DaiJcPqgEmigLgp7JYV0J06AXZPrzQtzWYX+qvLj +bSZz7rpoR3UnG1i4zEAurUexvYSqHplcgi/6OITgEl3EOUwOiVFTIFwWqd4CBmas3Sz PzE9KOCPzAHvKD9Z3vkdrc4ZhLKFVBXVBvUtiHxAiTg5Pf3oWV/fCEk56srW5EypW2d+ EzkxFVabBEwejjk4ZvVnyh6826To2q9NiU6tMDQV/fPSFzbPEQY4SNbDkMJGOeM3aPlv A6cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=G76SoJtpg/utI3pi7yuaH54pQQHht3OmiN4w23IPZNk=; b=knDUHQvhVzgahdfWehdOapGKb9jTtN6mbbSv1dIh774Mc89gK8A2OTCXg5CVEQcHa2 DIo6jRvsQgzqG+Ptha4UiecRulMEG+oBrncmH/vFC7TcSNhH/6GI8X2WGW6orEAHLOc+ Gbn2W9td7vGxleRQce2Xf8zuw2jP9gJiHLlek42IijxtYUC5wCiLGjoBKUMDO6uIEGgc eU+TISUlSY/kNjaumWAmnunUHKgjXUGusaulk32H8z3QnY5kjTJ/AUzTX1F566HdOOca QMYznlCxaCF39tQQcgn5PdZRfrki+r5EGFEcmONN5+It7zy65gIoiElO3vDXFuOGzAyr PFAQ== X-Gm-Message-State: AOAM533oNUBqNsjjo7QBHbFxp7RpSuIswgQLeqf9ttPYpHoX/GcTV2Nr +vm4HYG4viPEx8x6IjKPTbS/Pg== X-Received: by 2002:adf:f4ce:: with SMTP id h14mr22803358wrp.257.1615211471157; Mon, 08 Mar 2021 05:51:11 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id p10sm19395791wrw.33.2021.03.08.05.51.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Mar 2021 05:51:08 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 1392F1FF8F; Mon, 8 Mar 2021 13:51:05 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 03/18] docker: Add Hexagon image Date: Mon, 8 Mar 2021 13:50:49 +0000 Message-Id: <20210308135104.24903-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210308135104.24903-1-alex.bennee@linaro.org> References: <20210308135104.24903-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alessandro Di Federico , Brian Cain , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Fam Zheng , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Alessandro Di Federico [PMD: Base on qemu/debian10, add missing EXTRA_FILES, remove X86] Signed-off-by: Alessandro Di Federico Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Brian Cain Message-Id: <20210228222314.304787-2-f4bug@amsat.org> [AJB: add build-dep for QEMU, include in MAINTAINERS] Signed-off-by: Alex Bennée squash! docker: Add Hexagon image Message-Id: <20210305092328.31792-5-alex.bennee@linaro.org> -- 2.20.1 diff --git a/MAINTAINERS b/MAINTAINERS index 26c9454823..ab3118429b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -196,6 +196,8 @@ F: linux-user/hexagon/ F: tests/tcg/hexagon/ F: disas/hexagon.c F: default-configs/targets/hexagon-linux-user.mak +F: docker/dockerfiles/debian-hexagon-cross.docker +F: docker/dockerfiles/debian-hexagon-cross.docker.d/build-toolchain.sh HPPA (PA-RISC) TCG CPUs M: Richard Henderson diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include index 7cab761bf5..3aee031c4e 100644 --- a/tests/docker/Makefile.include +++ b/tests/docker/Makefile.include @@ -144,6 +144,8 @@ docker-image-debian-riscv64-cross: docker-image-debian10 docker-image-debian-s390x-cross: docker-image-debian10 docker-image-debian-sh4-cross: docker-image-debian10 docker-image-debian-sparc64-cross: docker-image-debian10 +docker-image-debian-hexagon-cross: \ + EXTRA_FILES:=$(SRC_PATH)/tests/docker/dockerfiles/debian-hexagon-cross.docker.d/build-toolchain.sh # Specialist build images, sometimes very limited tools docker-image-debian-tricore-cross: docker-image-debian10 diff --git a/tests/docker/dockerfiles/debian-hexagon-cross.docker b/tests/docker/dockerfiles/debian-hexagon-cross.docker new file mode 100644 index 0000000000..bf32536896 --- /dev/null +++ b/tests/docker/dockerfiles/debian-hexagon-cross.docker @@ -0,0 +1,27 @@ +FROM qemu/debian10 + +# What we need to build QEMU itself (as this is used in CI as well) +RUN apt update && \ + DEBIAN_FRONTEND=noninteractive eatmydata \ + apt build-dep -yy qemu + +RUN DEBIAN_FRONTEND=noninteractive eatmydata \ + apt install -y --no-install-recommends \ + bison \ + cmake \ + flex \ + lld \ + rsync \ + wget + +ENV TOOLCHAIN_INSTALL /usr +ENV ROOTFS /usr + +ENV LLVM_URL https://github.com/llvm/llvm-project/archive/3d8149c2a1228609fd7d7c91a04681304a2f0ca9.tar.gz +ENV MUSL_URL https://github.com/quic/musl/archive/aff74b395fbf59cd7e93b3691905aa1af6c0778c.tar.gz +ENV LINUX_URL https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.6.18.tar.xz + +ADD build-toolchain.sh /root/hexagon-toolchain/build-toolchain.sh + +RUN ( cd /root/hexagon-toolchain && ./build-toolchain.sh ) && \ + rm -rf /root/hexagon-toolchain diff --git a/tests/docker/dockerfiles/debian-hexagon-cross.docker.d/build-toolchain.sh b/tests/docker/dockerfiles/debian-hexagon-cross.docker.d/build-toolchain.sh new file mode 100755 index 0000000000..19b1c9f83e --- /dev/null +++ b/tests/docker/dockerfiles/debian-hexagon-cross.docker.d/build-toolchain.sh @@ -0,0 +1,141 @@ +#!/bin/bash + +set -e + +BASE=$(readlink -f ${PWD}) + +TOOLCHAIN_INSTALL=$(readlink -f "$TOOLCHAIN_INSTALL") +ROOTFS=$(readlink -f "$ROOTFS") + +TOOLCHAIN_BIN=${TOOLCHAIN_INSTALL}/bin +HEX_SYSROOT=${TOOLCHAIN_INSTALL}/hexagon-unknown-linux-musl +HEX_TOOLS_TARGET_BASE=${HEX_SYSROOT}/usr + +function cdp() { + DIR="$1" + mkdir -p "$DIR" + cd "$DIR" +} + +function fetch() { + DIR="$1" + URL="$2" + TEMP="$(readlink -f "$PWD/tmp.tar.gz")" + wget --quiet "$URL" -O "$TEMP" + cdp "$DIR" + tar xaf "$TEMP" --strip-components=1 + rm "$TEMP" + cd - +} + +build_llvm_clang() { + fetch "$BASE/llvm-project" "$LLVM_URL" + cdp "$BASE/build-llvm" + + cmake -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=${TOOLCHAIN_INSTALL} \ + -DLLVM_ENABLE_LLD=ON \ + -DLLVM_TARGETS_TO_BUILD="Hexagon" \ + -DLLVM_ENABLE_PROJECTS="clang;lld" \ + "$BASE/llvm-project/llvm" + ninja all install + cd ${TOOLCHAIN_BIN} + ln -sf clang hexagon-unknown-linux-musl-clang + ln -sf clang++ hexagon-unknown-linux-musl-clang++ + ln -sf llvm-ar hexagon-unknown-linux-musl-ar + ln -sf llvm-objdump hexagon-unknown-linux-musl-objdump + ln -sf llvm-objcopy hexagon-unknown-linux-musl-objcopy + ln -sf llvm-readelf hexagon-unknown-linux-musl-readelf + ln -sf llvm-ranlib hexagon-unknown-linux-musl-ranlib + + # workaround for now: + cat < hexagon-unknown-linux-musl.cfg +-G0 --sysroot=${HEX_SYSROOT} +EOF +} + +build_clang_rt() { + cdp "$BASE/build-clang_rt" + cmake -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DLLVM_CONFIG_PATH="$BASE/build-llvm/bin/llvm-config" \ + -DCMAKE_ASM_FLAGS="-G0 -mlong-calls -fno-pic --target=hexagon-unknown-linux-musl " \ + -DCMAKE_SYSTEM_NAME=Linux \ + -DCMAKE_C_COMPILER="${TOOLCHAIN_BIN}/hexagon-unknown-linux-musl-clang" \ + -DCMAKE_ASM_COMPILER="${TOOLCHAIN_BIN}/hexagon-unknown-linux-musl-clang" \ + -DCMAKE_INSTALL_PREFIX=${HEX_TOOLS_TARGET_BASE} \ + -DCMAKE_CROSSCOMPILING=ON \ + -DCMAKE_C_COMPILER_FORCED=ON \ + -DCMAKE_CXX_COMPILER_FORCED=ON \ + -DCOMPILER_RT_BUILD_BUILTINS=ON \ + -DCOMPILER_RT_BUILTINS_ENABLE_PIC=OFF \ + -DCMAKE_SIZEOF_VOID_P=4 \ + -DCOMPILER_RT_OS_DIR= \ + -DCAN_TARGET_hexagon=1 \ + -DCAN_TARGET_x86_64=0 \ + -DCOMPILER_RT_SUPPORTED_ARCH=hexagon \ + -DLLVM_ENABLE_PROJECTS="compiler-rt" \ + "$BASE/llvm-project/compiler-rt" + ninja install-compiler-rt +} + +build_musl_headers() { + fetch "$BASE/musl" "$MUSL_URL" + cd "$BASE/musl" + make clean + CC=${TOOLCHAIN_BIN}/hexagon-unknown-linux-musl-clang \ + CROSS_COMPILE=hexagon-unknown-linux-musl \ + LIBCC=${HEX_TOOLS_TARGET_BASE}/lib/libclang_rt.builtins-hexagon.a \ + CROSS_CFLAGS="-G0 -O0 -mv65 -fno-builtin -fno-rounding-math --target=hexagon-unknown-linux-musl" \ + ./configure --target=hexagon --prefix=${HEX_TOOLS_TARGET_BASE} + PATH=${TOOLCHAIN_BIN}:$PATH make CROSS_COMPILE= install-headers + + cd ${HEX_SYSROOT}/.. + ln -sf hexagon-unknown-linux-musl hexagon +} + +build_kernel_headers() { + fetch "$BASE/linux" "$LINUX_URL" + mkdir -p "$BASE/build-linux" + cd "$BASE/linux" + make O=../build-linux ARCH=hexagon \ + KBUILD_CFLAGS_KERNEL="-mlong-calls" \ + CC=${TOOLCHAIN_BIN}/hexagon-unknown-linux-musl-clang \ + LD=${TOOLCHAIN_BIN}/ld.lld \ + KBUILD_VERBOSE=1 comet_defconfig + make mrproper + + cd "$BASE/build-linux" + make \ + ARCH=hexagon \ + CC=${TOOLCHAIN_BIN}/clang \ + INSTALL_HDR_PATH=${HEX_TOOLS_TARGET_BASE} \ + V=1 \ + headers_install +} + +build_musl() { + cd "$BASE/musl" + make clean + CROSS_COMPILE=hexagon-unknown-linux-musl- \ + AR=llvm-ar \ + RANLIB=llvm-ranlib \ + STRIP=llvm-strip \ + CC=clang \ + LIBCC=${HEX_TOOLS_TARGET_BASE}/lib/libclang_rt.builtins-hexagon.a \ + CFLAGS="-G0 -O0 -mv65 -fno-builtin -fno-rounding-math --target=hexagon-unknown-linux-musl" \ + ./configure --target=hexagon --prefix=${HEX_TOOLS_TARGET_BASE} + PATH=${TOOLCHAIN_BIN}/:$PATH make CROSS_COMPILE= install + cd ${HEX_TOOLS_TARGET_BASE}/lib + ln -sf libc.so ld-musl-hexagon.so + ln -sf ld-musl-hexagon.so ld-musl-hexagon.so.1 + cdp ${HEX_TOOLS_TARGET_BASE}/../lib + ln -sf ../usr/lib/ld-musl-hexagon.so.1 +} + +build_llvm_clang +build_kernel_headers +build_musl_headers +build_clang_rt +build_musl