Android 使用fastboot烧录镜像

全编代码,将out/target/product/msm8909(msm8909为当前软件版本)下的所有image拿出来,放到一个目录,在该目录编写一个bash脚本:(我的生成的镜像就这么多,其他软件版本可能略有不同,需自行修改)
adb reboot bootloader

sudo fastboot flash boot boot.img
sudo fastboot flash cache cache.img
sudo fastboot flash dt dt.img
sudo fastboot flash fota fota.img
sudo fastboot flash persist persist.img
sudo fastboot flash ramdisk ramdisk.img
sudo fastboot flash ramdisk-recovery ramdisk-recovery.img
sudo fastboot flash recovery recovery.img
sudo fastboot flash splash splash.img
sudo fastboot flash system system.img
sudo fastboot flash userdata userdata.img

sudo fastboot reboot

在当前目录执行脚本(前提是手机可以进fastboot,之前手机一直进不了fastboot,adb reboot bootloader后一直wait for device,原来设备做过定制,关机后同时按某些键+开机键才进的去fast boot)

fastbootimg$ . mp02\ fastboot.sh 
error: device '(null)' not found
target reported max download size of 262144000 bytes
sending 'boot' (8525 KB)...
OKAY [  0.269s]
writing 'boot'...
OKAY [  0.261s]
finished. total time: 0.531s
target reported max download size of 262144000 bytes
erasing 'cache'...
OKAY [  0.046s]
sending 'cache' (6248 KB)...
OKAY [  0.200s]
writing 'cache'...
OKAY [  0.191s]
finished. total time: 0.437s
target reported max download size of 262144000 bytes
sending 'dt' (148 KB)...
OKAY [  0.009s]
writing 'dt'...
FAILED (remote: partition table doesn't exist)
finished. total time: 0.014s
target reported max download size of 262144000 bytes
sending 'fota' (7264 KB)...
OKAY [  0.230s]
writing 'fota'...
OKAY [  0.233s]
finished. total time: 0.463s
target reported max download size of 262144000 bytes
sending 'persist' (4716 KB)...
OKAY [  0.150s]
writing 'persist'...
OKAY [  0.149s]
finished. total time: 0.300s
target reported max download size of 262144000 bytes
sending 'ramdisk' (1176 KB)...
OKAY [  0.040s]
writing 'ramdisk'...
FAILED (remote: partition table doesn't exist)
finished. total time: 0.045s
target reported max download size of 262144000 bytes
sending 'ramdisk-recovery' (1543 KB)...
OKAY [  0.051s]
writing 'ramdisk-recovery'...
FAILED (remote: partition table doesn't exist)
finished. total time: 0.055s
target reported max download size of 262144000 bytes
sending 'recovery' (8891 KB)...
OKAY [  0.281s]
writing 'recovery'...
OKAY [  0.271s]
finished. total time: 0.552s
target reported max download size of 262144000 bytes
sending 'splash' (225 KB)...
OKAY [  0.012s]
writing 'splash'...
OKAY [  0.013s]
finished. total time: 0.025s
target reported max download size of 262144000 bytes
erasing 'system'...
OKAY [  0.509s]
sending sparse 'system' (254832 KB)...
OKAY [  8.457s]
writing 'system'...
OKAY [  8.324s]
sending sparse 'system' (255878 KB)...
OKAY [  8.564s]
writing 'system'...
OKAY [  8.636s]
sending sparse 'system' (253277 KB)...
OKAY [  8.329s]
writing 'system'...
OKAY [  8.298s]
sending sparse 'system' (102030 KB)...
OKAY [  3.409s]
writing 'system'...
OKAY [  3.146s]
finished. total time: 57.672s
target reported max download size of 262144000 bytes
erasing 'userdata'...
OKAY [  0.217s]
sending 'userdata' (88723 KB)...
OKAY [  2.802s]
writing 'userdata'...
OKAY [  2.757s]
finished. total time: 5.776s
rebooting...

finished. total time: 0.051s
fastboot android10版本 ubuntu linux平台 fastboot version 28.0.2-PD02.200305.0422 $ fastboot -h usage: fastboot [OPTION...] COMMAND... flashing: update ZIP Flash all partitions from an update.zip package. flashall Flash all partitions from $ANDROID_PRODUCT_OUT. On A/B devices, flashed slot is set as active. Secondary images may be flashed to inactive slot. flash PARTITION [FILENAME] Flash given partition, using the image from $ANDROID_PRODUCT_OUT if no filename is given. basics: devices [-l] List devices in bootloader (-l: with device paths). getvar NAME Display given bootloader variable. reboot [bootloader] Reboot device. locking/unlocking: flashing lock|unlock Lock/unlock partitions for flashing flashing lock_critical|unlock_critical Lock/unlock 'critical' bootloader partitions. flashing get_unlock_ability Check whether unlocking is allowed (1) or not(0). advanced: erase PARTITION Erase a flash partition. format[:FS_TYPE[:SIZE]] PARTITION Format a flash partition. set_active SLOT Set the active slot. oem [COMMAND...] Execute OEM-specific command. gsi wipe|disable Wipe or disable a GSI installation (fastbootd only). boot image: boot KERNEL [RAMDISK [SECOND]] Download and boot kernel from RAM. flash:raw PARTITION KERNEL [RAMDISK [SECOND]] Create boot image and flash it. --dtb DTB Specify path to DTB for boot image header version 2. --cmdline CMDLINE Override kernel command line. --base ADDRESS Set kernel base address (default: 0x10000000). --kernel-offset Set kernel offset (default: 0x00008000). --ramdisk-offset Set ramdisk offset (default: 0x01000000)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值