AM335x Android eMMC Booting - Texas Instruments Wiki
AM335x Android eMMC Booting - Texas Instruments Wiki
NOTICE: The Processors Wiki will End-of-Life in December of 2020. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.
Contents
Introduction
What is eMMC?
What is fastboot?
eMMC layout
Protective master boot record
GUID Partition Table (GPT)
eMMC partition layout
Fastboot flowchart
Support for eMMC fastboot update and raw boot on AM335xEVM
Prepare the u-boot source code
Selection of eMMC boot or NAND boot in u-boot
Selection of MMC0 or MMC1 as boot device for eMMC Raw boot on AM335xEVM
u-boot build
Prepare the kernel source code
kernel build
Build android file system
Prepare Images
boot.img
system.img
userdata.img
cache.img
Using Fastboot
Creating the GPT table on eMMC and flash raw images
How to change GPT(GUID Partition Table) configuration
Technical Support and Product Updates
Introduction
Content is no longer maintained and is being kept for reference only!
AM335xEVM has on board NAND and MMC interface. Either interface can be used for booting a system.
NAND boot is raw boot, as it reads raw data and manipulates it.
MMC boot is FAT boot, as it reads file from MMC sector and manipulates it.
MMC and NAND boot is already supported by android devkit releases available at http://arowboat.org.
This wiki highlights on:
Using the available MMC interface on the AM335xEVM to simulate the eMMC functionality.
Adding eMMC support for fastboot.
Updating images to eMMC over fastboot.
Boot android from eMMC using RAW boot technique.
Wiki will also act as porting guide to port eMMC support on other platforms.
Note: All patches described in this documents are validated on Texas Instruments' AM335xEVM board.
What is eMMC?
eMMC describes an architecture consisting of an embedded storage solution with MMC interface, flash memory and controller. In one line it is a flash/NAND over MMC interface.
The OMAP processor follows a 2 stage boot process. Details on the boot procedure can be found at the boot sequence page.
What is fastboot?
Fastboot is the method that android uses to flash the android built onto the target.
Fastboot protocol specification is found here.
Fastboot speeds up your development NOT the time it takes to boot.
Also, fastboot is used to update x-loader, bootloader, kernel, systemfs, userdata etc. by oem.
eMMC layout
In the discussion that follows, “sector” refers to a 512-byte disk sector, addressed by its Logical Block Address (LBA). Although the UEFI specs allow for disk sectors of other sizes, in practice 512 bytes is the norm.
Fastboot flowchart
The code is enabled for SD/MMC boot by default. Also it can be used for NAND boot by loading the images to NAND using Fastboot.
For enabling eMMC booting with Fastboot, do the following modifications in "include/configs/am335x_evm.h":
And for NAND boot with Fastboot, do the following modifications in "include/configs/am335x_evm.h":
Note: When eMMC boot mode is enabled, the normal SD/MMC FAT boot will not work. For getting the SD?MMC FAT boot user has to enable the configuration for NAND boot.
Selection of MMC0 or MMC1 as boot device for eMMC Raw boot on AM335xEVM
The AM335x General Purpose EVM has two SD/MMC connectors.
The SD/MMC0 connector is placed on the Base board and is available for all the 7 Profile modes.
The SD/MMC1 connector is placed on the General purpose Daughterboard and is available only on Profile 2.
The code adds two Macros to the board config file (include/configs/am335x_evm.h), named:
Also configure the AM335xEVM to Profile 2 mode, in order to enable both the MMC slots.
All the binaries can be flashed to the device, with the eMMC card interfaced to the respective slot, as per the enabled Macro in the board config file, using fastboot.
After flashing those binaries, on reboot the device boots Android through the raw read from the eMMC.
u-boot build
Build u-boot (both MLO and u-boot.img)
Download eMMC raw header here (right click and "save link as").
kernel build
Build kernel
Prepare Images
boot.img
$mkdir <YOUR_PATH>/images
$cd <YOUR_PATH>/images
$cp <ANDROID_SOURCE>/kernel/arch/arm/boot/zImage .
on fs
mount ext4 /dev/block/mmcblk0p6 /system wait ro
mount ext4 /dev/block/mmcblk0p8 /data wait noatime nosuid nodev
mount ext4 /dev/block/mmcblk0p7 /cache wait noatime nosuid nodev
Rebuild images
$cd <ANDROID_SOURCE>
$find out/target/product/am335xevm -name *.img -exec rm -f {} \;
$make TARGET_PRODUCT=am335xevm OMAPES=4.x
Prepare boot.img
$cd <YOUR_PATH>/images
$cp <ANDROID_SOURCE>/out/target/product/am335xevm/ramdisk.img .
$cp <ANDROID_SOURCE>/out/host/linux-x86/bin/mkbootimg .
$./mkbootimg --kernel zImage --ramdisk ramdisk.img --base 0x80000000 --cmdline "console=ttyO0,115200n8 androidboot.console=ttyO0 mem=256M root=/dev/ram0 rw initramfs=0x81000000,8M init=/init ip=off omap_vout.vid1_stat
system.img
$cd <YOUR_PATH>/images
/* creating 192MB, it can be configure as per need */
$dd if=/dev/zero of=./system.img bs=1M count=192
$mkfs.ext4 system.img
$mkdir mnt-point
$sudo mount -t ext4 -o loop system.img mnt-point/
$cp -rfp <ANDROID_SOURCE>/out/target/product/am335xevm/system/* mnt-point/
$sudo umount mnt-point
userdata.img
$cd <YOUR_PATH>/images
/* creating 192MB, it can be configure as per need */
$dd if=/dev/zero of=./userdata.img bs=1M count=192
$mkfs.ext4 userdata.img
$sudo mount -t ext4 -o loop userdata.img mnt-point/
$cp -rfp <ANDROID_SOURCE>/out/target/product/am335xevm/data/* mnt-point/
$cp -rfp <ANDROID_SOURCE>/out/target/product/am335xevm/root/data/* mnt-point/
$sudo umount mnt-point
cache.img
$cd <YOUR_PATH>/images
/* creating 192MB, it can be configure as per need */
$dd if=/dev/zero of=./cache.img bs=1M count=192
$mkfs.ext4 cache.img
Using Fastboot
Creating the GPT table on eMMC and flash raw images
Create MMC card for FAT boot mentioned here.
On Target
1. Connect target to host machine using USB cable. Connect USB cable to OTG port on target.
2. Boot target and enter any key at the U-boot prompt.
3. At the u-boot prompt enter following command:
#fastboot
Fastboot entered...
On Host Machine
/* locate fastboot in android filesystem */
$cd <ANDROID_SOURCE>/out/host/linux-x86/bin/
/* flash SPL */
$./fastboot flash spl <YOUR_PATH>/images/MLO.final
/* flash bootloader */
$./fastboot flash bootloader <YOUR_PATH>/images/u-boot.img
/* reboot target */
$./fastboot reboot
Note: Flashing of system.img, userdata.img, cache.img, each may take around 10-12 minutes.
Navigation menu
Personal tools
Log in
Request account
Namespaces
Page
Discussion
Variants
Views
Read
View source
View history
More
Search
Search Texas Instruments Search Go
Navigation
Main Page
All pages
All categories
Recent changes
Random page
Help
Toolbox
What links here
Related changes
Special pages
Printable version
Permanent link
Page information
Privacy policy
About Texas Instruments Wiki
Disclaimers
Terms of Use