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

From ESS-WIKI
Jump to: navigation, search
(Modify description)
 
(8 intermediate revisions by 3 users not shown)
Line 2: Line 2:
 
<!--
 
<!--
 
{| align="right"
 
{| align="right"
| __TOC__
+
|-
|}
+
| __TOC__
 +
|}
 
-->
 
-->
  
=Getting Started=
+
= Getting Started =
 +
 
 
== <span style="color:#0070c0">Conventions</span> ==
 
== <span style="color:#0070c0">Conventions</span> ==
  
Line 39: Line 41:
 
::terminal program (e.g. gnome-terminal, xfce4-terminal ...)
 
::terminal program (e.g. gnome-terminal, xfce4-terminal ...)
  
==<span style="color:#0070c0;">Prerequisites</span>==
+
== <span style="color:#0070c0">Prerequisites</span> ==
===<span style="color:#0070c0;">To install Docker Engine on your platform</span>===
+
 
 +
=== <span style="color:#0070c0">To install Docker Engine on your platform</span> ===
 +
 
 
:Please refer to [https://docs.docker.com/engine/installation/ Docker Installation Guide] for details
 
:Please refer to [https://docs.docker.com/engine/installation/ Docker Installation Guide] for details
  
===<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>===
+
=== <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 pull advrisc/u12.04-quarklbv2</code>
:<code>$ docker run --name quarkLBV2011 -it advrisc/u12.04-quarklbv2 /bin/bash</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> ===
  
===<span style="color:#0070c0;">To copy BSP from local filesystem to the container</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>
:<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>===
+
== <span style="color:#0070c0">Introducing BSP</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>==
 
 
: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..
  
Line 82: Line 90:
 
=== <span style="color:#0070c0">Prebuilt image pack</span> ===
 
=== <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>
+
:<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>
  
 
:Perform the following command to unpack prebuilt-image-pack to home directory
 
:Perform the following command to unpack prebuilt-image-pack to home directory
Line 104: Line 112:
 
: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> ===
Line 154: 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;">Setting up SDK</span>==
+
 
 +
If you want to see debug message from device, you need to prepare for hardware device and software tool.
 +
 
 +
=== <span style="color:#0070c0">Preparing for hardware device</span> ===
 +
 
 +
*The following URL provides information about the debug port slot and the debug port line for each device
 +
 
 +
[[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">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,[[#To_build_toolchain_installer|to build toolchain installer]], to build one toolchain installer first.
 
: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 ./iot-devkit-glibc-x86_64-image-full-i586-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:
<tt><big>
+
 
::{| style="color:white;background:black"
+
 
|Enter target directory for SDK (default: /opt/iot-devkit/1.7.2):
+
 
 +
::
 +
{| style="color:white; background:black"
 +
|-
 +
| <tt><big>Enter target directory for SDK (default: /opt/iot-devkit/1.7.2):</big></tt>
 
|}
 
|}
</big></tt>
+
 
 +
 
 +
 
  
 
:Just press Enter while following question shows up:
 
:Just press Enter while following question shows up:
<tt><big>
+
 
::{| style="color:white;background:black"
+
 
|You are about to install the SDK to "/opt/iot-devkit/1.7.2". Proceed[Y/n]?
+
 
 +
::
 +
{| 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>
 
|}
 
|}
</big></tt>
+
 
 +
 
 +
 
 +
 
 
:While following message shows up means the SDK is ready.
 
:While following message shows up means the SDK is ready.
<tt><big>
+
 
::{| style="color:white;background:black"
+
 
|Extracting SDK...done
+
 
 +
::
 +
{| style="color:white; background:black"
 
|-
 
|-
|Setting it up...done
+
| <tt><big>Extracting SDK...done</big></tt>
 
|-
 
|-
|SDK has been successfully set up and is ready to be used.
+
| <tt><big>Setting it up...done</big></tt>
 +
|-
 +
| <tt><big>SDK has been successfully set up and is ready to be used.</big></tt>
 
|}
 
|}
</big></tt>
 
  
==<span style="color:#0070c0;">Setting up cross compiling environment</span>==
+
 
 +
 
 +
 
 +
== <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/iot-devkit/<span style="color:#7030a0;">'''${POKY}'''</span>/environment-setup-i586-poky-linux</code>
+
::<code>$ source /opt/iot-devkit/<span style="color:#7030a0">'''${POKY}'''</span>/environment-setup-i586-poky-linux</code>
 +
 
 +
= 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:[[:File:BSP_package1_quark.docx|Package List]]
 +
 
 +
Show all recipes (include non-installed packages)
 +
 
 +
bitbake -s
 +
 
 +
File:[[:File:BSP_package2_quark.docx|Package Version List]]
 +
 
 +
You can also check <span style="color:purple">'''${BDIR}'''</span>/tmp/deploy/images/quark/image-full-<span style="color:purple">'''${MC}'''</span>.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:[[:File:Onboard_package_quark.docx|Package List]]

Latest revision as of 10: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