Deployment Methods
Relevant source files
The following files were used as context for generating this wiki page:
The safe64switch project provides a streamlined mechanism to transition Raspberry Pi OS from a 32-bit kernel to a 64-bit kernel environment. Deployment focuses on safety through automated hardware verification and configuration backups, ensuring that the system remains recoverable if the switch fails. The primary deployment method involves the execution of a shell script that modifies the boot configuration of the device.
Sources: README.md:1-5, safe64.sh:1-5
Scripted Deployment
The core deployment method is executed via the safe64.sh script. This script automates the verification of the target environment and the modification of system-level configuration files.
Execution Workflow
The deployment process follows a linear sequence of safety checks and system modifications:
- Environment Validation: The script verifies if the host hardware is a Raspberry Pi by inspecting
/proc/device-tree/model. - State Preservation: A backup of the existing
/boot/config.txtis created to allow for manual or automated recovery. - Kernel Configuration: The
arm_64bitflag is appended to the configuration if not already present. - Optimization: Performance-related settings, such as GPU memory allocation, are applied.
The following diagram illustrates the logical flow of the deployment script:
This flowchart describes the internal logic of the deployment script and its decision-making process.
Sources: safe64.sh:11-41
Configuration Details
During deployment, specific parameters are targeted within the /boot/config.txt file.
| Parameter | Value | Purpose |
|---|---|---|
arm_64bit | 1 | Forces the Raspberry Pi firmware to load the 64-bit kernel. |
gpu_mem | 16 | Reduces GPU memory to prioritize system RAM (Performance Setting). |
Sources: safe64.sh:25-36
Continuous Integration and Quality Assurance
While the deployment script is the primary end-user tool, the repository utilizes GitHub Actions to ensure the integrity of the deployment code.
ShellCheck Workflow
Automated testing is performed on every push or pull request to the main branch to prevent syntax errors or POSIX incompatibilities in the deployment script.
This sequence diagram shows how the project maintains deployment script quality through automated linting.
Sources: .github/workflows/shellcheck.yml:1-18
Installation and Requirements
Deployment requires root privileges due to the need to modify the /boot partition.
Prerequisites
- Target device must be a Raspberry Pi.
- User must have
sudopermissions. - The script must be granted execution permissions.
Command Sequence
chmod +x safe64.sh
sudo ./safe64.sh
Sources: README.md:14-17, safe64.sh:11-15
Recovery and Safety Mechanisms
The deployment is designed with a "Safety First" approach to prevent bricking the OS during the architecture switch.
- Exit on Error: The script uses
set -eto immediately stop execution if any command fails, preventing partial or corrupt configurations. - Backup Files: The file
/boot/config.txt.bakis generated before any modifications occur. - Idempotency: The script uses
grepto check if settings already exist before appending them, preventing duplicate entries in the configuration file.
Sources: safe64.sh:7, safe64.sh:20, safe64.sh:24-36
The safe64switch deployment method provides a high-reliability path for upgrading Raspberry Pi hardware utilization by automating the complex task of kernel switching while maintaining strict validation and backup protocols.