android-fastboot
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAndroid Fastboot Operations
Android Fastboot操作
⚠️ DANGER ZONE - Fastboot operations write directly to device partitions. Wrong images or interrupted operations can brick devices. Always verify:
- Correct device (check )
fastboot getvar product - Correct images for exact device model
- Bootloader is unlocked (for flashing)
- Battery > 50%
⚠️ 危险区域 - Fastboot操作会直接写入设备分区。错误的镜像或中断的操作可能导致设备变砖。请务必确认:
- 设备型号正确(执行检查)
fastboot getvar product - 镜像与设备型号完全匹配
- Bootloader已解锁(以便刷入)
- 电量 > 50%
Entering Fastboot Mode
进入Fastboot模式
bash
undefinedbash
undefinedFrom ADB (device running)
从ADB进入(设备正常运行时)
adb reboot bootloader
adb reboot bootloader
Hardware buttons (most devices)
硬件按键方式(大部分设备)
Power + Volume Down (hold until fastboot screen)
按住电源键 + 音量减键(直到出现fastboot界面)
undefinedundefinedBasic Commands
基础命令
bash
fastboot devices # List connected devices
fastboot getvar all # All device variables
fastboot reboot # Reboot to system
fastboot reboot bootloader # Stay in bootloader
fastboot reboot recovery # Boot to recovery
fastboot reboot fastboot # Boot to fastbootd (Android 10+)bash
fastboot devices # 列出已连接的设备
fastboot getvar all # 获取所有设备变量
fastboot reboot # 重启至系统
fastboot reboot bootloader # 保持在bootloader模式
fastboot reboot recovery # 启动至恢复模式
fastboot reboot fastboot # 启动至fastbootd(Android 10及以上)Check Before Flashing
刷入前检查
bash
undefinedbash
undefinedALWAYS run these first
请务必先执行这些命令
fastboot devices # Verify connection
fastboot getvar product # Verify device model
fastboot getvar unlocked # Must be "yes" for flashing
fastboot getvar current-slot # Know current A/B slot
fastboot getvar battery-level # Should be > 50
---fastboot devices # 验证连接状态
fastboot getvar product # 验证设备型号
fastboot getvar unlocked # 刷入时必须显示"yes"
fastboot getvar current-slot # 确认当前A/B插槽
fastboot getvar battery-level # 电量应 > 50%
---Bootloader Unlocking
Bootloader解锁
Google Pixel
Google Pixel
bash
undefinedbash
undefined1. Enable OEM unlocking in Developer Options
1. 在开发者选项中启用OEM解锁
2. Boot to fastboot
2. 启动至fastboot模式
adb reboot bootloader
adb reboot bootloader
3. Unlock
3. 执行解锁
fastboot flashing unlock
fastboot flashing unlock
4. Confirm on device with volume keys + power
4. 在设备上用音量键选择确认,按电源键确认
WARNING: This wipes all data!
警告:此操作会清除所有数据!
undefinedundefinedOther Manufacturers
其他品牌设备
| Brand | Process |
|---|---|
| OnePlus | |
| Xiaomi | Mi Unlock Tool (waiting period) |
| Samsung | Uses Odin, not fastboot |
| Motorola | Request code from website, |
| Sony | Request code from website |
| 品牌 | 操作流程 |
|---|---|
| OnePlus | |
| 小米 | 使用Mi解锁工具(需等待审核期) |
| 三星 | 使用Odin工具,不支持fastboot解锁 |
| 摩托罗拉 | 从官网申请解锁码,执行 |
| 索尼 | 从官网申请解锁码 |
Check Unlock Status
检查解锁状态
bash
fastboot getvar unlocked # yes/no
fastboot getvar device-state # locked/unlocked
fastboot getvar unlock_ability # Can be unlocked?bash
fastboot getvar unlocked # 显示yes/no
fastboot getvar device-state # 显示locked/unlocked
fastboot getvar unlock_ability # 设备是否可解锁?Flashing Partitions
刷入分区
Individual Partitions
单个分区刷入
bash
fastboot flash boot boot.img
fastboot flash recovery recovery.img # Non-A/B only
fastboot flash dtbo dtbo.img
fastboot flash vbmeta vbmeta.imgbash
fastboot flash boot boot.img
fastboot flash recovery recovery.img # 仅非A/B分区设备支持
fastboot flash dtbo dtbo.img
fastboot flash vbmeta vbmeta.imgDisable verification (for custom ROMs)
禁用验证(适用于自定义ROM)
fastboot flash --disable-verity --disable-verification vbmeta vbmeta.img
undefinedfastboot flash --disable-verity --disable-verification vbmeta vbmeta.img
undefinedBootloader & Radio (Extra Careful!)
Bootloader与基带(格外小心!)
bash
undefinedbash
undefinedThese can hard-brick if wrong!
操作错误会导致设备硬变砖!
fastboot flash bootloader bootloader.img
fastboot reboot bootloader # REQUIRED after bootloader flash
fastboot flash radio radio.img
fastboot reboot bootloader # Recommended after radio flash
undefinedfastboot flash bootloader bootloader.img
fastboot reboot bootloader # 刷入bootloader后必须执行此命令重启
fastboot flash radio radio.img
fastboot reboot bootloader # 刷入基带后建议执行此命令重启
undefinedTemporary Boot (No Flash)
临时启动(不刷入)
bash
undefinedbash
undefinedTest before committing - reboots to normal after restart
先测试再永久刷入 - 重启后恢复正常系统
fastboot boot recovery.img
fastboot boot patched_boot.img
---fastboot boot recovery.img
fastboot boot patched_boot.img
---A/B Slot Devices
A/B插槽设备
Modern devices have two copies of each partition (A and B).
bash
undefined现代设备拥有两套分区副本(A和B)。
bash
undefinedCheck current slot
检查当前插槽
fastboot getvar current-slot # Returns: a or b
fastboot getvar current-slot # 返回:a 或 b
Set active slot
设置活跃插槽
fastboot set_active a
fastboot set_active b
fastboot set_active a
fastboot set_active b
Flash to specific slot
刷入至指定插槽
fastboot flash boot_a boot.img
fastboot flash boot_b boot.img
fastboot flash boot_a boot.img
fastboot flash boot_b boot.img
Flash to both slots
刷入至两个插槽
fastboot --slot=all flash boot boot.img
---fastboot --slot=all flash boot boot.img
---Dynamic Partitions (Android 10+)
动态分区(Android 10及以上)
Large partitions (system, vendor, product) live inside a "super" partition.
大型分区(system、vendor、product)位于"super"分区内。
Fastbootd Mode
Fastbootd模式
bash
undefinedbash
undefinedEnter userspace fastboot
进入用户空间fastboot
fastboot reboot fastboot
fastboot reboot fastboot
Check if in fastbootd
检查是否处于fastbootd模式
fastboot getvar is-userspace # Should return: yes
undefinedfastboot getvar is-userspace # 应返回:yes
undefinedFlash Dynamic Partitions
刷入动态分区
bash
undefinedbash
undefinedMust be in fastbootd mode!
必须处于fastbootd模式!
fastboot reboot fastboot
fastboot flash system system.img
fastboot flash vendor vendor.img
fastboot flash product product.img
undefinedfastboot reboot fastboot
fastboot flash system system.img
fastboot flash vendor vendor.img
fastboot flash product product.img
undefinedVirtual A/B Snapshots
虚拟A/B快照
bash
undefinedbash
undefinedCheck snapshot status
检查快照状态
fastboot getvar snapshot-update-status
fastboot getvar snapshot-update-status
Cancel stuck update (CAREFUL!)
取消卡住的更新(小心操作!)
fastboot snapshot-update cancel
---fastboot snapshot-update cancel
---Recovery Operations
恢复模式操作
Enter Recovery
进入恢复模式
bash
adb reboot recoverybash
adb reboot recoveryOr: Power + Volume Up (varies by device)
或:按住电源键 + 音量加键(设备不同操作可能有差异)
undefinedundefinedADB Sideload
ADB侧载
bash
undefinedbash
undefined1. In recovery, select "Apply update from ADB"
1. 在恢复模式中,选择"从ADB应用更新"
2. Run:
2. 执行命令:
adb sideload update.zip
undefinedadb sideload update.zip
undefinedFlash Custom Recovery (TWRP)
刷入自定义恢复(TWRP)
bash
undefinedbash
undefinedTest first (temporary boot)
先测试(临时启动)
fastboot boot twrp.img
fastboot boot twrp.img
If it works, flash permanently
如果测试正常,再永久刷入
Non-A/B devices:
非A/B设备:
fastboot flash recovery twrp.img
fastboot flash recovery twrp.img
A/B devices (recovery in boot):
A/B设备(恢复模式集成在boot分区):
fastboot flash boot twrp.img
---fastboot flash boot twrp.img
---Magisk (Root)
Magisk(获取Root权限)
Installation
安装步骤
bash
undefinedbash
undefined1. Extract boot.img from your firmware
1. 从固件中提取boot.img
2. Transfer to device, patch with Magisk app
2. 将其传输至设备,用Magisk应用进行补丁
3. Pull patched image
3. 拉取已补丁的镜像
adb pull /sdcard/Download/magisk_patched_*.img
adb pull /sdcard/Download/magisk_patched_*.img
4. Flash patched boot
4. 刷入已补丁的boot镜像
fastboot flash boot magisk_patched_*.img
fastboot flash boot magisk_patched_*.img
5. Reboot
5. 重启设备
fastboot reboot
undefinedfastboot reboot
undefinedUseful Magisk Commands (after rooted)
有用的Magisk命令(获取Root后)
bash
adb shell su -c "magisk --version"
adb shell su -c "resetprop ro.debuggable 1"bash
adb shell su -c "magisk --version"
adb shell su -c "resetprop ro.debuggable 1"Factory Reset / Wipe
恢复出厂设置 / 擦除数据
bash
fastboot erase userdata # Wipe user data
fastboot erase cache # Wipe cache (if exists)
fastboot -w # Format data + cachebash
fastboot erase userdata # 擦除用户数据
fastboot erase cache # 擦除缓存(如果存在)
fastboot -w # 格式化数据分区 + 缓存分区Full flash with wipe
全量刷入并擦除
fastboot -w flashall
fastboot -w update image.zip
---fastboot -w flashall
fastboot -w update image.zip
---Danger Levels
危险等级
| Level | Operations |
|---|---|
| ✅ SAFE | |
| ⚠️ MEDIUM | |
| 🔴 HIGH | |
| ☠️ CRITICAL | |
| 等级 | 操作内容 |
|---|---|
| ✅ 安全 | |
| ⚠️ 中等 | |
| 🔴 高风险 | |
| ☠️ 极高风险 | |
Brick Prevention
防变砖措施
Never:
- Flash images from different device models
- Interrupt a flash operation
- Lock bootloader with custom ROM installed
- Flash bootloader/radio without matching versions
Always:
- Verify device with
fastboot getvar product - Keep stock images available for recovery
- Use to test before
fastboot bootfastboot flash - Maintain battery > 50%
切勿:
- 刷入其他设备型号的镜像
- 中断刷入操作
- 在安装自定义ROM后锁定Bootloader
- 刷入版本不匹配的Bootloader/基带
务必:
- 执行验证设备型号
fastboot getvar product - 保留官方镜像以便恢复
- 先使用测试,再执行
fastboot boot永久刷入fastboot flash - 保持电量 > 50%
Recovery from Soft Brick
从软变砖恢复
bash
undefinedbash
undefined1. Enter fastboot (Power + Vol Down)
1. 进入fastboot模式(按住电源键 + 音量减键)
fastboot devices
fastboot devices
2. Flash stock boot
2. 刷入官方boot镜像
fastboot flash boot boot.img
fastboot flash boot boot.img
3. For dynamic partitions
3. 针对动态分区设备
fastboot reboot fastboot
fastboot flash system system.img
fastboot flash vendor vendor.img
fastboot reboot fastboot
fastboot flash system system.img
fastboot flash vendor vendor.img
4. Wipe if needed
4. 必要时擦除数据
fastboot -w
fastboot -w
5. Reboot
5. 重启设备
fastboot reboot
For hard bricks (no fastboot access), you need EDL mode (Qualcomm) or manufacturer service tools.
---fastboot reboot
如果设备硬变砖(无法进入fastboot模式),则需要进入EDL模式(高通设备)或使用官方维修工具。
---Quick Reference
快速参考
| Task | Command |
|---|---|
| Check connection | |
| Device info | |
| Unlock bootloader | |
| Flash boot | |
| Test recovery | |
| Current slot | |
| Switch slot | |
| Wipe data | |
| Reboot | |
| 任务 | 命令 |
|---|---|
| 检查连接状态 | |
| 获取设备信息 | |
| 解锁Bootloader | |
| 刷入Boot分区 | |
| 测试恢复模式 | |
| 查看当前插槽 | |
| 切换插槽 | |
| 擦除数据 | |
| 重启设备 | |