Skip to content

Commit

Permalink
add support for Raspberry Pi
Browse files Browse the repository at this point in the history
  • Loading branch information
hmeiland committed Jan 18, 2023
1 parent 92233a9 commit ef1ae0b
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tests_archdetect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
- aarch64/arm/neoverse-n1/Azure-Ubuntu20-Altra
- aarch64/arm/neoverse-n1/AWS-awslinux-graviton2
- aarch64/arm/neoverse-v1/AWS-awslinux-graviton3
- aarch64/arm/cortex-a72/debian-rpi4
fail-fast: false
steps:
- uses: actions/checkout@v2
Expand Down
5 changes: 5 additions & 0 deletions init/arch_specs/eessi_arch_arm_part.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ARM CPU architecture specifications
# Software path in EESSI | Vendor ID | List of defining CPU features
"aarch64/arm/cortex-a72" "" "0xd08" # Raspberry Pi 4
"aarch64/arm/neoverse-n1" "" "0xd0c" # AWS Graviton2
"aarch64/arm/neoverse-v1" "" "0xd40" # AWS Graviton3
22 changes: 16 additions & 6 deletions init/eessi_archdetect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,27 +78,37 @@ cpupath(){
local machine_type=${EESSI_MACHINE_TYPE:-$(uname -m)}
log "DEBUG" "cpupath: Host CPU architecture identified as '$machine_type'"

# Identify the host CPU vendor
local cpu_vendor_tag="vendor[ _]id"
local cpu_vendor=$(get_cpuinfo "$cpu_vendor_tag")
log "DEBUG" "cpupath: CPU vendor of host system: '$cpu_vendor'"

# Identify the host CPU part
local cpu_part_tag="cpu[ _]part"
local cpu_part=$(get_cpuinfo "$cpu_part_tag")
log "DEBUG" "cpupath: CPU part of host system: '$cpu_part'"

# Populate list of supported specs for this architecture
case $machine_type in
"x86_64") local spec_file="eessi_arch_x86.spec";;
"aarch64") local spec_file="eessi_arch_arm.spec";;
"aarch64")
local spec_file="eessi_arch_arm.spec"
[ ! "${cpu_part}x" == "x" ] && local spec_file="eessi_arch_arm_part.spec"
;;
"ppc64le") local spec_file="eessi_arch_ppc.spec";;
*) log "ERROR" "cpupath: Unsupported CPU architecture $machine_type"
esac

# spec files are located in a subfolder with this script
local base_dir=$(dirname $(realpath $0))
update_arch_specs cpu_arch_spec "$base_dir/arch_specs/${spec_file}"

# Identify the host CPU vendor
local cpu_vendor_tag="vendor[ _]id"
local cpu_vendor=$(get_cpuinfo "$cpu_vendor_tag")
log "DEBUG" "cpupath: CPU vendor of host system: '$cpu_vendor'"

# Identify the host CPU flags or features
local cpu_flag_tag='flags'
# cpuinfo systems print different line identifiers, eg features, instead of flags
[ "${cpu_vendor}" == "ARM" ] && cpu_flag_tag='flags'
[ "${machine_type}" == "aarch64" ] && [ "${cpu_vendor}x" == "x" ] && cpu_flag_tag='features'
[ "${machine_type}" == "aarch64" ] && [ ! "${cpu_part}x" == "x" ] && cpu_flag_tag='cpu part'
[ "${machine_type}" == "ppc64le" ] && cpu_flag_tag='cpu'

local cpu_flags=$(get_cpuinfo "$cpu_flag_tag")
Expand Down
8 changes: 8 additions & 0 deletions tests/archdetect/aarch64/arm/cortex-a72/debian-rpi4.cpuinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
processor : 0
BogoMIPS : 108.00
Features : fp asimd evtstrm crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3
1 change: 1 addition & 0 deletions tests/archdetect/aarch64/arm/cortex-a72/debian-rpi4.output
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
aarch64/arm/cortex-a72

0 comments on commit ef1ae0b

Please sign in to comment.