feat(kernel): implement Phase 4 with kernel selection, microcode detection, and AMD P-State configuration
- commit
- 763f191865bb8cd628d949d08b6c43481d291783
- author
- bnema · · 2025-10-19 07:45 UTC
- parent
- de28510
- signature
- unsigned
6 files · +167 -17
M README.md +19 -13
| @@ -8,6 +8,7 @@ | |||
| 8 | 8 | ✅ **Phase 1: Barebone Installer - Basic - COMPLETE** | |
| 9 | 9 | ✅ **Phase 2: Add btrfs + LUKS Encryption - COMPLETE** | |
| 10 | 10 | ✅ **Phase 3: Limine Bootloader - COMPLETE** | |
| 11 | + | ✅ **Phase 4: Kernel Selection + Microcode - COMPLETE** | |
| 11 | 12 | ||
| 12 | 13 | ### Completed | |
| 13 | 14 | - ✅ Project structure created | |
| @@ -25,6 +26,9 @@ | |||
| 25 | 26 | - ✅ btrfs filesystem with subvolumes (@ for root, @home for home) | |
| 26 | 27 | - ✅ LUKS encryption with Argon2id (optional, 2000ms iteration) | |
| 27 | 28 | - ✅ Encrypted boot support (mkinitcpio hooks) | |
| 29 | + | - ✅ Kernel selection (linux, linux-lts, linux-zen) | |
| 30 | + | - ✅ Auto-detected CPU microcode (intel-ucode or amd-ucode) | |
| 31 | + | - ✅ AMD P-State driver selection (active/guided/passive) | |
| 28 | 32 | ||
| 29 | 33 | ### Project Structure | |
| 30 | 34 | ``` | |
| @@ -129,13 +133,16 @@ sudo ./install.sh | |||
| 129 | 133 | **What the installer does:** | |
| 130 | 134 | 1. Validates system (vanilla Arch ISO, UEFI, x86_64) | |
| 131 | 135 | 2. Asks for encryption preference (optional LUKS with Argon2id) | |
| 132 | - | 3. Selects installation disk (auto-partitions with GPT) | |
| 133 | - | 4. Formats partitions (FAT32 EFI + btrfs root with optional LUKS) | |
| 134 | - | 5. Creates btrfs subvolumes (@ for root, @home for home) | |
| 135 | - | 6. Installs ~15 base packages with pacstrap (+ cryptsetup if encrypted) | |
| 136 | - | 7. Configures system (timezone, locale, hostname, user) | |
| 137 | - | 8. Installs Limine bootloader (with encryption support if enabled) | |
| 138 | - | 9. Creates bootable minimal Arch system with btrfs | |
| 136 | + | 3. Asks for kernel choice (linux, linux-lts, or linux-zen) | |
| 137 | + | 4. Auto-detects CPU and selects microcode (Intel/AMD) | |
| 138 | + | 5. For AMD: Asks for P-State driver mode (active/guided/passive) | |
| 139 | + | 6. Selects installation disk (auto-partitions with GPT) | |
| 140 | + | 7. Formats partitions (FAT32 EFI + btrfs root with optional LUKS) | |
| 141 | + | 8. Creates btrfs subvolumes (@ for root, @home for home) | |
| 142 | + | 9. Installs base packages with pacstrap (kernel + microcode + cryptsetup if encrypted) | |
| 143 | + | 10. Configures system (timezone, locale, hostname, user) | |
| 144 | + | 11. Installs Limine bootloader (with encryption and AMD tuning if enabled) | |
| 145 | + | 12. Creates bootable minimal Arch system with btrfs | |
| 139 | 146 | ||
| 140 | 147 | ## Environment Variables | |
| 141 | 148 | ||
| @@ -145,12 +152,11 @@ sudo ./install.sh | |||
| 145 | 152 | ||
| 146 | 153 | ## Next Steps | |
| 147 | 154 | ||
| 148 | - | **Phase 4: Kernel Selection + Microcode** (Week 3) | |
| 149 | - | - [ ] Let user choose kernel (linux, linux-lts, linux-zen) | |
| 150 | - | - [ ] Auto-detect CPU (Intel/AMD) | |
| 151 | - | - [ ] Auto-install appropriate microcode (intel-ucode/amd-ucode) | |
| 152 | - | - [ ] For AMD: Add pstate and governor selection | |
| 153 | - | - [ ] Test all kernels boot successfully | |
| 155 | + | **Phase 5: Repository Setup (AUR + Chaotic)** (Week 3-4) | |
| 156 | + | - [ ] Ask user to enable AUR support (install yay) | |
| 157 | + | - [ ] Ask user to enable Chaotic-AUR repository | |
| 158 | + | - [ ] Test yay installation from AUR | |
| 159 | + | - [ ] Test Chaotic-AUR package installation | |
| 154 | 160 | ||
| 155 | 161 | ## Reference | |
| 156 | 162 | ||
| @@ -8,6 +8,7 @@ | |||||
| 8 | ✅ **Phase 1: Barebone Installer - Basic - COMPLETE** | 8 | ✅ **Phase 1: Barebone Installer - Basic - COMPLETE** | ||
| 9 | ✅ **Phase 2: Add btrfs + LUKS Encryption - COMPLETE** | 9 | ✅ **Phase 2: Add btrfs + LUKS Encryption - COMPLETE** | ||
| 10 | ✅ **Phase 3: Limine Bootloader - COMPLETE** | 10 | ✅ **Phase 3: Limine Bootloader - COMPLETE** | ||
| 11 | + | ✅ **Phase 4: Kernel Selection + Microcode - COMPLETE** | |||
| 11 | 12 | ||||
| 12 | ### Completed | 13 | ### Completed | ||
| 13 | - ✅ Project structure created | 14 | - ✅ Project structure created | ||
| @@ -25,6 +26,9 @@ | |||||
| 25 | - ✅ btrfs filesystem with subvolumes (@ for root, @home for home) | 26 | - ✅ btrfs filesystem with subvolumes (@ for root, @home for home) | ||
| 26 | - ✅ LUKS encryption with Argon2id (optional, 2000ms iteration) | 27 | - ✅ LUKS encryption with Argon2id (optional, 2000ms iteration) | ||
| 27 | - ✅ Encrypted boot support (mkinitcpio hooks) | 28 | - ✅ Encrypted boot support (mkinitcpio hooks) | ||
| 29 | + | - ✅ Kernel selection (linux, linux-lts, linux-zen) | |||
| 30 | + | - ✅ Auto-detected CPU microcode (intel-ucode or amd-ucode) | |||
| 31 | + | - ✅ AMD P-State driver selection (active/guided/passive) | |||
| 28 | 32 | ||||
| 29 | ### Project Structure | 33 | ### Project Structure | ||
| 30 | ``` | 34 | ``` | ||
| @@ -129,13 +133,16 @@ sudo ./install.sh | |||||
| 129 | **What the installer does:** | 133 | **What the installer does:** | ||
| 130 | 1. Validates system (vanilla Arch ISO, UEFI, x86_64) | 134 | 1. Validates system (vanilla Arch ISO, UEFI, x86_64) | ||
| 131 | 2. Asks for encryption preference (optional LUKS with Argon2id) | 135 | 2. Asks for encryption preference (optional LUKS with Argon2id) | ||
| 132 | - | 3. Selects installation disk (auto-partitions with GPT) | 136 | + | 3. Asks for kernel choice (linux, linux-lts, or linux-zen) |
| 133 | - | 4. Formats partitions (FAT32 EFI + btrfs root with optional LUKS) | 137 | + | 4. Auto-detects CPU and selects microcode (Intel/AMD) |
| 134 | - | 5. Creates btrfs subvolumes (@ for root, @home for home) | 138 | + | 5. For AMD: Asks for P-State driver mode (active/guided/passive) |
| 135 | - | 6. Installs ~15 base packages with pacstrap (+ cryptsetup if encrypted) | 139 | + | 6. Selects installation disk (auto-partitions with GPT) |
| 136 | - | 7. Configures system (timezone, locale, hostname, user) | 140 | + | 7. Formats partitions (FAT32 EFI + btrfs root with optional LUKS) |
| 137 | - | 8. Installs Limine bootloader (with encryption support if enabled) | 141 | + | 8. Creates btrfs subvolumes (@ for root, @home for home) |
| 138 | - | 9. Creates bootable minimal Arch system with btrfs | 142 | + | 9. Installs base packages with pacstrap (kernel + microcode + cryptsetup if encrypted) |
| 143 | + | 10. Configures system (timezone, locale, hostname, user) | |||
| 144 | + | 11. Installs Limine bootloader (with encryption and AMD tuning if enabled) | |||
| 145 | + | 12. Creates bootable minimal Arch system with btrfs | |||
| 139 | 146 | ||||
| 140 | ## Environment Variables | 147 | ## Environment Variables | ||
| 141 | 148 | ||||
| @@ -145,12 +152,11 @@ sudo ./install.sh | |||||
| 145 | 152 | ||||
| 146 | ## Next Steps | 153 | ## Next Steps | ||
| 147 | 154 | ||||
| 148 | - | **Phase 4: Kernel Selection + Microcode** (Week 3) | 155 | + | **Phase 5: Repository Setup (AUR + Chaotic)** (Week 3-4) |
| 149 | - | - [ ] Let user choose kernel (linux, linux-lts, linux-zen) | 156 | + | - [ ] Ask user to enable AUR support (install yay) |
| 150 | - | - [ ] Auto-detect CPU (Intel/AMD) | 157 | + | - [ ] Ask user to enable Chaotic-AUR repository |
| 151 | - | - [ ] Auto-install appropriate microcode (intel-ucode/amd-ucode) | 158 | + | - [ ] Test yay installation from AUR |
| 152 | - | - [ ] For AMD: Add pstate and governor selection | 159 | + | - [ ] Test Chaotic-AUR package installation |
| 153 | - | - [ ] Test all kernels boot successfully | |||
| 154 | 160 | ||||
| 155 | ## Reference | 161 | ## Reference | ||
| 156 | 162 | ||||
M install/base/all.sh +1 -0
| @@ -1,5 +1,6 @@ | |||
| 1 | 1 | #!/bin/bash | |
| 2 | 2 | # Base installation phase orchestrator | |
| 3 | 3 | ||
| 4 | + | run_logged "$ARCHUP_INSTALL/base/kernel.sh" | |
| 4 | 5 | run_logged "$ARCHUP_INSTALL/base/pacstrap.sh" | |
| 5 | 6 | run_logged "$ARCHUP_INSTALL/base/fstab.sh" | |
| @@ -1,5 +1,6 @@ | |||||
| 1 | #!/bin/bash | 1 | #!/bin/bash | ||
| 2 | # Base installation phase orchestrator | 2 | # Base installation phase orchestrator | ||
| 3 | 3 | ||||
| 4 | + | run_logged "$ARCHUP_INSTALL/base/kernel.sh" | |||
| 4 | run_logged "$ARCHUP_INSTALL/base/pacstrap.sh" | 5 | run_logged "$ARCHUP_INSTALL/base/pacstrap.sh" | ||
| 5 | run_logged "$ARCHUP_INSTALL/base/fstab.sh" | 6 | run_logged "$ARCHUP_INSTALL/base/fstab.sh" | ||
A install/base/kernel.sh +124 -0
| @@ -0,0 +1,124 @@ | |||
| 1 | + | #!/bin/bash | |
| 2 | + | # Kernel selection and microcode installation | |
| 3 | + | # Detects CPU vendor and auto-installs appropriate microcode | |
| 4 | + | ||
| 5 | + | gum style --foreground 6 --padding "1 0 0 $PADDING_LEFT" "Kernel Selection" | |
| 6 | + | ||
| 7 | + | # Ask user to choose kernel | |
| 8 | + | echo | |
| 9 | + | gum style --padding "0 0 0 $PADDING_LEFT" "Choose your kernel:" | |
| 10 | + | gum style --padding "0 0 0 $PADDING_LEFT" " • linux - Stable mainline kernel (recommended)" | |
| 11 | + | gum style --padding "0 0 0 $PADDING_LEFT" " • linux-lts - Long-term support (maximum stability)" | |
| 12 | + | gum style --padding "0 0 0 $PADDING_LEFT" " • linux-zen - Performance-optimized (gaming/desktop)" | |
| 13 | + | echo | |
| 14 | + | ||
| 15 | + | KERNEL_CHOICE=$(gum choose --padding "0 0 1 $PADDING_LEFT" "linux" "linux-lts" "linux-zen") | |
| 16 | + | export ARCHUP_KERNEL="$KERNEL_CHOICE" | |
| 17 | + | ||
| 18 | + | gum style --foreground 2 --padding "0 0 0 $PADDING_LEFT" "✓ Selected: $ARCHUP_KERNEL" | |
| 19 | + | echo "Kernel: $ARCHUP_KERNEL" | tee -a "$ARCHUP_INSTALL_LOG_FILE" | |
| 20 | + | ||
| 21 | + | # Detect CPU vendor | |
| 22 | + | gum style --foreground 6 --padding "1 0 0 $PADDING_LEFT" "Detecting CPU vendor..." | |
| 23 | + | ||
| 24 | + | CPU_VENDOR=$(grep -m1 'vendor_id' /proc/cpuinfo | awk '{print $3}') | |
| 25 | + | ||
| 26 | + | if [ "$CPU_VENDOR" = "GenuineIntel" ]; then | |
| 27 | + | MICROCODE="intel-ucode" | |
| 28 | + | CPU_TYPE="Intel" | |
| 29 | + | elif [ "$CPU_VENDOR" = "AuthenticAMD" ]; then | |
| 30 | + | MICROCODE="amd-ucode" | |
| 31 | + | CPU_TYPE="AMD" | |
| 32 | + | else | |
| 33 | + | MICROCODE="" | |
| 34 | + | CPU_TYPE="Unknown" | |
| 35 | + | gum style --foreground 3 --padding "0 0 1 $PADDING_LEFT" "⚠ Unknown CPU vendor: $CPU_VENDOR" | |
| 36 | + | fi | |
| 37 | + | ||
| 38 | + | if [ -n "$MICROCODE" ]; then | |
| 39 | + | export ARCHUP_MICROCODE="$MICROCODE" | |
| 40 | + | gum style --foreground 2 --padding "0 0 0 $PADDING_LEFT" "✓ Detected: $CPU_TYPE CPU" | |
| 41 | + | gum style --padding "0 0 1 $PADDING_LEFT" " Microcode: $MICROCODE" | |
| 42 | + | echo "CPU: $CPU_TYPE, Microcode: $MICROCODE" | tee -a "$ARCHUP_INSTALL_LOG_FILE" | |
| 43 | + | else | |
| 44 | + | export ARCHUP_MICROCODE="" | |
| 45 | + | echo "CPU: Unknown, no microcode" | tee -a "$ARCHUP_INSTALL_LOG_FILE" | |
| 46 | + | fi | |
| 47 | + | ||
| 48 | + | # AMD-specific tuning (P-State driver selection) | |
| 49 | + | if [ "$CPU_TYPE" = "AMD" ]; then | |
| 50 | + | echo | |
| 51 | + | gum style --foreground 6 --padding "1 0 0 $PADDING_LEFT" "AMD CPU Tuning" | |
| 52 | + | gum style --padding "0 0 0 $PADDING_LEFT" "Select AMD P-State driver mode for CPU frequency scaling" | |
| 53 | + | echo | |
| 54 | + | ||
| 55 | + | # Detect available AMD P-State modes from the live system | |
| 56 | + | gum style --padding "0 0 0 $PADDING_LEFT" "Detecting available P-State modes..." | |
| 57 | + | ||
| 58 | + | # Check if amd-pstate driver is loaded and what modes are available | |
| 59 | + | AVAILABLE_MODES=() | |
| 60 | + | ||
| 61 | + | # Try to read available modes from sysfs (if driver is already loaded) | |
| 62 | + | if [ -f /sys/devices/system/cpu/amd_pstate/status ]; then | |
| 63 | + | # Driver is loaded, check available modes | |
| 64 | + | # Typically: active, passive, guided, disable | |
| 65 | + | mapfile -t AVAILABLE_MODES < <(cat /sys/devices/system/cpu/amd_pstate/status 2>/dev/null | grep -oE '(active|passive|guided)' || echo "") | |
| 66 | + | fi | |
| 67 | + | ||
| 68 | + | # If we couldn't detect modes, check if the CPU supports CPPC | |
| 69 | + | # Most modern AMD Ryzen CPUs support all three modes | |
| 70 | + | if [ ${#AVAILABLE_MODES[@]} -eq 0 ]; then | |
| 71 | + | # Check if CPPC is supported (indicates active mode support) | |
| 72 | + | if grep -q "cppc" /proc/cpuinfo 2>/dev/null || [ -d /sys/devices/system/cpu/cpu0/cpufreq/amd_pstate ]; then | |
| 73 | + | AVAILABLE_MODES=("active" "guided" "passive") | |
| 74 | + | else | |
| 75 | + | # Fallback: older AMD CPUs might only support passive | |
| 76 | + | AVAILABLE_MODES=("passive") | |
| 77 | + | fi | |
| 78 | + | fi | |
| 79 | + | ||
| 80 | + | # Remove duplicates and sort | |
| 81 | + | AVAILABLE_MODES=($(printf '%s\n' "${AVAILABLE_MODES[@]}" | sort -u)) | |
| 82 | + | ||
| 83 | + | # Display detected modes | |
| 84 | + | if [ ${#AVAILABLE_MODES[@]} -gt 0 ]; then | |
| 85 | + | gum style --foreground 2 --padding "0 0 0 $PADDING_LEFT" "✓ Detected ${#AVAILABLE_MODES[@]} available mode(s): ${AVAILABLE_MODES[*]}" | |
| 86 | + | else | |
| 87 | + | gum style --foreground 3 --padding "0 0 0 $PADDING_LEFT" "⚠ Could not detect available modes, using defaults" | |
| 88 | + | AVAILABLE_MODES=("passive") | |
| 89 | + | fi | |
| 90 | + | ||
| 91 | + | echo | |
| 92 | + | gum style --padding "0 0 0 $PADDING_LEFT" "AMD P-State modes:" | |
| 93 | + | # Only show descriptions for available modes | |
| 94 | + | for mode in "${AVAILABLE_MODES[@]}"; do | |
| 95 | + | case "$mode" in | |
| 96 | + | active) | |
| 97 | + | gum style --padding "0 0 0 $PADDING_LEFT" " • active - CPPC (best performance, desktop/gaming)" | |
| 98 | + | ;; | |
| 99 | + | guided) | |
| 100 | + | gum style --padding "0 0 0 $PADDING_LEFT" " • guided - Balanced (laptop/hybrid use)" | |
| 101 | + | ;; | |
| 102 | + | passive) | |
| 103 | + | gum style --padding "0 0 0 $PADDING_LEFT" " • passive - Acpi-cpufreq replacement (compatibility)" | |
| 104 | + | ;; | |
| 105 | + | esac | |
| 106 | + | done | |
| 107 | + | echo | |
| 108 | + | gum style --foreground 3 --padding "0 0 0 $PADDING_LEFT" "Note: CPU governors will be available after reboot" | |
| 109 | + | gum style --padding "0 0 1 $PADDING_LEFT" " and depend on the P-State mode selected" | |
| 110 | + | echo | |
| 111 | + | ||
| 112 | + | AMD_PSTATE=$(gum choose --padding "0 0 1 $PADDING_LEFT" "${AVAILABLE_MODES[@]}") | |
| 113 | + | export ARCHUP_AMD_PSTATE="$AMD_PSTATE" | |
| 114 | + | gum style --foreground 2 --padding "0 0 0 $PADDING_LEFT" "✓ P-State: $AMD_PSTATE" | |
| 115 | + | echo "AMD P-State: $AMD_PSTATE (kernel parameter)" | tee -a "$ARCHUP_INSTALL_LOG_FILE" | |
| 116 | + | ||
| 117 | + | # Prepare kernel parameters for AMD P-State | |
| 118 | + | export ARCHUP_AMD_KERNEL_PARAMS="amd_pstate=$AMD_PSTATE" | |
| 119 | + | else | |
| 120 | + | export ARCHUP_AMD_PSTATE="" | |
| 121 | + | export ARCHUP_AMD_KERNEL_PARAMS="" | |
| 122 | + | fi | |
| 123 | + | ||
| 124 | + | gum style --foreground 2 --padding "1 0 1 $PADDING_LEFT" "✓ Kernel configuration complete" | |
| @@ -0,0 +1,124 @@ | |||||
| 1 | + | #!/bin/bash | |||
| 2 | + | # Kernel selection and microcode installation | |||
| 3 | + | # Detects CPU vendor and auto-installs appropriate microcode | |||
| 4 | + | ||||
| 5 | + | gum style --foreground 6 --padding "1 0 0 $PADDING_LEFT" "Kernel Selection" | |||
| 6 | + | ||||
| 7 | + | # Ask user to choose kernel | |||
| 8 | + | echo | |||
| 9 | + | gum style --padding "0 0 0 $PADDING_LEFT" "Choose your kernel:" | |||
| 10 | + | gum style --padding "0 0 0 $PADDING_LEFT" " • linux - Stable mainline kernel (recommended)" | |||
| 11 | + | gum style --padding "0 0 0 $PADDING_LEFT" " • linux-lts - Long-term support (maximum stability)" | |||
| 12 | + | gum style --padding "0 0 0 $PADDING_LEFT" " • linux-zen - Performance-optimized (gaming/desktop)" | |||
| 13 | + | echo | |||
| 14 | + | ||||
| 15 | + | KERNEL_CHOICE=$(gum choose --padding "0 0 1 $PADDING_LEFT" "linux" "linux-lts" "linux-zen") | |||
| 16 | + | export ARCHUP_KERNEL="$KERNEL_CHOICE" | |||
| 17 | + | ||||
| 18 | + | gum style --foreground 2 --padding "0 0 0 $PADDING_LEFT" "✓ Selected: $ARCHUP_KERNEL" | |||
| 19 | + | echo "Kernel: $ARCHUP_KERNEL" | tee -a "$ARCHUP_INSTALL_LOG_FILE" | |||
| 20 | + | ||||
| 21 | + | # Detect CPU vendor | |||
| 22 | + | gum style --foreground 6 --padding "1 0 0 $PADDING_LEFT" "Detecting CPU vendor..." | |||
| 23 | + | ||||
| 24 | + | CPU_VENDOR=$(grep -m1 'vendor_id' /proc/cpuinfo | awk '{print $3}') | |||
| 25 | + | ||||
| 26 | + | if [ "$CPU_VENDOR" = "GenuineIntel" ]; then | |||
| 27 | + | MICROCODE="intel-ucode" | |||
| 28 | + | CPU_TYPE="Intel" | |||
| 29 | + | elif [ "$CPU_VENDOR" = "AuthenticAMD" ]; then | |||
| 30 | + | MICROCODE="amd-ucode" | |||
| 31 | + | CPU_TYPE="AMD" | |||
| 32 | + | else | |||
| 33 | + | MICROCODE="" | |||
| 34 | + | CPU_TYPE="Unknown" | |||
| 35 | + | gum style --foreground 3 --padding "0 0 1 $PADDING_LEFT" "⚠ Unknown CPU vendor: $CPU_VENDOR" | |||
| 36 | + | fi | |||
| 37 | + | ||||
| 38 | + | if [ -n "$MICROCODE" ]; then | |||
| 39 | + | export ARCHUP_MICROCODE="$MICROCODE" | |||
| 40 | + | gum style --foreground 2 --padding "0 0 0 $PADDING_LEFT" "✓ Detected: $CPU_TYPE CPU" | |||
| 41 | + | gum style --padding "0 0 1 $PADDING_LEFT" " Microcode: $MICROCODE" | |||
| 42 | + | echo "CPU: $CPU_TYPE, Microcode: $MICROCODE" | tee -a "$ARCHUP_INSTALL_LOG_FILE" | |||
| 43 | + | else | |||
| 44 | + | export ARCHUP_MICROCODE="" | |||
| 45 | + | echo "CPU: Unknown, no microcode" | tee -a "$ARCHUP_INSTALL_LOG_FILE" | |||
| 46 | + | fi | |||
| 47 | + | ||||
| 48 | + | # AMD-specific tuning (P-State driver selection) | |||
| 49 | + | if [ "$CPU_TYPE" = "AMD" ]; then | |||
| 50 | + | echo | |||
| 51 | + | gum style --foreground 6 --padding "1 0 0 $PADDING_LEFT" "AMD CPU Tuning" | |||
| 52 | + | gum style --padding "0 0 0 $PADDING_LEFT" "Select AMD P-State driver mode for CPU frequency scaling" | |||
| 53 | + | echo | |||
| 54 | + | ||||
| 55 | + | # Detect available AMD P-State modes from the live system | |||
| 56 | + | gum style --padding "0 0 0 $PADDING_LEFT" "Detecting available P-State modes..." | |||
| 57 | + | ||||
| 58 | + | # Check if amd-pstate driver is loaded and what modes are available | |||
| 59 | + | AVAILABLE_MODES=() | |||
| 60 | + | ||||
| 61 | + | # Try to read available modes from sysfs (if driver is already loaded) | |||
| 62 | + | if [ -f /sys/devices/system/cpu/amd_pstate/status ]; then | |||
| 63 | + | # Driver is loaded, check available modes | |||
| 64 | + | # Typically: active, passive, guided, disable | |||
| 65 | + | mapfile -t AVAILABLE_MODES < <(cat /sys/devices/system/cpu/amd_pstate/status 2>/dev/null | grep -oE '(active|passive|guided)' || echo "") | |||
| 66 | + | fi | |||
| 67 | + | ||||
| 68 | + | # If we couldn't detect modes, check if the CPU supports CPPC | |||
| 69 | + | # Most modern AMD Ryzen CPUs support all three modes | |||
| 70 | + | if [ ${#AVAILABLE_MODES[@]} -eq 0 ]; then | |||
| 71 | + | # Check if CPPC is supported (indicates active mode support) | |||
| 72 | + | if grep -q "cppc" /proc/cpuinfo 2>/dev/null || [ -d /sys/devices/system/cpu/cpu0/cpufreq/amd_pstate ]; then | |||
| 73 | + | AVAILABLE_MODES=("active" "guided" "passive") | |||
| 74 | + | else | |||
| 75 | + | # Fallback: older AMD CPUs might only support passive | |||
| 76 | + | AVAILABLE_MODES=("passive") | |||
| 77 | + | fi | |||
| 78 | + | fi | |||
| 79 | + | ||||
| 80 | + | # Remove duplicates and sort | |||
| 81 | + | AVAILABLE_MODES=($(printf '%s\n' "${AVAILABLE_MODES[@]}" | sort -u)) | |||
| 82 | + | ||||
| 83 | + | # Display detected modes | |||
| 84 | + | if [ ${#AVAILABLE_MODES[@]} -gt 0 ]; then | |||
| 85 | + | gum style --foreground 2 --padding "0 0 0 $PADDING_LEFT" "✓ Detected ${#AVAILABLE_MODES[@]} available mode(s): ${AVAILABLE_MODES[*]}" | |||
| 86 | + | else | |||
| 87 | + | gum style --foreground 3 --padding "0 0 0 $PADDING_LEFT" "⚠ Could not detect available modes, using defaults" | |||
| 88 | + | AVAILABLE_MODES=("passive") | |||
| 89 | + | fi | |||
| 90 | + | ||||
| 91 | + | echo | |||
| 92 | + | gum style --padding "0 0 0 $PADDING_LEFT" "AMD P-State modes:" | |||
| 93 | + | # Only show descriptions for available modes | |||
| 94 | + | for mode in "${AVAILABLE_MODES[@]}"; do | |||
| 95 | + | case "$mode" in | |||
| 96 | + | active) | |||
| 97 | + | gum style --padding "0 0 0 $PADDING_LEFT" " • active - CPPC (best performance, desktop/gaming)" | |||
| 98 | + | ;; | |||
| 99 | + | guided) | |||
| 100 | + | gum style --padding "0 0 0 $PADDING_LEFT" " • guided - Balanced (laptop/hybrid use)" | |||
| 101 | + | ;; | |||
| 102 | + | passive) | |||
| 103 | + | gum style --padding "0 0 0 $PADDING_LEFT" " • passive - Acpi-cpufreq replacement (compatibility)" | |||
| 104 | + | ;; | |||
| 105 | + | esac | |||
| 106 | + | done | |||
| 107 | + | echo | |||
| 108 | + | gum style --foreground 3 --padding "0 0 0 $PADDING_LEFT" "Note: CPU governors will be available after reboot" | |||
| 109 | + | gum style --padding "0 0 1 $PADDING_LEFT" " and depend on the P-State mode selected" | |||
| 110 | + | echo | |||
| 111 | + | ||||
| 112 | + | AMD_PSTATE=$(gum choose --padding "0 0 1 $PADDING_LEFT" "${AVAILABLE_MODES[@]}") | |||
| 113 | + | export ARCHUP_AMD_PSTATE="$AMD_PSTATE" | |||
| 114 | + | gum style --foreground 2 --padding "0 0 0 $PADDING_LEFT" "✓ P-State: $AMD_PSTATE" | |||
| 115 | + | echo "AMD P-State: $AMD_PSTATE (kernel parameter)" | tee -a "$ARCHUP_INSTALL_LOG_FILE" | |||
| 116 | + | ||||
| 117 | + | # Prepare kernel parameters for AMD P-State | |||
| 118 | + | export ARCHUP_AMD_KERNEL_PARAMS="amd_pstate=$AMD_PSTATE" | |||
| 119 | + | else | |||
| 120 | + | export ARCHUP_AMD_PSTATE="" | |||
| 121 | + | export ARCHUP_AMD_KERNEL_PARAMS="" | |||
| 122 | + | fi | |||
| 123 | + | ||||
| 124 | + | gum style --foreground 2 --padding "1 0 1 $PADDING_LEFT" "✓ Kernel configuration complete" | |||
M install/base/pacstrap.sh +12 -0
| @@ -7,6 +7,18 @@ gum style --padding "0 0 1 $PADDING_LEFT" "This may take a few minutes..." | |||
| 7 | 7 | # Read barebone package list | |
| 8 | 8 | mapfile -t packages < <(grep -v '^#' "$ARCHUP_INSTALL/presets/barebone.packages" | grep -v '^$') | |
| 9 | 9 | ||
| 10 | + | # Add kernel (selected in kernel.sh) | |
| 11 | + | if [ -n "$ARCHUP_KERNEL" ]; then | |
| 12 | + | packages+=("$ARCHUP_KERNEL") | |
| 13 | + | echo "Adding kernel: $ARCHUP_KERNEL" | tee -a "$ARCHUP_INSTALL_LOG_FILE" | |
| 14 | + | fi | |
| 15 | + | ||
| 16 | + | # Add microcode (detected in kernel.sh) | |
| 17 | + | if [ -n "$ARCHUP_MICROCODE" ]; then | |
| 18 | + | packages+=("$ARCHUP_MICROCODE") | |
| 19 | + | echo "Adding microcode: $ARCHUP_MICROCODE" | tee -a "$ARCHUP_INSTALL_LOG_FILE" | |
| 20 | + | fi | |
| 21 | + | ||
| 10 | 22 | # Add cryptsetup if encryption is enabled | |
| 11 | 23 | if [ "$ARCHUP_ENCRYPTION" = "enabled" ]; then | |
| 12 | 24 | packages+=("cryptsetup") | |
| @@ -7,6 +7,18 @@ gum style --padding "0 0 1 $PADDING_LEFT" "This may take a few minutes..." | |||||
| 7 | # Read barebone package list | 7 | # Read barebone package list | ||
| 8 | mapfile -t packages < <(grep -v '^#' "$ARCHUP_INSTALL/presets/barebone.packages" | grep -v '^$') | 8 | mapfile -t packages < <(grep -v '^#' "$ARCHUP_INSTALL/presets/barebone.packages" | grep -v '^$') | ||
| 9 | 9 | ||||
| 10 | + | # Add kernel (selected in kernel.sh) | |||
| 11 | + | if [ -n "$ARCHUP_KERNEL" ]; then | |||
| 12 | + | packages+=("$ARCHUP_KERNEL") | |||
| 13 | + | echo "Adding kernel: $ARCHUP_KERNEL" | tee -a "$ARCHUP_INSTALL_LOG_FILE" | |||
| 14 | + | fi | |||
| 15 | + | ||||
| 16 | + | # Add microcode (detected in kernel.sh) | |||
| 17 | + | if [ -n "$ARCHUP_MICROCODE" ]; then | |||
| 18 | + | packages+=("$ARCHUP_MICROCODE") | |||
| 19 | + | echo "Adding microcode: $ARCHUP_MICROCODE" | tee -a "$ARCHUP_INSTALL_LOG_FILE" | |||
| 20 | + | fi | |||
| 21 | + | ||||
| 10 | # Add cryptsetup if encryption is enabled | 22 | # Add cryptsetup if encryption is enabled | ||
| 11 | if [ "$ARCHUP_ENCRYPTION" = "enabled" ]; then | 23 | if [ "$ARCHUP_ENCRYPTION" = "enabled" ]; then | ||
| 12 | packages+=("cryptsetup") | 24 | packages+=("cryptsetup") | ||
M install/boot/limine.sh +6 -0
| @@ -27,6 +27,12 @@ else | |||
| 27 | 27 | KERNEL_PARAMS="root=UUID=$ROOT_UUID rootflags=subvol=@ rw" | |
| 28 | 28 | fi | |
| 29 | 29 | ||
| 30 | + | # Add AMD-specific kernel parameters if configured | |
| 31 | + | if [ -n "$ARCHUP_AMD_KERNEL_PARAMS" ]; then | |
| 32 | + | KERNEL_PARAMS="$KERNEL_PARAMS $ARCHUP_AMD_KERNEL_PARAMS" | |
| 33 | + | echo "Added AMD kernel params: $ARCHUP_AMD_KERNEL_PARAMS" | tee -a "$ARCHUP_INSTALL_LOG_FILE" | |
| 34 | + | fi | |
| 35 | + | ||
| 30 | 36 | # Install Limine to the disk (UEFI) | |
| 31 | 37 | arch-chroot /mnt limine bios-install "$ARCHUP_DISK" | |
| 32 | 38 | ||
| @@ -27,6 +27,12 @@ else | |||||
| 27 | KERNEL_PARAMS="root=UUID=$ROOT_UUID rootflags=subvol=@ rw" | 27 | KERNEL_PARAMS="root=UUID=$ROOT_UUID rootflags=subvol=@ rw" | ||
| 28 | fi | 28 | fi | ||
| 29 | 29 | ||||
| 30 | + | # Add AMD-specific kernel parameters if configured | |||
| 31 | + | if [ -n "$ARCHUP_AMD_KERNEL_PARAMS" ]; then | |||
| 32 | + | KERNEL_PARAMS="$KERNEL_PARAMS $ARCHUP_AMD_KERNEL_PARAMS" | |||
| 33 | + | echo "Added AMD kernel params: $ARCHUP_AMD_KERNEL_PARAMS" | tee -a "$ARCHUP_INSTALL_LOG_FILE" | |||
| 34 | + | fi | |||
| 35 | + | ||||
| 30 | # Install Limine to the disk (UEFI) | 36 | # Install Limine to the disk (UEFI) | ||
| 31 | arch-chroot /mnt limine bios-install "$ARCHUP_DISK" | 37 | arch-chroot /mnt limine bios-install "$ARCHUP_DISK" | ||
| 32 | 38 | ||||
M install/presets/barebone.packages +5 -4
| @@ -3,13 +3,14 @@ | |||
| 3 | 3 | ||
| 4 | 4 | # Core System | |
| 5 | 5 | base | |
| 6 | - | linux | |
| 7 | 6 | linux-firmware | |
| 8 | 7 | btrfs-progs | |
| 9 | 8 | ||
| 10 | - | # Microcode (one will be selected based on CPU detection) | |
| 11 | - | # intel-ucode | |
| 12 | - | # amd-ucode | |
| 9 | + | # Kernel (selected dynamically by kernel.sh) | |
| 10 | + | # linux / linux-lts / linux-zen | |
| 11 | + | ||
| 12 | + | # Microcode (selected dynamically based on CPU detection) | |
| 13 | + | # intel-ucode / amd-ucode | |
| 13 | 14 | ||
| 14 | 15 | # Bootloader | |
| 15 | 16 | limine | |
| @@ -3,13 +3,14 @@ | |||||
| 3 | 3 | ||||
| 4 | # Core System | 4 | # Core System | ||
| 5 | base | 5 | base | ||
| 6 | - | linux | |||
| 7 | linux-firmware | 6 | linux-firmware | ||
| 8 | btrfs-progs | 7 | btrfs-progs | ||
| 9 | 8 | ||||
| 10 | - | # Microcode (one will be selected based on CPU detection) | 9 | + | # Kernel (selected dynamically by kernel.sh) |
| 11 | - | # intel-ucode | 10 | + | # linux / linux-lts / linux-zen |
| 12 | - | # amd-ucode | 11 | + | |
| 12 | + | # Microcode (selected dynamically based on CPU detection) | |||
| 13 | + | # intel-ucode / amd-ucode | |||
| 13 | 14 | ||||
| 14 | # Bootloader | 15 | # Bootloader | ||
| 15 | limine | 16 | limine | ||