CL-SOM-iMX6UL: Yocto Linux: Getting started
Contents
Introduction
This article provides an introduction on how to install the Debian example root filesystem image on the CompuLab CL-SOM-iMX6UL System-on-Module / Computer-on-Module NAND or eMMC internal storage devices.
Preparation steps
- Obtain a PC workstation with a serial communication port.
- For networked installation you need to install a TFTP server on the host PC. For Windows machines we recommend TFTPD32 included in the Linux package for CL-SOM-iMX6UL (link below).
- Download the Linux package for CL-SOM-iMX6UL from CompuLab website. Unzip the package to a directory on your host workstation.
- All image files mentioned below can be found in the images subdirectory.
- Connect the host PC to the SBC-iMX6UL base-board (connector P8) via the serial cable supplied with the evaluation kit.
- Start the terminal emulation software on your PC. Set baud rate to 115200 bps, 8 bit per frame, 1 stop bit, no parity, no flow control.
- Turn on the CL-SOM-iMX6UL evaluation system. The U-Boot boot-loader will start and you will get a command prompt.
If the boot settings of your CL-SOM-iMX6UL are different than the default, you may need to press and hold Ctrl-C while turning the CL-SOM-iMX6UL on, in order to get command prompt. |
Boot into the installation environment (ramdisk)
The first step in CL-SOM-iMX6UL Linux installation is starting the installation environment (Linux kernel and Ramdisk image). This can be done using the following media:
Using installation environment on MMC/SD card
- Copy kernel.img, imx6ul-sbc-imx6ul.dtb, ramdisk.img and bootscr.img from Linux package for CL-SOM-iMX6UL to the root directory on the first partition of the MMC/SD card. The partition can be formatted either ext2/3/4 or FAT file system.
- Ensure jumper presence on SB-SOM-iMX6UL P5-25 and P5-26 pins, to select SDCARD via on board SDIO mux.
- Insert the MMC/SD card into the SD socket (P6) on the SBC-iMX6UL.
- Use the following U-Boot commands to boot the installation environment on the CL-SOM-iMX6UL configuration:
CL-SOM-iMX6UL # mmc dev 0 CL-SOM-iMX6UL # mmc rescan CL-SOM-iMX6UL # load mmc 0 ${loadaddr} bootscr.img CL-SOM-iMX6UL # source ${loadaddr}
- Continue to the Install Kernel and Debian Linux Images section.
Using installation environment on USB storage
- Copy kernel.img, imx6ul-sbc-imx6ul.dtb and ramdisk.img from Linux package for CL-SOM-iMX6UL to the root directory on the first partition of the USB storage. The partition can be formatted either ext2/3/4 or FAT file system.
- Insert the USB storage into a USB port on the SBC-iMX6UL.
- Use the following U-Boot commands to boot the installation environment on a CL-SOM-iMX6UL configuration:
CL-SOM-iMX6UL # usb start CL-SOM-iMX6UL # load usb 0 ${loadaddr} bootscr.img CL-SOM-iMX6UL # source ${loadaddr}
- Use the following U-Boot commands to boot the installation environment on a CL-SOM-iMX6UL configuration:
CL-SOM-iMX6UL # setenv fdt_file imx6ul-sbc-imx6ul.dtb CL-SOM-iMX6UL # setenv ramdisk_addr 0x82000000 CL-SOM-iMX6UL # setenv bootargs 'root=/dev/ram0 ramdisk_size=16384 console=ttymxc2,115200' CL-SOM-iMX6UL # usb start CL-SOM-iMX6UL # load usb 0 ${load_addr} kernel.img && load usb 0 ${fdt_addr} ${fdt_file} && load usb 0 ${ramdisk_addr} ramdisk.img CL-SOM-iMX6UL # bootz ${load_addr} ${ramdisk_addr} ${fdt_addr}
- Continue to the Install Kernel and Debian Linux Images section.
Using installation environment from TFTP server
- Connect the CL-SOM-iMX6UL Ethernet port (connector P9 marked as "CM ETHERNET" on the SBC-iMX6UL) to your local network.
- Put kernel.img, imx6ul-sbc-imx6ul.dtb and ramdisk.img from Linux package for CL-SOM-iMX6UL to a location accessible by the TFTP server:
- - On Windows machine: copy kernel.img, imx6ul-sbc-imx6ul.dtb and ramdisk.img to the same folder and point the TFTP server to that folder
- - On Linux machine: copy kernel.img, imx6ul-sbc-imx6ul.dtb and ramdisk.img to the TFTP server root directory, usually /tftpboot or /tftproot.
- You can use U-Boot dhcp command to obtain an IP address or manually set ipaddr environment variable:
CL-SOM-iMX6UL # setenv ipaddr <CL-SOM-iMX6UL ip address>
- Set the serverip environment variable:
CL-SOM-iMX6UL # setenv serverip <tftp server host ip address>
- Use the following U-Boot commands to boot Linux on CL-SOM-iMX6UL:
CL-SOM-iMX6UL # setenv fdt_file imx6ul-sbc-imx6ul.dtb CL-SOM-iMX6UL # setenv ramdisk_addr 0x82000000 CL-SOM-iMX6UL # setenv bootargs 'root=/dev/ram0 rw ramdisk_size=16384 console=ttymxc2,115200 ip=dhcp' CL-SOM-iMX6UL # tftpboot ${load_addr} kernel.img && tftpboot ${fdt_addr} ${fdt_file} && tftpboot ${ramdisk_addr} ramdisk.img CL-SOM-iMX6UL # bootz ${load_addr} ${ramdisk_addr} ${fdt_addr}
- Continue to the Install Kernel and Debian Linux Images section.
Install Kernel and Yocto Linux Images
After the ramdisk image is loaded the Linux login prompt will appear. Login as root into the system. Use 111111 password for login:
compulab login: root Password: 111111
The next step is installing the kernel and Yocto Linux images. The following media can be used as a source for installation:
Yocto Image
The latest Linux package for CL-SOM-iMX6UL contain a Yocto Linux rootfs image:
- fsl-image-gui-cl-som-imx6ul.tar.bz2
Mount an MMC/SD Card
- Copy the fsl-image-gui-cl-som-imx6ul.tar.bz2, imx6ul-sbc-imx6ul.dtb, imx6ul-sbc-imx6ul-wilink.dtb, and the zImage-cl-som-imx6ul from the Yocto Linux package for CL-SOM-iMX6UL to the root directory of any partition on the MMC/SD card. The partition can be formatted as either ext2/3/4 or FAT file system.
- Ensure jumper presence on SB-SOM-iMX6UL P5-25 and P5-26 pins, to select SDCARD via on board SDIO mux.
- Insert the MMC/SD card into the SD socket (P9) on the SBC-iMX6UL.
- The MMC/SD card is mounted automatically under /media/mmcblk0pX. Where X is the partition number.
- If for some reason the MMC/SD card hasn't been mounted automatically, use the following mount command:
root@compulab:~# mkdir -p /media/mmcblk0pX && mount /dev/mmcblk0pX /media/mmcblk0pX
- Continue to the Install Images section.
Mount a USB Storage Device
- Copy the fsl-image-gui-cl-som-imx6ul.tar.bz2, imx6ul-sbc-imx6ul.dtb, imx6ul-sbc-imx6ul-wilink.dtb, and the zImage-cl-som-imx6ul from the Yocto Linux package for CL-SOM-iMX6UL to the root directory of any partition on the USB storage device. The partition can be formatted as either ext2/3/4 or FAT file system.
- Plug the USB storage device to the lower port on the dual USB host connector P6 of the SBC-iMX6UL.
SBC-iMX6UL jumper E7 must be open |
- The USB device is mounted automatically under /media/sdXY. Where X is the device letter and Y is the partition number.
- If for some reason the USB storage device hasn't been mounted automatically, use the following mount command:
root@compulab:~# mkdir -p /media/sdXY && mount /dev/sdXY /media/sdXY
- Continue to the Install Images section.
Mount an NFS drive
- Connect the CL-SOM-iMX6UL Ethernet port (connector P21 on the SBC-iMX6UL) to your local network.
- Copy the fsl-image-gui-cl-som-imx6ul.tar.bz2, imx6ul-sbc-imx6ul.dtb, imx6ul-sbc-imx6ul-wilink.dtb, and the zImage-cl-som-imx6ul from the Linux package for CL-SOM-iMX6UL to a directory exported through NFS.
- Obtain an IP address for the CL-SOM-iMX6UL:
- Using DHCP:
root@compulab:~# ifup `basename /sys/devices/platform/enet.0/net/eth?`
- If you do not have a DHCP server, you can set a static IP address using ifconfig:
root@compulab:~# ifconfig `basename /sys/devices/platform/enet.0/net/eth?` <ip address>
- Using DHCP:
- Mount the NFS share containing the zImage-cl-som-imx6ul and the fsl-image-gui-cl-som-imx6ul.tar.bz2 files:
root@compulab:~# mount -o nolock <host ip>:/path/to/nfs/share /mnt/net
- Continue to Install Images section.
Install Images
- In this subsection the term /mount/point can be:
- /mnt/net if NFS is used
- /media/mmcblk0pX if an MMC/SD card is used, where X is the partition number.
- /media/sdXY if USB storage is used, where X is the USB drive letter and Y is the partition number.
Once the ramdisk image is loaded and the media containing the CL-SOM-iMX6UL Kernel and Yocto Linux images is mounted, the installation can be done on:
Install on the NAND flash
Required media size is at least 1G. Make sure that the nand device size meets these requirements |
- In this subsection the term /mount/point can be:
- /mnt/net if NFS is used
- /media/mmcblk0pX if an MMC/SD card is used, where X is the partition number.
- /media/sdXY if a USB storage is used, where X is the USB drive letter and Y is the partition number.
- Select a correct device tree file that meets the configuration requirements:
- MMC
root@compulab:~# export fdt_file=imx6ul-sbc-imx6ul.dtb
- WiFi
root@compulab:~# export fdt_file=imx6ul-sbc-imx6ul-wifi.dtb
- Format the NAND flash kernel partition and write the kernel image onto it:
root@compulab:~# flash_erase /dev/mtd3 0 0 root@compulab:~# nandwrite -p /dev/mtd3 /mount/point/zImage-cl-som-imx6ul root@compulab:~# nandwrite -p /dev/mtd3 -s 0x780000 /mount/point/${fdt_file}
- Format the NAND flash root filesystem partition:
root@compulab:~# ubiformat /dev/mtd4
- Attach the NAND flash root filesystem partition:
root@compulab:~# ubiattach -m 4 -d 0
- Create a ubi volume and name it "rootfs":
root@compulab:~# ubimkvol /dev/ubi0 -m -N rootfs
- Mount the ubi volume:
root@compulab:~# mkdir -p /media/rootfs && mount -t ubifs ubi0:rootfs /media/rootfs
- Extract the content of fsl-image-gui-cl-som-imx6ul.tar.bz2 onto the /media/rootfs:
root@compulab:~# tar -xvpjf /mount/point/fsl-image-gui-cl-som-imx6ul.tar.bz2 -C /media/rootfs && sync
- Unmount the ubi volume:
root@compulab:~# umount /media/rootfs
- Continue to the After Installation section.
Install on MMC/SD or eMMC
CL-SOM-iMX6UL pin 21 must be connected to GND (Install jumper on SB-SOM-iMX6UL P5-25 and P5-26 pins). |
The below procedure will work on an empty MMC device only. If you have already used the MMC device, please delete all the partitions before proceeding. |
- Define an environment variable that describes an MMC/SD device:
MMC/SD
root@compulab:~# export TARGET_DEVICE=mmcblk0
MMC/SD on a Linux host
root@compulab:~# export TARGET_DEVICE=sdg
eMMC
root@compulab:~# export TARGET_DEVICE=mmcblk1
- Clean up the on the TARGET_DEVICE:
root@compulab:~# dd if=/dev/zero of=/dev/${TARGET_DEVICE} bs=1M count=1 root@compulab:~# hdparm -z /dev/${TARGET_DEVICE}
- Create two partitions for the Linux kernel (FAT32 100M) and root file system (EXT4 the rest of the disk) on the MMC device:
root@compulab:~# echo -e "n\np\n1\n\n+100M\na\n1\nt\nc\nn\np\n2\n\n\nw\neof\n" | fdisk /dev/${TARGET_DEVICE}
- Adjust the TARGET_DEVICE name:
root@compulab:~# TARGET_DEVICE=$(awk -v device=${TARGET_DEVICE} 'BEGIN {if (device~/mmc/) {part="p"}; print device part}')
- Format the first partition with FAT32 file system:
root@compulab:~# mkfs.vfat -n boot /dev/${TARGET_DEVICE}1
- Format the second partition with EXT4 file system:
root@compulab:~# mkfs.ext4 -L rootfs /dev/${TARGET_DEVICE}2
- Mount both partitions:
root@compulab:~# mkdir -p /media/boot && mount /dev/${TARGET_DEVICE}1 /media/boot root@compulab:~# mkdir -p /media/rootfs && mount /dev/${TARGET_DEVICE}2 /media/rootfs
- Copy zImage-cl-som-imx6ul, imx6ul-sbc-imx6ul.dtb and imx6ul-sbc-imx6ul-wilink.dtb to the first (FAT) partition:
root@compulab:~# cp /mount/point/zImage-cl-som-imx6ul /mount/point/imx6ul*.dtb /media/boot && sync
- Extract the content of fsl-image-gui-cl-som-imx6ul.tar.bz2 onto the second partition:
root@compulab:~# tar --numeric-owner -xvpjf /mount/point/fsl-image-gui-cl-som-imx6ul.tar.bz2 -C /media/rootfs && sync
- Unmount both partitions:
root@compulab:~# umount /dev/${TARGET_DEVICE}1 root@compulab:~# umount /dev/${TARGET_DEVICE}2
- Continue to the After Installation section.
After Installation
If the boot settings of the CL-SOM-iMX6UL are different than default, you may need to press and hold Ctrl-C while turning the CL-SOM-iMX6UL on, in order to get command prompt. |
Boot Environment
Common Environment Variables
CL-SOM-iMX6UL # setenv bootdelay 3 CL-SOM-iMX6UL # setenv image zImage-cl-som-imx6ul
Configuration Dependent Environment Variables
CL-SOM-iMX6UL makes use of the same interface for the first MMC and a WiFi. These devices can't be used simultaneously, thus two different device tree files are provided.
In case that the bootable device is mmc 0, then imx6ul-sbc-imx6ul.dtb must be used. |
- MMC
CL-SOM-iMX6UL # setenv fdt_file imx6ul-sbc-imx6ul.dtb
- WiFi
CL-SOM-iMX6UL # setenv fdt_file imx6ul-sbc-imx6ul-wilink.dtb
Display Options
SBC-iMX6UL has an option to connect either an LCD or a DVI display.
Below are examples that show how to change the boot environment in order to set the correct interface timing and geometry and work with either an LCD or a DVI display separately.
- DVI display enable function:
CL-SOM-iMX6UL # setenv dvi+ 'fdt rm lcdif/display/display-timings/lcd'
- LCD display enable function:
CL-SOM-iMX6UL # setenv lcd+ 'fdt rm lcdif/display/display-timings/dvi'
Storage Device Options
SBC-iMX6UL has an option to use either an eMMC or a NAND as a storage device.
Both devices make use of the same SoC pads. As a result these device can't work simultaneously.
Device tree modification allows using one of these devices.
- NAND enable function:
CL-SOM-iMX6UL # setenv nand+ 'fdt addr ${fdt_addr}; fdt set gpmi status "okay"; fdt set mmc1 status "disabled"'
- eMMC enable function:
CL-SOM-iMX6UL # setenv emmc+ 'fdt addr ${fdt_addr}; fdt set gpmi status "disabled"; fdt set mmc1 status "okay"'
NAND flash
- Kernel and device tree loaders:
CL-SOM-iMX6UL # setenv loadimage 'nand read ${loadaddr} 0 800000' CL-SOM-iMX6UL # setenv loadfdt 'nand read ${fdt_addr} 780000 10000'
- Set the bootargs environment variable:
CM-FX6 # setenv bootargs 'console=ttymxc2,115200 root=ubi0:rootfs rw rootfstype=ubifs ubi.mtd=rootfs ip=dhcp'
MMC/SD or eMMC
- mmcdev and fdt_file environment variables:
MMC
CL-SOM-iMX6UL # setenv mmcdev 0 CL-SOM-iMX6UL # setenv fdt_file imx6ul-sbc-imx6ul.dtb
eMMC
CL-SOM-iMX6UL # setenv mmcdev 1 CL-SOM-iMX6UL # setenv fdt_file imx6ul-sbc-imx6ul-wilink.dtb
- mmcroot environment variable:
CL-SOM-iMX6UL # setenv mmcroot "/dev/mmcblk${mmcdev}p2 rootwait rw"
- Kernel and device tree loaders:
CL-SOM-iMX6UL # setenv loadimage 'load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}' CL-SOM-iMX6UL # setenv loadfdt 'load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}'
- bootargs environment variable:
CL-SOM-iMX6UL # setenv bootargs "console=ttymxc2,115200 root=${mmcroot} ip=dhcp"
Boot command
- Default boot command:
CL-SOM-iMX6UL # setenv bootcmd 'run loadimage; run loadfdt; bootz ${loadaddr} - ${fdt_addr}'
- NAND boot command:
CL-SOM-iMX6UL # setenv bootcmd 'run loadimage; run loadfdt; run nand+; bootz ${loadaddr} - ${fdt_addr}'
Make use of either dvi+ or lcd+ function depends on a desire display type |
- DVI enabled boot command:
CL-SOM-iMX6UL # setenv bootcmd 'run loadimage; run loadfdt; run dvi+; bootz ${loadaddr} - ${fdt_addr}'
- LCD enabled boot command:
CL-SOM-iMX6UL # setenv bootcmd 'run loadimage; run loadfdt; run lcd+; bootz ${loadaddr} - ${fdt_addr}'
- To boot Linux, type:
CL-SOM-iMX6UL # saveenv CL-SOM-iMX6UL # boot