CL-SOM-iMX6: Linux: Manual Installation

From Compulab Mediawiki
Jump to: navigation, search

Introduction

This article provides an introduction on how to install the Debian example root filesystem image on the CompuLab CL-SOM-iMX6 System-on-Module / Computer-on-Module NAND or SSD.

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-iMX6 (link below).
  • Download the Linux package for CL-SOM-iMX6 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 SB-FX6 base-board (connector P60) 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-iMX6 evaluation system. The U-Boot boot-loader will start and you will get a command prompt.
Admolition note.png If the boot settings of your CL-SOM-iMX6 are different than the default, you may need to press and hold Ctrl-C while turning the CL-SOM-iMX6 on, in order to get command prompt.

Installation and Deployment Files

Installation media or TFTP export directory

  • kernel.img
  • imx6qp-sbc-som-imx6-hdmi.dtb
  • ramdisk.img
  • boot.scr

Installation media or NFS export directory

  • rootfs.tar.bz2
  • kernel.update.tar.bz2
  • murata.update.tar.bz2
  • startx.update.tar.bz2 - Optional
  • clsysreconf.update.tar.bz2 - Optional

Boot into the installation environment (ramdisk)

The first step in CL-SOM-iMX6 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

The partition can be formatted as either ext2/3/4 or FAT file system.

  • Insert the MMC/SD card into the SD socket (P6) on the SB-FX6.
  • Use the following U-boot commands to boot the installation environment on the CL-SOM-iMX6 quad/dual lite configuration:
CL-SOM-iMX6 #
setenv loadaddr 0x10800000
mmc dev 2; mmc rescan
load mmc 2 ${loadaddr} boot.scr
source ${loadaddr}

Using installation environment on USB storage

The partition can be formatted as either ext2/3/4 or FAT file system.

  • Insert the USB storage into a USB socket on the SB-FX6.
  • Use the following U-boot commands to boot the installation environment on a CL-SOM-iMX6 quad/dual lite configuration:
CL-SOM-iMX6 #
setenv loadaddr 0x10800000
usb start
load usb 0 ${loadaddr} boot.scr
source ${loadaddr}

Using installation environment from TFTP server

  • Connect the CL-SOM-iMX6 Ethernet port (connector P9 marked as "CM ETHERNET" on the SB-FX6) to your local network.
  • Copy files listed in Installation media or TFTP export directory from Linux package for CL-SOM-iMX6 to a TFTP server export directory:
    - On Windows machine: copy files to the same folder and point the TFTP server to that folder
    - On Linux machine: copy files to the TFTP server root directory, usually /tftpboot or /tftproot.
  • You can use U-boot dhcp command to obtain IP address or manually set ipaddr environment variable:
CL-SOM-iMX6 # setenv ipaddr <CL-SOM-iMX6 ip address>
  • Set the serverip environment variable and save the new environment:
CL-SOM-iMX6 # setenv serverip <tftp server host ip address>
CL-SOM-iMX6 # saveenv
  • Set a correct value for the fdt_file variable:
CL-SOM-iMX6 # setenv fdt_file imx6q-sbc-som-imx6.dtb
  • Use the following U-Boot commands to boot Linux on CL-SOM-iMX6:
CL-SOM-iMX6 #
setenv fdt_high 0xffffffff
setenv fdt_addr 0x15000000
setenv bootm_low 0x15000000
setenv bootm_size 0x20000000
setenv load_addr 0x10800000
setenv ramdisk_addr 0x12000000
setenv bootargs 'root=/dev/ram0 rw ramdisk_size=16384 console=ttymxc3,115200 ip=dhcp'
tftpboot ${load_addr} kernel.img && tftpboot ${fdt_addr} ${fdt_file} && tftpboot ${ramdisk_addr} ramdisk.img
bootz ${load_addr} ${ramdisk_addr} ${fdt_addr}

Install Kernel and Root Files System Images

After the ramdisk image is loaded the bash shell prompt shows up:

root@cl-ramdisk:/#

The next step is installing the kernel and Debian Linux images. The following media can be used as a source for installation:

Mount MMC/SD Card

  • Insert the MMC/SD card into the SD socket (P6) on the SB-FX6.
  • The MMC/SD card is mounted automatically under /media/mmcblk2pX. 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@cl-ramdisk:~# mkdir -p /media/mmcblk2pX && mount /dev/mmcblk2pX /media/mmcblk2pX

Mount USB Storage Device

  • Plug the USB storage device to the lower port on the dual USB host connector P13 of the SB-FX6.
  • 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@cl-ramdisk:~# mkdir -p /media/sdXY && mount /dev/sdXY /media/sdXY

Mount NFS drive

Admolition note.png All followed instructions will be invoked in the CompuLab ram-disk environment.

The environment prompt is: root@cl-ramdisk:~#

DHCP Static
basename /sys/devices/platform/enet.0/net/eth?
basename /sys/devices/platform/enet.0/net/eth?` <ip address>
  • Mount the NFS share containing the kernel.update.tar.bz2 and the rootfs.tar.bz2 files:
    mount -o nolock <host ip>:/path/to/nfs/share /mnt/net

Install Images

Once the ramdisk image is loaded and the media containing the CL-SOM-iMX6 Kernel and Debian Linux images is mounted, the installation can be done on either of the following:

  • NAND
  • EMMC

Prepare Target Media

NAND eMMC
  • Format the NAND flash root filesystem partition:
ubiformat --yes /dev/mtd4
  • Attach the NAND flash root filesystem partition:
ubiattach -m 4 -d 0
  • Create a ubi volume and name it "rootfs":
ubimkvol /dev/ubi0 -m -N rootfs
  • Mount the ubi volume:
mkdir -p /media/rootfs && mount -t ubifs ubi0:rootfs /media/rootfs
  • Create two partitions for the Linux kernel (EXT4 100M) and root file system (EXT4 the rest of the disk) on the eMMC:
echo -e "n\np\n1\n\n+100M\na\n1\nt\nc\nn\np\n2\n\n\nw\neof\n" | fdisk /dev/mmcblk3
  • Format 1-st boot-partition with EXT4 file system:
mkfs.ext4 -L boot /dev/mmcblk3p1
  • Format 2-d rootfs-partition with EXT4 file system:
mkfs.ext4 -L rootfs /dev/mmcblk3p2
  • Mount both partitions:
mkdir -p /media/rootfs && mount /dev/mmcblk3p2 /media/rootfs
mkdir -p /media/rootfs/boot && mount /dev/mmcblk3p1 /media/rootfs/boot

Extract Rootfs

  • Extract the content of rootfs.tar.bz2 onto the /media/rootfs:
tar -xvpjf /mount/point/rootfs.tar.bz2 -C /media/rootfs && sync
  • Extract the content of kernel.update.tar.bz2 onto the /media/rootfs:
tar -xvpjf /mount/point/kernel.update.tar.bz2 -C /media/rootfs && sync
  • Extract the content of murata.update.tar.bz2 onto the /media/rootfs:
tar -xvpjf /mount/point/murata.update.tar.bz2 -C /media/rootfs && sync
  • Extract the content of startx.update.tar.bz2 onto the /media/rootfs:
tar -xvpjf /mount/point/startx.update.tar.bz2 -C /media/rootfs && sync
  • Extract the content of clsysreconf.update.tar.bz2 onto the /media/rootfs:
tar -xvpjf /mount/point/clsysreconf.update.tar.bz2 -C /media/rootfs && sync

Commit Installation

NAND eMMC
  • Update /dev/mtd3 partition

See Display Options for more information about fdt_file

export fdt_file=imx6qp-sbc-imx6-hdmi.dtb
flash_erase /dev/mtd3 0 0
nandwrite -p /dev/mtd3 /media/rootfs/boot/zImage-cl-som-imx6
nandwrite -p /dev/mtd3 -s 0x780000 /media/rootfs/boot/${fdt_file}
  • Unmount target media rootfs partition
umount /media/rootfs
  • Unmount target media boot, rootfs partitions
umount /media/rootfs/boot
umount /media/rootfs

After Installation

Admolition note.png If the boot settings of the CL-SOM-iMX6 are different than default, you may need to press and hold Ctrl-C while turning the CL-SOM-iMX6 on, in order to get command prompt.

Boot Environment

Admolition note.png All followed instructions will be invoked in the U-Boot environment.

The environment prompt is: CL-SOM-iMX6 #

Common Environment Variables

setenv bootdelay 3
setenv loadaddr 0x10800000
setenv fdt_high 0xffffffff
setenv fdt_addr 0x15000000
setenv bootm_low 0x15000000
setenv bootm_size 0x20000000
setenv zImage zImage-cl-som-imx6
setenv fdt_file imx6qp-sbc-imx6-hdmi.dtb
setenv console console=ttymxc3,115200

Display Options

CL-SOM-iMX6 evaluation platform has six video output interfaces: LCD, DVI, HDMI, 2xLVDS and MIPI.
Only four of them can be configured at the same time. The default configuration is: LCD, HDMI and 2xLVDS.

Default Video Output Mapping

Using a correct device tree file allows changing the default (mxcfb0) mapping.

LCD(P50) DVI(J6) HDMI(J5) MIPI(P19)
setenv fdt_file imx6qp-sbc-imx6.dtb
  • Mapping
LCD  800x480@58
HDMI 1920x1080@50
LVDS(P53) 1366x768
LVDS(P17) 1368x768
setenv fdt_file imx6qp-sbc-imx6-dvi.dtb
  • Mapping
DVI  1920x1080@50
HDMI 1920x1080@50
LVDS(P53) 1366x768
LVDS(P17) 1368x768
setenv fdt_file imx6qp-sbc-imx6-hdmi.dtb
  • Mapping
HDMI 1920x1080@50
LCD  800x480@58
LVDS(P53) 1366x768
LVDS(P17) 1368x768
setenv fdt_file imx6qp-sbc-imx6-mipi.dtb
  • Mapping
MIPI(P19) 480x800@50
HDMI 1920x1080@50
LVDS(P53) 1366x768
LVDS(P17) 1368x768

Boot Parameters

NAND eMCC
setenv set_media 'echo nand is ready'
setenv set_args 'setenv bootargs ${console} root=ubi0:rootfs rw rootfstype=ubifs ubi.mtd=rootfs'
setenv load_kernel 'nand read ${loadaddr} 0 800000'
setenv load_dtb 'nand read ${fdt_addr} 780000 10000'
setenv set_media 'setenv mmcdev 3; mmc dev ${mmcdev}'
setenv set_args 'setenv bootargs ${console} root=/dev/mmcblk3p2 rootfstype=ext4 rw rootwait'
setenv load_kernel 'load mmc ${mmcdev} ${loadaddr} ${zimage}'
setenv load_dtb 'load mmc ${mmcdev} ${fdt_addr} ${fdt_file}'

Boot Command

  • Extra boot parameters
setenv set_args+ 'setenv bootargs ${bootargs} ${video} vmalloc=256M cma=384M ip=dhcp'
  • Default boot command
setenv set_boot 'run set_media; run set_args; run set_args+; run load_kernel; run load_dtb;'
setenv bootcmd 'run set_boot; bootz ${loadaddr} - ${fdt_addr}'

See also