Preparing Linux bootable SD card for i.MX6UL

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Preparing Linux bootable SD card for i.MX6UL

No ratings

Preparing Linux bootable SD card for i.MX6UL

  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
activity.

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
utility.

Guide to the .sdcard format 

Win32 Disk Imager download | SourceForge.net 

 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)

http://www.nxp.com/webapp/Download?colCode=L4.1.15_2.1.0_LINUX_DOCS&Parent_nodeId=133769948107170617... 

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.

Attachments
Comments

in build Procedure which MACHINE we need to Select for this imx6ulevk board

The information provided is useful, however I would have added the following details, useful to a newcomer:

Preparing a SD card is easy from a .sdcard file.

The whole point is to locate the .sdcard files...

Such files are available on the NXP download pages, but not directly.

I first looked on i.MX Software|NXP , where I looked for the Linux tools, and found under Linux 4.9.11_1.0.0: 

      Which I could use to download https://www.nxp.com/webapp/Download?colCode=L4.9.11_1.0.0_MX6QDLSOLOX&appType=license&location=null&... 

In my example I downloaded 

L4.9.11_1.0.0-ga_images_MX6QPDLSOLOX.tar.gz (it's a 2.5GB file)

From this .tar.gz file, I extracted a .tar file: 

L4.9.11_1.0.0-ga_images_MX6QPDLSOLOX.tar

From this .tar file, I extracted all files, and there is a list of several .sdcard.bz2 files in there

I selected the .sdcard.bz2 file matching my setup:

fsl-image-qt5-validation-imx-x11-imx6qpdlsolox.sdcard.bz2

Which I extracted to get the final .sdcard file

fsl-image-qt5-validation-imx-x11-imx6qpdlsolox.sdcard

Then I was able to use Win32DiskImager to write this file to my SD card (after changing Win32DiskImager file filter to '*.*).

This is not a straightforward process, and is nearly impossible to figure out from a new user perspective.

Fortunately I got help from a colleague familiar with all this.

Version history
Last update:
‎06-14-2017 10:39 PM
Updated by: