DEVELOPMENT GUIDE VAB-800 BSP 1.4

1.4-09222014-165700

Copyright Copyright © 2014-VIA Technologies Incorporated. All rights reserved.

No part of this document may be reproduced, transmitted, transcribed, stored in a retrieval system, or translated into any language, in any form or by any means, electronic, mechanical, magnetic, optical, chemical, manual or otherwise without the prior written permission of VIA Technologies, Incorporated.

Trademarks All brands, product names, company names, trademarks and service marks are the property of their respective holders.

Disclaimer VIA Technologies makes no warranties, implied or otherwise, in regard to this document and to the products described in this document. The information provided in this document is believed to be accurate and reliable as of the publication date of this document. However, VIA Technologies assumes no responsibility for the use or misuse of the information in this document and for any patent infringements that may arise from the use of this document. The information and product specifications within this document are subject to change at any time, without notice and without obligation to notify any person of such change.

VIA Technologies, Inc. reserves the right the make changes to the products described in this manual at any time without prior notice.

VABVAB- ---8080808000 Linux BSP V1.V1.4444 Development Guide

Revision History

Version DateDateDate Remarks 1.0 12/24/2012 Initial external release 1.1 4/2/2013 Added the eMMC evaluation kit process in Appendix A Modified Micro SD/eMMC partition method in Chapter 4 1.2 4/19/2013 Added the ADI ADV7511W in Step 10 of 3.2.2 Run Ltib to build VAB-800 BSP 1.3 8/14/2014 Modified the necessary packages and patch of Ltib for Ubuntu 12.04 64bit host development PC 1.4 9/17/2014 Added Xrandr dual display setting in Appendix.E

iii VABVAB- ---8080808000 Linux BSP V1.V1.4444 Development Guide

Table of Contents

1.1.1. Introduction ...... 111 1.1. Overview...... 1 1.2. Package Content...... 2 1.2.1. BSP Folder Contents...... 2 1.2.2. EVK Folder Contents...... 2

2.2.2. Setup Building Environment ...... 333 2.1. Configure Ubuntu...... 3 2.1.1. Change Default Editor (optional) ...... 3 2.1.2. Sudoers...... 3 2.1.3. Install Host Packages...... 4 2.1.4. Change Default Shell...... 4 2.1.5. Configure Ccache (optional)...... 5 2.1.6. Change Permissions on /opt ...... 5 2.2. Install LTIB...... 6 2.2.1. Extracting Bundle and Installing LTIB...... 6 2.2.1.1. Download i.MX53 Linux Source Bundle...... 6 2.2.1.2. User install ...... 7 2.2.1.3. Extract content...... 7 2.2.1.4. Adopting Extra the LTIB Patch...... 9

3.3.3. Building BSP through LTIBLTIB...... 101010 3.1.1. Getting iMX5x Based Board Packages...... 10 3.2. Building VAB-800 BSP...... 15 3.2.1. Add/Replace VAB-800 modification files ...... 15 3.2.2. Run LTIB to build VAB-800 BSP...... 17

4.4.4. Making Linux System Booting MediaMedia...... 272727 4.1. Making a Linux System Micro SD Storage Card...... 27 4.1.1. Requirements ...... 27

iv VABVAB- ---8080808000 Linux BSP V1.V1.4444 Development Guide 4.1.2. Partition Micro SD storage card...... 27 4.1.3. Copy images to Micro SD storage card...... 29 4.2. Making a Linux System eMMC...... 30 4.2.1. Requirements ...... 30 4.2.2. Partition eMMC...... 30 4.2.3. Copy images to eMMC ...... 32 4.2.4. Setup u-boot parameter for eMMC...... 34

Appendix A. Making Ubuntu Demo Image ...... 373737 A.1. Getting Ubuntu demo image...... 37 A.2. Making demo image into Micro SD...... 40 A.3. Replace U-boot/Kernel/Modules of VAB-800...... 40 A.4. Making demo image to eMMC (optional) ...... 45

Appendix B. The List of Additional FilesFiles...... 525252 B.1. FreeScale Patch Files...... 52 B.2. VAB-800 Patch Files ...... 53

Appendix . Touch Panel Calibration ...... 545454

Appendix . Setting UU----bootbootboot...... 575757

Appendix E. XRandR Dual Display Setting ...... 606060

v VABVAB- ---8080808000 Linux BSP V1.V1.4444 Development Guide

Lists of Figures

Figure 1. VAB-800 package content ...... 2 Figure 2. Source Code download link ...... 6 Figure 3. Target Image Builder Platform Selection...... 11 Figure 4. Platform choice...... 11 Figure 5. Save Platform Image Selection ...... 11 Figure 6. i.MX Development Platforms...... 12 Figure 7. imx5x Platform Selection ...... 13 Figure 8. Platform Save ...... 13 Figure 9. iMX5x Based Boards...... 14 Figure 10. iMX53 loco...... 14 Figure 11. Save the configuration ...... 15 Figure 12. iMX5x Based Boards...... 18 Figure 13. Target System Configuration ...... 19 Figure 14. Boot up with a tty and login setting (original) ...... 19 Figure 15. Boot up with a tty and login setting (modified)...... 20 Figure 16. Configure the kernel ...... 21 Figure 17. Save the configuration ...... 21 Figure 18. Kernel configuration menu ...... 22 Figure 19. GPIO ...... 23 Figure 20. FUSE support ...... 24 Figure 21. NTFS support (optional)...... 24 Figure 22. ADI ADV7511W DVI/HDMI Interface Chip support...... 25 Figure 23. Save the configuration ...... 25 Figure 24. Build successful...... 26 Figure 25. Select eMMC boot at J4...... 34 Figure 26. u-boot parameter...... 35 Figure 27. u-boot parameter...... 50

vi VABVAB- ---8080808000 Linux BSP V1.V1.4444 Development Guide

Lists of Tables

Table 1. Images generated through LTIB...... 26 Table 2. J4 jumper settings ...... 34 Table 3. u-boot/kernel/modules ...... 40 Table 4. u-boot bootloader and Linux Kernel ulmage...... 45 Table 5. u-boot/kernel/rootfs...... 46 Table 6. J4 jumper settings ...... 49 Table 7. VAB-800 patch file...... 53

vii VABVAB- ---8080808000 Linux BSP V1.V1.4444 Development Guide 1. Introduction The purpose of this document is to provide a practical introduction on developing software for the VAB-800/AMOS-800/ARTiGO A800 on a Linux development host only.

The AMOS-800/ARTiGO A800 is a fanless ARM-based embedded system with VIA VAB-800 Pico-ITX board. This development guide will use VAB-800 as an example instead of AMOS-800/ARTiGO A800, since the VAB-800 BSP is used in AMOS-800/ARTIGO A800 system.

1.1. Overview The VIA VAB-800 platform is an embedded system powered by ARM processor with Linux kernel 2.6.35 operating system as default. The Linux major functions include all system-requirement shell commands and drivers ready for VAB-800 platform. VAB-800’s Linux package does not offer a development environment. Users can develop it under an Ubuntu environment.

There are three major boot components for Linux, the """u"uuu----boot.binboot.binboot.bin"""",, """uImage"uImageuImage"""" and """Root"Root File SystemSystem"""". The "u"u"u-"u---boot.bin"boot.bin" is for initial peripheral hardware parameter. The "uImage" is the Linux kernel image, and the """Root"Root File System" is for Linux O.S. The system will not boot successfully into a Linux environment if one of these files does not exist on the boot media (SD storage card or onboard eMMC).

1 VABVAB- ---8080808000 Linux BSP V1.V1.4444 Development Guide 1.2. Package Content There are three folders in VAB-800 package.

Figure 111.1. VABVAB----800800 package content

1.2.1. BSP Folder Contents • LTIB (Linux Target Image Builder)Builder):::: A tool that can be used to develop and deploy BSPs (Board Support Packages) for a number of embedded target platforms including PowerPC, ARM.

• Patch filefile:::: This folder provides u-boot/kernel configuration, source code and patch files for VAB-800. It also includes Ltib patch files which support BSP development on Ubuntu 12.04 x64 host PC.

• External packagepackage:::: This folder provides X window driver package and patch files for VAB-800.

1.2.2. EVK Folder Contents • uuu-u---bootbootboot.bin:.bin: U-boot image.

• uImageuImage:::: Linux kernel image.

• vabvabvab-vab---800_rootfs_patch.tar800_rootfs_patch.tar800_rootfs_patch.tar.bz2:.bz2: Including driver modules, configuration files and FlexCAN utility. User can evaluate VAB-800 with Freescale Ubuntu demo root file system.

Note: If user needs the supporting files for all software mentioned in VAB-800 Linux BSP document, please contact our regional sales representative for assistance.

2 VABVAB- ---8080808000 Linux BSP V1.V1.4444 Development Guide 2. Setup Building Environment This chapter will guide you through setting up your developing environment. All instructions in this guide are for Ubuntu 12.04 (64Bit). Please install the Ubuntu to your PC/NB in advance.

2.1. Configure Ubuntu

2.1.1. Change Default Editor (optional) The default editor is NANO. To set vi as the default editor: user@ubuntu:~$ sudo update-alternatives --config editor There are 3 choices for the alternative editor (providing /usr/bin/editor).

Selection Path Priority Status ------* 0 /bin/nano 40 auto mode 1 /bin/ed -100 manual mode 2 /bin/nano 40 manual mode 3 /usr/bin/vim.tiny 10 manual mode

Press enter to keep the current choice[*], or type selection number: 3 update-alternatives: using /usr/bin/vim.tiny to provide /usr/bin/editor (editor) in manual mode.

2.1.2. Sudoers The sudoer’s file must be updated to allow the login account to run the rpm commands as root. The login for this example is "user". Edit the sudoer’s file using the $$$sudo$sudo visudo and add the line after the comment "#User alias specification" as shown below. The first word "%us"%user"er"er"er" would be the login name you are using. Save the changes when it is done. user@ubuntu:~$ sudo visudo ...... # User alias specification %user ALL = NOPASSWD: /usr/bin/rpm, /opt/freescale//usr/bin/rpm

3 VABVAB- ---8080808000 Linux BSP V1.V1.4444 Development Guide

2.1.3. Install Host Packages The following packages are installed to support a LTIB development environment and presented in a bash script that can be cut and pasted into your environment and execute:

#/bin/bash # Install LTIB dependant packages sudo apt-get install gettext libgtk2.0-dev rpm bison m4 libfreetype6-dev sudo apt-get install libdbus-glib-1-dev liborbit2-dev intltool sudo apt-get install ccache ncurses-dev zlib1g zlib1g-dev gcc g++ libtool sudo apt-get install uuid-dev liblzo2-dev sudo apt-get install tcl dpkg ia32-libs libc6-dev-i386 lib32z1 # The following recommended for Linux development. # They are not required by LTIB. sudo apt-get install gparted openssh-server sudo apt-get install nfs-common nfs-kernel-server lintian sudo apt-get install git-core git-doc git-email git-gui gitk sudo apt-get install diffstat indent tofrodos fakeroot doxygen uboot- mkimage sudo apt-get install sendmail mailutils meld atftpd sharutils sudo apt-get install manpages-dev manpages- manpages-posix-dev linux- doc sudo apt-get install vnc4server xvnc4viewer

2.1.4. Change Default Shell The Ubuntu default shell is dash. To change the default shell to bash, select and exit. This will remove the dash and use bash. user@ubuntu: $ sudo dpkg-reconfigure dash

Below is a screenshot to show the status before and after the reconfiguration. user@ubuntu:~$ ls -l /bin/sh lrwxrwxrwx 1 root root 4 2012-01-02 07:23 /bin/sh -> dash user@ubuntu:~$ sudo dpkg-reconfigure dash [sudo] password for user: Removing 'diversion of /bin/sh to /bin/sh.distrib by dash' Adding 'diversion of /bin/sh to /bin/sh.distrib by bash' Removing 'diversion of /usr/share/man/man1/sh.1.gz to /usr/share/man/man1/sh.distrib.1.gz by dash' Adding 'diversion of /usr/share/man/man1/sh.1.gz to /usr/share/man/man1/sh.distrib.1.gz by bash' user@ubuntu:~$ ls -l /bin/sh lrwxrwxrwx 1 root root 4 2012-01-02 18:51 /bin/sh -> bash

4 VABVAB- ---8080808000 Linux BSP V1.V1.4444 Development Guide

2.1.5. Configure Ccache (optional) LTIB uses ccache to speed up the compilation. The cache that LTIB uses exists as a .ccache directory in each user's home directory. The path for this example is """/home/us"/home/us/home/user/.ccacheer/.ccacheer/.ccache"""". This directory can grow to be quite large if no upper limit is set.

The followings are the ccache commands to limit the size to 50 MB [1] . The size may change as you see fit, clean the ccache [2] and show the settings [3].

[1] user@ubuntu:~$ ccache -M 50M Set cache size limit to 50.0 Mbytes [2] user@ubuntu:~$ ccache -c Cleaned cache [3] user@ubuntu:~$ ccache -s cache directory /home/user/.ccache cache hit (direct) 0 cache hit (preprocessed) 0 cache miss 0 files in cache 0 cache size 0 Kbytes max cache size 50.0 Mbytes

2.1.6. Change Permissions on /opt The LTIB installation process creates the directory "/opt/freescale". By default the "/opt" directory has root privileges which are changed to allow a regular user to access. user@ubuntu:~/imx53/11.09.01/ltib$ ls -ld /opt drwxr-xr-x 2 root root 4096 2012-01-02 14:24 /opt user@ubuntu:~/imx53/11.09.01/ltib$ sudo chmod 777 /opt [sudo] password for user: user@ubuntu:~/imx53/11.09.01/ltib$ ls -ld /opt drwxrwxrwx 2 root root 4096 2012-01-02 14:24 /opt

5 VABVAB- ---8080808000 Linux BSP V1.V1.4444 Development Guide 2.2. Install LTIB The LTIB (Linux Target Image Builder) is a tool that can be used to develop and deploy BSPs (Board Support Packages) for a number of embedded target platforms including PowerPC, ARM.

The VAB-800 BSP is developed based on Freescale released i.MX5x BSP "L2.6.35_11.09.01_ER_source_bundle.tar.gz". Users can get it from Freescale official web site.

2.2.1. Extracting Bundle and Installing LTIB This section describes the steps to extract the content from the source bundle and to install LTIB.

2.2.1.1. Download i.MX53 Linux Source Bundle The Linux source bundle can be found and downloaded at: http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=IMX53QSB &fpsp=1&tab=Design_Tools_Tab

The Run-time Software section in Board Support Packages tab is shown in Figure 2.

Figure 222.2. Source Code download link

Using Firefox, the default save location is in the Downloads folder that contains the file: "L2.6.35_11.09.01_ER_source_bundle.tar.gz" which is zipped and tar with an md5 checksum of 18eaeb0dcae95c083d40ad13267549a3.

6 VABVAB- ---8080808000 Linux BSP V1.V1.4444 Development Guide 2.2.1.2. User install All LTIB installation and execution should be done as a regular user and not using the root account.

To accommodate running LTIB as a regular user and allow this process to perform privileged commands requiring root permissions that the sudoer’s file is modified (see section 2.1.2), and the permissions on the /opt directory are changed (see section 2.1.6).

2.2.1.3. Extract content We assume that the file "L2.6.35_11.09.01_ER_source_bundle.tar.gz" is already in the """/home/user/Downloads"/home/user/Downloads/home/user/Downloads"""" folder directory.

7 VABVAB- ---8080808000 Linux BSP V1.V1.4444 Development Guide user@ubuntu:~$ cd ~/Downloads user@ubuntu:~/Downloads$ ls -l total 1047352 -rw-rw-r-- 1 user user 1072482848 2012-01-02 18:05 L2.6.35_11.09.01_ER_source_bundle.tar.gz user@ubuntu:~/Downloads$ mkdir -p ~/imx53/11.09.01 user@ubuntu:~/Downloads$ tar -zxf L2.6.35_11.09.01_ER_source_bundle.tar.gz -C ~/imx53/11.09.01/ user@ubuntu:~/Downloads$ cd !$ cd ~/imx53/11.09.01/ user@ubuntu:~/imx53/11.09.01$ ls -l total 1046968 -rwxrwxr-x 1 user user 18941043 2011-11-23 07:19 L2.6.35_11.09.01_ER_docs.tar.gz -rwxrwxr-x 1 user user 230125193 2011-10-13 07:41 L2.6.35_11.09.01_ER_images_MX5X.tar.gz -rwxrwxr-x 1 user user 822925221 2011-10-10 10:27 L2.6.35_11.09.01_ER_source.tar.gz -rwxrwxr-x 1 user user 93132 2011-11-08 11:28 patches.tar.gz user@ubuntu:~/imx53/11.09.01$ tar -zxf L2.6.35_11.09.01_ER_source.tar.gz user@ubuntu:~/imx53/11.09.01$ cd *source user@ubuntu:~/imx53/11.09.01/L2.6.35_11.09.01_ER_source$ ls EULA install ltib.tar.gz package_manifest.txt pkgs redboot_201003.zip tftp.zip user@ubuntu:~/imx53/11.09.01/L2.6.35_11.09.01_ER_source$ ./install

You are about to install the LTIB (GNU/Linux Target Image Builder) Before installing LTIB, you must read and accept the EULA (End User License Agreement) which will be presented next.

Do you want to continue ? Y|n Y ------I have read and accept the EULA (yes|no): yes The LTIB files are extracted from a tar file which includes the prefix ltib. After installation you will find LTIB in: /home/user/imx53/11.09.01/L2.6.35_11.09.01_ER_source/ltib Where do you want to install LTIB ? (/home/user/imx53/11.09.01/L2.6.35_11.09.01_ER_source) .. ------Copying packages to ../ltib/pkgs Installation complete, your ltib installation has been placed in ../ltib, to complete the installation: cd ../ltib ./ltib user@ubuntu:~/imx53/11.09.01/L2.6.35_11.09.01_ER_source$

8 VABVAB- ---8080808000 Linux BSP V1.V1.4444 Development Guide 2.2.1.4. Adopting Extra the LTIB Patch Adding the LTIB patch """ubuntu"ubuntuubuntu----ltibltibltibltib----patch.tgzpatch.tgzpatch.tgz"""" to avoid compiling errors in Ubuntu 12.04 x64 host PC. user@ubuntu:~/imx53/11.09.01/ltib$ cp ubuntu-ltib-patch.tgz user@ubuntu:~/imx53/11.09.01/ltib$ tar zxvf ubuntu-ltib-patch.tgz user@ubuntu:~/imx53/11.09.01/ltib$ cd ubuntu-ltib-patch user@ubuntu:~/imx53/11.09.01/ltib/ubuntu-ltib-patch$ ./install-patches.sh ~/imx53/11.09.01/ltib/

9 VABVAB- ---8080808000 Linux BSP V1.V1.4444 Development Guide 3. Building BSP through LTIB Once the building environment has been configured as described in Chapter 2, the environment and host are now ready to run the LTIB. This chapter will guide you on how to build the BSP through LTIB.

3.1.1. Getting iMX5x Based Board Packages To get iMX5x based board packages through LTIB when you first use the LTIB. Those packages include iMX5x hardware definitions, drivers and many more. user@ubuntu:~/imx53/11.09.01/ltib$ ./ltib

Depending on the performance of user’s computer, this process would take time to run. It may take several minutes to an hour. Once the LTIB environment is configured, a menu will be available for selecting configurations.

The first menu is shown in Figure 3. Use the arrow keys to move the cursor between then press enter key to open the selected item.

10 VABVAB- ---8080808000 Linux BSP V1.V1.4444 Development Guide

Figure 333.3. Target Image Builder Platform Selection

Choose