Android emmc booting

Source: Internet
Author: User
Tags uncompress
Android emmc booting
Contents

[Hide]

  • 1 emmc Binaries

    • 1.1 creating the GPT table
    • 1.2 modifying. IMG files
    • 1.3 Ti Android build setup
[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 wowould 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 mem=456M@0x80000000 mem=512M@0xA0000000 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

To "just" 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/ # 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/ %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:

 %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 --emuor%fastboot.sh --gp

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.