Preparing Linux bootable SD card for i.MX6UL

Document created by Yuri Muhin Employee on Jun 14, 2017Last modified by Yuri Muhin Employee on Jun 14, 2017
Version 2Show Document
  • View in full screen mode

  IMX6 UL boot process is described in Chapter 8 (System Boot) of the Reference
Manual. Also you may look at the following Community regarding i.MX6 boot ROM


How to build bootable SD image (for i.MX6 SL as example) 


U-boot is used as Linux bootloader and U-boot image should be located in SD area,
used by i.MX6 boot ROM. The simplest way to get bootable SD card is just to copy
system image in so called .sdcard format. Such image is prepared in Yocto by default
and can be transfered to SD card with Linux dd command or Windows win32diskimager


Guide to the .sdcard format 


Win32 Disk Imager download | 


 The full SD image (.sdcard) should contain all parts, needed for Linux boot
(U-boot, kernel, dtb, file system), maybe except U-boot environment.


Carry out the following command to copy the SD card image to the SD/MMC card.
Change sdx below to match the one used by the SD card.


$ sudo dd if=<image name>.sdcard of=/dev/sdx bs=1M && sync


  Note, U-boot environment (described below) should be set (and saved) in U-boot after

the first start.


  In any case it makes sense to understand general structure and implementation
details of bootable SD card. Instructions are provided in section 4.3 (Preparing
an SD/MMC card to boot) of i.MX Linux® User's Guide in Linux doc package (L4.1.15_2)… 


Summary page :


i.MX 6 / i.MX 7 Series Software and Development Tool|NXP 

  For a Linux image to be able to run, four separate pieces are needed:
• Linux OS kernel image (zImage)
• Device tree file (*.dtb)
• U-Boot bootloader image
• Root file system (*.ext3 or *.ext4)


  The mentioned files may be found in demo images on NXP Web or generated with Yocto.
After a build is complete, the created image resides in <build directory>/tmp/deploy/images

The device tree file (.dtb) contains board and configuration-specific changes to the kernel.
Change the device tree file to change the kernel for a different i.MX board or configuration.
   By default, the kernel image and DTB are located on FAT partition without a fixed raw address
on the SD card. Generally fix addresses / blocks of SD card may be applied for kernel and DTB
location. The users have to change the U-Boot boot environment if the fixed raw address is required.


In example below the following image layout on SD card is assumed :


Start address (sectors) = 0x400 bytes (2) for U-boot (i.MX6 boot ROM reads first 4K bytes of SD card).
Start address (sectors) = 0xa00000 bytes (20480) for FAT partition, size=500MB, intended for Kernel zImage and DTBs.
Start address (sectors) = 0x25800000 bytes (1228800) for rootfs.


   Preparing the card


  An SD/MMC card reader, such as a USB card reader, is required. Any Linux distribution can be used. Further follow instructions

in sections 4.3.1 (Preparing the card), 4.3.3 (Partitioning the SD/MMC card), 4.3.4 (Copying a bootloader image), 4.3.5 (Copying the

kernel image and DTB file), 4.3.6 Copying the root file system (rootfs) of attached "i.MX_Graphics_User's_Guide.pdf".


The next step - try to insert the SD card to slot in i.MX6UL board, select proper boot options for

SD boot and power the system. U-boot prompt should appear. Finally it is needed to configure environment for further Linux boot

from SD.


U-Boot > setenv mmcdev 1
U-Boot > setenv mmcpart 1
U-Boot > setenv mmcroot '/dev/mmcblk1p2 rootwait rw'
U-Boot > setenv loadaddr 0x80800000
U-Boot > setenv fdt_addr=0x83000000
U-Boot > setenv fdt_file imx6ul-9x9-evk.dtb

U-Boot > setenv mmcpart 1
U-Boot > setenv loadfdt 'fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}'
U-Boot > setenv loadkernel 'fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} zImage'
U-Boot > setenv bootcmd 'mmc dev ${mmcdev}; run loadkernel; run mmcargs; run loadfdt; bootz $
{loadaddr} - ${fdt_addr};'

U-boot > saveenv


fdt_file should be set for your case ( on example “imx6ul-9x9-evk.dtb”)

Try reboot with new environment.

4 people found this helpful