diff --git a/common/constants.yaml b/common/constants.yaml index 74193d3..5e6d989 100644 --- a/common/constants.yaml +++ b/common/constants.yaml @@ -18,12 +18,12 @@ profiles: unlocked_mib: 65536 cfg1: "0x02779000" lmr: "0x0000020B" - fb_bytes: "0x0000001000000000" # 64 GiB + fb_bytes: "0x0000001000000000" comment: "8GB physical card → 64GB geometry" "10gb": stock_mib: 10240 unlocked_mib: 40960 cfg1: "0x02669000" lmr: "0x0000028A" - fb_bytes: "0x0000000A00000000" # 40 GiB + fb_bytes: "0x0000000A00000000" comment: "10GB physical card → 40GB geometry" diff --git a/driver/build.sh b/driver/build.sh index 4a59cdc..5aaa7f5 100755 --- a/driver/build.sh +++ b/driver/build.sh @@ -1,10 +1,6 @@ #!/bin/bash set -euo pipefail -############################################################################# -# cmpunlocker — build & install patched open kernel modules for 610.43.0x -############################################################################# - SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" mapfile -t SUPPORTED_VERSIONS < <(grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' "${SCRIPT_DIR}/VERSION") DEFAULT_VERSION="${SUPPORTED_VERSIONS[0]:-}" @@ -49,10 +45,6 @@ info "Building against open-gpu-kernel-modules ${VERSION}" mkdir -p "${BUILD_ROOT}" -############################################################################# -# Fetch + extract clean stock sources -############################################################################# - if [[ ! -f "${TARBALL}" ]]; then info "Downloading open-gpu-kernel-modules ${VERSION}..." curl -L --fail -o "${TARBALL}.partial" "${TARBALL_URL}" @@ -72,10 +64,6 @@ if [[ ! -d "${SRC_DIR}" ]]; then fi ok "Sources ready: ${SRC_DIR}" -############################################################################# -# Apply patches -############################################################################# - info "Applying unlock patches..." cd "${SRC_DIR}" shopt -s nullglob @@ -87,11 +75,6 @@ for p in "${patches[@]}"; do done ok "All patches applied" -############################################################################# -# Card profile geometry (8gb → 64GB unlock, 10gb → 40GB unlock) -############################################################################# - -# Default matches values baked into 0001-*.patch (8GB physical → 64GB geometry). PROFILE="${CMPUNLOCKER_CARD_PROFILE:-8gb}" GSP_C="${SRC_DIR}/src/nvidia/src/kernel/gpu/gsp/kernel_gsp.c" [[ -f "${GSP_C}" ]] || die "Missing ${GSP_C} after patching" @@ -117,8 +100,7 @@ case "${PROFILE}" in esac info "Applying memory profile ${PROFILE} (${UNLOCK_LABEL} geometry)..." -# Newer patches select CFG1/LMR/fb by PCI device ID at runtime (0x20C2→64GB, -# 0x2082→40GB). Older single-constant patches still need a rewrite for 10gb. + python3 - "${GSP_C}" "${CFG1}" "${LMR}" "${FB_BYTES}" "${UNLOCK_LABEL}" <<'PY' import pathlib, re, sys path, cfg1, lmr, fb, label = sys.argv[1:6] @@ -167,10 +149,6 @@ printf '%s\n' "${VERSION}" > "${INSTALL_MOD_DIR}/driver_version" printf '%s\n' "${PROFILE}" > "${INSTALL_MOD_DIR}/card_profile" printf '%s\n' "${UNLOCK_LABEL}" > "${INSTALL_MOD_DIR}/unlock_geometry" -############################################################################# -# Build -############################################################################# - info "Building modules for kernel ${KVER}..." cd "${SRC_DIR}" find . -name "*.sh" -exec chmod +x {} + 2>/dev/null || true @@ -180,10 +158,6 @@ JOBS="$(nproc)" make -j"${JOBS}" modules SYSSRC="${KSRC}" ok "Modules built" -############################################################################# -# Install -############################################################################# - info "Installing modules to ${INSTALL_MOD_DIR}..." mkdir -p "${INSTALL_MOD_DIR}" @@ -202,12 +176,6 @@ done depmod -a "${KVER}" ok "depmod complete" -############################################################################# -# Initramfs — required so early boot does not keep loading stock DKMS -############################################################################# - -# NVIDIA often loads from initramfs. If only updates/dkms is packed there, -# stock modules win at boot even when updates/cmpunlocker is preferred by depmod. rebuild_initramfs() { if command -v update-initramfs &>/dev/null; then info "Rebuilding initramfs (update-initramfs) so patched modules load at boot..." @@ -241,10 +209,6 @@ if [[ -n "${resolved}" ]]; then fi fi -############################################################################# -# Reload -############################################################################# - info "Attempting to unload existing NVIDIA modules..." systemctl stop nvidia-persistenced 2>/dev/null || true systemctl stop nvidia-fabricmanager 2>/dev/null || true diff --git a/install.sh b/install.sh index b7e4b22..65670a8 100755 --- a/install.sh +++ b/install.sh @@ -1,15 +1,6 @@ #!/bin/bash set -euo pipefail -############################################################################# -# cmpunlocker — one-shot install (patch nvidia-open 610.43.0x modules only) -# -# Usage: -# sudo ./install.sh # auto-detect 8GB→64GB or 10GB→40GB -# sudo ./install.sh --profile=8gb # force 8GB card / 64GB unlock -# sudo ./install.sh --profile=10gb # force 10GB card / 40GB unlock -############################################################################# - SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" mapfile -t SUPPORTED_VERSIONS < <(grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' "${SCRIPT_DIR}/driver/VERSION") SUPPORTED_VERSIONS_CSV="$(IFS=', '; echo "${SUPPORTED_VERSIONS[*]}")" @@ -73,7 +64,6 @@ detect_card_profile() { return 1 fi - # Allow already-unlocked cards to reinstall the matching profile. if (( mem_mib >= 60000 )); then echo "8gb" return 0 @@ -82,7 +72,6 @@ detect_card_profile() { echo "10gb" return 0 fi - # Stock sizes (±512 MiB tolerance for reserved FB) if (( mem_mib >= 7680 && mem_mib <= 8704 )); then echo "8gb" return 0 diff --git a/remove.sh b/remove.sh index 1b28766..09e15b7 100755 --- a/remove.sh +++ b/remove.sh @@ -1,10 +1,6 @@ #!/bin/bash set -euo pipefail -############################################################################# -# cmpunlocker — remove patched modules and restore stock nvidia-open load -############################################################################# - SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SERVICE_NAME="cmpunlocker" SERVICE_FILE="/etc/systemd/system/${SERVICE_NAME}.service" @@ -107,7 +103,6 @@ if [[ ${#kernels_touched[@]} -gt 0 ]]; then ok "initramfs rebuild attempted" fi -# Clean leftover GSP backups from older cmpunlocker versions for gsp in /lib/firmware/nvidia/*/gsp_tu10x.bin; do rm -f \ "${gsp}.cmpunlocker.bak" \