Difference between revisions of "IoTGateway/BSP/Linux/Quark/Yocto LBV2 User Guide"

From ESS-WIKI
Jump to: navigation, search
(Creating boot-up on-board flash from built sdcard image)
(Modify description)
 
(49 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<big><big><big>Yocto Linux BSP Ver.2 User Guide for Quark series</big></big></big>
+
{{DISPLAYTITLE:Yocto Linux BSP Ver.2 User Guide for Quark series}}
 
<!--
 
<!--
 
{| align="right"
 
{| align="right"
| __TOC__
+
|-
|}
+
| __TOC__
 +
|}
 
-->
 
-->
  
=Getting Started=
+
= Getting Started =
==<span style="color:#0070c0;">Prerequisites</span>==
 
All operations in this guide are based on Ubuntu 12.04 LTS 64bit only.<br>
 
First please install Ubuntu 12.04 LTS 64bit<sup><span style="color:red">*</span></sup> with minimum 2GB memory.<br>
 
<span style="color:red"><nowiki>* ubuntu-12.04.1-desktop-amd64.iso</nowiki></span>
 
===<span style="color:#0070c0;">To install required packages</span>===
 
Please login and perform the following commands:
 
  
$ sudo apt-get install ssh
+
== <span style="color:#0070c0">Conventions</span> ==
$ sudo apt-get install ia32-libs libx11-dev:i386 libreadline6-dev:i386 \
 
libgl1-mesa-glx:i386 zlib1g-dev:i386 uuid-dev:i386 liblzo2-dev:i386 \
 
libncurses5-dev:i386
 
$ sudo apt-get install \
 
bison build-essential ccache dpkg flex gcc g++ gettext intltool \
 
libarchive-zip-perl libfreetype6-dev libdbus-glib-1-dev liborbit2-dev \
 
libxml2-dev libx11-dev libgtk2.0-dev liblzo2-2 libtool m4 \
 
patch rpm tcl uboot-mkimage uuid zlib1g zlib1g-dev \
 
git gnupg flex bison gperf build-essential  zip \
 
curl libc6-dev libncurses5-dev x11proto-core-dev libx11-dev:i386 \
 
libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib \
 
mingw32 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 \
 
gcc-4.6 g++-4.6 cpp-4.6 gcc-4.6-multilib uuid-dev liblzo2-dev \
 
uboot-mkimage libarchive-zip-perl \
 
wget git-core unzip texinfo gawk diffstat build-essential chrpath \
 
sed cvs subversion coreutils texi2html \
 
docbook-utils python-pysqlite2 help2man make gcc g++ \
 
desktop-file-utils libgl1-mesa-dev libglu1-mesa-dev mercurial \
 
autoconf automake groff curl lzop asciidoc xterm
 
$ sudo apt-get install libncurses5-dev:i386 liblzo2-dev:i386 uuid-dev:i386
 
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
 
$ tar zcvf ~/usr_lib_i386-linux-gnu_for_Building_Android_KK.tar.gz \
 
/usr/lib/i386-linux-gnu/{libuuid.a,libuuid.so,liblzo2.so,liblzo2.a}
 
$ sudo apt-get install uuid-dev liblzo2-dev
 
$ sudo tar zxvf ~/usr_lib_i386-linux-gnu_for_Building_Android_KK.tar.gz -C /
 
  
===<span style="color:#0070c0;">To install JDK</span>===
+
:<span style="color:purple">'''${BOARD_ID}'''</span>&nbsp;: board ID
Please download "jdk-6u45-linux-x64.bin" manually, put it to directory ~/FILES/ and perform the following commands:
+
::e.g. ubc222 or ubc221
$ cd /usr/lib
 
$ sudo ~/FILES/jdk-6u45-linux-x64.bin
 
$ sudo mkdir jvm
 
$ cd jvm
 
$ sudo mv ../jdk1.6.0_45 .
 
$ cd jdk1.6.0_45/
 
$ sudo update-alternatives --install /usr/bin/java    java    /usr/lib/jvm/jdk1.6.0_45/jre/bin/java    2
 
$ sudo update-alternatives --install /usr/bin/javac  javac  /usr/lib/jvm/jdk1.6.0_45/bin/javac  2
 
$ sudo update-alternatives --install /usr/bin/jar    jar    /usr/lib/jvm/jdk1.6.0_45/bin/jar    2
 
$ sudo update-alternatives --install /usr/bin/javap  javap  /usr/lib/jvm/jdk1.6.0_45/bin/javap  2
 
$ sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk1.6.0_45/bin/javadoc 2
 
$ sudo update-alternatives --config javap
 
$ sudo update-alternatives --config javadoc
 
$ sudo update-alternatives --config java
 
$ sudo update-alternatives --config javac
 
$ sudo update-alternatives --config jar
 
$ cd ~/
 
$ sudo sh -c "echo "JAVA_HOME=/usr/lib/jvm/jdk1.6.0_45" >> /etc/environment"
 
  
==<span style="color:#0070c0;">Conventions</span>==
+
:<span style="color:purple">'''${IMAGE_PACK}'''</span>&nbsp;: prebuilt image pack
<span style="color:purple">'''${BOARD_ID}'''</span> : board ID
+
::e.g. ubc222 or ubc221
:e.g. ubc222 or ubc221
 
  
<span style="color:purple">'''${IMAGE_PACK}'''</span> : prebuilt image pack
+
:<span style="color:purple">'''${IMAGE_DIR}'''</span>&nbsp;: the directory prebuilt image pack extracted to
:e.g. ubc222 or ubc221
+
::e.g. ~/U222LIV2011_quark_2016-01-29
  
<span style="color:purple">'''${IMAGE_DIR}'''</span> : the directory prebuilt image pack extracted to
+
:<span style="color:purple">'''${BSP_PACK}'''</span>&nbsp;: BSP pack
:e.g. ~/U222LIV2011_quark_2016-01-29
+
::e.g. U222LBV2011_2016-01-29.zip
  
<span style="color:purple">'''${BSP_PACK}'''</span> : BSP pack
+
:<span style="color:purple">'''${BSP_HOME}'''</span>&nbsp;: the directory BSP pack extracted to
:e.g. U222LIV2011_quark_2016-01-29.zip
+
::e.g. ~/LBV2011/meta-clanton_v1.2.0
  
<span style="color:purple">'''${BSP_HOME}'''</span> : the directory BSP pack extracted to
+
:<span style="color:purple">'''${BDIR}'''</span>&nbsp;: build directory
:e.g. ~/LBV2011/meta-clanton_v1.2.0
+
::e.g. yocto_build
  
<span style="color:purple">'''${BDIR}'''</span> : build directory
+
:<span style="color:purple">'''${SD_MOUNT}'''</span>&nbsp;: mount point of SD card in Ubuntu
:e.g. yocto_build
+
::e.g. /media/sdf1
  
<span style="color:purple">'''${DEPLOY_IMAGE}'''</span> : all built images are located in this relative path starts from <span style="color:purple">'''${BDIR}'''</span>
+
:<span style="color:purple">'''${POKY}'''</span>&nbsp;: Yocto poky version
:e.g. tmp/deploy/images/quark
+
::e.g. 1.7.2
  
<span style="color:purple">'''${DEPLOY_SDK}'''</span> : the built SDK is located in this relative path starts from <span style="color:purple">'''${BDIR}'''</span>
+
:debug console / serial console
:e.g. tmp/deploy/sdk
+
::serial terminal program (e.g. minicom, putty, teraterm ...) that serial port is configured to 115200 8N1
  
<span style="color:purple">'''${SD_MOUNT}'''</span> : mount point of SD card in Ubuntu
+
:terminal console
:e.g. /media/sdf1
+
::terminal program (e.g. gnome-terminal, xfce4-terminal ...)
  
<span style="color:purple">'''${POKY}'''</span> : Yocto poky version
+
== <span style="color:#0070c0">Prerequisites</span> ==
:e.g. 1.7.2
 
  
debug console / serial console
+
=== <span style="color:#0070c0">To install Docker Engine on your platform</span> ===
:serial terminal program (e.g. minicom, putty, teraterm ...) that serial port is configured to 115200 8N1
 
  
terminal console
+
:Please refer to [https://docs.docker.com/engine/installation/ Docker Installation Guide] for details
:terminal program (e.g. gnome-terminal, xfce4-terminal ...)
+
 
 +
=== <span style="color:#0070c0">To pull [https://hub.docker.com/r/advrisc/u12.04-quarklbv2/ ubuntu 12.04 image from Docker Hub] & run the image</span> ===
 +
 
 +
:<code>$ docker pull advrisc/u12.04-quarklbv2</code>
 +
:<code>$ docker run --name quarkLBV2011 -it advrisc/u12.04-quarklbv2 /bin/bash</code>
 +
 
 +
=== <span style="color:#0070c0">To copy BSP from local filesystem to the container</span> ===
 +
 
 +
:<code>$ docker cp <span style="color:purple">'''${BSP_PACK}'''</span> quarkLBV2011:/home/adv/</code>
 +
 
 +
=== <span style="color:#0070c0">To copy files from the container's filesystem to local machine</span> ===
 +
 
 +
:<code>$ docker cp quarkLBV2011:/home/adv/<span style="color:#7030a0">'''${BSP_HOME}'''</span>/<span style="color:#7030a0">'''${BDIR}'''</span>/tmp/deploy/images/quark ~</code>
 +
 
 +
== <span style="color:#0070c0">Introducing BSP</span> ==
  
==<span style="color:#0070c0;">Introducing BSP</span>==
 
 
:The BSP is based on Yocto Project with Intel enhanced features for Quark, plus specific target board features from Advantech Inc..
 
:The BSP is based on Yocto Project with Intel enhanced features for Quark, plus specific target board features from Advantech Inc..
  
===<span style="color:#0070c0;">Naming Rule</span>===
+
=== <span style="color:#0070c0">Naming Rule</span> ===
 +
 
 
:The tarball/prebuilt image name is consist of the model name followed by "LB" or "LI" plus version number and released date.
 
:The tarball/prebuilt image name is consist of the model name followed by "LB" or "LI" plus version number and released date.
  
:For example, U222LBV2011_2016-01-29.zip which "<span style="color:#ff0000;">'''U'''</span>222" stands for UBC-<span style="color:#ff0000;">'''222'''</span>, "LB" is acronym of <span style="color:#ff0000;">'''L'''</span>inux <span style="color:#ff0000;">'''B'''</span>SP, "V2011" stands for <span style="color:#ff0000;">'''V'''</span>ersion <span style="color:#ff0000;">'''2'''</span>.<span style="color:#ff0000;">'''011'''</span><nowiki>.</nowiki>
+
:For example, U222LBV2011_2016-01-29.zip which "U222" stands for <span style="color:#ff0000">'''U'''</span>BC-<span style="color:#ff0000">'''222'''</span>, "LB" is acronym of <span style="color:#ff0000">'''L'''</span>inux <span style="color:#ff0000">'''B'''</span>SP, "V2011" stands for <span style="color:#ff0000">'''V'''</span>ersion <span style="color:#ff0000">'''2'''</span>.<span style="color:#ff0000">'''011'''</span>.
  
:For example, U222LBV2011_quark_2016-01-29.zip which "LI" is acronym for prebuilt <span style="color:#ff0000;">'''L'''</span>inux <span style="color:#ff0000;">'''I'''</span>mage.
+
:For example, U222LIV2011_quark_2016-01-29.zip which "LI" is acronym for prebuilt <span style="color:#ff0000">'''L'''</span>inux <span style="color:#ff0000">'''I'''</span>mage.<br/>
 +
 
 +
 
 +
 
 +
=== <span style="color:#0070c0">BSP pack</span> ===
 +
 
 +
:Using one of the following ways
 +
:*Unpack BSP pack to home directory
 +
::<code>$ unzip <span style="color:#7030a0">'''${BSP_PACK}'''</span> -d ~/</code>
 +
:*[[IoTGateway/BSP/Linux/Quark/Getting_BSP_from_GitHub|Get the BSP from GitHub]]
  
===<span style="color:#0070c0;">BSP pack</span>===
 
:Unpack BSP pack to home directory by performing the following command:
 
::<code>$ unzip <span style="color:#7030a0;">'''${BSP_PACK}'''</span> -d ~/</code>
 
 
:The description of some important folders list below:
 
:The description of some important folders list below:
::<span style="color:#7030a0;">'''$BSP_HOME'''</span>/meta-clanton_v1.2.0
+
::<span style="color:#7030a0">'''${BSP_HOME}'''</span>/
:::'''meta-advantech/''' : meta layer by Advantech
+
:::'''meta-advantech/''': meta layer by Advantech
:::'''meta-intel-*/''' : meta layer by Intel
+
:::'''meta-intel-*/''': meta layer by Intel
:::'''setup.sh''' : to setup one new build environment
+
:::'''setup.sh''': to setup one new build environment'''<sup><span style="color:red">(read [[IoTGateway/BSP/Linux/Quark/Getting_BSP_from_GitHub#setup.sh|this]] if the BSP is got from GitHub)</span></sup>'''
:::'''oe-init-build-env''' : to initiate build environment
+
:::'''oe-init-build-env''': to initiate build environment
 +
 
 +
=== <span style="color:#0070c0">Prebuilt image pack</span> ===
 +
 
 +
:<sup><span style="color:red">'''(read [[IoTGateway/BSP/Linux/Quark/Getting_BSP_from_GitHub#Prebuilt_image_pack|this]] if the BSP is got from GitHub)'''</span></sup>
  
===<span style="color:#0070c0;">Prebuilt image pack</span>===
 
 
:Perform the following command to unpack prebuilt-image-pack to home directory
 
:Perform the following command to unpack prebuilt-image-pack to home directory
::<code>$ unzip <span style="color:#7030a0;">'''${PREBUILT_IMAGE_PACK}'''</span> -d ~/</code>
+
::<code>$ unzip <span style="color:purple">'''${IMAGE_PACK}'''</span> -d ~/</code>
 
:Prepare one FAT32 formatted SD card, and mount it to mount point
 
:Prepare one FAT32 formatted SD card, and mount it to mount point
::<code>$ cp -a <span style="color:#7030a0;">'''${PREBUILT_IMAGE_DIR}'''</span>/sdcard/* <span style="color:#7030a0;">'''${SD_MOUNT}'''</span>/</code>
+
::<code>$ cp -a <span style="color:purple">'''${IMAGE_DIR}'''</span>/sdcard/* <span style="color:#7030a0">'''${SD_MOUNT}'''</span>/</code>
 +
 
 +
== <span style="color:#0070c0">Build Instructions</span> ==
 +
 
 +
Please refer to [https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration this link] to set Git configuration first.
 +
 
 +
=== <span style="color:#0070c0">To create one new build environment</span> ===
  
==<span style="color:#0070c0;">Build Instructions</span>==
 
===<span style="color:#0070c0;">To create one new build environment</span>===
 
 
:Perform the following commands in terminal console
 
:Perform the following commands in terminal console
::<code>$ cd <span style="color:#7030a0;">'''${BSP_HOME}'''</span></code>
+
::<code>$ cd <span style="color:#7030a0">'''${BSP_HOME}'''</span></code>
::<code>$ ./setup.sh</code>
+
::<code>$ ./setup.sh</code><sup><span style="color:red">'''(read [[IoTGateway/BSP/Linux/Quark/Getting_BSP_from_GitHub#setup.sh|this]] if the BSP is got from GitHub)'''</span></sup>
::<code>$ BOARD=<span style="color:#7030a0;">'''${BOARD_ID}'''</span> source ./oe-init-build-env <span style="color:#7030a0;">'''${BDIR}'''</span></code>
+
::<code>$ BOARD=<span style="color:#7030a0">'''${BOARD_ID}'''</span> source ./oe-init-build-env <span style="color:#7030a0">'''${BDIR}'''</span></code>
 +
 
 +
=== <span style="color:#0070c0">To continue an exist build environment</span> ===
  
===<span style="color:#0070c0;">To continue an exist build environment</span>===
 
 
:Perform the following commands in terminal console
 
:Perform the following commands in terminal console
::<code>$ cd <span style="color:#7030a0;">'''${BSP_HOME}'''</span></code>
+
::<code>$ cd <span style="color:#7030a0">'''${BSP_HOME}'''</span></code>
::<code>$ BOARD=<span style="color:#7030a0;">'''${BOARD_ID}'''</span> source ./oe-init-build-env </code>
+
::<code>$ BOARD=<span style="color:#7030a0">'''${BOARD_ID}'''</span> source ./oe-init-build-env <span style="color:#7030a0">'''${BDIR}'''</span></code>
 +
 
 +
=== <span style="color:#0070c0">To build all image files</span> ===
  
===<span style="color:#0070c0;">To build all image files</span>===
 
 
:To create/continue a build environment
 
:To create/continue a build environment
 
:Perform the following command in terminal console
 
:Perform the following command in terminal console
 
::<code>$ bitbake image-full</code>
 
::<code>$ bitbake image-full</code>
 
:The following files will be located in directory "./tmp/deploy/images/quark" while building process finished successfully.
 
:The following files will be located in directory "./tmp/deploy/images/quark" while building process finished successfully.
<tt>
 
::boot/grub/grub.conf
 
::bzImage
 
::core-image-minimal-initramfs-quark.cpio.gz
 
::grub.efi
 
::image-full-quark.ext3
 
</tt>
 
  
===<span style="color:#0070c0;">To build toolchain installer</span>===
+
 
 +
 
 +
::<tt>boot/grub/grub.conf</tt>
 +
::<tt>bzImage</tt>
 +
::<tt>core-image-minimal-initramfs-quark.cpio.gz</tt>
 +
::<tt>grub.efi</tt>
 +
::<tt>image-full-quark.ext3</tt>
 +
 
 +
 
 +
 
 +
=== <span style="color:#0070c0">To build toolchain installer</span> ===
 +
 
 
:To create/continue a build environment
 
:To create/continue a build environment
 
:Perform the following command in terminal console
 
:Perform the following command in terminal console
 
::<code>$ bitbake image-full -c populate_sdk</code>
 
::<code>$ bitbake image-full -c populate_sdk</code>
:The installer, iot-devkit-glibc-x86_64-image-full-i586-toolchain-<span style="color:#7030a0;">'''${POKY}'''</span>.sh, will be located in the directory "./tmp/deploy/sdk".</code>
+
:The installer, iot-devkit-glibc-x86_64-image-full-i586-toolchain-<span style="color:#7030a0">'''${POKY}'''</span>.sh, will be located in the directory "./tmp/deploy/sdk".
 +
 
 +
=== <span style="color:#0070c0">To build grub individually</span> ===
  
===<span style="color:#0070c0;">To build grub individually</span>===
 
 
:To create/continue a build environment
 
:To create/continue a build environment
 
:Perform the following command in terminal console
 
:Perform the following command in terminal console
Line 162: Line 145:
 
:The file, grub.efi, will be located in directory, ./tmp/deploy/images/quark.
 
:The file, grub.efi, will be located in directory, ./tmp/deploy/images/quark.
  
===<span style="color:#0070c0;">To build linux kernel individually</span>===
+
=== <span style="color:#0070c0">To build linux kernel individually</span> ===
 +
 
 
:To create/continue a build environment
 
:To create/continue a build environment
 
:Perform the following command in terminal console
 
:Perform the following command in terminal console
Line 171: Line 155:
 
:The file, bzImage, will be located in directory, ./tmp/deploy/images/quark.
 
:The file, bzImage, will be located in directory, ./tmp/deploy/images/quark.
  
===<span style="color:#0070c0;">To build initramfs individually</span>===
+
=== <span style="color:#0070c0">To build initramfs individually</span> ===
 +
 
 
:To create/continue a build environment
 
:To create/continue a build environment
 
:Perform the following command in terminal console
 
:Perform the following command in terminal console
Line 177: Line 162:
 
:The file, core-image-minimal-initramfs-quark.cpio.gz, will be located in directory, ./tmp/deploy/images/quark.
 
:The file, core-image-minimal-initramfs-quark.cpio.gz, will be located in directory, ./tmp/deploy/images/quark.
  
=Customization=
+
== <span style="color:#0070c0">Debug console information</span> ==
==<span style="color:#0070c0;">Package addition</span>==
+
 
===<span style="color:#0070c0;">To add tcf-agent & openssh-sftp-server</span>===
+
If you want to see debug message from device, you need to prepare for hardware device and software tool.
:Navigate to the directory where fsl-image-adv.inc located
+
 
::<code>$ cd <span style="color:#7030a0;">'''${BSP_HOME}'''</span>/sources/meta-advantech/recipes-fsl/images</code>
+
=== <span style="color:#0070c0">Preparing for hardware device</span> ===
:Add following line to fsl-image-adv.inc
+
 
::<code>IMAGE_INSTALL += " tcf-agent openssh-sftp-server "</code>
+
*The following URL provides information about the debug port slot and the debug port line for each device
:[[IoTGateway/BSP/Linux/iMX6/Yocto_LBV5_User_Guide#To_continue_an_exist_build_environment|Continue an exist build environment]] and [[IoTGateway/BSP/Linux/iMX6/Yocto_LBV5_User_Guide#To_build_sdcard_image|build sdcard image]]
+
 
 +
[[Debug_Port_Information#Quark|Debug Port Information]]
 +
 
 +
=== <span style="color:#0070c0">Preparing for software tool</span> ===
 +
 
 +
*You need to prepare the debug console tool. For example: "minicom" tool or "putty" tool.
 +
*Baud rate: 115200
 +
 
 +
= Customization =
  
===<span style="color:#0070c0;">To add chromium browser</span>===
+
== <span style="color:#0070c0">Setting up SDK</span> ==
:Navigate to the directory where local.conf located
 
::<code>$ cd <span style="color:#7030a0;">'''${BSP_HOME}'''</span>/<span style="color:#7030a0;">'''${BDIR</span><span style="color:#7030a0;">}'''</span>/conf</code>
 
:Add following two lines to local.conf
 
::<code>CORE_IMAGE_EXTRA_INSTALL += "chromium"</code>
 
::<code>LICENSE_FLAGS_WHITELIST="commercial"</code>
 
:[[IoTGateway/BSP/Linux/iMX6/Yocto_LBV5_User_Guide#To_continue_an_exist_build_environment|Continue an exist build environment]] and [[IoTGateway/BSP/Linux/iMX6/Yocto_LBV5_User_Guide#To_build_sdcard_image|build sdcard image]]
 
  
==<span style="color:#0070c0;">Setting up SDK</span>==
+
:Please follow the section,[[#To_build_toolchain_installer|to build toolchain installer]], to build one toolchain installer first.
:Please follow the section,[[IoTGateway/BSP/Linux/iMX6/Yocto_LBV5_User_Guide#To_build_toolchain_installer|To build toolchain installer]], to build one toolchain installer
 
 
:Perform the following command in terminal console
 
:Perform the following command in terminal console
::<code>$ cd <span style="color:#7030a0;">'''${BSP_HOME}'''</span>/<span style="color:#7030a0;">'''BDIR</span><span style="color:#7030a0;">}'''</span>/tmp/deploy/sdk</code>
+
::<code>$ cd <span style="color:#7030a0">'''${BSP_HOME}'''</span>/<span style="color:#7030a0">'''${BDIR}'''</span>/tmp/deploy/sdk</code>
::<code>$ sudo ./poky-eglibc-x86_64-fsl-image-qt5-cortexa9hf-vfp-neon-toolchain-<span style="color:#7030a0;">'''${POKY}'''</span>.sh</code>
+
::<code>$ sudo ./iot-devkit-glibc-x86_64-image-full-i586-toolchain-<span style="color:#7030a0">'''${POKY}'''</span>.sh</code>
 +
 
 
:Enter directory or press Enter while following question shows up:
 
:Enter directory or press Enter while following question shows up:
::[[File:setting_up_sdk_1.png]]
+
 
 +
 
 +
 
 +
::
 +
{| style="color:white; background:black"
 +
|-
 +
| <tt><big>Enter target directory for SDK (default: /opt/iot-devkit/1.7.2):</big></tt>
 +
|}
 +
 
 +
 
 +
 
 +
 
 
:Just press Enter while following question shows up:
 
:Just press Enter while following question shows up:
::[[File:setting_up_sdk_2.png]]
+
 
 +
 
 +
 
 +
::
 +
{| style="color:white; background:black"
 +
|-
 +
| <tt><big>You are about to install the SDK to "/opt/iot-devkit/1.7.2". Proceed[Y/n]?</big></tt>
 +
|}
 +
 
 +
 
 +
 
 +
 
 
:While following message shows up means the SDK is ready.
 
:While following message shows up means the SDK is ready.
::[[File:setting_up_sdk_3.png]]
 
  
==<span style="color:#0070c0;">Setting up cross compiling environment</span>==
+
 
 +
 
 +
::
 +
{| style="color:white; background:black"
 +
|-
 +
| <tt><big>Extracting SDK...done</big></tt>
 +
|-
 +
| <tt><big>Setting it up...done</big></tt>
 +
|-
 +
| <tt><big>SDK has been successfully set up and is ready to be used.</big></tt>
 +
|}
 +
 
 +
 
 +
 
 +
 
 +
== <span style="color:#0070c0">Setting up cross compiling environment</span> ==
 +
 
 
:SDK has been set up (ref. [[#Setting_up_SDK|Setting up SDK]])
 
:SDK has been set up (ref. [[#Setting_up_SDK|Setting up SDK]])
 
:Perform the following command in terminal console
 
:Perform the following command in terminal console
::<code>$ source /opt/poky/<span style="color:#7030a0;">'''${POKY}'''</span>/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi</code>
+
::<code>$ source /opt/iot-devkit/<span style="color:#7030a0">'''${POKY}'''</span>/environment-setup-i586-poky-linux</code>
 
 
==<span style="color:#0070c0;">Building & updating u-boot manually</span>==
 
===<span style="color:#0070c0;">To build u-boot</span>===
 
:The cross compiling environment has been set up. (ref. [[#Setting_up_cross_compiling_environment|Setting up cross compiling environment]])
 
:Make one copy from Yocto working directory
 
::<code>$ mkdir -p ~/code</code>
 
::<code>$ pushd <span style="color:#7030a0;">'''${BSP_HOME}'''</span>/<span style="color:#7030a0;">'''${BDIR}'''</span>/tmp/work/<span style="color:#7030a0;">'''${MC}'''</span>-poky-linux-gnueabi/</code>
 
::<code>$ rm -rf ~/code/u-boot-imx</code>
 
::<code>$ cp -a ./u-boot-imx/<span style="color:#7030a0;">'''${UBOOT}'''</span>/git ~/code/u-boot-imx</code>
 
::<code>$ popd</code>
 
:Configure u-boot
 
::<code>$ cd ~/code/u-boot-imx</code>
 
::<code>$ make distclean</code>
 
::<code>$ make <span style="color:#7030a0;">'''${MX6PROC}${BOARD}${BOARD_REV}'''</span>_<span style="color:#7030a0;">'''${MEM_SIZE}'''</span>_config</code>
 
:Start building u-boot
 
::<code>$ make -j4 LDFLAGS=</code>
 
:The two files, u-boot-crc.bin & u-boot-crc.bin.crc, are located in directory "~/code/u-boot-imx".
 
  
===<span style="color:#0070c0;">To update u-boot to target device</span>===
+
= Package List =
:Perform the following command to transfer to exist boot-up SD card
 
::<code>$ dd if=u-boot_crc.bin.crc of=<span style="color:#7030a0;">'''${SD_DEVICE}'''</span> bs=512 seek=2 conv=fsync</code>
 
::<code>$ dd if=u-boot-crc.bin of=<span style="color:#7030a0;">'''${SD_DEVICE}'''</span> bs=512 seek=3 conv=fsync</code>
 
:Make sure new u-boot does work then perform the following commands to transfer to on-board flash
 
::<code># dd if=u-boot_crc.bin.crc of=/dev/mmcblk0 bs=512 seek=2 conv=fsync</code>
 
::<code># dd if=u-boot-crc.bin of=/dev/mmcblk0 bs=512 seek=3 conv=fsync</code>
 
  
==<span style="color:#0070c0;">Building & updating kernel/modules/dtb manually</span>==
+
'''In BSP''', list all packages which will be built in the image
===<span style="color:#0070c0;">To build kernel/modules/dtb</span>===
 
:The cross compiling environment has been set up. (ref. [[#Setting_up_cross_compiling_environment|Setting up cross compiling environment]])
 
  
:Make one copy from Yocto working directory
+
bitbake -g '''image-full''' && cat pn-depends.dot | grep -v -e '-native' | grep -v digraph | grep -v -e '-image' \
::<code>$ mkdir -p ~/code</code>
+
| awk '{print $1}' | sort | uniq
::<code>$ pushd <span style="color:#7030a0;">'''${BSP_HOME}'''</span>/<span style="color:#7030a0;">'''${BDIR}'''</span>/tmp/work/<span style="color:#7030a0;">'''${MC}'''</span>-poky-linux-gnueabi/</code>
 
::<code>$ rm -rf ~/code/linux-imx</code>
 
::<code>$ cp -a ./linux-imx/${KERNEL}/git ~/code/inux-imx</code>
 
::<code>$ popd</code>
 
  
:Configure linux kernel
+
File:[[:File:BSP_package1_quark.docx|Package List]]
::<code>$ cd ~/code/linux-imx</code>
 
::<code>$ make distclean</code>
 
::<code>$ make imx_v7_adv_defconfig</code>
 
::<code>$ make menuconfig PKG_CONFIG_SYSROOT_DIR= PKG_CONFIG_PATH=</code>
 
  
:Start building linux kernel
+
Show all recipes (include non-installed packages)
::<code>$ make -j4 zImage LOADADDR=0x10008000 LDFLAGS=</code>
 
  
:The kernel image file, zImage, is located in the directory "./arch/arm/boot/".
+
bitbake -s
  
:Start building kernel modules
+
File:[[:File:BSP_package2_quark.docx|Package Version List]]
::<code>$ make -j4 modules LDFLAGS=</code>
 
  
:Copy all modules to a temporary rootfs directory, "~/temp/rootfs"
+
You can also check <span style="color:purple">'''${BDIR}'''</span>/tmp/deploy/images/quark/image-full-<span style="color:purple">'''${MC}'''</span>.manifest
::<code>$ make modules_install INSTALL_MOD_PATH=~/temp/rootfs</code>
 
  
:Start building device tree blob
+
It will show the same content with checking by opkg tool on target board.
::<code>$ make -j4 <span style="color:#7030a0;">'''${IMX6PROC}'''</span>-<span style="color:#7030a0;">'''${BOARD}'''</span>-<span style="color:#7030a0;">'''${BOARD_REV}'''</span>.dtb</code>
 
  
:The device tree blob, <span style="color:#7030a0;">'''${IMX6PROC}'''</span>-<span style="color:#7030a0;">'''${BOARD}'''</span>-<span style="color:#7030a0;">'''${BOARD_REV}'''</span>.dtb, is located in the directory "./arch/arm/boot/dts/".
+
'''On target board''', list all packages by opkg tool
  
===<span style="color:#0070c0;">To update kernel/modules/dtb to target device</span>===
+
opkg list-installed
:Copy zImage & <span style="color:#7030a0;">'''${IMX6PROC}'''</span>-<span style="color:#7030a0;">'''${BOARD}'''</span>-<span style="color:#7030a0;">'''${BOARD_REV}'''</span>.dtb to the 1<sup>st</sup> partition of SD card
 
:Copy modues to the 2<sup>nd</sup> partition of SD card.
 
:Make sure all new linux kernel, device tree and kernel modules work well, then copy all of them to the on-board flash
 
  
=System Recovery=
+
File:[[:File:Onboard_package_quark.docx|Package List]]
Please refer to [[#Creating_boot-up_on-board_flash_from_prebuilt_image|Creating boot-up on-board flash from prebuilt image]] / [[#Creating_boot-up_on-board_flash_from_built_sdcard_image|sdcard image]] to create a boot-up SD card and transfer whole system to on-board flash.
 

Latest revision as of 11:46, 6 February 2018


Getting Started

Conventions

${BOARD_ID} : board ID
e.g. ubc222 or ubc221
${IMAGE_PACK} : prebuilt image pack
e.g. ubc222 or ubc221
${IMAGE_DIR} : the directory prebuilt image pack extracted to
e.g. ~/U222LIV2011_quark_2016-01-29
${BSP_PACK} : BSP pack
e.g. U222LBV2011_2016-01-29.zip
${BSP_HOME} : the directory BSP pack extracted to
e.g. ~/LBV2011/meta-clanton_v1.2.0
${BDIR} : build directory
e.g. yocto_build
${SD_MOUNT} : mount point of SD card in Ubuntu
e.g. /media/sdf1
${POKY} : Yocto poky version
e.g. 1.7.2
debug console / serial console
serial terminal program (e.g. minicom, putty, teraterm ...) that serial port is configured to 115200 8N1
terminal console
terminal program (e.g. gnome-terminal, xfce4-terminal ...)

Prerequisites

To install Docker Engine on your platform

Please refer to Docker Installation Guide for details

To pull ubuntu 12.04 image from Docker Hub & run the image

$ docker pull advrisc/u12.04-quarklbv2
$ docker run --name quarkLBV2011 -it advrisc/u12.04-quarklbv2 /bin/bash

To copy BSP from local filesystem to the container

$ docker cp ${BSP_PACK} quarkLBV2011:/home/adv/

To copy files from the container's filesystem to local machine

$ docker cp quarkLBV2011:/home/adv/${BSP_HOME}/${BDIR}/tmp/deploy/images/quark ~

Introducing BSP

The BSP is based on Yocto Project with Intel enhanced features for Quark, plus specific target board features from Advantech Inc..

Naming Rule

The tarball/prebuilt image name is consist of the model name followed by "LB" or "LI" plus version number and released date.
For example, U222LBV2011_2016-01-29.zip which "U222" stands for UBC-222, "LB" is acronym of Linux BSP, "V2011" stands for Version 2.011.
For example, U222LIV2011_quark_2016-01-29.zip which "LI" is acronym for prebuilt Linux Image.


BSP pack

Using one of the following ways
  • Unpack BSP pack to home directory
$ unzip ${BSP_PACK} -d ~/
The description of some important folders list below:
${BSP_HOME}/
meta-advantech/: meta layer by Advantech
meta-intel-*/: meta layer by Intel
setup.sh: to setup one new build environment(read this if the BSP is got from GitHub)
oe-init-build-env: to initiate build environment

Prebuilt image pack

(read this if the BSP is got from GitHub)
Perform the following command to unpack prebuilt-image-pack to home directory
$ unzip ${IMAGE_PACK} -d ~/
Prepare one FAT32 formatted SD card, and mount it to mount point
$ cp -a ${IMAGE_DIR}/sdcard/* ${SD_MOUNT}/

Build Instructions

Please refer to this link to set Git configuration first.

To create one new build environment

Perform the following commands in terminal console
$ cd ${BSP_HOME}
$ ./setup.sh(read this if the BSP is got from GitHub)
$ BOARD=${BOARD_ID} source ./oe-init-build-env ${BDIR}

To continue an exist build environment

Perform the following commands in terminal console
$ cd ${BSP_HOME}
$ BOARD=${BOARD_ID} source ./oe-init-build-env ${BDIR}

To build all image files

To create/continue a build environment
Perform the following command in terminal console
$ bitbake image-full
The following files will be located in directory "./tmp/deploy/images/quark" while building process finished successfully.


boot/grub/grub.conf
bzImage
core-image-minimal-initramfs-quark.cpio.gz
grub.efi
image-full-quark.ext3


To build toolchain installer

To create/continue a build environment
Perform the following command in terminal console
$ bitbake image-full -c populate_sdk
The installer, iot-devkit-glibc-x86_64-image-full-i586-toolchain-${POKY}.sh, will be located in the directory "./tmp/deploy/sdk".

To build grub individually

To create/continue a build environment
Perform the following command in terminal console
$ bitbake grub
The file, grub.efi, will be located in directory, ./tmp/deploy/images/quark.

To build linux kernel individually

To create/continue a build environment
Perform the following command in terminal console
to show up menuconfig
$ bitbake linux-yocto-quark -c menuconfig
to do build
$ bitbake linux-yocto-quark
The file, bzImage, will be located in directory, ./tmp/deploy/images/quark.

To build initramfs individually

To create/continue a build environment
Perform the following command in terminal console
$ bitbake core-image-minimal-initramfs
The file, core-image-minimal-initramfs-quark.cpio.gz, will be located in directory, ./tmp/deploy/images/quark.

Debug console information

If you want to see debug message from device, you need to prepare for hardware device and software tool.

Preparing for hardware device

  • The following URL provides information about the debug port slot and the debug port line for each device

Debug Port Information

Preparing for software tool

  • You need to prepare the debug console tool. For example: "minicom" tool or "putty" tool.
  • Baud rate: 115200

Customization

Setting up SDK

Please follow the section,to build toolchain installer, to build one toolchain installer first.
Perform the following command in terminal console
$ cd ${BSP_HOME}/${BDIR}/tmp/deploy/sdk
$ sudo ./iot-devkit-glibc-x86_64-image-full-i586-toolchain-${POKY}.sh
Enter directory or press Enter while following question shows up:


Enter target directory for SDK (default: /opt/iot-devkit/1.7.2):



Just press Enter while following question shows up:


You are about to install the SDK to "/opt/iot-devkit/1.7.2". Proceed[Y/n]?



While following message shows up means the SDK is ready.


Extracting SDK...done
Setting it up...done
SDK has been successfully set up and is ready to be used.



Setting up cross compiling environment

SDK has been set up (ref. Setting up SDK)
Perform the following command in terminal console
$ source /opt/iot-devkit/${POKY}/environment-setup-i586-poky-linux

Package List

In BSP, list all packages which will be built in the image

bitbake -g image-full && cat pn-depends.dot | grep -v -e '-native' | grep -v digraph | grep -v -e '-image' \
| awk '{print $1}' | sort | uniq

File:Package List

Show all recipes (include non-installed packages)

bitbake -s

File:Package Version List

You can also check ${BDIR}/tmp/deploy/images/quark/image-full-${MC}.manifest

It will show the same content with checking by opkg tool on target board.

On target board, list all packages by opkg tool

opkg list-installed

File:Package List