Android eMMC Booting[wiki百科]

eMMC binaries

This is the efi partition table as exists on the emmc

Sector#    Size Name
    256     128K xloader
    512     256K bootloader
   2048       8M recovery
  18432       8M boot
  34816     512M system
1083392     256M cache
1607680     512M userdata
2656256    2183M media

[edit]Creating the GPT table

On Target
  1. Connect a USB cable to the OTG port on your platform
  2. Boot your platform up with a stock u-boot and MLO
  3. Once you platform is booted you will see the following:
Fastboot entered...
On Host Machine

locate fastboot in you android filesystem

cd $mydroid/out/host/linux-x86/bin/fastboot

Search for fastboot devices

fastboot devices

Create GPT table on eMMC/SD card

fastboot oem format

From the android build these are the binaries that go into each partition:

 Sector#    Size Name            Binary
    256     128K xloader         MLO
    512     256K bootloader      u-boot.bin
   2048       8M recovery        recovery.img
  18432       8M boot            boot.img
  34816     512M system          system.img
1083392     256M cache           cache.img
1607680     512M userdata        userdata.img
2656256    2183M media           none
File locations
  • MLO --> x-loader/MLO
  • u-boot --> u-boot/u-boot.bin
  • boot.img --> need to create using zImage + ramdisk.img
  • recovery.img ---> need to create using zImage + ramdisk-recovery.img
  • system.img --> $mydroid/out/target/product/<platform>/system.img
  • cache.img -->
  • userdata.img --> $mydroid/out/target/product/<platform>/userdata.img

All these partitions can be flashed with the given binary using fastboot.

 fastboot flash <name> <binary>

Example flashing of all partitions

 fastboot flash xloader     MLO
 fastboot flash bootloader  u-boot.bin
 fastboot flash recovery    recovery.img
 fastboot flash boot        boot.img
 fastboot flash system      system.img
 fastboot flash cache       cache.img
 fastboot flash userdata    userdata.img

[edit]Modifying .IMG Files

Typically when you want to modify any of the partitions, you would need to unzip-modify-rezip and then fastboot flash.

Following section talks about how to do that for each partition

BOOT.IMG

 boot.img = zImage + ramdisk.img
 zImage = kernel image
 ramdisk.img = out/target/product/blaze/root/
 %./out/host/linux-x86/bin/mkbootimg
 --kernel zImage
 --ramdisk ramdisk.img
 --base 0x80000000
 --cmdline "console=ttyO2,115200n8 [email protected] [email protected] init=/init vram=10M omapfb.vram=0:4M androidboot.console=ttyO2"
 --board omap4
 -o boot.img.new
 Output: boot.img.new
 **Note: bootarg is passed to kernel via --cmdline option above
 **Note:For Pandaboard ES,--cmdline should be mmodified as "console=ttyO2,115200n8 [email protected] [email protected] init=/init vram=32M omapfb.vram=0:16M androidboot.console=ttyO2"

To "just" boot boot.img (before flashing) you can use:

%fastboot boot boot.img

RAMDISK.IMG

 %mkdir root
 %cd root
 %gunzip -c ../ramdisk.img | cpio -i
 <make changes to root/ contents...>
 %./out/host/linux-x86/bin/mkbootfs root/ | ./out/host/linux-x86/bin/minigzip >ramdisk.img.new
 #output: ramdisk.img.new
 ** Note: any init.rc changes will need to use this method

RECOVERY.IMG

Is just like boot.img.
recovery.img = zImage + ramdisk-recovery.img
*Follow the same steps as boot.img for packing/unpacking

SYSTEM.IMG

 #uncompress
 %./out/host/linux-x86/bin/simg2img system.img system.img.raw
 #mount to directory mnt-point/
 %mkdir mnt-point
 %sudo mount -t ext4 -o loop system.img.raw mnt-point/
 #modify any .so or apk in the mnt-point/ directory
 #rezip
 %sudo out/host/linux-x86/bin/make_ext4fs -s -l 512M -a system system.img.new mnt-point/
 %sudo umount mnt-point/
 Output: system.img.new

Instead of having to reflash the whole big system.img, one can selective update any binary in /system folder on running target

%adb remount
%adb push <local> <remote>
Eg:
%adb remount
%adb push out/target/product/blaze/obj/lib/overlay.omap4.so /system/lib/hw/overlay.omap4.so
%adb sync

USERDATA.IMG

 #uncompress
 %./out/host/linux-x86/bin/simg2img userdata.img userdata.img.raw
 #mount to directory mnt-point/
 %mkdir mnt-point
 %sudo mount -t ext4 -o loop userdata.img.raw mnt-point/
 #modify any .so or apk in the mnt-point/ directory
 #rezip
 #%sudo ./out/host/linux-x86/bin/make_ext4fs -s -l 512M -a userdata userdata.img.new mnt-point/
 # Above command won‘t work on GB/HC. For GB/HC, please use the following updated command
 %sudo ./out/host/linux-x86/bin/make_ext4fs -s -l 512M -a data userdata.img.new mnt-point/
 %sudo umount mnt-point/
 Output: userdata.img.new

CACHE.IMG

 #This is empty ext4 fs image
 %mkdir mnt-point/
 %sudo ./make_ext4fs -s -l 256M -a cache cache.img mnt-point/
 Output: cache.img

[edit]TI Android build setup

Copy kernel zImage, u-boot.bin and MLO for your board in folder device/ti/blaze/boot/.

Rename as:

 %mv MLO MLO_es2.2_emu
 or
 %mv MLO MLO_es2.2_gp
 (based on your board being GP or EMU)

Next start standard android build and all img files are generated in:

out/target/product/blaze/*.img

A script is introduced in TI Android release to make this flashing process easier: device/ti/blaze/boot/fastboot.sh

Usage:
cd device/ti/blaze/boot/
%fastboot.sh --emu
or
%fastboot.sh --gp

Running this script will flash whole android system on your board.

时间: 2024-12-18 18:34:28

Android eMMC Booting[wiki百科]的相关文章

AM335x Android eMMC mkmmc-android.sh hacking

# AM335x Android eMMC mkmmc-android.sh hacking # # 1. 有空解读一下android的分区文件. # 2. 代码来源:https://github.com/hendersa/bbbandroid-external-ti_android_utilities/blob/master/am335x/mk-mmc/mkmmc-android.sh # # 2016-9-8 深圳 南山平山村 曾剑锋 #!/bin/bash # 如果参数只有一个,这里就会直

Android Fastboot[wiki百科]

Overview Fastboot is the method that Android uses to flash the Android build onto the target. If you really want the details, the Fastboot protocol specification is found in the Android source fastboot_protocol.txt. Fastboot abstracts the details of

碎碎念android eMMC

一./dev/block root@:/dev/block #ls bootdevice mmcblk0 mmcblk0p1 mmcblk0p10 --. mmcblk0p18 mmcblk0p19 mmcblk0p2 mmcblk0p20 -- mmcblk0p29 mmcblk0p3 mmcblk0p30 -- mmcblk0rpmb platform LK获取分区信息  smem_ptable_init()从SMEM的entry SMEM_AARM_PARTITION_TABLE中读取分区

Android重量级--糗事百科客户端服务器全套源码

声明:本源码只用于个人研究使用,不可用于商业用途,由于本源码引起的纠纷皆与作者无关. 本项目是“苦涩”在学校的时候准备出来实习的时候做的,由于代码有些粗糙迟迟没有发出来.项目的服务器搭建为php环境,本人用的搭建环境的软件是使用PHPStudy. 项目默认访问的是本人的网络服务器,只要把项目中的model包下的model.java类下的域名换成自己的服务器地址就可以. 记得把服务器的文件上传到服务器. 数据表是测试数据,用于开发使用,可以考虑添加或者废弃.(注:有少许bug,感兴趣的同学可以研究

IntelHaxm : 加速android模拟器启动速度(Stack Overflow 、eoeAndroid wiki)

performance - Why is the Android emulator so slow? - Stack Overflowhttp://stackoverflow.com/questions/1554099/why-is-the-android-emulator-so-slow Android Tools - eoeAndroid wikihttp://wiki.eoeandroid.com/Android_Tools

百科知识 什么是Web2.0

web2.0 百科名片 Web2.0 是相对Web1.0 的新的一类互联网应用的统称.Web1.0 的主要特点在于用户通过浏览器获取信息.Web2.0 则更注重用户的交互作用,用户既是网站内容的浏览者,也是网站内容的制造者.所谓网站内容的制造者是说互联网上的每一个用户不再仅仅是互联网的读者,同时也成为互联网的作者:不再仅仅是在互联网上冲浪,同时也成为波浪制造者;在模式上由单纯的"读"向"写"以及"共同建设"发展:由被动地接收互联网信息向主动创造互

Android 颜色渲染(二) 颜色区域划分原理与实现思路

版权声明:本文为博主原创文章,未经博主允许不得转载. 上一篇讲到颜色选择器,该demo不能选择黑白或者具体区间颜色,这是为什么呢,还是要从原理部分讲起,首先看一下两张图:            图1                   图2 看一下这两张图,有什么相似的地方么,其实在第二张图中已经标记地很明显了,无论这个选择器以什么样的图形展现,是圆形选择器也好,线性或者画板选择器也好,其实都是由七种颜色进行组成: R,RG,G,GB,B,BR,R 它们对应的进制颜色值为 0xFFFF0000,

c 各种编译器(gcc clang)

很多时候,出现一些类似GNU,GCC,CLANG,LLVM等与编译器有关的名词的时候,都不太清楚它到底是干嘛的,理解这些东西后, 对于xcode中很多配置型的需求修改起来都会得心应手,因此有必要了解透彻他们直接的关系与区别. 1 GUN “GNU,名称来自Gnu's Not Unix"的缩写,一个类UNIX的操作系统,由GNU计划推动,目标在于创建一个完全兼容于UNIX的自由软件环境.” 由于当时UNIX系统是商业软件,是收费的,而且有一部分源码是没有开放的,所以在1983年,理查德·斯托曼提出

[知乎]ARM 到底是什么

[小宅按]近期公司推出来基于ARM芯片的服务器,本文就一些基本概念,比如ARM, ARM64, ARMv8, ARM7,ARMv7, 64位等让人费解的概念进行了粗浅地分析,涉及的关键字已用粗体标出.文中观点仅仅是一家之言,拙劣之处,欢迎斧正. https://zhuanlan.zhihu.com/p/66348633 华为官网的账号 (图1) 基本原理(记住1Byte=8bit): 电子计算机本质上是通过给三极管 (或MOS管用半导体材料如硅和硒制成的) 的基极输送不同的电压(大于或小于0.7