VAR-SOM-MX6 Ubuntu Build Ubuntu Alip NFS

From Variscite Wiki
VAR-SOM-MX6 - Ubuntu Linaro Alip-20151215 NFS development system

1 Overview

Ubuntu Linaro Alip is pre built file system. For more information Ubuntu based Rootfs provided by Linaro. Variscite used linaro-vivid-alip-20151215-714 image added Vivante Graphic acceleration and compile the GStreamer with i.MX6 support. The steps require to build an NFS development system:

  1. Install the toolchain.
  2. Extract the file system
  3. Build Linux kernel, modules and all relevant device tree.
    1. Deploy The Linux modules into the filesystem.
  4. Build U-boot
  5. Build the Wi-Fi modules and deploy them into the filesystem.
  6. Boot the target with the New kernel and device tree while using the fileystem.

2 Installing required packages

On your Ubuntu building machine:

sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm lib32ncurses5-dev

Ubuntu Alip build was tested with Ubuntu 14.04 LTS only! We know that Ubuntu 12.04 have some problems with it.

3 Tool Installation

The tool-chain are available for Download from: Linaro-Toolchain Install the tools:

$ sudo tar xvf ~/Downloads/gcc-linaro-arm-linux-gnueabihf-4.9-2014.05_linux.tar.xz -C /opt
$ export PATH=/opt/gcc-linaro-arm-linux-gnueabihf-4.9-2014.05_linux/bin/:$PATH

4 TFTP and NFS setup

Please follow the link to the WIKI TFTP & NFS and set-up TFTP/NFS servers on your host machine.

5 File System

Ubuntu Linaro Alip file system available for Download from: Alip-Filesystem

$ mkdir ~/var-som-mx6-alip
$ cd ~/var-som-mx6-alip
$ sudo mkdir rootfs
$ cd rootfs
$ sudo tar xvf ~/Downloads/linaro-alip-20151215-v3.tar.bz2

6 Build Linux

Get sources:

$ cd ~/var-som-mx6-alip
$ git clone --branch imx_3.14.38_6qp_ga_var01 --depth 50 https://github.com/varigit/linux-2.6-imx.git
$ cd linux-2.6-imx/

Build the Linux kernel and device tree:

$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mrproper
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- imx_v7_var_ubuntu_defconfig
$ make -j6 LOADADDR=0x10008000 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage
$ make -j6 LOADADDR=0x10008000 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules
$ make -j6 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- dtbs

Copy uImage and device tree to the tftpboot directory. Install the modules to the root file system:

$ sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules_install INSTALL_MOD_PATH=../rootfs/
$ cp arch/arm/boot/uImage /tftpboot
$ cp arch/arm/boot/dts/*var*.dtb /tftpboot

7 Build U-Boot

Note:
This is a single u-boot image that supports all VAR-SOM-MX6 SOM's.

Obtain sources:

$ cd ~/var-som-mx6-alip
$ git clone --branch imx_v2013.10_var4 --depth 50 https://github.com/varigit/uboot-imx
$ cd uboot-imx/
Build u-boot: 
clean tree:
$ make -j6 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mrproper
Choose build for SD-Card or NAND Flash:
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mx6var_som_sd_config
or
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-  mx6var_som_nand_config
Build U-BOOT:
$ make -j6 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-

Flash u-boot to the sd-card:

$ sudo dd if=SPL of=/dev/sdxxx bs=1K seek=1; sync
$ sudo dd if=u-boot.img of=/dev/sdxxx bs=1K seek=69; sync

In case of UBI copy it to the sd-card:

$ sudo cp SPL /media/rootfs/opt/images
$ sudo cp u-boot.img /media/rootfs/opt/images

Eject SD-Card gracefully from host machine.

Note:
Refer to NAND Flash Burning for a complete description.

8 Build the Wi-Fi drivers

Based on: WL18xx System Build Scripts

8.1 Clone the build git

$ cd ~/var-som-mx6-alip
$ git clone git://git.ti.com/wilink8-wlan/build-utilites.git
$ cd build-utilites

8.2 Setup the environment

$ cp setup-env setup-env.sample

Edit setup-env and set:

export TOOLCHAIN_PATH=/opt/gcc-linaro-arm-linux-gnueabihf-4.9-2014.05_linux/bin
export ROOTFS=/home/<me>/var-som-mx6-alip/rootfs
export KERNEL_PATH=/home/<me>/var-som-mx6-alip/linux-2.6-imx/

Change "<me>" to your true name.

Complete file example:

#                            \\\// 
#                           -(o o)- 
#========================oOO==(_)==OOo=======================
# This file contains the exports needed for automating the
# build process of WLAN components.
# Place this file in the same directory with wl18xx_build.sh
# build scripts. No need to run 'source setup-env', the build
# scripts will perfom it internaly. 
#===========================================================
# User specific environment settings - use full PATH

# if DEFAULT toolchain path is set toolchain will be downloaded to ./toolchain.
export TOOLCHAIN_PATH=/opt/gcc-linaro-arm-linux-gnueabihf-4.9-2014.05_linux/bin

# if DEFAULT path to root filesystem is set ./fs folder will be used.
export ROOTFS=/home/variscite/var-som-mx6-alip/rootfs

#if DEFAULT kernel path is set - kernel will be downloaded (set branch to match kernel version)
export KERNEL_PATH=export KERNEL_PATH=/home/variscite/var-som-mx6-alip/linux-2.6-imx/

# if KERNEL_VARIANT below is set the build script will look for kernel specific
# patches under the patches directory:
# - patches under the pathces/driver_patches/$KERNEL_VARIANT directory would be
#   applied during "modules" build.
# - patches under the patches/kernel_patches/$/$KERNEL_VARIANT directory would
#   be applied to the kernel pointed by KERNEL_PATH in case the "patch_kernel"
#   command is used.
#   Note: the kernel is not built automatically after the patches are applied
export KERNEL_VARIANT=DEFAULT

export CROSS_COMPILE=arm-linux-gnueabihf-
export ARCH=arm
[ "$TOOLCHAIN_PATH" != "DEFAULT" ] && export PATH=$TOOLCHAIN_PATH:$PATH

8.3 Download the source

Note:
Don't use the "sudo" version of the script for this step or you'll end up with directories owned by root instead of user.
$ ./build_wl18xx.sh init

8.4 Checkout, Build, and Install

$ ./sudo_build_wl18xx.sh update R8.6
Note:
This build will fail. Please move to the next step apply the patch's and run the build with the commands described below.

8.5 Patch for Bugfix & Build

Patch:

$ sed -i 's/__TIMESTAMP__/"June_22_2015"/g' src/driver/drivers/net/wireless/ti/wlcore/Makefile 
$ sed -i 's/__TIMESTAMP__/"June_22_2015"/g' src/driver/drivers/net/wireless/ti/wlcore/release_version.h
$ sed -i 's/\/\* time sync \*\//return hw; \/\* time sync \*\//g' src/driver/drivers/net/wireless/ti/wlcore/main.c

Build:

$ ./sudo_build_wl18xx.sh modules
$ ./sudo_build_wl18xx.sh firmware
$ ./sudo_build_wl18xx.sh bt-firmware

The build above will deploy the Wi-Fi modules and the relevant firmware directly into the the rootfs. Any other packages is not required because we are using the Ubuntu supplied one.

Note:
For rebuild just do the last 3 build steps.

9 Device Tree Information

The table below summarize all available Device Tree.

Device Tree Name
SOM type
Carrier Board type
LCD Type
Evaluation Kit name
imx6q-var-som.dtb VAR-SOM-MX6_V2 (Quad / Dual) VAR-MX6CustomBoard Capacitive/Resistive touch VAR-DVK-MX6_V2-PRO
VAR-STK-MX6_V2
imx6q-var-som-vsc.dtb VAR-SOM-MX6_V2 (Quad / Dual) VAR-SOLOCustomBoard Capacitive LVDS touch N/A
imx6dl-var-som.dtb VAR-SOM-MX6_V2 (DualLite/ Solo) VAR-MX6CustomBoard Capacitive/Resistive touch N/A
imx6dl-var-som-solo-vsc.dtb VAR-SOM-SOLO / VAR-SOM-DUAL VAR-SOLOCustomBoard Capacitive LVDS touch VAR-DVK-SOLO/DUAL VAR-STK-SOLO/DUAL
imx6dl-var-som-solo.dtb VAR-SOM-SOLO / VAR-SOM-DUAL VAR-MX6CustomBoard Capacitive/Resistive touch N/A
imx6q-var-dart.dtb VAR-SOM-SOLO / VAR-SOM-DUAL VAR-DT6CustomBoard Capacitive LVDS touch VAR-STK-DT6.VAR-DVK-DT6

10 Boot your target

Export your new rootfs directory:

$ sudo gedit /etc/exports
Add a line:
/home/<my name >/var-som-mx6-alip/rootfs *(rw,sync,no_root_squash,no_all_squash,no_subtree_check)
and restart the server:
$ sudo /etc/init.d/nfs-kernel-server restart

Make sure you have A SOM with U-Boot installed on it. You can use the nand recovery utility to install Yocto on it. Boot your target and stop at U-Boot

Select the right device tree (from the table above).
$ setenv fdt_file imx6q-var-som.dtb
$ setenv serverip <server IP Address>
$ setenv uimage uImage

$ setenv nfsroot /home/<me>/var-som-mx6-alip/rootfs
$ setenv console ttymxc0
Add rw to root=/dev/nfs
$ editenv netargs <== root=/dev/nfs rw

$ setenv bootcmd 'run netboot'
$ saveenv

11 Flash images to NAND

Please refer to VAR-SOM-MX6 NAND Flash burning