📱 Custom ROM Flashing Guide

Step-by-step guides for Samsung & Xiaomi devices

🔷

Samsung

Galaxy S / Note / A / Z series
🟠

Xiaomi

Mi / Redmi / POCO series
⚠️

Critical Warnings for Samsung Devices

  • Knox Fuse: Unlocking bootloader permanently trips Knox e-fuse. Samsung Pay, Secure Folder, and some banking apps will never work again, even if you relock.
  • Camera Quality: Custom ROMs often use AOSP camera apps instead of Samsung's proprietary camera software. Photo quality may degrade significantly.
  • Exynos vs Snapdragon: Snapdragon variants (US/China) often have locked bootloaders. Exynos variants (Global) are usually unlockable.
  • Odin vs Heimdall: Odin is Windows-only proprietary software. Heimdall is open-source but less reliable.
🔓 Unlock Bootloader
⚡ Flash ROM
🔄 Restore Stock
🛠️ Troubleshoot
📋

Prerequisites Checklist

Complete all items before proceeding. Skipping any step may brick your device.

1
Enter Download Mode

Power off your device completely. Then press and hold:

Volume Down + Volume Up (connect USB cable while holding)

On newer devices (S8+), hold Volume Up + Volume Down, then connect USB.

When the warning screen appears, press Volume Up to continue to Download Mode.

2
Unlock Bootloader (OEM Unlock)

Some Samsung devices require a specific unlock process:

  1. Boot into Download Mode (Step 1)
  2. Long-press Volume Up to enter "Device unlock mode"
  3. Press Volume Up again to confirm bootloader unlock
  4. Device will factory reset automatically
⚠️ This trips Knox permanently. There is no way to undo this.
3
Flash Custom Recovery (TWRP)

Download TWRP for your specific model from twrp.me.

Using Odin (Windows):

  1. Open Odin3 as Administrator
  2. Click AP (or PDA on older versions) and select the TWRP .tar file
  3. Make sure ONLY "Auto Reboot" is checked. Uncheck everything else.
  4. Click Start
  5. Immediately after flashing completes, hold Volume Up + Power to boot into TWRP (don't let it boot to system)

Using Heimdall (Linux/Mac):

heimdall flash --RECOVERY twrp.img --no-reboot

Then manually boot to recovery with Volume Up + Power.

📦

Required Files

Download these before starting the flash process.

Custom ROM
LineageOS, crDroid, etc. for your model
GApps
OpenGApps or MindTheGapps (optional)
Magisk
For root access (optional)
vbmeta.img
Disable AVB verification
1
Boot into TWRP Recovery

Power off, then hold Volume Up + Power until TWRP appears.

If you see "Unmodified system partition," swipe to allow modifications.

2
Wipe Data (Clean Flash)

In TWRP, go to WipeAdvanced Wipe:

  1. Select: Dalvik/ART Cache, System, Data, Cache
  2. DO NOT select Internal Storage (where your ROM zip is stored)
  3. Swipe to wipe
💡 For major Android version upgrades, also wipe Vendor partition.
3
Flash ROM + GApps + Magisk

Go to Install and flash in this exact order:

  1. Custom ROM .zip
  2. GApps .zip (if ROM doesn't include Google apps)
  3. Magisk .apk renamed to .zip (for root, optional)

After each file, tap "Add another ZIP" rather than rebooting between flashes.

4
First Boot & Setup

Reboot to System. First boot may take 5-15 minutes.

Complete setup wizard. If you flashed Magisk:

  1. Install Magisk app
  2. Open Magisk → Install → Direct Install
  3. Reboot once more
⚠️ Samsung devices often need to flash vbmeta_disabled.tar via Odin to disable AVB, or the device won't boot custom ROMs.
1
Download Stock Firmware

Use one of these tools to download official firmware:

  • Frija (Windows) - Enter model + CSC code
  • SamFw (Windows) - Alternative firmware tool
  • Samloader (Python, cross-platform)

Your CSC (region code) can be found in Settings → About → Software Information.

2
Flash Stock via Odin

Extract the firmware. You should see files like AP_xxx.tar.md5, BL_xxx.tar.md5, etc.

  1. Boot to Download Mode
  2. Open Odin as Administrator
  3. Load each file into its matching slot:
    • AP → AP_xxx.tar.md5
    • BL → BL_xxx.tar.md5
    • CP → CP_xxx.tar.md5 (modem)
    • CSC → CSC_xxx.tar.md5 (use HOME_CSC to keep data, or CSC to wipe)
  4. Click Start
⚠️ Knox will still be tripped. There is no way to restore Knox once triggered.

🔄 Bootloop

Boot back to TWRP, wipe Dalvik/Cache, and re-flash ROM. If persistent, do a full wipe (including Internal Storage) and reflash stock firmware first.

❌ Odin Fail (Auth Error)

Your bootloader is still locked, or you're using the wrong firmware variant. Check model number carefully (e.g., SM-G991B vs SM-G991U).

📷 Camera Not Working

Install a GCam port or Samsung camera APK from your stock firmware. AOSP cameras lack Samsung's proprietary image processing.

📶 No Signal / Baseband Unknown

Flash the correct CP/modem file for your model. Baseband version must match your hardware variant.

🔒 FRP Lock After Restore

Use the CSC file (not HOME_CSC) to fully wipe including FRP. Or boot to stock recovery and factory reset from there.

🐌 Slow Performance

Disable Samsung Game Optimizing Service (GOS) if present. Or flash a kernel tuned for your device (e.g., Kirisakura).

⚠️

Critical Warnings for Xiaomi Devices

  • Mi Account Binding: You MUST have a Mi Account bound to your device for 7-30 days before unlocking. New accounts won't work immediately.
  • Anti-Rollback (ARB): Some Xiaomi devices have ARB protection. Downgrading to older MIUI versions can hard-brick your device permanently.
  • HyperOS Lock: Devices shipped with HyperOS (Android 14+) have stricter unlock policies. The unlock tool may not work on newer models.
  • Regional Variants: China variants often have locked bootloaders that cannot be unlocked. Global/Indian/European variants are usually unlockable.
🔓 Unlock Bootloader
⚡ Flash ROM
🔄 Restore Stock
🛠️ Troubleshoot
📋

Prerequisites Checklist

Xiaomi has the most restrictive unlock process. Read carefully.

1
Bind Mi Account to Device

Go to Settings → Additional Settings → Developer Options → Mi Unlock Status.

Tap Add account and device. Sign in with your Mi Account.

⚠️ If you get "Couldn't add, error 86012" or similar, your account is too new or the device model is restricted. Wait and try again later.

After binding, wait the required period (usually 168 hours / 7 days, up to 720 hours for newer devices).

2
Enter Fastboot Mode

Power off completely. Then hold:

Volume Down + Power simultaneously

Release when you see the Fastboot screen (Mi Bunny with "FASTBOOT" text).

3
Run Mi Unlock Tool
  1. Connect device to PC via USB (in Fastboot mode)
  2. Open Mi Unlock Tool and sign in with the same Mi Account
  3. Click Unlock
  4. If you see a timer, you must wait that duration before unlocking
  5. Once unlocked, device will reboot and factory reset automatically
⚠️ HyperOS devices: If the tool says "Current account not bound," you may need to use the Xiaomi Community app to apply for unlock permission first.
4
Flash TWRP / Custom Recovery

Download TWRP for your specific Xiaomi model from twrp.me or the device's XDA thread.

Via Fastboot:

fastboot flash recovery twrp.img
fastboot boot twrp.img

Alternative (if booting TWRP directly fails):

fastboot flash recovery twrp.img
fastboot reboot recovery
💡 On Xiaomi devices with A/B partitions, you may need to flash to both slots: fastboot flash recovery_a twrp.img && fastboot flash recovery_b twrp.img
📦

Required Files

Download these before starting the flash process.

Custom ROM
LineageOS, PixelOS, Xiaomi.eu, etc.
Firmware
Vendor/firmware zip for your base MIUI version
GApps
NikGApps or MindTheGapps
Magisk
For root and SafetyNet fix
1
Boot into TWRP & Decrypt

Hold Volume Up + Power to enter recovery.

If TWRP asks for a password, enter your lock screen PIN/pattern. If that doesn't work:

  1. Go to WipeFormat Data
  2. Type yes to format
  3. This removes encryption and allows TWRP to mount partitions
2
Wipe Partitions

In TWRP, go to WipeAdvanced Wipe:

  1. Select: Dalvik/ART Cache, System, Data, Cache, Vendor
  2. Swipe to wipe

For A/B devices, you may also need to wipe the inactive slot:

adb shell
set_active a  # or b
# Then wipe from TWRP
3
Flash Firmware + ROM + Extras

Go to Install. Flash in this order:

  1. Firmware zip (vendor/base firmware - required for most custom ROMs)
  2. Custom ROM zip
  3. GApps zip (if ROM is vanilla)
  4. Magisk apk (rename to .zip for flashing, optional)

Use "Add another ZIP" between each file. Do not reboot between flashes.

⚠️ Xiaomi devices are very sensitive to firmware version. Always flash the firmware zip that matches the ROM's requirements (usually listed on the ROM's download page).
4
Post-Flash Setup

Reboot to System. First boot may take 5-15 minutes.

For SafetyNet / Banking apps:

  1. Open Magisk app
  2. Enable MagiskHide / Zygisk
  3. Install MagiskHide Props Config module
  4. Set fingerprint to a certified device (e.g., Pixel)
  5. Reboot

For Xiaomi.eu ROMs: These are based on China MIUI with Google services added. They don't need GApps but may need Magisk for full functionality.

1
Download MIUI Fastboot ROM

Download the correct Fastboot ROM (tgz file) for your exact model from:

Verify the model matches exactly (e.g., miui_REMINGTON for Redmi Note 12 Pro).

2
Flash via Mi Flash Tool
  1. Extract the Fastboot ROM tgz file (you'll get a folder with flash_all.bat)
  2. Boot device to Fastboot mode (Volume Down + Power)
  3. Open Mi Flash Tool (Windows) or use command line
  4. Select the extracted ROM folder
  5. Choose flash mode:
    • clean all - Wipes everything (recommended)
    • save user data - Keeps internal storage
    • clean all and lock - Wipes and relocks bootloader
  6. Click Flash
⚠️ Never downgrade across Android versions if your device has Anti-Rollback protection. Check ARB index before flashing older MIUI versions.
3
Command Line Alternative (Cross-Platform)

If you don't have Windows, use the built-in scripts:

# Windows
flash_all.bat

# Linux/Mac
./flash_all.sh

These scripts use fastboot commands to flash each partition individually. Make sure fastboot is in your PATH.

⏳ Mi Unlock Timer Too Long

Newer HyperOS devices require 720 hours (30 days). There is no way to bypass this. Some community tools claim to bypass but are scams or malware.

🔒 "Account Not Bound" Error

Ensure you're using the same Mi Account in the tool as on the device. For HyperOS, apply for unlock in Xiaomi Community app first. Some regions (India) have additional restrictions.

💥 Hard Brick (No Fastboot, No Recovery)

Use EDL mode (Qualcomm 9008). Requires an authorized Xiaomi account or EDL cable. Search for "EDL mode [your model]" on XDA. This is the only way to recover from a hard brick.

📶 No Mobile Data / IMEI Lost

Flash the correct firmware/vendor zip before the ROM. If IMEI is lost, restore from backup (if you made one) or use QPST/QFIL to rewrite partitions. Never flash modem partitions from different variants.

🔄 Bootloop After Flash

Boot to TWRP, wipe Dalvik/Cache, and check you flashed the correct firmware. Xiaomi devices are very firmware-sensitive. Also ensure you didn't flash a ROM for the wrong variant (e.g., China ROM on Global device).

🚫 SafetyNet Fails

Use Magisk with Zygisk enabled. Install MagiskHide Props Config and set a certified fingerprint. For Xiaomi.eu ROMs, SafetyNet usually passes out of the box.

🔋 Fast Battery Drain

Flash the correct vendor/firmware for your base MIUI version. Wrong firmware causes power management issues. Also check for wakelocks using apps like BetterBatteryStats.

📷 Camera Quality Poor

Install ANXCamera or a GCam port with the correct config for your sensor. Stock MIUI camera apps don't work on AOSP ROMs without significant modification.