Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Build and Install Linux System for SMARC-FiMX6 (Solo, Dual Lite, Dual and Quad Core)


This document provides instructions for advanced users how Embedian offers patches and builds a customized version of u-boot and linux kernel for Embedian's SMARC-FiMX6 product platform and how to install the images to bring the evaluation board up and running. 

Our aim is to fully support our hardware through device drivers. We also provide unit tests so that testing a board is easy and custom development can start precisely.

Availability


SMARC-FiMX6 at Embedian

Carrier Board


SBC-SMART-BEE (module and carrier board) at Embedian

SBC-SMART-MEN (module and carrier board) at Embedian

EVK-STD-CARRIER (universal carrier board for all SMARC modules) at Embedian

Basic Resources


 

ARM Cross Compiler: GCC


This is a pre-built (32bit) version of Linaro GCC that runs on generic linux, so 64bit users need to make sure they have installed the 32bit libraries for their distribution.

debian basedextrapkgs: (sudo apt-get update ; sudo apt-get install xyz)

Ubuntu 12.04

 

ia32-libs

Debian 7 (Wheezy)

sudo dpkg --add-architecture i386

libc6:i386 libstdc++6:i386 libncurses5:i386 zlib1g:i386

Ubuntu 12.10 -> 14.04

 

libc6:i386 libstdc++6:i386 libncurses5:i386 zlib1g:i386

Red Hat/Centos/Fedora

 

libstdc++.i686 ncurses-devel.i686 zlib.i686

Red Hat based (rpm)

extra

pkgs: (yum install xyz)

Red Hat/Centos/Fedora

 

libstdc++.i686 ncurses-devel.i686 zlib.i686

Ubuntu 12.04

 

ia32-libs

Ubuntu 12.10 -> 14.04

 

libc6:i386 libstdc++6:i386 libncurses5:i386 zlib1g:i386


To build Embedian’s SMARC-FiMX6 u-boot and linux kernel, you will need to install the Linaro arm compiler that is the same as that we build for SMARC-T335X:

$ wget http://releases.linaro.org/13.04/components/toolchain/binaries/gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux.tar.xz

$ sudo tar -C /opt -xJf gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux.tar.xz

$ export CC=/opt/gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux/bin/arm-linux-gnueabihf-


Test:

If this test fails, verify that you have the 32bit libraries installed on your development system.

$ ${CC}gcc --version
arm-linux-gnueabihf-gcc (crosstool-NG linaro-1.13.1-4.7-2013.04-20130415 - Linaro GCC 2013.04) 4.7.3 20130328 (prerelease)
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Generating SSH Keys


We recommend you use SSH keys to establish a secure connection between your computer and Embedian Gitlab server. The steps below will walk you through generating an SSH key and then adding the public key to our Gitlab account.

Step 1. Check for SSH keys


First, we need to check for existing ssh keys on your computer. Open up Git Bash and run:

Check the directory listing to see if you have a file named either id_rsa.pub or id_dsa.pub. If you don't have either of those files go to step 2. Otherwise, you already have an existing keypair, and you can skip to step 3.

Step 2. Generate a new SSH key


To generate a new SSH key, enter the code below. We want the default settings so when asked to enter a file in which to save the key, just press enter.

Now you need to enter a passphrase.

Which should give you something like this:

Step 3. Add your SSH key to Embedian Gitlab Server


Copy the key to your clipboard.

Go to Embedian Git Server. At Profile Setting --> SSH Keys --> Add SSH Key 

Paste your public key and press "Add Key" and your are done.

Bootloader: U-Boot 


Clone the U-Boot source code from Embedian Git Server.

Download:

$ git clone git@git.embedian.com:developer/smarc-t335x-uboot.git smarcfimx6-uboot

$ cd smarcfimx6-uboot

$ git checkout smarc-imx_v2014.04_3.14.28_1.0.0_ga

Configure and Build:

$ make ARCH=arm CROSS_COMPILE=${CC} distclean

$ make ARCH=arm CROSS_COMPILE=${CC} smarcfimx6_quad_1g_ser3_config

$ make ARCH=arm CROSS_COMPILE=${CC}

Note

Icon

Note1:

If the board is SMARC-FiMX6-Q-2G or SMARC-FiMX6-D-2G, use
$ make ARCH=arm CROSS_COMPILE=${CC} smarcfimx6_quad_2g_ser3_config

 If the board is SMARC-FiMX6-Q-1G or SMARC-FiMX6-D-1G, use
$ make ARCH=arm CROSS_COMPILE=${CC} smarcfimx6_quad_1g_ser3_config

 If the board is SMARC-FiMX6-U-1G, use
$ make ARCH=arm CROSS_COMPILE=${CC} smarcfimx6_dl_1g_ser3_config

 If the board is SMARC-FiMX6-S, use
$ make ARCH=arm CROSS_COMPILE=${CC} smarcfimx6_solo_ser3_config

Note 2:

"ser3" stands for console debug port. In this example, we uses SER3 as debug port. If user uses SER0 as your debug port, make change to "ser0" instead. Same as SER1 and SER2.

 


Linux Kernel


Download:

For 3.14.28 (Based on Freescale imx_3.14.28_1.0.0_ga official release):

$ git clone git@git.embedian.com:developer/smarc-fsl-linux-kernel.git

$ cd smarc-fsl-linux-kernel

$ git checkout smarc-imx_3.14.28_1.0.0_ga

Configure and Build:

$ make ARCH=arm CROSS_COMPILE=${CC} distclean

$ make ARCH=arm CROSS_COMPILE=${CC} smarcfimx6_defconfig

$ make ARCH=arm CROSS_COMPILE=${CC} zImage modules imx6q-smarcfimx6.dtb imx6dl-smarcfimx6.dtb

Note1:

If the board is Dual or Quad core, the device tree blob is imx6q-smarcfimx6.dtb.

If the board is Dual Lite or Solo core, the device tree blob is imx6dl-smarcfimx6.dtb

If you are using LVDS panel, replace the corresponding device tree file by the following.

For WVGA (800x480) LVDS panel:
imx6q-smarcfimx6.dtb --> imx6q-smarcfimx6-wvga.dtb
imx6dl-smarcfimx6.dtb --> imx6dl-smarcfimx6-wvga.dtb

For XGA (1024x768) LVDS panel:
imx6q-smarcfimx6.dtb --> imx6q-smarcfimx6-xga.dtb
imx6dl-smarcfimx6.dtb --> imx6dl-smarcfimx6-xga.dtb 

For WXGA (1366x768) LVDS panel:
imx6q-smarcfimx6.dtb --> imx6q-smarcfimx6-wxga.dtb
imx6dl-smarcfimx6.dtb --> imx6dl-smarcfimx6-wxga.dtb

For 1080p (1920x1080) LVDS panel:
imx6q-smarcfimx6.dtb --> imx6q-smarcfimx6-1080p.dtb
imx6dl-smarcfimx6.dtb --> imx6dl-smarcfimx6-1080p.dtb

Root File System


Ubuntu 14.04:

UserPassword
rootroot
ubuntutemppwd

Ubuntu 14.04 Download:

Verify:

$ md5sum imx6-ubuntu1404.tar.gz
f1420197b9581468f586ae3a4181b125  imx6-ubuntu1404.tar.gz

 

Yocto Build Root File System:

UserPassword
rootN/A

Find the yocto pre-built root file systems here at Embedian's ftp site based on your module CPU variants.

Setup SD Card


For these instruction, we are assuming: DISK=/dev/mmcblk0, "lsblk" is very useful for determining the device id.

$ export DISK=/dev/mmcblk0

Erase SD card:

$ sudo dd if=/dev/zero of=${DISK} bs=1M count=16

Create Partition Layout:

$ sudo sfdisk --in-order --Linux --unit M ${DISK} <<-__EOF__
1,48,0x83,*
,,,-
__EOF__

Format Partitions:

for: DISK=/dev/mmcblk0
$ sudo mkfs.vfat -F 16 ${DISK}p1 -n boot
$ sudo mkfs.ext4 ${DISK}p2 -L rootfs
 
for: DISK=/dev/sdX
$ sudo mkfs.vfat -F 16 ${DISK}1 -n boot
$ sudo mkfs.ext4 ${DISK}2 -L rootfs

Mount Partitions:

On some systems, these partitions may be auto-mounted...

 

$ sudo mkdir -p /media/boot/
$ sudo mkdir -p /media/rootfs/
 
for: DISK=/dev/mmcblk0
$ sudo mount ${DISK}p1 /media/boot/
$ sudo mount ${DISK}p2 /media/rootfs/
 
for: DISK=/dev/sdX
$ sudo mount ${DISK}1 /media/boot/
$ sudo mount ${DISK}2 /media/rootfs/

Install Bootloader

Copy u-boot.bin to the boot partition

~/smarcfimx6-uboot


$ sudo cp -v u-boot.bin /media/boot/ 

uEnv.txt based bootscript

Create "uEnv.txt" boot script: ($ vim uEnv.txt)

~/uEnv.txt


#####HDMI######
#optargs="video=mxcfb0:dev=hdmi,1280x720M@60,if=RGB24,bpp=32 consoleblank=0"
#####LVDS#####
#optargs="video=mxcfb0:dev=ldb,if=RGB24,bpp=32 consoleblank=0 fbmem=24M vmalloc=400M"
#####Parallel LCD Setting#####
#optargs="video=mxcfb0:dev=lcd,CLAA-WVGA,if=RGB24,bpp=32 consoleblank=0 fbmem=24M vmalloc=400M"
#####Parallel LCD to CH7055A (VESA Timing Format) Setting #####
#optargs="video=mxcfb0:dev=lcd,768x576M@75,if=RGB24,bpp=32 consoleblank=0"
#optargs="video=mxcfb0:dev=lcd,1280x1024M@60,if=RGB24,bpp=32 consoleblank=0"
#optargs="video=mxcfb0:dev=lcd,640x480M@60,if=RGB24,bpp=32 consoleblank=0"

console=ttymxc4,115200
mmcdev=0
mmcpart=1
image=zImage
loadaddr=0x12000000
fdt_addr=0x18000000
mmcroot=/dev/mmcblk1p2 ro
mmcrootfstype=ext4 rootwait fixrtc
netdev=eth0
ethact=FEC0
ipaddr=192.168.1.150
serverip=192.168.1.53
gatewayip=192.168.1.254
mmcargs=setenv bootargs console=${console} root=${mmcroot} rootfstype=${mmcrootfstype} ${optargs}
uenvcmd=run loadzimage; run loadfdt; run mmcboot

Copy uEnv.txt to the boot partition:

~/


$ sudo cp -v ~/uEnv.txt /media/boot/

Install Kernel zImage

Copy zImage to the boot partition:

~/smarc-fsl-linux-kernel


$ sudo cp -v arch/arm/boot/zImage /media/boot

Install Kernel Device Tree Binary

$ sudo mkdir -p /media/boot/dtbs

$ sudo cp -v arch/arm/boot/dts/imx6q-smarcfimx6.dtb arch/arm/boot/dts/imx6dl-smarcfimx6.dtb /media/boot/dtbs


Note

Icon
  1. If you are using LVDS panel, copy the corresponding device tree blob into SD card as follows.

For WVGA (800x480) LVDS panel:
$ sudo cp -v arch/arm/boot/dts/imx6q-smarcfimx6-wvga.dtb /media/boot/dtbs/imx6q-smarcfimx6.dtb
$ sudo cp -v arch/arm/boot/dts/imx6dl-smarcfimx6-wvga.dtb /media/boot/dtbs/imx6dl-smarcfimx6.dtb 

For XGA (1024x768) LVDS panel:
 $ sudo cp -v arch/arm/boot/dts/imx6q-smarcfimx6-xga.dtb /media/boot/dtbs/imx6q-smarcfimx6.dtb
 $ sudo cp -v arch/arm/boot/dts/imx6dl-smarcfimx6-xga.dtb /media/boot/dtbs/imx6dl-smarcfimx6.dtb 

For WXGA (1366x768) LVDS panel:
 $ sudo cp -v arch/arm/boot/dts/imx6q-smarcfimx6-wxga.dtb /media/boot/dtbs/imx6q-smarcfimx6.dtb
 $ sudo cp -v arch/arm/boot/dts/imx6dl-smarcfimx6-wxga.dtb /media/boot/dtbs/imx6dl-smarcfimx6.dtb 

For 1080p (1920x1080) LVDS panel:
 $ sudo cp -v arch/arm/boot/dts/imx6q-smarcfimx6-1080p.dtb /media/boot/dtbs/imx6q-smarcfimx6.dtb
 $ sudo cp -v arch/arm/boot/dts/imx6dl-smarcfimx6-1080p.dtb /media/boot/dtbs/imx6dl-smarcfimx6.dtb 

 

Install Root File System and Kernel Modules


Copy Root File System:

Yocto Pre-Built Rootfs:

directory where your root file system is


$ sudo tar xvfz <filename.tar.gz> -C /media/rootfs

Ubuntu 14.04:

directory where your root file system is


$ sudo tar xvfz imx6-ubuntu1404.tar.gz -C /media/rootfs

Copy Kernel Modules:

~/smarc-fsl-linux-kernel


$ sudo make ARCH=arm INSTALL_MOD_PATH=/media/rootfs modules_install


Note

Icon
  1. SMARC-FiMX6 always boots up to SPI flash first. The firmware in SPI flash is factory pre-installed from Embedian. It will read the BOOT_SEL configuration that defined by SMARC specification on your carrier board and load u-boot.bin from the partition one of the device (could be SD card, eMMC, SATA,..etc) that you selected to memory.
  2. After compiled u-boot, it will generated u-boot.imx and u-boot.bin. The only difference is IVT header that will tell i.MX6 internal ROM where to load u-boot. If the firmware in SPI flash need to be update or empty. Users could pull the TEST# pin on carrier board to low. In this way, SMARC-FiMX6 will boot up to SD card first. The u-boot we need to use now will be u-boot.imx. The command to copy u-boot.imx to SD card now is:
    $ sudo dd if=u-boot.imx of=${DISK} bs=512 seek=2 
    In this case, user will only need to copy uEnv.txt, zImage and device tree blob to partition one of your boot device.  
  3. MAC address is factory pre-installed at on board I2C EEPROM at offset 60 bytes. It starts with Embedian's vendor code 10:0D:32. u-boot will read it and pass this parameter to kernel.
  4. If your rootfs is yocto built, the kernel modules will be included in the rootfs.

Networking:

Edit: /etc/network/interfaces

$ sudo vim /media/rootfs/etc/network/interfaces

Add:

/media/rootfs/etc/network/interfaces


auto lo
iface lo inet loopback
 
auto eth0
iface eth0 inet dhcp

 

Remove SD card:

$ sync
$ sudo umount /media/boot
$ sudo umount /media/rootfs

Setup eMMC


Setting up eMMC usually is the last step at development stage after the development work is done at your SD card or NFS environments. From software point of view, eMMC is nothing but a non-removable SD card on board. For SMARC-FiMX6, the SD card is always emulated as /dev/mmcblk1 and on-module eMMC is always emulated as /dev/mmcblk3. Setting up eMMC now is nothing but changing the device descriptor. 

This section gives a step-by-step procedure to setup eMMC flash. Users can write a shell script your own at production to simplify the steps.

First, we need to backup the final firmware from your SD card or NFS.

Prepare for eMMC binaries from SD card (or NFS):

Insert SD card into your Linux PC. For these instructions, we are assuming: DISK=/dev/mmcblk0, "lsblk" is very useful for determining the device id.

For these instruction, we are assuming: DISK=/dev/mmcblk0, "lsblk" is very useful for determining the device id.

$ export DISK=/dev/mmcblk0

Mount Partitions:

On some systems, these partitions may be auto-mounted...

$ sudo mkdir -p /media/boot/
$ sudo mkdir -p /media/rootfs/
 
for: DISK=/dev/mmcblk0
$ sudo mount ${DISK}p1 /media/boot/
$ sudo mount ${DISK}p2 /media/rootfs/
 
for: DISK=/dev/sdX
$ sudo mount ${DISK}1 /media/boot/
$ sudo mount ${DISK}2 /media/rootfs/

Changing Device descriptor from U-Boot:

There is only one line needed to be changed from original u-boot.

At include/configs/smarcfimx6.h, find

#define CONFIG_SYS_MMC_ENV_DEV

Change from "0" to "2" and make again.

(Users can also checkout the smarc-emmc-imx_3.14.28_1.0.0_ga branch from Embedian u-boot git server by the following way.

git checkout smarc-imx_3.14.28_1.0.0_ga
make ARCH=arm CROSS_COMPILE=${CC} distclean
make ARCH=arm CROSS_COMPILE=${CC} smarcfimx6_quad_1g_ser3_config
make ARCH=arm CROSS_COMPILE=${CC}

)

The new u-boot.bin will be the one for eMMC use.

Copy u-boot.bin to rootfs partition:

~/smarcfimx6-uboot

$ sudo cp -v u-boot.bin /media/rootfs/home/root

Note

Icon
  1. If your rootfs is Ubuntu 14.04, copy to /media/rootfs/home/ubuntu instead of /media/rootfs/home/root

Copy zImage to rootfs partition:

$ sudo cp -v /media/boot/zImage /media/rootfs/home/root

Copy uEnv.txt to rootfs partition:

Copy and paste the following contents to /media/rootfs/home/root ($ sudo vim /media/rootfs/home/root/uEnv.txt)

#####HDMI######
#optargs="video=mxcfb0:dev=hdmi,1280x720M@60,if=RGB24,bpp=32 consoleblank=0"
#####LVDS#####
#optargs="video=mxcfb0:dev=ldb,if=RGB24,bpp=32 consoleblank=0 fbmem=24M vmalloc=400M"
#####Parallel LCD Setting#####
#optargs="video=mxcfb0:dev=lcd,CLAA-WVGA,if=RGB24,bpp=32 consoleblank=0 fbmem=24M vmalloc=400M"
#####Parallel LCD to CH7055A (VESA Timing Format) Setting #####
#optargs="video=mxcfb0:dev=lcd,768x576M@75,if=RGB24,bpp=32 consoleblank=0"
#optargs="video=mxcfb0:dev=lcd,1280x1024M@60,if=RGB24,bpp=32 consoleblank=0"
#optargs="video=mxcfb0:dev=lcd,640x480M@60,if=RGB24,bpp=32 consoleblank=0"

console=ttymxc4,115200
mmcdev=2
mmcpart=1
image=zImage
loadaddr=0x12000000
fdt_addr=0x18000000
mmcroot=/dev/mmcblk3p2 ro
mmcrootfstype=ext4 rootwait fixrtc
netdev=eth0
ethact=FEC0
ipaddr=192.168.1.150
serverip=192.168.1.53
gatewayip=192.168.1.254
mmcargs=setenv bootargs console=${console} root=${mmcroot} rootfstype=${mmcrootfstype} ${optargs}
uenvcmd=run loadzimage; run loadfdt; run mmcboot

Copy device tree blob to rootfs partition:

$ sudo cp -v /media/boot/dtbs/imx6q-smarcfimx6.dtb /media/rootfs/home/root/imx6q-smarcfimx6.dtb
$ sudo cp -v /media/boot/dtbs/imx6dl-smarcfimx6.dtb /media/rootfs/home/root/imx6dl-smarcfimx6.dtb 


Note

Icon
  1. If you are using LVDS panel, copy the corresponding device tree blob into eMMC as follows.

For WVGA (800x480) LVDS panel:
$ sudo cp -v arch/arm/boot/dts/imx6q-smarcfimx6-wvga.dtb /media/boot/dtbs/imx6q-smarcfimx6.dtb
$ sudo cp -v arch/arm/boot/dts/imx6dl-smarcfimx6-wvga.dtb /media/boot/dtbs/imx6dl-smarcfimx6.dtb 

For XGA (1024x768) LVDS panel:
 $ sudo cp -v arch/arm/boot/dts/imx6q-smarcfimx6-xga.dtb /media/boot/dtbs/imx6q-smarcfimx6.dtb
 $ sudo cp -v arch/arm/boot/dts/imx6dl-smarcfimx6-xga.dtb /media/boot/dtbs/imx6dl-smarcfimx6.dtb 

For WXGA (1366x768) LVDS panel:
 $ sudo cp -v arch/arm/boot/dts/imx6q-smarcfimx6-wxga.dtb /media/boot/dtbs/imx6q-smarcfimx6.dtb
 $ sudo cp -v arch/arm/boot/dts/imx6dl-smarcfimx6-wxga.dtb /media/boot/dtbs/imx6dl-smarcfimx6.dtb 

For 1080p (1920x1080) LVDS panel:
 $ sudo cp -v arch/arm/boot/dts/imx6q-smarcfimx6-1080p.dtb /media/boot/dtbs/imx6q-smarcfimx6.dtb
 $ sudo cp -v arch/arm/boot/dts/imx6dl-smarcfimx6-1080p.dtb /media/boot/dtbs/imx6dl-smarcfimx6.dtb 

 

Copy real rootfs to rootfs partition:

Yocto Built Root File Systems

$ pushd /media/rootfs

$ sudo tar cvfz ~/smarcfimx6-emmc-rootfs.tar.gz .

$ sudo mv ~/smarcfimx6-emmc-rootfs.tar.gz /media/rootfs/home/root

$ popd

Ubuntu 14.04 Root File Systems

$ sudo vim /media/rootfs/etc/udev/rules.d/70-persistent-net.rules

Delete all contents starting with "SUBSYSTEM=="

$ pushd /media/rootfs

$ sudo tar cvfz ~/smarcfimx6-emmc-rootfs.tar.gz .

$ sudo mv ~/smarcfimx6-emmc-rootfs.tar.gz /media/rootfs/home/root

$ popd

Remove SD card:

$ sync
$ sudo umount /media/boot
$ sudo umount /media/rootfs

Copy Binaries to eMMC from SD card:

Insert this SD card into your SMARC-FiMX6 device.

Now it will be almost the same as you did when setup your SD card, but the eMMC device descriptor is /dev/mmcblk3 now.

$ export DISK=/dev/mmcblk3

Erase SD card:

$ sudo dd if=/dev/zero of=${DISK} bs=1M count=16

Create Partition Layout:

$ sudo sfdisk --in-order --Linux --unit M ${DISK} <<-__EOF__
1,48,0x83,*
,,,-
__EOF__

Format Partitions:

$ sudo mkfs.vfat -F 16 ${DISK}p1 -n boot
$ sudo mkfs.ext4 ${DISK}p2 -L rootfs

Mount Partitions:

$ sudo mkdir -p /media/boot/
$ sudo mkdir -p /media/rootfs/
$ sudo mount ${DISK}p1 /media/boot/
$ sudo mount ${DISK}p2 /media/rootfs/

Install binaries for partition 1

Copy u-boot.bin/uEnv.txt/zImage/*.dtb to the boot partition


$ sudo cp -v u-boot.bin zImage uEnv.txt /media/boot/

Install Kernel Device Tree Binary

$ sudo mkdir -p /media/boot/dtbs

$ sudo cp -v imx6q-smarcfimx6.dtb imx6dl-smarcfimx6.dtb /media/boot/dtbs

Install Root File System


$ sudo tar -zxvf smarcfimx6-emmc-rootfs.tar.gz -C /media/rootfs

 

Unmount eMMC:

$ sync
$ sudo umount /media/boot
$ sudo umount /media/rootfs

 

Switch your Boot Select to eMMC and you will be able to boot up from eMMC now.


version 1.0a, 3/23/2015

Last updated 2015-06-11

  • No labels