1. 将 linux fastboot 程序拷贝到 /usr/bin/fastboot 路径下
2. 在 /usr/share/bash-completion/completions/fastboot 路径下创建 fastboot 脚本
_fastboot()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="reboot boot flash devices -w reboot-bootloader"
case "$prev" in
reboot | devices | -w | reboot-bootloader)
COMPREPLY=()
return 0
;;
flash)no permissions
COMPREPLY=( $(compgen -W "boot system recovery radio userdata rpm sbl1 modem tz persist splash aboot" -- $cur ))
return 0
;;
boot)
COMPREPLY=( $(compgen -o filenames -G "${cur}*.img"))
return 0
;;
*)
local prev2="${COMP_WORDS[COMP_CWORD-2]}"
local prev3="${COMP_WORDS[COMP_CWORD-3]}"
if [ "$prev2" == "flash" ];then
COMPREPLY=( $(compgen -o filenames -G "${cur}*.img"))
return 0
elif [ "$prev2" == "boot" ];then
COMPREPLY=()
return 0
elif [ "$prev3" == "flash" ];then
COMPREPLY=()
return 0
fi
;;
esac
COMPREPLY=( $(compgen -W "$opts" -- $cur) )
return 0
}
complete -F _fastboot fastboot
3. 编辑或新建 /etc/udev/rules.d/51-android.rules 文件,增加如下内容,解决下面的 no permissions 权限错误
d00d 为 lsusb 看到的 id,如下信息
Bus 003 Device 011: ID 18d1:d00d Google Inc.
ATTR{idProduct}=="d00d", SYMLINK+="android_fastboot", MODE="0660", GROUP="plugdev", TAG+="uaccess", SYMLINK+="android"
fastboot devices
no permissions (user in plugdev group; are your udev rules wrong?); see [http://developer.android.com/tools/device.html] fastboot
4. 重启 udev 服务
sudo service udev restart
sudo udevadm trigger
5. fastboot devices 测试一下,成功识别设备即可进行下面的烧录
fastboot flash boot boot.img
target reported max download size of 536870912 bytes
sending 'boot' (12409 KB)...
OKAY [ 0.303s]
writing 'boot'...
OKAY [ 0.049s]
finished. total time: 0.351s
本文详细介绍了如何在Linux环境下配置并使用Fastboot工具,包括将Fastboot程序拷贝到指定路径、创建Fastboot脚本、编辑udev规则以解决权限问题,以及重启udev服务和测试设备识别的方法。
1075

被折叠的 条评论
为什么被折叠?



