安卓adb及fastboot、两个img的认识

本文详细介绍了Android开发中常用的adb和fastboot工具,包括它们的安装、使用命令以及在设备调试和刷机过程中的作用。此外,还深入解析了boot.img和recovery.img文件的结构与功能,为读者提供了丰富的技术细节。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.安卓adb及fastboot

adb工具起到调试桥的作用,可以在命令行或IDE中对手机或模拟器进行调试,安装卸载应用查看设备信息的等,fastboot工具多是用来刷机的,比如刷boot,刷recovery等。

安装adb及fastboot:

sudo apt-get install android-tools-adb android-tools-fastboot

一、adb常用命令:

1 查看设备

adb devices

这个命令是查看当前连接的设备, 连接到计算机的android设备或者模拟器将会列出显示

2 安装软件

adb install

adb install:这个命令将指定的apk文件安装到设备上

3 卸载软件

adb uninstall

4 进入设备或模拟器的shell:

adb shell

通过上面的命令,就可以进入设备或模拟器的shell环境中,在这个Linux Shell中,你可以执行各种Linux的命令,另外如果只想执行一条shell命令,可以采用以下的方式:

adb shell [command]

如:adb shell dmesg会打印出内核的调试信息。

二、fastboot常用命令:

1 待机状态快速进入Recovery

adb shell reboot recovery

2 待机状态下快速进入Hboot

adb shell reboot bootloader

3 以下命令需要在HBOOT的Fastboot界面内操作

刷入Boot

fastboot flash boot boot.img

刷入Recovery

fastboot flash recovery recovery.img

2.boot.img和recovery.img的认识

       boot.img一般是底层系统文件。recovery.img一般是一个linux程序

一、boot.img

boot.img是Android系统启动所必须加载的文件。简单的说,boot.img包括boot.img header、kernel以及ramdisk文件系统。

boot.img文件跳过2k的文件头之后,包括两个 gz包,一个是boot.img-kernel.gz:Linux内核,一个是boot.img-ramdisk.cpio.gz

格式参考:https://www.cnblogs.com/xxxgod/articles/8623322.html

ramdisk映像是一个最基础的小型文件系统,它包括了初始化系统所需要的全部核心文件,例如:初始化init进程以及init.rc(可以用于设置很多系统的参数)等文件。参考:https://blog.youkuaiyun.com/z_hualin/article/details/78500663

二、recovery.img

  recovery.img文件,是用来刷入(安装)recovery模式的,获取后,可以用来安装手机的recovery模式(即恢复模式)Recovery模式指的是一种可以对安卓机内部的数据或系统进行修改的模式(类似于windows PE或DOS)。在这个模式下我们可以刷入新的安卓系统,或者对已有的系统进行备份或升级,也可以在此恢复出厂设置。

刷入第三方的Recovery,将获得更多的功能,并且可以刷入第三方rom,官方自带则不行。


(1)recovery.img其实已经是进入了Linux系统。
(2)recovery.img为了具有恢复系统的能力,比普通的boot.img目录结构中:
       1、多了/res/images目录,在这个目录下的图片都是恢复时我们看到的背景画面。
       2、多了/sbin/recovery二进制程序,这个就是恢复用的程序。
       3、/sbin/adbd不一样,应该和恢复有关。
(3)Android系统中的初始化程序(init)和初始化配置文件(default.prop、init.trout.rc、init.rc、init.goldfish.rc、)都不一样。这就是系统没有进入图形界面而进入了类似文本界面,并可以通过简单的组合键进行恢复的原因。

通过查阅相关资料,对android的recovery模式有了一定的了解

Android 可以通过Recovery 模式,实现恢复出厂设置、OTA 升级、patch 升级及firmware 升级。在关机后,同时按下home + power 键可以进入recovery 模式。

 

What is this? This is All-in-One installer for 3 most needed PC tools for Android. No need to download big SDK for 3 small things. I originaly made it for my Kurdish friend AnGrY DuDe in early 2013. I saw another ADB installer on XDA, but it wasn't good enough for me so i'm finaly posting it here. It's very small and fast installer for tools and drivers. Features: Small - 9.18 MB Fast - 15 seconds install (many times its even less) AIO - ADB, Fastboot and also Drivers Easy to install - just run it and program will guide you Clean - ADB and Google Drivers from latest SDK Install process: 1. Run it (Require administrator privileges) 2. Press Y/Yes to install ADB and Fastboot or N/No to skip 3. Press Y/Yes to install ADB system-wide or N/No for current user only 4. Press Y/Yes to install Drivers or N/No to skip 5. Continue Driver installation 6. 15 seconds passed - finished! Notes: System-wide: ADB and Fastboot are installed to %SystemDrive%\adb directory, and added system-wide path. Current user only: ADB and Fastboot are installed to %UserProfile%\adb directory, and added path for current user. CMD can use ADB and Fastboot from any directory. Drivers are installed to system - no need to install them from directories. Installer automaticly decides if install 32-bit or 64-bit drivers. If anybody got problem with detecting device, go see picture guide howto_driver.zip If installation fails, then post here contents of "adb-installer.log" from desktop. (if there is any) If you have problem with driver enumeration in Windows 8.1 install update KB2917929 If you have older Google USB Driver installed, please uninstall it from Control Panel before installing new If you have previously installed it as system-wide and now you want it current user only (or vice-versa), it won't remove it, you must do it yourself. (at least for now)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值