其他分享
首页 > 其他分享> > kernel – 如何修改Android引导顺序以便从SD卡引导

kernel – 如何修改Android引导顺序以便从SD卡引导

作者:互联网

我一直在研究如何从SD卡启动Android.
这是带有说明的帖子:

Victory!

I took sdbags’s stock zip (4.3) and extracted it on my computer. I used unmkbootimg to extract the initramfs.gz and kernel.gz from the boot.img in the ROM. I unzipped the initramfs and un-cpio’d it, then modified macallan.fstab to refer to /dev/block/mmcblk1p1 for /data, p2 for /system, and p3 for /cache. I also modified init.macallan.rc to avoid having it try to make filesystems on the EMMC — I want it not to try touching the EMMC at all.

Next I rebuilt the initramfs.gz. I bought a good quality class 10 microsd and partitioned it on my computer with 3 primary partitions, one for /data, one for /system, and one for /cache (about 2GB and 1GB for /system and /cache). I made ext4 filesystems on all 3 partitions, mounted p2, and copied the rom over and installed it by hand using the updater-script as a guide. Then I unmounted and popped the SD card into my TF701t.

To boot it, I put my tablet into fastboot mode. I booted the kernel and ramdisk using ‘fastboot boot’ — no need for kexec from recovery. I can do this without any reliance whatsoever on the internal EMMC. It took awhile to boot up, but it booted first try. The app drawer was a bit slow to come up, but I’m pretty happy I get to use my tablet at all! This whole process turned out to be MUCH easier than I expected it would be, and I’m quite confident I could do this to boot any ROM I wanted. I only use stock because of driver issues with my bluetooth keyboard.

Still willing to try my hand at maintaining cromi’s ROM2SD branch though

Thanks everyone for all of your help!

然后有更详细的说明here

To answer your question, I don’t know. My method works for booting because I changed the ROM’s idea of what device/partition /system and /data live on. I don’t know where your device holds its idea of which partition holds the radio firmware. If it’s somewhere in the initramfs, then you can modify it in the same way I modified mine and tell it to load the radio off of the external SD. If the ROM is hardcoded to look for the radio on the internal SD, then you may be screwed.

A quick note on the initramfs for those curious: the initramfs (initrd, initramdisk, etc) is a compressed miniature linux filesystem holding the bare essentials necessary to get a linux system running. The initrd’s job is to figure out where the filesystem(s) are that hold the actual linux installation, mount them, and hand over control to that linux system.

It’s not absolutely necessary to use an initrd to boot a linux system, but it makes it a lot easier because you can load drivers, prepare the filesystem, etc. The stock ROM for the TF701t (and I’m assuming most, if not all ROMs for all android devices) use an initrd to mount /system, /data, and any other necessary partitions. I’m just telling it to mount those from my external SD instead of internal.

I don’t know how radio partitions work. Is it just a raw firmware image on the partition, or is it an ext4 (or other) filesystem with a firmware binary file on it? The latter case might mean the initrd mounts the radio firmware along with everything else it does before handing over control to android, so it might mean you can change it to a partition on the external card.

我不太明白,我希望能够进行一些细化,因为这似乎与Linux操作系统(inramfs.gz,kernel.gz和一般的启动过程)有类似的处理.

解决方法:

我真的不知道从SD卡启动的标准方式,它是否容易取决于您使用的Android设备:

例如,如果你有一个Nexus设备,你可以从Play商店下载MultiROM,你很高兴.它通常从未如此简单;我目前正试图让我的基于Mediatek MT6575的设备从SD卡启动,因为内部eMMC内存已经死了,还没有管理它,所以我想现在它已经’砖了’.

我在这里要说的是,没有逐步指南可以与所有设备一起使用,因为有大量设备,每个设备都有不同的分区布局,内核等.

我将提供一些关于如何从SD启动几个不同设备的示例,希望您能够看到所涉及的内容,如果您说出您拥有的设备,我可能会遇到该设备的工作方法.

Boot Android from SdCard wiki – 这是’sunxi’安卓平板电脑的网站,但信息很有用,因为它包含有关编辑恢复和启动分区的信息,即使SD卡图像只能在sunxi平板电脑上运行.

Use SD instead of eMMC on GS3 – 逐步介绍如何对SD卡进行分区和编辑boot.img.我在我的MT6575上尝试过这种方法,但只是更改fstab上的信息是不够的,它仍然试图从eMMC启动我的设备,但如果你有GS3,这是理想的.

Multiboot for MediaTek devices – 如何在内部eMMC上安装1个ROM,在SD卡上安装第二个ROM.如果您有一个mediatek设备,可以一步一步地提供.

Convert ROM to boot from SD card – 考虑到诺基亚X2,但我现在要通过这种方法,立即安装两个系统分区,SD系统分区的挂载点是/ system-ext

这就是我现在所拥有的,如果您设法从SD启动,请发表评论,说明您使用的方法和使用的设备,谢谢.

标签:android,kernel,boot,initramfs,boot-loader
来源: https://codeday.me/bug/20190814/1658759.html