How to root the Google Pixel 5, 5a 5G, 4a (5G) & Pixel 4 XL with Magisk
Fastboot rooting manual for Qualcomm-based Google Pixel devices including Pixel 5 (redfin), Pixel 5a (barbet), Pixel 4a 5G (bramble), Pixel 4 / 4 XL (coral/flame), and Pixel 4a (sunfish). Explains the vital distinction: these legacy devices use boot.img instead of init_boot.img.
At a glance
| Device family | Google Pixel 5, 5a 5G, 4a (5G) & Pixel 4 XL |
| Launch software | Android 11 / 12 / 13 / 14 (Stock and Custom ROMs like LineageOS / EvolutionX) |
| Chipset | Qualcomm Snapdragon 765G 5G / Snapdragon 855 / Snapdragon 730G (Adreno 620 / 640 GPU, Titan M) |
| Root partition | boot.img (Legacy Qualcomm Partition - Pre-GKI architecture; init_boot does NOT exist on Pixel 5 and older) |
| Firmware format | Official Google Factory Image Zip (image-redfin-*.zip / image-barbet-*.zip / image-bramble-*.zip / image-coral-*.zip / image-sunfish-*.zip) |
| Bootloader unlock | Developer Options > OEM Unlocking + `fastboot flashing unlock` (or `fastboot flashing unlock_critical` on Pixel 4 XL for full bootloader access). |
| Warranty / security impact | Unlocking the bootloader wipes user data and may disable some hardware-backed features. It can usually be re-locked and re-flashed to stock. |
Rooting method
- Step 1. Download the stock firmware or factory image that matches your exact build (Official Google Factory Image Zip (image-redfin-*.zip / image-barbet-*.zip / image-bramble-*.zip / image-coral-*.zip / image-sunfish-*.zip)).
- Step 2. Extract
boot.imgfrom the package. - Step 3. Copy
boot.imgto the phone, open the Magisk app, tap Install → Select and Patch a File and choose it. Magisk writesmagisk_patched.imgto your Download folder. - Step 4. Copy the patched image back to your computer.
- Step 5. Reboot to the bootloader and flash it, then reboot the device.
For the full workflow and prerequisites, see the installation guide and boot image patching guide.
If the device bootloops
Hold Power + Volume Down -> Fastboot Mode -> `fastboot flash boot boot.img` (stock boot.img from factory image zip).
More options: fix a Magisk bootloop.
Keeping root across updates
For stock firmware: Magisk Inactive Slot install. For custom ROMs: dirty-flash ROM zip + Magisk APK in custom recovery (TWRP/OrangeFox).
See the OTA survival guide for the full procedure.
Related
Google rooting hub
HubAll Google models covered on this site.
Play Integrity Fix
ModuleRestore device integrity for Google Wallet and banking apps after rooting.
Shamiko
ModuleHide root from apps that perform detection checks.
Root method checker
ToolConfirm which partition to patch and generate the flash command.