Skip to content

Improvement for cachyos-repo.sh to not depend on gcc for zen arch detection. #7

@sgmihai

Description

@sgmihai
detect_zen_generation() {
    local family=$(awk '/^cpu family/ {print $NF}' /proc/cpuinfo | head -1)
    local model=$(awk '/^model[[:space:]]*:/ {print $NF}' /proc/cpuinfo | head -1)
    
    case "$family" in
        23) (( model <= 31 )) && echo "zen1" || echo "zen2" ;;
        24) echo "zen1" ;;
        25) (( model <= 95 )) && echo "zen3" || echo "zen4" ;;
        26) echo "zen5" ;;
        *) echo "not_zen" ;;
    esac
}

check_supported_znver45() {
    [[ "$(detect_zen_generation)" =~ ^zen[45] ]] && echo 0 || echo 1
}

This is my proposal. Some slim environments (like LXC containers) do not have gcc installed, so adding cachyos repos won't work with the existnig script, if using zen4/5.

I have used the wikichip reference data and also AI to get relevant information about model numbers. Tested on zen4 and it is correct.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions