Booting Linux from eMMC Print


Use the procedure documented below to install the U-Boot firmware, Linux kernel and filesystem images to the eMMC on the i.MX 8M module. Having completed the installation, the i.MX 8M SOM will boot to Linux from the eMMC on next reset / power on.

Note that the installation procedure requires a bootable SD card that will be used for the initial boot. Refer to Booting Linux from SD card for information on how to create a bootable SD card. Note also that the procedure will erase all data previously present on the eMMC.

Here is the installation procedure:

  1. Insert a bootable SD card into the Linux development host. Download the tarball with the prebuilt bootable Linux images from the Emcraft site, and unpack it into the /usr/local/mfg_images directory on the rootfs partition on the SD card:
  2. $ sudo mkdir -p /media/emcraft/b8a8aa84-4c96-443e-8563-88a388f197ec/usr/ local/mfg_images $ sudo tar xvfj images-imx8m-<version>.tar.bz2 -C /media/emcraft/b8a8aa84- 4c96-443e-8563-88a388f197ec/usr/local/mfg_images Image Image-imx8m-som.dtb imx-boot-imx8m-som-sd.bin imx8mq_m4_TCM_rpmsg_lite_str_echo_rtos.bin modules-imx8m-som.tgz emcraft-rootfs-imx8m-som.tar.bz2 $

  3. Unmount the SD card and use it for booting the i.MX 8M SOM. Refer to Booting Linux from SD card. Once the i.MX 8M SOM login prompt appears, login with the root user and an empty password.
  4. In the Linux command prompt unmount the eMMC (if it is mounted) in order to make sure it ready for the partitioning:
  5. $ umount -f /dev/mmcblk0p1 $ umount -f /dev/mmcblk0p2

  6. Erase the previous partition table, which may be present if the eMMC was used for something before:
  7. $ wipefs --all /dev/mmcblk0

  8. Install the U-Boot image file (imx-boot-imx8m-som-sd.bin) to the eMMC starting at the 33KB offset. Note that you need to specify the whole device as the destination for the dd command (i.e. do not install the image to a partition):
  9. $ dd if=/usr/local/mfg_images/imx-boot-imx8m-som-sd.bin of=/dev/mmcblk0 bs=1k seek=33

  10. Flush the system caches:
  11. $ sync

  12. Create a partition table on the eMMC, as follows (note the offset of  9000 sectors before the first partition):
  13. $ echo -ne "9000 128M 83\n262145 + 83\n" | /usr/sbin/sfdisk /dev/mmcblk0

  14. Create the filesystems on the eMMC:
  15. $ umount /dev/mmcblk0p1 $ umount /dev/mmcblk0p2 $ mkfs.vfat /dev/mmcblk0p1 $ mkfs.ext4 -F /dev/mmcblk0p2

  16. Mount the eMMC partitions:
  17. $ mkdir -p /mnt/mmcblk0p1 $ mkdir -p /mnt/mmcblk0p2 $ mount /dev/mmcblk0p1 /mnt/mmcblk0p1 $ mount /dev/mmcblk0p2 /mnt/mmcblk0p2

  18. Copy the Linux kernel, DTB and Cortex-M4 demo images to the first (VFAT) eMMC partition:
  19. $ cp /usr/local/mfg_images/{Image,Image-imx8m-som.dtb,imx8mq_m4_TCM_rpmsg _lite_str_echo_rtos.bin} /mnt/mmcblk0p1

  20. Install the root filesystem to the ext4 SD Card partition:
  21. $ tar xfj /usr/local/mfg_images/emcraft-rootfs-imx8m-som.tar.bz2 -C /mnt/mmcblk0p2

  22. Flush the system caches and umount the eMMC partitions:
  23. $ sync $ umount /dev/mmcblk0p1 $ umount /dev/mmcblk0p2

  24. The eMMC is now ready for booting. Remove the SD card from the slot, power off the IMX8M-SOM-BSB board, and prepare it for booting from the eMMC by setting the S1 DIP switch boot selection jumpers as follows:

  25. S1.1 Off
    S1.2 On
    S1.3 Off
    S1.4 Off
    S1.5 Off
    S1.6 Off
    S1.7 On
    S1.8 Off
  26. Re-apply the power. The system will boot to the Linux login prompt:
  27. U-Boot SPL 2017.03-imx_v2017.03_4.9.51_imx8m_beta (Feb 04 2018 - 22:09:01) DDR PLL1 400MHz locked DDR PLL1 395MHz locked Normal Boot Trying to boot from MMC1 U-Boot 2017.03-imx_v2017.03_4.9.51_imx8m_beta (Feb 04 2018 - 22:09:01 +0300) CPU: Freescale i.MX8MQ rev2.0 1500 MHz (running at 1000 MHz) CPU: Commercial temperature grade (0C to 95C) at 32C Reset cause: POR Model: EmCraft i.MX8M SOM LPDDR4 DRAM: 1 GiB MMC: FSL_SDHC: 0, FSL_SDHC: 1 In: serial Out: serial Err: serial Net: eth0: ethernet@30be0000 Normal Boot Hit any key to stop autoboot: 0 ... NXP i.MX Release Distro 4.9.51-mx8-beta imx8m-som ttymxc0 imx8m-som login: root ...