Android eMMC Booting

转载 2012年03月28日 17:07:09

Android eMMC Booting



[edit]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 = zImage + ramdisk.img
 zImage = kernel image
 ramdisk.img = out/target/product/blaze/root/
 --kernel zImage 
 --ramdisk ramdisk.img 
 --base 0x80000000 
 --cmdline "console=ttyO2,115200n8 mem=456M@0x80000000 mem=512M@0xA0000000 init=/init vram=10M omapfb.vram=0:4M androidboot.console=ttyO2" 
 --board omap4 
 **Note: bootarg is passed to kernel via --cmdline option above

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

%fastboot boot boot.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 >
 ** Note: any init.rc changes will need to use this method


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


 %./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
 %sudo out/host/linux-x86/bin/make_ext4fs -s -l 512M -a system mnt-point/
 %sudo umount mnt-point/

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>
%adb remount
%adb push out/target/product/blaze/obj/lib/ /system/lib/hw/
%adb sync


 %./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
 #%sudo ./out/host/linux-x86/bin/make_ext4fs -s -l 512M -a userdata 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 mnt-point/
 %sudo umount mnt-point/


 #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 
 %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:


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

cd device/ti/blaze/boot/ --emu
or --gp

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

Android eMMC Booting 2

Android eMMC Booting Contents [hide] 1 eMMC binaries 1.1 Creating the GPT ta...
  • cosmoslhf
  • cosmoslhf
  • 2013年05月10日 16:09
  • 673

Android eMMC booting Android ginge...
  • cosmoslhf
  • cosmoslhf
  • 2013年05月10日 16:07
  • 1413

Android gingerbread eMMC booting

Android gingerbread eMMC booting This page is currently under c...
  • LoongEmbedded
  • LoongEmbedded
  • 2014年07月22日 10:14
  • 1733

Android eMMC Booting

Android eMMC Booting Contents   [hide] 1 eMMC binaries 1.1 Creating the GP...
  • LoongEmbedded
  • LoongEmbedded
  • 2014年07月22日 10:15
  • 1649

android booting 启动过程

原文 Android 系统的启动过程分为若干个阶段,本文主要介绍一下内容 ...
  • YAJUN0601
  • YAJUN0601
  • 2012年01月17日 17:23
  • 1439

Android eMMC 分区详解

1. fastboot flash boot boot.img     当使用上述命令写入编译的Image时,fastboot做了些什么?基于那些信息把Image写到哪里呢?     Androi...
  • firefox_1980
  • firefox_1980
  • 2014年08月25日 17:59
  • 6130

Android白话启动篇(Android booting process)

今天我们将深入Android的启动流程,从用户按下开机键到Android界面的过程。在谷歌上搜索“Android boot process”会得到很多很好英文文章,讲解Android启动这一过程,每个...
  • seek_0380
  • seek_0380
  • 2016年07月01日 12:41
  • 4351

碎碎念android eMMC

碎碎念android eMMC
  • Fybon
  • Fybon
  • 2015年03月13日 16:13
  • 5167


随着手机的存储 前提:
  • Fybon
  • Fybon
  • 2014年04月09日 17:33
  • 6129


Android存储系统如何优化? 我也不知道…那为什么会想到要写这篇文章哪?主要是因为有天晚上和以前一个同事讨论到Android手机存储系统的优化问题。用过Android手机的人可能都会有这么个感觉...
  • panzhenjie
  • panzhenjie
  • 2016年06月30日 06:35
  • 2406
您举报文章:Android eMMC Booting