android - "fastboot boot <kernel>"在内部是如何工作的?

标签 android linux-kernel boot fastboot

Fastboot 有以下方便的 feature (如果启动自定义镜像失败,设备下次会神奇地启动默认镜像,一切都会好起来的):

To boot with a host-side kernel image

This command allows you to download a kernel image (and optional root filesystem image) and boot the phone with those, instead of using the kernel and rootfs in the boot flash partition. It is very useful while developing a kernel or modifying the rootfs.

fastboot boot < kernel > [ < ramdisk > ]

有人知道它的内部工作原理吗? 重启设备之前内核是否被复制到一个特殊的启动分区? (更新:正如答案所指出的,没有重启,因为 fastboot 是启动过程中的一个步骤,这基本上使我的问题变得毫无意义。)我正在查看 fastboot 的源代码,但是它似乎只包含主机端发生的事情,而不是设备上发生的事情。

我的意思是,刷机功能的工作原理非常简单,我可以通过将带有自定义内核的启动镜像复制到 boot 来模仿它。分区,例如,通过:

dd if='<my_boot.img>' of='/dev/block/platform/msm_sdcc.1/by-name/boot'

顺便说一句:我问这个问题是因为我正在开发一个应用程序;我想“无风险”直接从设备启动自定义内核,它存储在哪里,例如在 SD 卡上。

最佳答案

Is the kernel copied to a special boot partition before rebooting the device?

不,不会对任何分区进行修改。
引导内核意味着从存储设备加载(即读入内存)内核镜像。这个 fastboot 类似于 netboot,例如内核镜像是使用 TFTP 通过以太网链接从服务器/主机加载的。如果唯一的目的是使用内核镜像启动系统,那么就没有理由将内核镜像也写入分区,尤其是在没有明确指定的情况下。

此操作的可选根文件系统明确指定为 ramdisk 镜像,也不需要写入或存储在分区中。

Does anyone know how it internally works?

fastboot 程序是在您重启设备后执行的备用引导加载程序。
内核通过 USB 从主机加载到内存中。可选的 rootfs(一个 ramdisk 或者一个 initramfs 镜像)也可以通过 USB 从主机加载到内存中。加载后,即可开始普通的内核引导。

Btw: I am asking the question because of an app I am developing; I'd like to "risk free" boot a custom kernel directly from the device, where it is stored e.g. on the SD-card

你可能不得不使用一些其他的引导加载程序/方法而不是这个 fastboot。

关于android - "fastboot boot <kernel>"在内部是如何工作的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34667656/

相关文章:

linux - 读/写字符设备时如何避免高CPU使用率?

cpu - CPU如何执行存储在主板闪存芯片中的指令?

java - 高度与最小高度工具栏

android - ScrollView 中的多个 WebView 出现问题 (Android)

android - 与 Android 的持续集成 [Codeship]

c - 使用 Splice 将文件复制到标准输出

c - Xenomai rtdm_clock_read 测量

Android 模拟器卡在启动循环中 - 未找到库 "/system/lib/libnetcmdiface.so"

Android 小部件更新在设备启动后调用两次

android - httpclient4.3.5 运行 android 模拟器抛出 'java.net.UnknownHostException'