Difference between revisions of "Loading Images onto eMMC Devices"

From wiki.emacinc.com
Jump to: navigation, search
m (Updated the SoM-9x25/Ipac-9x25 section)
m (Brought wiki format forward - modified to use new templates)
Line 1: Line 1:
{{todo|SEOKWREV (12.31.13-13:15->MD-);(12.31.13-14:50->MW+);(12.31.13-18:10->MD+);(12.31.13-18:45->MG+);(03.06.14-15:35->BS-);(04.11.14-15:55->BS+);(05.01.15-12:12->MG+)|Michael Welling|project=oe 4,oe 5,mw,md,mg,bs,SEOKWREV}}
+
{{todo|SEOKWREV (12.31.13-13:15->MD-);(12.31.13-14:50->MW+);(12.31.13-18:10->MD+);(12.31.13-18:45->MG+);(03.06.14-15:35->BS-);(04.11.14-15:55->BS+);(05.01.15-12:12->MG+);(11.05.15-17:50->MD+)|Michael Welling|project=oe 4,oe 5,mw,md,mg,bs,SEOKWREV}}
  
 
{{#seo:
 
{{#seo:
Line 13: Line 13:
  
  
{{imbox | type=notice | text = The procedures below require that you have a TFTP and NFS server setup on a host computer. }}
+
{{note | The procedures below require that you have a TFTP and NFS server setup on a host computer. }}
  
  
Line 27: Line 27:
 
For example here is the procedure for creating a 128 MB primary partition:
 
For example here is the procedure for creating a 128 MB primary partition:
  
root@emac-oe:~# fdisk /dev/mmcblk0
+
{{clop}}
 +
{{cliop | hostname=emac-oe |fdisk /dev/mmcblk0}}<nowiki>
 +
The number of cylinders for this disk is set to 57024.
 +
There is nothing wrong with that, but this is larger than 1024,
 +
and could in certain setups cause problems with:
 +
1) software that runs at boot time (e.g., old versions of LILO)
 +
2) booting and partitioning software from other OSs
 +
  (e.g., DOS FDISK, OS/2 FDISK)
 +
Command (m for help): n
 +
Command action
 +
  e  extended
 +
  p  primary partition (1-4)
 +
p
 +
Partition number (1-4): 1
 +
First cylinder (1-57024, default 1): Using default value 1
 +
Last cylinder or +size or +sizeM or +sizeK (1-57024, default 57024): +128M
 
   
 
   
The number of cylinders for this disk is set to 57024.
+
Command (m for help): p
There is nothing wrong with that, but this is larger than 1024,
 
and could in certain setups cause problems with:
 
1) software that runs at boot time (e.g., old versions of LILO)
 
2) booting and partitioning software from other OSs
 
    (e.g., DOS FDISK, OS/2 FDISK)
 
Command (m for help): n
 
Command action
 
    e  extended
 
    p   primary partition (1-4)
 
p
 
Partition number (1-4): 1
 
First cylinder (1-57024, default 1): Using default value 1
 
Last cylinder or +size or +sizeM or +sizeK (1-57024, default 57024): +128M
 
 
   
 
   
Command (m for help): p
+
Disk /dev/mmcblk0: 1868 MB, 1868562432 bytes
+
4 heads, 16 sectors/track, 57024 cylinders
Disk /dev/mmcblk0: 1868 MB, 1868562432 bytes
+
Units = cylinders of 64 * 512 = 32768 bytes
4 heads, 16 sectors/track, 57024 cylinders
+
 
Units = cylinders of 64 * 512 = 32768 bytes
+
        Device Boot      Start        End      Blocks  Id System
+
/dev/mmcblk0p1              1        3907      125016  83 Linux
        Device Boot      Start        End      Blocks  Id System
+
 
/dev/mmcblk0p1              1        3907      125016  83 Linux
+
Command (m for help): w
+
The partition table has been altered!
Command (m for help): w
+
 
The partition table has been altered!
+
Calling ioctl() to re-read partition table
+
[  566.062896]  mmcblk0: p1
Calling ioctl() to re-read partition table
+
</nowiki>
[  566.062896]  mmcblk0: p1
+
{{cliop | hostname=emac-oe|}}
 +
{{closp}}
  
 
For more information about <code>fdisk</code>, see:
 
For more information about <code>fdisk</code>, see:
Line 64: Line 67:
 
After creating the partitions, they can formatted with the various <code>mkfs</code> utilities. The formatting used is dependent on how the partition is to be accessed. For eMMC root filesystems EMAC currently uses EXT3 (http://en.wikipedia.org/wiki/Ext3). Other formatting options are available (EXT2, EXT4, etc) and can be used. It should be noted that the kernel must be configured to support the chosen filesystem and the bootargs need to specify the correct type.  
 
After creating the partitions, they can formatted with the various <code>mkfs</code> utilities. The formatting used is dependent on how the partition is to be accessed. For eMMC root filesystems EMAC currently uses EXT3 (http://en.wikipedia.org/wiki/Ext3). Other formatting options are available (EXT2, EXT4, etc) and can be used. It should be noted that the kernel must be configured to support the chosen filesystem and the bootargs need to specify the correct type.  
  
{{imbox | type=notice | text =For additional information on configuring and compiling the Linux kernel see the following page: [[Building the Linux Kernel]] }}
+
{{note | For additional information on configuring and compiling the Linux kernel see the following page: [[Building the Linux Kernel]] }}
  
 
As described above, the <code>bootargs</code> is used for signalling to the Linux kernel the location of the root filesystem partition, and its formatting. The <code>root</code> parameter is used to specify the partition to use while the <code>rootfstype</code> parameter is used to specify the formatting of the partition.
 
As described above, the <code>bootargs</code> is used for signalling to the Linux kernel the location of the root filesystem partition, and its formatting. The <code>root</code> parameter is used to specify the partition to use while the <code>rootfstype</code> parameter is used to specify the formatting of the partition.
  
{{imbox | type=notice | text =For more information about the <code>bootargs</code> variable see this page: [[U-Boot Overview]] }}
+
{{note | For more information about the <code>bootargs</code> variable see this page: [[U-Boot Overview]] }}
  
 
Partitions accessed by processor boot ROM or U-Boot typically need to be formatted with FAT32 formatting. The SoM-3517M, for instance, requires a FAT32 formatted partition for the bootloader and kernel in order to boot properly from eMMC. For more specifics about the SoM-3517M, see the quick reference section below.
 
Partitions accessed by processor boot ROM or U-Boot typically need to be formatted with FAT32 formatting. The SoM-3517M, for instance, requires a FAT32 formatted partition for the bootloader and kernel in order to boot properly from eMMC. For more specifics about the SoM-3517M, see the quick reference section below.
Line 74: Line 77:
 
===Formatting a partition with EXT3===
 
===Formatting a partition with EXT3===
  
root@emac-oe:~# mkfs.ext3 /dev/mmcblk0p1
+
{{clop}}
mke2fs 1.41.14 (22-Dec-2010)
+
{{cliop | hostname=emac-oe |mkfs.ext3 /dev/mmcblk0p1}}<nowiki>
Filesystem label=
+
mke2fs 1.41.14 (22-Dec-2010)
OS type: Linux
+
Filesystem label=
Block size=1024 (log=0)
+
OS type: Linux
Fragment size=1024 (log=0)
+
Block size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
+
Fragment size=1024 (log=0)
31360 inodes, 125016 blocks
+
Stride=0 blocks, Stripe width=0 blocks
6250 blocks (5.00%) reserved for the super user
+
31360 inodes, 125016 blocks
First data block=1
+
6250 blocks (5.00%) reserved for the super user
Maximum filesystem blocks=67371008
+
First data block=1
16 block groups
+
Maximum filesystem blocks=67371008
8192 blocks per group, 8192 fragments per group
+
16 block groups
1960 inodes per group
+
8192 blocks per group, 8192 fragments per group
Superblock backups stored on blocks:  
+
1960 inodes per group
        8193, 24577, 40961, 57345, 73729
+
Superblock backups stored on blocks:  
 +
        8193, 24577, 40961, 57345, 73729
 +
 
 +
Writing inode tables: done     
 +
Creating journal (4096 blocks): done
 +
Writing superblocks and filesystem accounting information: done
 
   
 
   
Writing inode tables: done     
+
This filesystem will be automatically checked every 39 mounts or
Creating journal (4096 blocks): done
+
180 days, whichever comes first.  Use tune2fs -c or -i to override.
Writing superblocks and filesystem accounting information: done
+
</nowiki>
+
{{cliop| hostname=emac-oe |}}
This filesystem will be automatically checked every 39 mounts or
+
{{closp}}
180 days, whichever comes first.  Use tune2fs -c or -i to override.
 
  
 
===Formatting a partition with FAT32===
 
===Formatting a partition with FAT32===
  
root@emac-oe:~# mkdosfs -F 32 /dev/mmcblk0p1
+
{{clop}}
mkdosfs 2.11 (12 Mar 2005)
+
{{cliop | hostname=emac-oe |mkdosfs -F 32 /dev/mmcblk0p1}}
 
+
mkdosfs 2.11 (12 Mar 2005)
 +
{{cliop | hostname=emac-oe |}}
 +
{{closp}}
  
  
Line 109: Line 118:
  
 
For example, here is the procedure for writing a root filesystem to the first partition of an eMMC card:
 
For example, here is the procedure for writing a root filesystem to the first partition of an eMMC card:
root@emac-oe:~# mkdir -p /mnt/card
+
 
root@emac-oe:~# mount /dev/mmcblk0p1 /mnt/card
+
{{clo}}
root@emac-oe:~# cd /mnt/card
+
{{clio | hostname=emac-oe |mkdir -p /mnt/card}}
root@emac-oe:~# tar xzvf /images/emac-image.rootfs.tar.gz
+
{{clio | hostname=emac-oe |mkdir -p /mnt/card}}
   
+
{{clio | hostname=emac-oe |mount /dev/mmcblk0p1 /mnt/card}}
 +
{{clio | hostname=emac-oe |cd /mnt/card}}
 +
{{clio | hostname=emac-oe |tar xzvf /images/emac-image.rootfs.tar.gz}}
 +
<nowiki>    </nowiki>
 +
{{clos}}
  
 
In the above example the <code>/mnt/card</code> directory is called the mount point. The <code>mkdir -p</code> command creates the directory if it does not already exist. The <code>mount</code> command attaches the specified partition to the directory. Any files written to the mounted directory will go to the partition on the eMMC. After the mount is complete, files can be extracted as shown using the <code>tar</code> command.
 
In the above example the <code>/mnt/card</code> directory is called the mount point. The <code>mkdir -p</code> command creates the directory if it does not already exist. The <code>mount</code> command attaches the specified partition to the directory. Any files written to the mounted directory will go to the partition on the eMMC. After the mount is complete, files can be extracted as shown using the <code>tar</code> command.
Line 127: Line 140:
 
==== Partitioning the eMMC ====
 
==== Partitioning the eMMC ====
  
root@emac-oe:~# fdisk /dev/mmcblk0
+
{{cli | hostname=emac-oe |fdisk /dev/mmcblk0}}
  
 
The partitioning steps are as follows:
 
The partitioning steps are as follows:
Line 138: Line 151:
 
==== Formatting the eMMC ====
 
==== Formatting the eMMC ====
  
root@emac-oe:~# mkfs.ext3 /dev/mmcblk0p2
+
{{clo}}
root@emac-oe:~# mkdosfs -F 32 /dev/mmcblk0p1
+
{{clio | hostname=emac-oe |mkfs.ext3 /dev/mmcblk0p2}}
 +
{{clio | hostname=emac-oe |mkdosfs -F 32 /dev/mmcblk0p1}}
 +
{{clos}}
  
The first command formats the second partition as ext3. The mkfs.ext3 command can take further configuration parameters. See the mkfs.ext3 man page for more information.
+
The first command formats the second partition as ext3. The <code>mkfs.ext3</code> command can take further configuration parameters. See the <code>mkfs.ext3</code> man page for more information.
  
 
The second command formats the first partition as FAT32 for use with the AM3517's boot ROM. This is a requirement to boot from the eMMC.
 
The second command formats the first partition as FAT32 for use with the AM3517's boot ROM. This is a requirement to boot from the eMMC.
Line 147: Line 162:
 
==== Adding Kernel and Bootloader ====
 
==== Adding Kernel and Bootloader ====
  
root@emac-oe:~# mkdir -p /mnt/card
+
{{clo}}
root@emac-oe:~# mount /dev/mmcblk0p1 /mnt/card
+
{{clio | hostname=emac-oe |mkdir -p /mnt/card}}
root@emac-oe:~# cd /images
+
{{clio | hostname=emac-oe |mount /dev/mmcblk0p1 /mnt/card}}
root@emac-oe:/images# cp MLO uImage u-boot.bin /mnt/card/
+
{{clio | hostname=emac-oe |cd /images}}
root@emac-oe:/images# sync
+
{{clio | hostname=emac-oe | pwd=images |cp MLO uImage u-boot.bin /mnt/card/}}
root@emac-oe:/images# umount /dev/mmcblk0p1
+
{{clio | hostname=emac-oe | pwd=images |sync}}
 +
{{clio | hostname=emac-oe | pwd=images |umount /dev/mmcblk0p1}}
 +
{{clos}}
  
 
To understand why these files are programmed in FAT32 on the first primary partition, the eMMC boot sequence of the SoM-3517M must be understood. MLO is called the first boot and it is loaded directly by the AM3517 processor's boot ROM. Once the ROM finishes loading MLO, it is executed. MLO then relocates the U-Boot binary (u-boot.bin) from eMMC to DDR and executes it. Finally when U-Boot starts the Linux boot process, it relocates the kernel image (uImage) to DDR and starts Linux.
 
To understand why these files are programmed in FAT32 on the first primary partition, the eMMC boot sequence of the SoM-3517M must be understood. MLO is called the first boot and it is loaded directly by the AM3517 processor's boot ROM. Once the ROM finishes loading MLO, it is executed. MLO then relocates the U-Boot binary (u-boot.bin) from eMMC to DDR and executes it. Finally when U-Boot starts the Linux boot process, it relocates the kernel image (uImage) to DDR and starts Linux.
  
{{ imbox | type=notice | text=The first partition '''must''' be formatted FAT32 and the MLO binary '''must''' be in the first sector for the eMMC boot sequence to work properly.  }}
+
{{ note | The first partition '''must''' be formatted FAT32 and the MLO binary '''must''' be in the first sector for the eMMC boot sequence to work properly.  }}
  
 
==== Extracting Root Filesystem ====
 
==== Extracting Root Filesystem ====
root@emac-oe:/images# mount /dev/mmcblk0p2 /mnt/card
+
{{clo}}
root@emac-oe:/images# cd /mnt/card
+
{{clio | hostname=emac-oe | pwd=images |mount /dev/mmcblk0p2 /mnt/card}}
root@emac-oe:/mnt/card# tar xzvf /emac-image.rootfs.tar.gz
+
{{clio | hostname=emac-oe | pwd=images |cd /mnt/card}}
root@emac-oe:/mnt/card# cd ..
+
{{clio | hostname=emac-oe | pwd=/mnt/card |tar xzvf /emac-image.rootfs.tar.gz}}
root@emac-oe:/mnt# sync
+
{{clio | hostname=emac-oe | pwd=/mnt/card |cd ..}}
root@emac-oe:/mnt# umount /dev/mmcblk0p2
+
{{clio | hostname=emac-oe | pwd=/mnt |sync}}
 +
{{clio | hostname=emac-oe | pwd=/mnt |umount /dev/mmcblk0p2}}
 +
{{clos}}
  
 
=== SoM-9X25M / IPAC-9X25 ===
 
=== SoM-9X25M / IPAC-9X25 ===
 
==== Partitioning the eMMC ====
 
==== Partitioning the eMMC ====
  
root@emac-oe:~# fdisk /dev/mmcblk0
+
{{cli | hostname=emac-oe |fdisk /dev/mmcblk0}}
  
{{imbox | type=notice | text = For the SoM-9x25M revisions 7 and above, the eMMC block device is /dev/sdb }}
+
{{ note | For the SoM-9x25M revisions 7 and above, the eMMC block device is /dev/sdb }}
  
 
The partitioning steps are as follows:
 
The partitioning steps are as follows:
Line 180: Line 199:
  
 
==== Formatting the eMMC ====
 
==== Formatting the eMMC ====
root@emac-oe:~# mkfs.ext4 /dev/mmcblk0p1
+
{{clo}}
root@emac-oe:~# mkfs.ext4 /dev/mmcblk0p2
+
{{clio | hostname=emac-oe |mkfs.ext4 /dev/mmcblk0p1}}
 +
{{clio | hostname=emac-oe |mkfs.ext4 /dev/mmcblk0p2}}
 +
{{clos}}
  
 
==== Extracting Root Filesystem ====
 
==== Extracting Root Filesystem ====
root@emac-oe:~# mkdir -p /mnt/card
+
{{clo}}
root@emac-oe:~# mount /dev/mmcblk0p1 /mnt/card
+
{{clio | hostname=emac-oe |mkdir -p /mnt/card}}
root@emac-oe:~# cd /mnt/card
+
{{clio | hostname=emac-oe |mount /dev/mmcblk0p1 /mnt/card}}
root@emac-oe:/mnt/card# tar xzvf /emac-image.rootfs.tar.gz
+
{{clio | hostname=emac-oe |cd /mnt/card}}
root@emac-oe:/mnt/card# cd ..
+
{{clio | hostname=emac-oe | pwd=/mnt/card |tar xzvf /emac-image.rootfs.tar.gz}}
root@emac-oe:/mnt# sync
+
{{clio | hostname=emac-oe | pwd=/mnt/card |cd ..}}
root@emac-oe:/mnt# umount /dev/mmcblk0p1
+
{{clio | hostname=emac-oe | pwd=/mnt |sync}}
 +
{{clio | hostname=emac-oe | pwd=/mnt |umount /dev/mmcblk0p1}}
 +
{{clos}}

Revision as of 18:53, 5 November 2015

TODO: {{#todo:SEOKWREV (12.31.13-13:15->MD-);(12.31.13-14:50->MW+);(12.31.13-18:10->MD+);(12.31.13-18:45->MG+);(03.06.14-15:35->BS-);(04.11.14-15:55->BS+);(05.01.15-12:12->MG+);(11.05.15-17:50->MD+)|Michael Welling|oe 4,oe 5,mw,md,mg,bs,SEOKWREV}}

Background

Some EMAC products use eMMC in place of NAND flash. eMMC is an embedded MMC compliant memory that takes the form of an integrated circuit instead of a media card.

U-Boot does not support writing to file systems in eMMC. To overcome this issue, the embedded target has to boot into Linux using an auxiliary method. Once U-Boot has been loaded into RAM, it can be used to load the target kernel using TFTP and boot into a file system stored in NFS. Once the board has booted into Linux, the eMMC can be partitioned and formatted, and the root file system can be extracted. The SoM-3517M requires a special FAT formatted partition that contains the bootloader and Linux kernel images. This article explains the general process of writing the eMMC from Linux as well as some specifics related to programming the SoM-3517M, SoM-9X25 and IPAC-9X25.




NOTE
The procedures below require that you have a TFTP and NFS server setup on a host computer.


Creating partitions and formatting eMMC

Once the Linux command prompt is reached, the Linux utilities can be used to create and format partitions on the eMMC. By partitioning the eMMC, the partitions can be accessed individually and formatted differently as required. The fdisk utility can be used to create these partitions on the eMMC.

For example here is the procedure for creating a 128 MB primary partition:

root@emac-oe:~# fdisk /dev/mmcblk0
The number of cylinders for this disk is set to 57024. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-57024, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-57024, default 57024): +128M Command (m for help): p Disk /dev/mmcblk0: 1868 MB, 1868562432 bytes 4 heads, 16 sectors/track, 57024 cylinders Units = cylinders of 64 * 512 = 32768 bytes Device Boot Start End Blocks Id System /dev/mmcblk0p1 1 3907 125016 83 Linux Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table [ 566.062896] mmcblk0: p1
root@emac-oe:~#

For more information about fdisk, see: http://tldp.org/HOWTO/Partition/fdisk_partitioning.html

After creating the partitions, they can formatted with the various mkfs utilities. The formatting used is dependent on how the partition is to be accessed. For eMMC root filesystems EMAC currently uses EXT3 (http://en.wikipedia.org/wiki/Ext3). Other formatting options are available (EXT2, EXT4, etc) and can be used. It should be noted that the kernel must be configured to support the chosen filesystem and the bootargs need to specify the correct type.



NOTE
For additional information on configuring and compiling the Linux kernel see the following page: Building the Linux Kernel


As described above, the bootargs is used for signalling to the Linux kernel the location of the root filesystem partition, and its formatting. The root parameter is used to specify the partition to use while the rootfstype parameter is used to specify the formatting of the partition.



NOTE
For more information about the bootargs variable see this page: U-Boot Overview


Partitions accessed by processor boot ROM or U-Boot typically need to be formatted with FAT32 formatting. The SoM-3517M, for instance, requires a FAT32 formatted partition for the bootloader and kernel in order to boot properly from eMMC. For more specifics about the SoM-3517M, see the quick reference section below.

Formatting a partition with EXT3

root@emac-oe:~# mkfs.ext3 /dev/mmcblk0p1
mke2fs 1.41.14 (22-Dec-2010) Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) Stride=0 blocks, Stripe width=0 blocks 31360 inodes, 125016 blocks 6250 blocks (5.00%) reserved for the super user First data block=1 Maximum filesystem blocks=67371008 16 block groups 8192 blocks per group, 8192 fragments per group 1960 inodes per group Superblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729 Writing inode tables: done Creating journal (4096 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 39 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.
root@emac-oe:~#

Formatting a partition with FAT32

root@emac-oe:~# mkdosfs -F 32 /dev/mmcblk0p1

mkdosfs 2.11 (12 Mar 2005)

root@emac-oe:~#


Extracting filesystems to eMMC

After formatting a partition correctly, the partition can be mounted and files can be loaded to the eMMC.

For example, here is the procedure for writing a root filesystem to the first partition of an eMMC card:

root@emac-oe:~# mkdir -p /mnt/card
root@emac-oe:~# mkdir -p /mnt/card
root@emac-oe:~# mount /dev/mmcblk0p1 /mnt/card
root@emac-oe:~# cd /mnt/card
root@emac-oe:~# tar xzvf /images/emac-image.rootfs.tar.gz

In the above example the /mnt/card directory is called the mount point. The mkdir -p command creates the directory if it does not already exist. The mount command attaches the specified partition to the directory. Any files written to the mounted directory will go to the partition on the eMMC. After the mount is complete, files can be extracted as shown using the tar command.

It should be noted that the /etc/fstab file can be used to specify mount points for partitions upon boot. See http://en.wikipedia.org/wiki/Fstab for additional information.

Quick Reference (by Target Type)

This section is used to provide specifics for programming eMMC on various targets.

For the partitioning sections, the information in the parenthesis denotes a keyboard input sequence. The (n,p,1,default,+64M) creates a new primary partition. Each input is followed a carriage return and the default is selected by pressing carriage return with no entry. See the expanded example in the above Creating partitions and formatting eMMC section for an idea of how the interface looks when commands are executed correctly.

SoM-3517M

Partitioning the eMMC

root@emac-oe:~# fdisk /dev/mmcblk0

The partitioning steps are as follows:

  1. Create 1st partition (n,p,1,default,+64M)
  2. Create 2nd partition (n,p,2,default,default)
  3. Change 1st partition type to FAT32 (t,1,c)
  4. Make 1st partition ACTIVE (a,1)
  5. Write (w)

Formatting the eMMC

root@emac-oe:~# mkfs.ext3 /dev/mmcblk0p2
root@emac-oe:~# mkdosfs -F 32 /dev/mmcblk0p1

The first command formats the second partition as ext3. The mkfs.ext3 command can take further configuration parameters. See the mkfs.ext3 man page for more information.

The second command formats the first partition as FAT32 for use with the AM3517's boot ROM. This is a requirement to boot from the eMMC.

Adding Kernel and Bootloader

root@emac-oe:~# mkdir -p /mnt/card
root@emac-oe:~# mount /dev/mmcblk0p1 /mnt/card
root@emac-oe:~# cd /images
root@emac-oe:images# cp MLO uImage u-boot.bin /mnt/card/
root@emac-oe:images# sync
root@emac-oe:images# umount /dev/mmcblk0p1

To understand why these files are programmed in FAT32 on the first primary partition, the eMMC boot sequence of the SoM-3517M must be understood. MLO is called the first boot and it is loaded directly by the AM3517 processor's boot ROM. Once the ROM finishes loading MLO, it is executed. MLO then relocates the U-Boot binary (u-boot.bin) from eMMC to DDR and executes it. Finally when U-Boot starts the Linux boot process, it relocates the kernel image (uImage) to DDR and starts Linux.



NOTE
The first partition must be formatted FAT32 and the MLO binary must be in the first sector for the eMMC boot sequence to work properly.


Extracting Root Filesystem

root@emac-oe:images# mount /dev/mmcblk0p2 /mnt/card
root@emac-oe:images# cd /mnt/card
root@emac-oe:/mnt/card# tar xzvf /emac-image.rootfs.tar.gz
root@emac-oe:/mnt/card# cd ..
root@emac-oe:/mnt# sync
root@emac-oe:/mnt# umount /dev/mmcblk0p2

SoM-9X25M / IPAC-9X25

Partitioning the eMMC

root@emac-oe:~# fdisk /dev/mmcblk0



NOTE
For the SoM-9x25M revisions 7 and above, the eMMC block device is /dev/sdb


The partitioning steps are as follows:

  1. Create 1st partition (n,p,1,default,+1G)
  2. Create 2nd partition (n,p,2,default,default)
  3. Write (w)

Formatting the eMMC

root@emac-oe:~# mkfs.ext4 /dev/mmcblk0p1
root@emac-oe:~# mkfs.ext4 /dev/mmcblk0p2

Extracting Root Filesystem

root@emac-oe:~# mkdir -p /mnt/card
root@emac-oe:~# mount /dev/mmcblk0p1 /mnt/card
root@emac-oe:~# cd /mnt/card
root@emac-oe:/mnt/card# tar xzvf /emac-image.rootfs.tar.gz
root@emac-oe:/mnt/card# cd ..
root@emac-oe:/mnt# sync
root@emac-oe:/mnt# umount /dev/mmcblk0p1