From a3bdff601e623bb64b0e29edf545448b0a07a9d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lumi=C3=A8re=20=C3=89lev=C3=A9?= <88174309+PoneyClairDeLune@users.noreply.github.com> Date: Wed, 7 Feb 2024 05:22:18 +0000 Subject: [PATCH] Detect for amd64 revisions. --- README.md | 2 +- src/acari/acari.sh | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 src/acari/acari.sh diff --git a/README.md b/README.md index a359df2..296f791 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Acari only supports `amd64`, `armv8`, `rv64g` and their later revisions. ### CISC - +- `i386`: A 32-bit only CPU architecture from Intel. - `amd64`: A 64-bit CPU architecture from AMD. - `amd64v2`: `amd64` with extensions like SSE3. - `amd64v3`: `amd64v2` with extensions like AVX and AVX2. diff --git a/src/acari/acari.sh b/src/acari/acari.sh new file mode 100644 index 0000000..3b7b929 --- /dev/null +++ b/src/acari/acari.sh @@ -0,0 +1,34 @@ +#!/bin/bash +nativeArch="$(uname -m)" +detectArch="$nativeArch" +# Arch rename +case $nativeArch in + "i386" | "i686" ) + detectArch="i386" + ;; + "x86_64" | "amd64") + detectArch="amd64" + ;; + "arm64" | "armv8l" | "aarch64") + detectArch="arm64" + ;; + "riscv64" ) + detectArch="rv64" + ;; +esac +# Revision match +cpuFlags=$(cat "/proc/cpuinfo") +case $detectArch in + "amd64" ) + if [[ "$cpuFlags" == *"avx256"* ]]; then + detectArch="amd64v4" + elif [[ "$cpuFlags" == *"avx2"* ]]; then + detectArch="amd64v3" + elif [[ "$cpuFlags" == *"sse3"* ]]; then + detectArch="amd64v2" + fi + ;; +esac +# Print the output +printf "$detectArch" +exit \ No newline at end of file