Category : Blog Post
Following is the list of Supported hardware SoCs and boards covered in this guide:
- i.MX 6Quad Freescale SABRE-SD Board and Platform
- i.MX 6DualLite Freescale SABRE-SD Platform
- i.MX 6Quad Freescale SABRE-AI Platform
- i.MX 6DualLite Freescale SABRE-AI Platform
- i.MX 6SoloLite EVK
- i.MX 6SoloX Freescale SABRE-SD Platform
- i.MX 6SoloX Freescale SABRE-AI Platform
- i.MX 6QuadPlus Freescale SABRE-AI platform
- i.MX 6QuadPlus Freescale SABRE-SD platform
- i.MX 6UltraLite EVK platform
Abbreviations used in this article.
- Freescale SABRE-SD refers to the i.MX 6Quad Freescale SABRE-SD, i.MX 6DualLite Freescale SABRE-SD, i.MX 6QuadPlus Freescale SABRE-SD, and i.MX 7Dual Freescale SABRE-SD boards.
- SABRE-AI refers to the i.MX 6Quad SABRE-AI, i.MX 6DualLite SABRE-AI, and i.MX 6QuadPlus SABRE-AI boards.
- SoloLite refers to the i.MX 6SoloLite Board.
- SoloX or SX refers to the i.MX 6SoloX SABRE-SD and SABRE-AI boards.
- UL refers to the i.MX 6UltraLite board
The i.MX Linux BSP is a collection of binary files, source code, and support files that can be used to create a U-Boot bootloader, a Linux kernel image, and a root file system for i.MX development system. The Yocto Project is the framework of choice to build the images although other methods can be used. You can refer “Yocto Project User’s Guide” for all the information on how to set up Linux host machine, how to run and configure a Yocto Project, generate an image, and generate a rootfs.
Basic Terminal Setup
The i.MX boards can communicate with a host server (Windows® OS or Linux OS) using a serial cable. Common serial communication programs such as HyperTerminal, Tera Term, or PuTTY can be used.
USB cable can be connected from PC to Sabre-SD board for debugging. PuTTY can be setup with following configuration on PC.
Booting Linux OS
Before the Linux OS kernel can boot on an i.MX board, the images (U-Boot, Linux kernel, device tree, and rootfs) need to be copied to a boot device and the boot switches need to be set to boot that device. There are various ways that this can be done for different boards, boot devices, and results desired. This section explains how to prepare a boot device, where files need to be in the memory map, how to set switches for booting, and how to boot Linux OS from U-Boot.
To boot a Linux image, four elements are needed:
- Bootloader (U-Boot)
- Linux kernel image (zImage)
- A device tree file (.dtb) for the board being used
- A root files system (rootfs) for the particular Linux image
The system can be configured for a specific graphical backend. The graphical backend are X11, XWayland, and Frame Buffer.
U-Boot is most recommended tool as bootloader. U-Boot must be loaded onto a device to be able to boot from it. U-Boot images are board-specific and can be configured to support booting from different sources.
Linux kernel image and device tree
This Freescale i.MX BSP contains a pre-built kernel image based on the 4.1.15 version of the Linux kernel and the device tree files associated with each platform. The same kernel image is used for all the i.MX boards. Device trees are kernel configuration files that allow a common kernel to boot with different pin settings for different boards or configurations. Device tree files use the .dtb extension. The configuration for a device tree can be found in the Linux source code under arch/arm/boot/dts in the *.dts files.
Root file system
The root file system package (or rootfs) provides busybox, common libraries, and other fundamental elements.
The i.MX BSP package contains several root file systems. The file system includes Freescale-specific libraries and common Linux utilities. They are named with the following convention: [image recipe]-[backend]-[platform][board].[ext3|sdcard]. The ext3 extension indicates a standard file system. It can be mounted as NFS, or its contents can be stored on a boot media such as an SD/MMC card. The graphical backend to be used is also defined by the rootfs.
Preparing an SD/MMC card to boot
For a Linux image to be able to run, four separate pieces are needed:
Linux kernel image (zImage), device tree file (*.dtb), U-Boot boot loader image, and root file system (*.ext3 or *.ext4).
An “.sdcard” image contains all four images properly configured for an SD card. The release contains a pre-built .sdcard image that is built specifically for the one board configuration. It runs the X11 graphical backend. It does not run on other boards unless U-Boot, device tree, and rootfs are changed.
The Yocto Project build creates an SD card image that can be flashed directly. This is the simplest way to load everything needed onto the card with one command. When more flexibility is desired, the individual components can be loaded separately.
An SD card can be loaded with the individual components one-by-one The rootfs on the default .sdcard image is limited to a bit less than 4 GB, but re-partitioning and re-loading the rootfs can increase that to the size of the card.
The rootfs can also be changed to specify the graphical backend that is used.
The device tree file (.dtb) contains board and configuration-specific changes to the kernel.
The kernel image and DTB move to use the FAT partition without a fixed raw address on the SD card. The users have to change the U-Boot boot environment if the fixed raw address is required.
|Start address (sectors)||Size (sectors)||Format||Description|
|0x400 bytes (2)||0x9FFC00 bytes (20478)||RAW||U-Boot and reserved area|
|0xa00000 bytes (20480)||500 Mbytes (1024000)||FAT||Kernel zImage and DTBs|
|0x25800000 bytes (1228800)||Remaining space||Ext3/Ext4||Rootfs|
Preparing the card
An SD/MMC card reader, such as a USB card reader, is required. SD/MMC card reader is used to transfer the bootloader and kernel images to initialize the partition table and copy the root file system. To simplify the instructions, it is assumed that a 4GB SD/MMC card is used.
Any Linux distribution can be used for the following procedure.
The Linux kernel running on the Linux host assigns a device node to the SD/MMC card reader. The kernel might decide the device node name or udev rules might be used. In the following instructions, it is assumed that udev is not used.
Drive utility can be used to identify SDX.
Copying the full SD card image
The SD card image (with the extension .sdcard) contains U-Boot, the Linux image and device trees, and the rootfs for a 4 GB SD card. The image can be installed on the SD card with one command if flexibility is not required.
$ sudo dd if=<image name>.sdcard of=/dev/sdx bs=1M && sync
Partitioning the SD/MMC card
The full SD card image already contains partitions. This section describes how to set up the partitions manually. This needs to be done to individually load the bootloader, kernel, and rootfs.
There are various ways to partition an SD card. Essentially, the bootloader image needs to be at the beginning of the card, followed by the Linux image and the device tree file. These can either be in separate partitions or not. The root file system does need to be in a partition that starts after the Linux section. Make sure that each section has enough space. The example below creates two partitions.
On most Linux host operating systems, the SD card is mounted automatically upon insertion. Therefore, before running fdisk, make sure that the SD card is unmounted if it was previously mounted (through sudo umount /dev/sdx).
Start by running fdisk with root permissions.
$ sudo fdisk /dev/sdx
Type the following parameters (each followed by <ENTER>):
|p||[lists the current partitions]|
|d||[To delete existing partitions. Repeat this until no unnecessary partitions are reported by the ‘p’ command to start fresh.]|
|n||[create a new partition]|
|p||[create a primary partition – use for both partitions]|
|1||[the first partition]|
|20480||[starting at offset sector]|
|1024000||[size for the first partition to be used for the boot images]|
|P||[to check the partitions]|
|1228800||[starting at offset sector, which leaves enough space for the kernel, the bootloader and its configuration data]|
|<enter>||[using the default value will create a partition that extends to the last sector of the media]|
|p||[to check the partitions]|
|w||[this writes the partition table to the media and fdisk exits]|
Copying a bootloader image
Execute the following command to copy the U-Boot image to the SD/MMC card.
$ sudo dd if=<U-Boot image> of=/dev/sdx bs=512 seek=2 conv=fsync
Copying the kernel image and DTB file
This section describes how to load the kernel image and DTB when the full SD card image is not used. The pre-built SD card image uses the VFAT partition for storing kernel image and DTB, which requires a VFAT partition that is mounted as a Linux drive and the files are simply copied into it. This is the preferred method.
Another method that can be used is for users to put the kernel image and DTB to the fixed raw address of the SD card by using the dd command. The later method needs to modify the U-Boot default environment variables for loading the kernel image and DTB.
Format partition 1 on the card as VFAT with this command:
$ sudo mkfs.vfat /dev/sdx1
Mount the formatted partition with this command:
$ mkdir mountpoint
$ sudo mount /dev/sdx1 mountpoint
Copy the zImage and *.dtb files to the mount point by using cp. The device tree names should match the mount point specified by U-Boot. Be sure to un-mount the partition with this command:
$ sudo umount mountpoint
Copying the root file system (rootfs)
Copy the target file system to a partition that only contains the rootfs. This example uses partition 2 for the rootfs. First format the partition. The file system format ext3 or ext4 is a good option for the removable media due to the built-in journaling. Replace sdx with the partition in use in your configuration.
$ sudo mkfs.ext3 /dev/sdx2
$ sudo mkfs.ext4 /dev/sdx2
Copy the target file system to the partition:
$ mkdir /home/user/mountpoint
$ sudo mount /dev/sdx2 /home/user/mountpoint
Extract a rootfs package to a directory: extract fsl-image-gui-imx6qpsabreauto.ext3 to /home/user/rootfs for
$ sudo mount -o loop -t ext3 fsl-image-gui-imx6qpsabreauto.ext3 /home/user/rootfs
The rootfs directory needs to be created manually.
Assume that the root file system files are located in /home/user/rootfs as in the previous step:
$ cd /home/user/rootfs
$ sudo cp -a * /home/user/mountpoint
$ sudo umount /home/user/mountpoint
$ sudo umount /home/user/rootfs