E-MMC boot

=eMMC boot=

Introduction
The OMAP processor follows a 2 stage boot process. Details on the boot procedure can be found at the boot sequence page.

eMMC is an embedded MMC device; OMAP support both RAW and FAT boot from eMMC device in Slot-2.

eMMC FAT boot
FAT boot method is the same as MMC/SD Configuration flashing and booting procedure. MMC/SD card must be formatted with the correct partitions prior to flashing any device. Once the MMC/SD is configured it will contain two separate partitions that will be used to boot the device. The FAT32 partition is used for uboot, xloader, and kernel. The ext3 partitions is used for the actual file system. Once both of these are loaded onto an MMC/SD the device can boot up and run the selected file system.

But eMMC is an Embedded device. So we have to partition and format the the eMMC using kernel utility(fdisk, mke2fs) and that available in FileSystem.

Normal (existing) Linux Boot
Step-1 : ROM code transfers X-loader to SRAM and executes it. Step-2 : X-Loader transfers U-Boot to DRAM and executes it. Step-3 : U-Boot transfers the OS Kernel to DRAM and executes it.

eMMC RAW boot
Step-1 : ROM code reads 0th sector from eMMC device. Step-2 : Check TOC, sets up SDRAM using configuration headers in the TOC. Step-3 : ROM code reads 1st sector from eMMC device. Step-4 : Decode the length of the image and load address(SRAM) of the x-loader. And execute it. Step-5 : X-Loader transfers U-Boot to DRAM and executes it. Step-6 : U-boot reads Kernel from FAT partition to SDRAM and executes it. Step-7 : Kernel reads Filesystem.

''The Final destination of this RAW boot is to avoid the step-4 & step-5(as above). I.e. there is still a chance to kill x-loader completely and depend solely on bootloader.''

Following sections discuss about the eMMC RAW boot Flashing Procedure

eMMC RAW boot Procedure for 3630-SDP
1. S9 dip switch settings for MMC/SD boot: 0001 1111

2. Create the x-loader and u-boot for 3630-SDP

3. Add the TOC in x-loader Use the Attached 'eMMC_raw_header' (size 512 bytes)– and add at beginning of the signed x-loader(MLO) => assume this new file name is “mlo-mmc2”. 'eMMC_raw_header' (right click and "save link as") 4. Copy the following files(in order) in bootable MMC/SD card - MLO - u-boot.bin - mlo-mmc2

5. Restart board to Boot from MMC/SD card

6. Flashing(x-loader and u-boot) to eMMC device

mmcinit 0 mmcinit 1 fatload mmc 0 80000000 mlo-mmc2 mmc write.i 1 80000000 0 ${filesize} fatload mmc 0 80000000 u-boot.bin mmc write.i 1 80000000 80000 ${filesize}

OR mmcinit 0 mmcinit 1 fatload mmc 0 80000000 mlo-mmc2 mmc write 1 80000000 0 25 fatload mmc 0 80000000 u-boot.bin mmc write 1 80000000 400 16B

7. Remove the MMC/SD card; Change the Dip-switch to boot from eMMC device and restart the SDP. S9 dip switch for eMMC boot: 1110 1111

eMMC RAW boot Procedure for ZOOM3
1. H/W Modification in SOM board.

The desired SYS_BOOT configuration is: SYS_BOOT[5:0]: 110001           USB -> UART3 -> MMC1 -> MMC2

Note: Once this modification has been made, we can no longer boot out of NAND.

• All in RED color - resistors that should be installed according to the value given in the schematic. Although most of the SYS_BOOT resistors are 4.75 kohm, 3 are not: R73 (1 kohm), R44 & R45 (0 ohms). • Other 6(not in red) need to removed.

2. Create the x-loader and u-boot for ZOOM3

3. Same as step-3 for SDP 4. Same as step-4 for SDP 5. Same as step-5 for SDP 6. Same as step-6 for SDP

7. Remove the MMC/SD card; Change and restart the board

eMMC FAT boot
This is the same as normal(existing) Linux Boot procedure form MMC/SD card. So here are the steps how to make a bootable partiton and copy the x-loader and u-boot to eMMC Device.

Following are the steps need to follow after kernel boots up from MMC/SD or NAND. 1. Create a bootable Partition: root0sdp:/sbin# fdisk /dev/mmcblk1 a>delete the partition if exists b>exit

root@omap-3630sdp# fdisk -H 255 -S 63 /dev/mmcblk1 a> create 1st partition (n,p,1,+64M) b> create 2nd partition (n,p,2,default) c> change 1st partition type to FAT32 (t,1,c) d> make 1st partition ACTIVE (a,1) c> Check the pattition type as below(p)

Disk /dev/mmcblk1: 15.9 GB, 15931539456 bytes 255 heads, 63 sectors/track, 1936 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot        Start   End    Blocks     Id    System /dev/mmcblk1p1 *    1      9      72261      c     Win95 FAT32 (LBA) /dev/mmcblk1p2      10     1936   15478627+  83    Linux

e> write (w)

2. Format the 1st-Partiton to FAT32: ./mkdosfs -F 32 /dev/mmcblk1p1

3. Copy x-loader and u-boot from MMC/SD card to 1st-Parition or eMMC: mount /dev/mmcblk1p1 /mnt/mmc2 mount /dev/mmcblk0p1 /mnt/mmc cp /mnt/mmc/MLO /mnt/mmc2/. cp /mnt/mmc/u-boot.bin /mnt/mmc2/. sync umount /mnt/mmc2 umount /mnt/mmc

eMMC RAW boot & manage rest of space for user Data
eMMC device is a quite big size and full space is not required to hold the binaries. For example we have the following division for each image. Following images (x-loader, u-boot, kernel) is not visible in any of the Partition(as below) for eMMC RAW boot.

For ZOOM2 and ZOOM3 "Remaining Space" in eMMC(16GB, usable space ~15GB) device can be used as File System and/or Userspace. I.e. (15GB-7.5MB) ie. ~14.9GB can be use as a multiple pertitions(file system and user memory). Here is an example of having two partition (4GB and ~10GB), 1st one is FAT Formated and 2nd partition is EXT3 formated : Also this can be achive by following steps - Step-1 : Boot from eMMC device as step mentioned above. Step-2 : use /sbin/fdisk to create the partiton(s). Example: Disk /dev/mmcblk0: 15.9 GB, 15931539456 bytes 255 heads, 63 sectors/track, 1936 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot     Start       End    Blocks    Id   System /dev/mmcblk0p1              2          66      522112+  83  Linux /dev/mmcblk0p2             67        1936    15020775   83  Linux

Step-3 : format the partition (e.g. mkdosfs -F 32 /dev/mmcblk0p1). Step-4 : Dont flash(eMMC - xloader/ u-boot) further.

How to copy the File System in 2nd Partition
Step-1 : Format the partition as EXT3 using the kernel utility. Step-2 : Copy the FS from MMC1 or from NFS to this partion of eMMC

eMMC boot information and Format the Partition
Q. What if the card gets formatted offline by other utils – will the area get overwritten? A. No. Sector#0 having TOC SETTINGS and partition information. And formatting the partition does not overwrite TOC SETTINGS

To overwrite the TOC in sector 0: dd if=/dev/zero of=/dev/mmcblk1 bs=512 count=1

Q. Can I format the card from any OS and still my boot information will exists? A. Yes, we can format the partitions in any OS. Until you do the delete and create new partition.

You can boot omap3630 without x-loader
Step-1 : Copy the following settings(512+8 bytes) in front of u-boot.bin file; This is the TOC settings for Clock and SDRAM. And say new file name as u-boot.bin.ift

A0 00 00 00 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 43 48 53 45 54 54 49 4E 47 53 00 00 F0 00 00 00 5C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 43 48 52 41 4D 00 00 00 00 00 00 00 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 C1 C0 C0 C0 01 01 00 00 FD 01 00 05 40 00 00 00 03 00 00 00 02 00 00 00 0A 13 00 00 15 00 00 00 07 00 37 00 00 00 00 00 00 0C C8 08 11 00 00 00 00 00 00 00 0C B0 41 04 09 00 00 00 37 00 00 00 00 00 00 00 0C 2C 11 00 01 00 00 00 00 00 00 00 C2 C0 C0 C0 01 00 00 00 00 00 02 00 00 01 00 00 0A 00 00 00 00 00 00 00 85 00 00 00 03 00 00 00 99 80 58 03 32 00 00 00 00 00 00 00 C6 B4 E1 A2 1C 13 02 00 01 E6 05 00 03 00 00 00 99 80 58 03 32 00 00 00 00 00 00 00 C6 B4 E1 A2 1C 13 02 00 01 E6 05 00 00 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 C0 D5 02 00 00 00 E8 80 --- --- 4-byte-size 4byteLoadAddr

====> Step-1 can be done automatically using the http://code.google.com/p/omap-u-boot-utils/ utility. a. Download the code (git tree) b. make c. copy the u-boot.bin in same location. d. ./gpsign -c configs/sample-3630.cfg -l 80000000 -f u-boot.bin e. output file u-boot.bin.ift Step-2: Copy the image(say, u-boot.bin.ift) in MMC/SD card Step-3: Boot from MMC/SD card and follow the steps as below to flush image in eMMC


 * 1) mmcinit 0
 * 2) mmcinit 1
 * 3) fatload mmc 0 90000000 u-boot.bin.ift
 * 4) mmc write.i 1 90000000 0 ${filesize}

Step-4: Remove the MMC/SD card and reboot the system. [Change the dipswitch settings for SDP only for eMMC boot.]