Feature: 64-bit Kernel Switch
Relevant source files
The following files were used as context for generating this wiki page:
The 64-bit Kernel Switch feature is a specialized utility designed to transition a Raspberry Pi OS environment from a 32-bit architecture to a 64-bit kernel. The primary objective is to provide a safe, automated method for modifying the boot configuration while ensuring system recoverability through automated backups.
Sources: README.md:3-6, safe64.sh:2-4
The implementation focuses on verifying hardware compatibility, preserving existing configurations, and applying the necessary firmware flags to enable 64-bit addressing. It also includes provisions for performance tuning by optimizing memory allocation for the system.
Sources: safe64.sh:12-16, safe64.sh:23-28
System Architecture and Logic
The switch logic is encapsulated within a shell script that follows a linear execution path with strict error handling. The script is configured to exit immediately upon encountering any command failure, ensuring that the boot configuration is not left in a corrupt or partial state.
Sources: safe64.sh:7
Execution Flow
The following diagram illustrates the logical flow from hardware verification to the final configuration update:
The script first validates the environment by checking the device tree model before performing any filesystem modifications.
Sources: safe64.sh:12-34
Key Components and Operations
Environment Validation
The system performs a hardware check by querying /proc/device-tree/model. If the string "Raspberry Pi" is not detected, the script terminates to prevent accidental modification of non-target Linux systems.
| Component | Target File / Path | Action |
|---|---|---|
| Hardware Check | /proc/device-tree/model | Grep for "Raspberry Pi" |
| Configuration | /boot/config.txt | Target for 64-bit kernel enabling |
| Backup | /boot/config.txt.bak | Copy of original config for rollback |
Sources: safe64.sh:12-16, safe64.sh:20
Configuration Management
The core functionality involves manipulating the Raspberry Pi boot configuration. The script checks for the presence of specific flags before appending them to avoid duplicate entries.
- Kernel Switch: Adds
arm_64bit=1to the configuration file if not already present. - Performance Tuning: Sets
gpu_mem=16to minimize GPU memory allocation, freeing more RAM for the 64-bit CPU operations.
Sources: safe64.sh:23-31
Data Flow Diagram
This sequence diagram shows the interaction between the script and the system files:
The data flow ensures that the original state is preserved in .bak before any write operations occur.
Sources: safe64.sh:12-32
Continuous Integration and Quality Control
The project utilizes automated workflows to maintain script integrity. A GitHub Action is configured to run shellcheck on the script to identify syntax errors or potential bugs in the shell logic.
Sources: .github/workflows/shellcheck.yml:1-15
Usage Summary
The feature is designed to be executed with administrative privileges. Once the script completes its modifications to the bootloader configuration, a system reboot is required to initialize the 64-bit kernel mode.
Sources: README.md:12-15, safe64.sh:33