Difference between revisions of "IoTGateway/BSP/Linux/APQ8016/BSP User Guide V1"

From ESS-WIKI
Jump to: navigation, search
 
(101 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
= Getting Started =
 
= Getting Started =
 +
 +
== <font color="#0070c0">Package Content</font> ==
 +
 +
An official build release consists of the following contents. We take V1.070 for RSB-4760 as example.
 +
 +
{| class="wikitable" style="text-align: ; width: 700px;"
 +
|-
 +
| '''Filename'''
 +
| '''Usage'''
 +
|-
 +
| 410cLBV1070_2017-07-30.tgz
 +
| BSP source code (Yocto meta-layers & bootloader sources)
 +
|-
 +
| 410cLBV1070_2017-07-30_sdk.tgz
 +
| SDK installer
 +
|-
 +
| 4760LIV1070_2017-07-30.tgz
 +
| Yocto Linux Image binaries (boot, recovery images & rootfs)
 +
|-
 +
| 4760LIV1070_2017-07-30_sd_installer.img.gz
 +
| Installation SD card image for Yocto Linux
 +
|-
 +
| 4760LIV1070_2017-07-30_sd_factory.img.gz
 +
| Factory SD card image
 +
|-
 +
| 4760LIV1070_2017-07-30_sdboot.tgz
 +
| Boot images for sd_installer & sd_factory
 +
|-
 +
| 4760LIV1070_2017-07-30_misc.tgz
 +
| Kernel, DTS & kernel modules
 +
|-
 +
| 4760DIV1070_2017-07-30.tgz
 +
| Debian Image binaries (boot & rootfs)
 +
|-
 +
| 4760DIV1070_2017-07-30_sd_installer.img.gz
 +
| Installation SD card image for Debian
 +
|-
 +
| 4760LIV1070_2017-07-30.csv
 +
| Official build information
 +
|-
 +
| update_4760LIV1070_2017-07-30_*.zip
 +
| OTA packages
 +
|-
 +
| *.md5, *log.tgz & *.log
 +
| MD5 checksum & Log files
 +
|}
  
 
== <font color="#0070c0">Conventions</font> ==
 
== <font color="#0070c0">Conventions</font> ==
 +
 +
<span style="color:purple">'''${BSP_HOME}'''</span>: home directory of the BSP
 +
 +
<span style="color:purple">'''${BDIR}'''</span>&nbsp;: build directory (e.g. build/)
 +
 +
<span style="color:purple">'''${MACHINE}'''</span>&nbsp;: available target boards list below
 +
 +
:rsb-4760 / epc-r4761
 +
 +
<span style="color:purple">'''${DISTRO}'''</span>&nbsp;: Linux distribution
 +
 +
:rpb / rpb-wayland
 +
 +
<span style="color:purple">'''${RPB-IMAGES}'''</span>&nbsp;: meta-rpb provides the following images
 +
 +
:rpb-console-image / rpb-desktop-image / rpb-minimal-image / rpb-qt5-image / rpb-weston-image
  
 
== <font color="#0070c0">Build Environment on Host</font> ==
 
== <font color="#0070c0">Build Environment on Host</font> ==
Line 13: Line 75:
 
== <font color="#0070c0">BSP</font> ==
 
== <font color="#0070c0">BSP</font> ==
  
=== <font color="#0070c0">Download BSP from GitHub</font> ===
+
=== <font color="#0070c0">BSP Source</font> ===
 +
 
 +
You have two methods to put BSP into Docker container.
 +
 
 +
==== <font color="#0070c0">[1]&nbsp;Download BSP from GitHub</font> ====
 +
 
 +
The [https://github.com/ADVANTECH-Corp/oe-rpb-manifest oe-rpb-manifest] @GitHub is our manifest repository for Qualcomm APQ8016 projects. You can use '''repo init''' & '''repo sync''' to get the entire BSP we put on GitHub.
 +
 
 +
Create your own BSP folder first.
 +
 
 +
$ mkdir <span style="color:purple">'''${BSP_HOME}'''</span>
 +
$ cd <span style="color:purple">'''${BSP_HOME}'''</span>
 +
 
 +
To get the latest version of Advantech meta layers, you can use BSP specific XML.
 +
 
 +
$ repo init -u [https://github.com/ADVANTECH-Corp/oe-rpb-manifest.git https://github.com/ADVANTECH-Corp/oe-rpb-manifest.git] -b krogoth -m 16.09.xml
 +
 
 +
To get an official release version, you can assign a specific tag & xml, e.g. 410cLBV1120.
 +
 
 +
$ repo init -u [https://github.com/ADVANTECH-Corp/oe-rpb-manifest.git https://github.com/ADVANTECH-Corp/oe-rpb-manifest.git] -b refs/tags/'''410cLBV1120''' -m '''410cLBV1120'''.xml
 +
 
 +
Finally, pull down the BSP by running
 +
 
 +
$ repo sync
  
=== <font color="#0070c0">Copy BSP tarball into Container</font> ===
+
Checking the steps in [https://github.com/ADVANTECH-Corp/oe-rpb-manifest#bsp-source oe-rpb-manifest] for details.
  
=== <font color="#0070c0">Downloads Folder</font> ===
+
==== <font color="#0070c0">[2]&nbsp;Copy BSP tarball into Container</font> ====
 +
 
 +
The BSP tarball file can be found in&nbsp;'''BSP & Image Binaries '''field in [[IoTGateway/BSP/Linux/APQ8016/OS_Support_List|OS Support List]].
 +
 
 +
You can use docker cp to do this.
 +
<div><pre>// Copy BSP source code into container
 +
$ docker cp 410cLBV1070_2017-07-30.tgz <your container id>:/home/adv</pre>
 +
</div>
 +
Or Use&nbsp;''docker run''&nbsp;with&nbsp;'''-v'''&nbsp;options to enable data volume. Then, you are able to put the BSP into the data volume folder.
 +
 
 +
For example, you can put the BSP into /home/root/workspace folder.
 +
<div><pre>$ docker run -it --name docker_test -v /home/root/workspace:/home/adv/BSP advrisc/u14.04-410clbv1 /bin/bash</pre>
 +
</div>
 +
=== <font color="#0070c0">BSP Content</font> ===
 +
 
 +
The descriptions of some important folders in BSP are listed below:
 +
 
 +
'''bitbake/&nbsp;&nbsp;: '''Yocto build command
 +
 
 +
'''bootloader/&nbsp;: '''Bootloader binaries including of CDT, SBL, RPM, LK, etc.
 +
 
 +
'''layers/&nbsp;: '''Sources for meta-layers
 +
 
 +
'''&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; meta-96boards/&nbsp;: '''meta layer of 96Boards definitions
 +
 
 +
&nbsp; &nbsp; &nbsp; &nbsp; '''meta-advantech/&nbsp;'''''':''' meta layer by Advantech
 +
 
 +
'''&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; meta-qcom/&nbsp;:''' meta layer for APQ8016 configurations
 +
 
 +
'''&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; meta-rpb/&nbsp;: '''meta layer for RPB distro
 +
 
 +
'''setup-environment'''''&nbsp;''''':''' to set up build environment for Yocto
  
 
=== <font color="#0070c0">Naming Rule</font> ===
 
=== <font color="#0070c0">Naming Rule</font> ===
  
=== <font color="#0070c0">BSP Content</font> ===
+
The tarball/prebuilt image name consists of the model name followed by "LB" or "LI" plus version number and released date.
 +
 
 +
For example,&nbsp;BSP file name: '''410cLBV1070_2017-07-30.tgz'''
 +
 
 +
Which "410c" means Dragonboard<span style="color:#FF0000;">'''410c'''</span> which a demo board for APQ8016 we use
 +
 
 +
&nbsp;"LB" is acronym of&nbsp;<span style="color:#FF0000;">'''L'''</span>inux&nbsp;<span style="color:#FF0000;">'''B'''</span>SP,
 +
 
 +
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"V1070" stands for&nbsp;<span style="color:#FF0000;">'''V'''</span>ersion&nbsp;<span style="color:#FF0000;">'''1'''.'''070'''</span>.
 +
 
 +
Another example,&nbsp;Yocto image name: '''4760LIV1070_2017-07-30.tgz'''
 +
 
 +
which "4760" stands for&nbsp;<span style="color:#FF0000;">'''RSB-4760'''</span>
 +
 
 +
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "LI" is acronym for prebuilt&nbsp;<span style="color:#FF0000;">'''L'''</span>inux&nbsp;<span style="color:#FF0000;">'''I'''</span>mage.
 +
 
 +
And,&nbsp;Debian image name: '''4760DIV1070_2017-07-30.tgz'''
 +
 
 +
which "4760" stands for&nbsp;<span style="color:#FF0000;">'''RSB-4760'''</span>
 +
 
 +
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "DI" is acronym for prebuilt&nbsp;<span style="color:#FF0000;">'''D'''</span>ebian&nbsp;<span style="color:#FF0000;">'''I'''</span>mage.
 +
 
 +
=== <font color="#0070c0">Pre-built Images</font> ===
 +
 
 +
In '''LIV''' tarball file, you can get binary images. For example,
 +
 
 +
'''boot-Image--4.4-r0-rsb-4760-20170730151529-3.img&nbsp;: '''Boot Image
 +
 
 +
'''rpb-desktop-image-rsb-4760-20170730152516-3.rootfs.img&nbsp;: '''Root filesystem
 +
 
 +
'''recovery-rsb-4760.img&nbsp;:''' Recovery Image
 +
 
 +
&nbsp;
 +
 
 +
For bootloader binaries, the contents are as below.
 +
 
 +
'''advantech_bootloader_emmc_linux-79/'''
 +
 
 +
'''&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;cache.img&nbsp;: '''Cache partition for OTA feature
 +
 
 +
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '''cdt_1.1_MT52L256M32D1PF.bin&nbsp;: '''DDR CDT parameters
 +
 
 +
'''&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; emmc_appsboot.mbn&nbsp;: '''Little Kernel (LK) responsible to load Linux kernel
 +
 
 +
'''&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; flashall&nbsp;: '''Shell script to flash bootloader binaries
 +
 
 +
'''&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpt_both0.bin&nbsp;: '''GPT partition table
 +
 
 +
'''&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hyp.mbn&nbsp;: '''Trust Zone / QHEE
 +
 
 +
'''&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rpm.mbn&nbsp;: '''Resource and Power Management (RPM)
 +
 
 +
'''&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sbl1.mbn&nbsp;:''' Secondary Boot Loader (SBL)
 +
 
 +
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '''tz.mbn&nbsp;: '''Trust Zone / QSEE
  
 
== <font color="#0070c0">Build Instructions</font> ==
 
== <font color="#0070c0">Build Instructions</font> ==
  
 
=== <font color="#0070c0">Create New Build Environment</font> ===
 
=== <font color="#0070c0">Create New Build Environment</font> ===
 +
 +
To create one new build environment, perform following commands in terminal console:
 +
 +
$ cd <span style="color:purple">'''${BSP_HOME}'''</span>
 +
$ MACHINE=<span style="color:purple">'''${MACHINE}'''</span> DISTRO=<span style="color:purple">'''${DISTRO}'''</span> source setup-environment <span style="color:purple">'''${BDIR}'''</span>
 +
 +
You need to read and accept the EULA. Press "Y"
  
 
=== <font color="#0070c0">Load Existed Build Environment</font> ===
 
=== <font color="#0070c0">Load Existed Build Environment</font> ===
 +
 +
To continue an existed build environment, perform following commands in terminal console:
 +
 +
$ cd <span style="color:purple">'''${BSP_HOME}'''</span>
 +
$ source setup-environment <span style="color:purple">'''${BDIR}'''</span>
  
 
=== <font color="#0070c0">Build Images</font> ===
 
=== <font color="#0070c0">Build Images</font> ===
 +
 +
To build the desktop image, run
 +
 +
$ bitbake rpb-desktop-image
 +
 +
=== <font color="#0070c0">Build Linux Kernel</font> ===
 +
 +
To build kernel only, run
 +
 +
$ bitbake linux-linaro-qcomlt
 +
 +
To show up menuconfig
 +
<nowiki>   $bitbake linux-linaro-qcomlt -c menuconfig</nowiki>
 +
 +
Before show up menuconfig , need to install tmux package&nbsp;
 +
 +
* If you operate on docker images, please install tmux application before running this command.
 +
 +
:<nowiki>$ sudo apt-get install tmux</nowiki>
 +
 +
 +
  
 
=== <font color="#0070c0">Build Toolchain Installer</font> ===
 
=== <font color="#0070c0">Build Toolchain Installer</font> ===
 +
 +
To build SDK toolchain installer, perform following commands in terminal console:
 +
 +
$ bitbake <span style="color:purple">'''${RPB-IMAGES}'''</span> -c populate_sdk
 +
 +
The installer (''oecore-x86_64-aarch64-toolchain-nodistro.0.sh'') will be located in the directory "./tmp-rpb-glibc/deploy/sdk".
  
 
=== <font color="#0070c0">Build Bootloader</font> ===
 
=== <font color="#0070c0">Build Bootloader</font> ===
  
=== <font color="#0070c0">Build Linux Kernel</font> ===
+
To build & sign LK bootloader, run
 +
 
 +
$ cd <span style="color:purple">'''${BSP_HOME}'''</span>
 +
$ cd bootloader/lk
 +
$ make -j4 msm8916 EMMC_BOOT=1 TOOLCHAIN_PREFIX=../toolchain/bin/arm-eabi-
 +
 +
$ mv ./build-msm8916/emmc_appsboot.mbn ./build-msm8916/emmc_appsboot_unsigned.mbn
 +
$ ../signlk/signlk.sh -i=./build-msm8916/emmc_appsboot_unsigned.mbn -o=./build-msm8916/emmc_appsboot.mbn -d
  
 
== <font color="#0070c0">Flash Pre-built Images</font> ==
 
== <font color="#0070c0">Flash Pre-built Images</font> ==
  
=== <font color="#0070c0">USB Download Tools</font> ===
+
We provide two ways to flash pre-built images, Fastboot & Installation SD card.
 +
 
 +
=== <font color="#0070c0">Boot Configurations</font> ===
 +
 
 +
Before you&nbsp;start flashing, make sure the '''SW1 '''boot switch is set correctly.
 +
 
 +
For example, to boot from rescue or sd-installer sdcard, you have to set 01&nbsp;(Boot Config 1 = Off, Boot Config 2 = On).
 +
 
 +
{| class="wikitable" style="text-align: ; width: 500px;"
 +
|-
 +
| style="text-align: center;" | '''Boot Config 1'''
 +
| style="text-align: center;" | '''Boot Config 2'''
 +
| '''Boot Option'''
 +
|-
 +
| style="text-align: center;" | 0
 +
| style="text-align: center;" | 0
 +
| eMMC -> SD card -> USB
 +
|-
 +
| style="text-align: center;" | 0
 +
| style="text-align: center;" | 1
 +
| SD card -> eMMC ->USB
 +
|-
 +
| style="text-align: center;" | 1
 +
| style="text-align: center;" | 0
 +
| eMMC -> USB
 +
|-
 +
| style="text-align: center;" | 1
 +
| style="text-align: center;" | 1
 +
| USB
 +
|}
  
 
=== <font color="#0070c0">Fastboot Tool</font> ===
 
=== <font color="#0070c0">Fastboot Tool</font> ===
  
=== <font color="#0070c0">Installation SD Card</font> ===
+
By default, we use&nbsp;<code>fastboot</code>&nbsp;utility to flash images into on-board eMMC.
 +
 
 +
'''[Ubuntu]''' You can get the package by this way.
 +
<pre>$ sudo apt-get install android-tools-fastboot
 +
</pre>
 +
 
 +
'''[Windows]''' Please get the Android standalone tool <span style="font-size:xx-large;">[https://dl.google.com/android/repository/platform-tools-latest-windows.zip here].</span>
 +
 
 +
To flash the images, the target device must be booted into&nbsp;<code>fastboot mode</code>.
 +
 
 +
There are 2 ways to do this.
 +
 
 +
1. Boot from rescue sdcard
 +
 
 +
*Download the rescue image from&nbsp;[https://github.com/ADVANTECH-Corp/db-boot-tools/raw/17.04-adv/advantech_sdcard_rescue-79.zip here]. It will be named like&nbsp;<code>advantech_sdcard_rescue-&lt;version&gt;.zip</code>.
 +
*Flash the rescue image into a sdcard. Then, insert the sdcard and boot from it. You will enter the fastboot mode by default.
 +
 
 +
2. Hold volume down key when booting
 +
 
 +
*While holding down volume down key, power on the target device.
 +
*After a few seconds, release Vol down key. Then, it will enter fastboot mode as well.
 +
*You can only do this, when bootloader is already flashed on your target device.
 +
 
 +
Once you enter fastboot mode, you can plug a USB cable from host to target device. To verify the fastboot connection, you can run:
 +
 
 +
'''[Ubuntu]'''
 +
<pre>$ sudo fastboot devices
 +
</pre>
 +
 
 +
'''[Windows]'''
 +
<pre>$ cd <android-standalone-tool-unzip-path>
 +
$ fastboot devices
 +
</pre>
 +
 
 +
==== Bootloader ====
 +
 
 +
Besides, you also need the bootloader packages from&nbsp;[https://github.com/ADVANTECH-Corp/db-boot-tools/raw/17.04-adv/advantech_bootloader_emmc_linux-79.zip here], it will be named something like&nbsp;<code>advantech_bootloader_emmc_linux-&lt;version&gt;.zip</code>.
 +
 
 +
Unzip the file and run the&nbsp;<code>flashall</code>&nbsp;script to update bootloader.
 +
 
 +
'''Note: '''You need to add filename extension (''.bat'') for the <code>flashall</code> script on Windows. In addition, please also make sure the path of <code>fastboot</code> tool&nbsp;is correct or define the path in your '''''PATH&nbsp;'''''envrionment.
 +
 
 +
==== Flash into eMMC ====
 +
 
 +
At the end of any successful build you will end up with the following artifacts.
 +
 
 +
*<code><span style="color:purple">'''${RPB-IMAGES}'''</span>-<span style="color:purple">'''${MACHINE}'''</span>.ext4.gz</code>&nbsp;and
 +
*<code>boot-<span style="color:purple">'''${MACHINE}'''</span>.img</code>
 +
 
 +
If your <span style="color:purple">'''${RPB-IMAGES}'''</span> is&nbsp;<code>rpb-desktop-image</code>&nbsp;and <span style="color:purple">'''${MACHINE}'''</span> is&nbsp;<code>rsb-4760</code>, the images will be&nbsp;<code>rpb-desktop-image-rsb-4760.ext4.gz</code>&nbsp;and&nbsp;<code>boot-rsb-4760.img</code>&nbsp;respectively.
 +
 
 +
You can use fastboot to flash them as well.
 +
 
 +
$ fastboot flash boot boot-<span style="color:purple">'''${MACHINE}'''</span>.img
 +
 
 +
Because fastboot supports sparse image, you have to transform the rootfs image before flashing.
 +
 
 +
$ gunzip <span style="color:purple">'''${RPB-IMAGES}'''</span>-<span style="color:purple">'''${MACHINE}'''</span>.ext4.gz
 +
$ ext2simg -v <span style="color:purple">'''${RPB-IMAGES}'''</span>-<span style="color:purple">'''${MACHINE}'''</span>.ext4 <span style="color:purple">'''${RPB-IMAGES}'''</span>-<span style="color:purple">'''${MACHINE}'''</span>.img
 +
$ fastboot flash rootfs <span style="color:purple">'''${RPB-IMAGES}'''</span>-<span style="color:purple">'''${MACHINE}'''</span>.img
 +
 
 +
You can also download & flash the pre-built images, e.g. 4760'''LIV'''1070_2017-07-30.tgz or 4760'''DIV'''1070_2017-07-30.tgz
 +
 
 +
Both Debian & Yocto Linux have the same '''boot '''& '''rootfs '''partition names.
 +
 
 +
$ fastboot flash boot <boot image>
 +
$ fastboot flash rootfs <rootfs image>
 +
 
 +
=== <font color="#0070c0">Installation SD card</font> ===
 +
 
 +
1. Download specific [[IoTGateway/BSP/Linux/APQ8016/OS_Support_List|sd-installer images]] into SD card, e.g. 4760'''LIV'''1070_2017-07-30_sd_installer.img.gz or 4760'''DIV'''1070_2017-07-30_sd_installer.img.gz
 +
 
 +
2. Boot from installation SD card, and Click "Install"
 +
 
 +
:'''DIV for Debian'''
 +
 
 +
:[[File:R0026013.JPG|RTENOTITLE]]
 +
 
 +
:'''LIV for Yocto'''
 +
 
 +
:[[File:Install 1.jpg|600x700px|Install_1]]
 +
 
 +
3. Select "Yes" to flash all partitions
 +
 
 +
:[[File:Install 2.jpg|600x700px|Install_2]]
 +
 
 +
4. Waiting for process finished
 +
 
 +
:[[File:Install 3.jpg|600x700px|Install_3]]
 +
 
 +
5. Finish and Reboot
 +
 
 +
:[[File:Install 4.jpg|600x700px|Install_4]]
 +
 
 +
== <font color="#0070c0">Screenshot</font> ==
 +
 
 +
After flashing images, you can boot into OS. Here are the screenshots you should see.
 +
 
 +
=== <font color="#0070c0">Yocto Linux</font> ===
 +
 
 +
A simple desktop environment with '''Xorg '''and '''openbox'''. You can use '''Xterm '''program for terminal.
 +
 
 +
[[File:Rsb4760-yocto-screen.jpg|600px|Rsb4760-yocto-screen.jpg]]
 +
 
 +
=== <font color="#0070c0">Debian</font> ===
 +
 
 +
A desktop environment using '''LXQt'''. You can configure network & other settings via GUI.
 +
 
 +
[[File:Rsb4760-debian-screen1.png|400px|Rsb4760-debian-screen1.png]]
 +
 
 +
[[File:Rsb4760-debian-screen2.png|400px|Rsb4760-debian-screen2.png]]
 +
 
 +
== <span style="color:#0070c0">Debug console information</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#APQ8016|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 =
 
= Customization =
  
 
== <font color="#0070c0">Set Up SDK</font> ==
 
== <font color="#0070c0">Set Up SDK</font> ==
 +
 +
You can get the SDK installer from official releases, or build by yourself.
 +
 +
$ tar zxvf 410cLBV1070_2017-07-30_sdk.tgz
 +
$ cd 410cLBV1070_2017-07-30_sdk
 +
-OR-
 +
$ cd <span style="color:#7030a0">'''${BSP_HOME}'''</span>/<span style="color:#7030a0">'''${BDIR}'''</span>/tmp-rpb-glibc/deploy/sdk
 +
 +
Perform the following command to install.
 +
 +
$ sudo ./oecore-x86_64-aarch64-toolchain-nodistro.0.sh
 +
 +
Enter new installed directory or just press Enter to use default directory. (''/usr/local/oecore-x86_64'')
 +
 +
Once you see the following prompt, the SDK is installed successfully.
 +
 +
Extracting SDK......................................................done
 +
Setting it up...done
 +
SDK has been successfully set up and is ready to be used.
 +
Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
 +
  $ . /usr/local/oecore-x86_64/environment-setup-aarch64-oe-linux
 +
 +
== <font color="#0070c0">Create Debian Images</font> ==
 +
 +
In this section, we will show you how to generate a Debian image based on the same Yocto kernel.
 +
 +
This is also how we generate the official Debian images. If you are only interested in the images, you can just skip this section and download the '''DIV''' binaries, e.g.&nbsp;4760'''DIV'''1070_2017-07-30.tgz or 4760'''DIV'''1070_2017-07-30_sd_installer.img.gz for V1.070.
 +
 +
=== <font color="#0070c0">Customize the kernel source code</font> ===
 +
 +
In Yocto BSP, you can build kernel easily. To learn how to build kernel, you can refer to [https://github.com/ADVANTECH-Corp/oe-rpb-manifest oe-rpb-manifest].
 +
 +
Then, we need three output files in your build artifacts.
 +
 +
*Kernel image (Image-MACHINE.bin)
 +
*DTS image (dt-Image-MACHINE.img)
 +
*Modules (modules-MACHINE.tgz)
 +
 +
Now you need to create a valid boot image with your own kernel build.
 +
 +
On your host PC, we need to install the following tools:
 +
 +
$ git clone [git://codeaurora.org/quic/kernel/skales git://codeaurora.org/quic/kernel/skales]
 +
 +
To create the boot image, you also need a ramdisk image, and you can get one from the 96Boards release:
 +
 +
$ wget [https://builds.96boards.org/snapshots/dragonboard410c/linaro/debian/227/initrd.img-4.9.21-linaro-lt-qcom https://builds.96boards.org/releases/dragonboard410c/linaro/debian/16.09/initrd.img-4.4.23-linaro-lt-qcom]
 +
 +
The tool ''mkbootimg'' is a standalone application that will process all files and create the boot image that can then be booted on the target board, or flash into the on-board eMMC. The boot image also contains the kernel bootargs, which can be changed as needed in the next command:
 +
 +
$ ./skales/mkbootimg --kernel Image-MACHINE.bin \
 +
                    --ramdisk initrd.img-4.4.23-linaro-lt-qcom \
 +
                    --output boot-MACHINE-debian.img \
 +
                    --dt dt-Image-MACHINE.img \
 +
                    --pagesize 2048 \
 +
                    --base 0x80000000 \
 +
                    --cmdline "root=/dev/disk/by-partlabel/rootfs rw rootwait console=ttyMSM0,115200n8"
 +
 +
After this step, you will get a boot image for Debian called ''boot-MACHINE-debian.img''.
 +
 +
=== <font color="#0070c0">Revise Debian Rootfs</font> ===
 +
 +
Basically, we can adopt Linaro's Debian rootfs directly with a little modifications for kernel modules. First, you can get the Debian rootfs from the 96Boards release:
 +
 +
$ wget [https://builds.96boards.org/snapshots/dragonboard410c/linaro/debian/227/linaro-stretch-alip-qcom-snapdragon-arm64-20170427-227.img.gz https://builds.96boards.org/releases/dragonboard410c/linaro/debian/16.09/linaro-jessie-alip-qcom-snapdragon-arm64-20161006-144.img.gz]
 +
 +
Second, unzip the file and transform it from sparse image to raw image.
 +
 +
$ gunzip linaro-jessie-alip-qcom-snapdragon-arm64-20161006-144.img.gz
 +
$ simg2img linaro-jessie-alip-qcom-snapdragon-arm64-20161006-144.img rootfs.raw
 +
 +
Then, you are able to mount the raw rootfs, and update with your kernel modules.
 +
 +
$ sudo mount -o loop rootfs.raw /mnt
 +
$ sudo rm -rf /mnt/lib/modules/
 +
 +
// Copy firmware & modules into /lib
 +
$ tar zxf modules-MACHINE.tgz
 +
$ sudo cp -a lib/* /mnt/lib
 +
$ sudo umount /mnt
 +
 +
Finally, make the rootfs into sparse image.
 +
 +
$ ext2simg -v rootfs.raw linaro-jessie-alip-qcom-snapdragon-arm64-20161006-144-MACHINE.img
 +
 +
=== <font color="#0070c0">Flash Debian Images</font> ===
 +
 +
Now, you have both boot & rootfs images. You can easily flash them into eMMC via fastboot utility.
 +
 +
$ sudo fastboot erase boot
 +
$ sudo fastboot flash boot boot-MACHINE-debian.img
 +
$ sudo fastboot erase rootfs
 +
$ sudo fastboot flash rootfs linaro-jessie-alip-qcom-snapdragon-arm64-20161006-144-MACHINE.img
 +
 +
'''Note:''' After booting up, you have an important thing to do! You have to generate modules.dep and map files.
 +
 +
$ depmod -a
 +
 +
After reboot, the Debian system should work well!
 +
 +
== <font color="#0070c0">Create Bootable Sdcard</font> ==
 +
 +
In this section, we will show you how to create a bootable sdcard&nbsp;image based on the same Yocto kernel.
 +
 +
The difference between normal eMMC image & bootable sdcard image are:
 +
 +
*bootloader
 +
*boot argument in boot.img
 +
 +
So, we have to replace these two parts in the following way.
 +
 +
First, get the bootloader for sd boot [https://github.com/ADVANTECH-Corp/db-boot-tools/raw/17.04-adv/advantech_bootloader_sd_linux-79.zip here]. It will be named something like&nbsp;<code>advantech_bootloader_sd_linux-&lt;version&gt;.zip</code>.
 +
 +
Second, get the corresponding sdboot boot image from official release. For example, boot-sdboot*.img in 4760LIV1070_2017-07-30_sdboot.tgz for V1.070.&nbsp;Or, you can generate your own sdboot boot image via <code>mkbootimg</code> tool as well.
 +
 +
$ ./skales/mkbootimg --kernel Image-MACHINE.bin \
 +
                    --ramdisk <span style="color:#7030a0">'''initrd.img'''</span> \
 +
                    --output boot-sdboot-MACHINE.img \
 +
                    --dt dt-Image-MACHINE.img \
 +
                    --pagesize 2048 \
 +
                    --base 0x80000000 \
 +
                    --cmdline "root=<span style="color:red">'''/dev/mmcblk1p13'''</span> rw rootwait console=ttyMSM0,115200n8"
 +
 +
'''Note''': The ''initrd.img'' is a fake ramdisk image.
 +
 +
$ echo "This is not an initrd" > initrd.img
 +
 +
Now, you should have new bootloader, boot.img for sdboot, and original eMMC image binaries. Please rename ''boot-sdboot-MACHINE.img'' to '''boot.img''' and unzip ''rpb-desktop-image-MACHINE-*.rootfs.img.gz'' to '''rootfs.img'''. Then, also unzip bootloader file, and put all the images we mentioned above into the same folder.
 +
 +
Finally, you can use the <code>db-boot-tools</code> to create bootable sdcard image.
 +
 +
git clone [https://github.com/ADVANTECH-Corp/db-boot-tools.git https://github.com/ADVANTECH-Corp/db-boot-tools.git]
 +
cd db-boot-tools
 +
sudo ./mksdcard -p dragonboard410c/linux/sdcard.txt -s 3G -i <span style="color:#7030a0">'''${THE_FOLDER_YOU_PUT_ALL_THE_IMAGES_IN}'''</span> -o <span style="color:#7030a0">'''${SDCARD_IMG_NAME}'''</span>
 +
 +
'''Note''': The '''-s''' option means&nbsp;''image size''. You can modify as your need.
 +
 +
= Add-On Values =
 +
 +
== <font color="#0070c0">RMM</font> ==
 +
 +
The installation files of RMM (Remote Monitoring and Management) 3.2 Agent are prepared and it's ready to install in our pre-built images.
 +
 +
Please refer to [[WISE-PaaS/RMM_Agent|WISE-PaaS/RMM_Agent]] for details.
 +
 +
== <font color="#0070c0">OTA</font> ==
 +
 +
It is a new feature Advantech provides to upgrade your devices easily through OTA (Over The Air). Customers can upload their own update packages onto OTA server, and handle the update procedures via specific website.
 +
 +
Please refer to [[RISC_FOTA|RISC_FOTA]] for details.
 +
 +
'''Note:'''&nbsp;If your version is '''1.090''', you have to create the OTA package manually. Please follow the instructions below.&nbsp;Or you can upgrade your device to '''1.110''' (or later) to fix this OTA issue.
 +
 +
When you generate the OTA package zip file by [[:File:OTA_PACKAGE_TOOL.zip|OTA PACKAGE TOOL]], the contents should look like below.
 +
 +
:rsb4760-v0.0.0.2-69d11df073258d6de8357614d5cf43ec.zip
 +
:|- PackageInfo.xml
 +
:|- rsb4760.zip
 +
::|- Deploy.xml
 +
::|- rsb4760/
 +
:::|- install.sh
 +
:::|- OTAPackager SOP-Chinese.pdf
 +
:::|- OTAPackager-1.0.9.exe
 +
:::|- result.sh
 +
:::|- update.zip
 +
 +
 +
 +
Now, we are going to create a similar one by ourselves. The goal is to unzip the 2nd ZIP in the package.
 +
 +
1. First, create new folders we need with specific package name, e.g. rsb4760.
 +
 +
For example, we create a new ''rsb4760-v0.0.0.1-checksum'' folder with two ''rsb4760'' folders inside. Totally, we have 3 layers of folder now.
 +
 +
:rsb4760-v0.0.0.1-checksum
 +
:|- rsb4760/
 +
::|- rsb4760/
 +
 +
2. Put '''PackageInfo.xml''' into the 1st folder.
 +
 +
Please make sure the &lt;Password&gt; field is empty.
 +
 +
<?xml version="1.0" encoding="utf-8" standalone="no"?> <PackageDescription>
 +
  <BaseSettings>
 +
    <PackageType>rsb4760</PackageType>
 +
    <Version>0.0.0.1</Version>
 +
    <OS></OS>
 +
    <Arch></Arch>
 +
  </BaseSettings>
 +
  <Password></Password>
 +
</PackageDescription>
 +
 +
3. Put '''Deploy.xml''' into the 2nd folder.
 +
 +
<?xml version="1.0" encoding="utf-8" standalone="no"?>
 +
<DeployDescription>
 +
  <DeploySetting>
 +
    <DeployFileName>rsb4760/install.sh</DeployFileName>
 +
    <RebootFlag>1</RebootFlag>
 +
    <ResultCheckScript>rsb4760/result.sh</ResultCheckScript>
 +
  </DeploySetting>
 +
</DeployDescription>
 +
 +
4. Finally, put the remainders into the 3rd folder. You can find these files in OTA PACKAGE TOOL.
 +
 +
The update.zip is created by '''ota-package.sh'''
 +
 +
:- install.sh
 +
:- OTAPackager SOP-Chinese.pdf
 +
:- OTAPackager-1.0.9.exe
 +
:- result.sh
 +
:- update.zip
 +
 +
5. ZIP the entire folder, and calculate the MD5 checksum.
 +
 +
cd rsb4760-v0.0.0.1-checksum
 +
zip -r rsb4760-v0.0.0.1-checksum.zip .
 +
md5sum rsb4760-v0.0.0.1-checksum.zip
 +
 +
If the MD5 value is ''84c14f0cebb5814b98e61259e88f352a'', you have to rename the ZIP file as rsb4760-v0.0.0.1-84c14f0cebb5814b98e61259e88f352a.zip
 +
 +
That's all. This OTA package can be uploaded to the OTA server now!
 +
 +
= Package List =
 +
 +
'''In BSP''', list all packages which will be built in the image
 +
 +
bitbake -g '''rpb-desktop-image''' && cat pn-depends.dot | grep -v -e '-native' | grep -v digraph | grep -v -e '-image' \
 +
| awk '{print $1}' | sort | uniq
 +
 +
File:[[:File:BSP_package1_410c.docx|Package List]]
 +
 +
Show all recipes (include non-installed packages)
 +
 +
bitbake -s
 +
 +
File:[[:File:BSP_package2_410c.docx|Package Version List]]
 +
 +
You can also check <span style="color:purple">'''${BDIR}'''</span>/tmp/deploy/images/<span style="color:purple">'''${MACHINE}'''</span>/rpb-desktop-image-<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_410c.docx|Package List]]

Latest revision as of 10:24, 5 June 2018

Getting Started

Package Content

An official build release consists of the following contents. We take V1.070 for RSB-4760 as example.

Filename Usage
410cLBV1070_2017-07-30.tgz BSP source code (Yocto meta-layers & bootloader sources)
410cLBV1070_2017-07-30_sdk.tgz SDK installer
4760LIV1070_2017-07-30.tgz Yocto Linux Image binaries (boot, recovery images & rootfs)
4760LIV1070_2017-07-30_sd_installer.img.gz Installation SD card image for Yocto Linux
4760LIV1070_2017-07-30_sd_factory.img.gz Factory SD card image
4760LIV1070_2017-07-30_sdboot.tgz Boot images for sd_installer & sd_factory
4760LIV1070_2017-07-30_misc.tgz Kernel, DTS & kernel modules
4760DIV1070_2017-07-30.tgz Debian Image binaries (boot & rootfs)
4760DIV1070_2017-07-30_sd_installer.img.gz Installation SD card image for Debian
4760LIV1070_2017-07-30.csv Official build information
update_4760LIV1070_2017-07-30_*.zip OTA packages
*.md5, *log.tgz & *.log MD5 checksum & Log files

Conventions

${BSP_HOME}: home directory of the BSP

${BDIR} : build directory (e.g. build/)

${MACHINE} : available target boards list below

rsb-4760 / epc-r4761

${DISTRO} : Linux distribution

rpb / rpb-wayland

${RPB-IMAGES} : meta-rpb provides the following images

rpb-console-image / rpb-desktop-image / rpb-minimal-image / rpb-qt5-image / rpb-weston-image

Build Environment on Host

Currently, we adopt Docker as build environment.

You can get the latest version of advrisc/u14.04-410clbv1 Docker image for developing Qualcomm APQ8016 projects.

If you don't know much about Docker, please refer to IoTGateway/Docker for details.

BSP

BSP Source

You have two methods to put BSP into Docker container.

[1] Download BSP from GitHub

The oe-rpb-manifest @GitHub is our manifest repository for Qualcomm APQ8016 projects. You can use repo init & repo sync to get the entire BSP we put on GitHub.

Create your own BSP folder first.

$ mkdir ${BSP_HOME}
$ cd ${BSP_HOME}

To get the latest version of Advantech meta layers, you can use BSP specific XML.

$ repo init -u https://github.com/ADVANTECH-Corp/oe-rpb-manifest.git -b krogoth -m 16.09.xml

To get an official release version, you can assign a specific tag & xml, e.g. 410cLBV1120.

$ repo init -u https://github.com/ADVANTECH-Corp/oe-rpb-manifest.git -b refs/tags/410cLBV1120 -m 410cLBV1120.xml

Finally, pull down the BSP by running

$ repo sync

Checking the steps in oe-rpb-manifest for details.

[2] Copy BSP tarball into Container

The BSP tarball file can be found in BSP & Image Binaries field in OS Support List.

You can use docker cp to do this.

// Copy BSP source code into container
$ docker cp 410cLBV1070_2017-07-30.tgz <your container id>:/home/adv

Or Use docker run with -v options to enable data volume. Then, you are able to put the BSP into the data volume folder.

For example, you can put the BSP into /home/root/workspace folder.

$ docker run -it --name docker_test -v /home/root/workspace:/home/adv/BSP advrisc/u14.04-410clbv1 /bin/bash

BSP Content

The descriptions of some important folders in BSP are listed below:

bitbake/  : Yocto build command

bootloader/ : Bootloader binaries including of CDT, SBL, RPM, LK, etc.

layers/ : Sources for meta-layers

        meta-96boards/ : meta layer of 96Boards definitions

        meta-advantech/ ':' meta layer by Advantech

        meta-qcom/ : meta layer for APQ8016 configurations

        meta-rpb/ : meta layer for RPB distro

setup-environment : to set up build environment for Yocto

Naming Rule

The tarball/prebuilt image name consists of the model name followed by "LB" or "LI" plus version number and released date.

For example, BSP file name: 410cLBV1070_2017-07-30.tgz

Which "410c" means Dragonboard410c which a demo board for APQ8016 we use

 "LB" is acronym of Linux BSP,

           "V1070" stands for Version 1.070.

Another example, Yocto image name: 4760LIV1070_2017-07-30.tgz

which "4760" stands for RSB-4760

          "LI" is acronym for prebuilt Linux Image.

And, Debian image name: 4760DIV1070_2017-07-30.tgz

which "4760" stands for RSB-4760

          "DI" is acronym for prebuilt Debian Image.

Pre-built Images

In LIV tarball file, you can get binary images. For example,

boot-Image--4.4-r0-rsb-4760-20170730151529-3.img : Boot Image

rpb-desktop-image-rsb-4760-20170730152516-3.rootfs.img : Root filesystem

recovery-rsb-4760.img : Recovery Image

 

For bootloader binaries, the contents are as below.

advantech_bootloader_emmc_linux-79/

        cache.img : Cache partition for OTA feature

        cdt_1.1_MT52L256M32D1PF.bin : DDR CDT parameters

        emmc_appsboot.mbn : Little Kernel (LK) responsible to load Linux kernel

        flashall : Shell script to flash bootloader binaries

        gpt_both0.bin : GPT partition table

        hyp.mbn : Trust Zone / QHEE

        rpm.mbn : Resource and Power Management (RPM)

        sbl1.mbn : Secondary Boot Loader (SBL)

        tz.mbn : Trust Zone / QSEE

Build Instructions

Create New Build Environment

To create one new build environment, perform following commands in terminal console:

$ cd ${BSP_HOME}
$ MACHINE=${MACHINE} DISTRO=${DISTRO} source setup-environment ${BDIR}

You need to read and accept the EULA. Press "Y"

Load Existed Build Environment

To continue an existed build environment, perform following commands in terminal console:

$ cd ${BSP_HOME}
$ source setup-environment ${BDIR}

Build Images

To build the desktop image, run

$ bitbake rpb-desktop-image

Build Linux Kernel

To build kernel only, run

$ bitbake linux-linaro-qcomlt

To show up menuconfig    $bitbake linux-linaro-qcomlt -c menuconfig

Before show up menuconfig , need to install tmux package 

* If you operate on docker images, please install tmux application before running this command.

$ sudo apt-get install tmux



Build Toolchain Installer

To build SDK toolchain installer, perform following commands in terminal console:

$ bitbake ${RPB-IMAGES} -c populate_sdk

The installer (oecore-x86_64-aarch64-toolchain-nodistro.0.sh) will be located in the directory "./tmp-rpb-glibc/deploy/sdk".

Build Bootloader

To build & sign LK bootloader, run

$ cd ${BSP_HOME}
$ cd bootloader/lk
$ make -j4 msm8916 EMMC_BOOT=1 TOOLCHAIN_PREFIX=../toolchain/bin/arm-eabi-

$ mv ./build-msm8916/emmc_appsboot.mbn ./build-msm8916/emmc_appsboot_unsigned.mbn
$ ../signlk/signlk.sh -i=./build-msm8916/emmc_appsboot_unsigned.mbn -o=./build-msm8916/emmc_appsboot.mbn -d

Flash Pre-built Images

We provide two ways to flash pre-built images, Fastboot & Installation SD card.

Boot Configurations

Before you start flashing, make sure the SW1 boot switch is set correctly.

For example, to boot from rescue or sd-installer sdcard, you have to set 01 (Boot Config 1 = Off, Boot Config 2 = On).

Boot Config 1 Boot Config 2 Boot Option
0 0 eMMC -> SD card -> USB
0 1 SD card -> eMMC ->USB
1 0 eMMC -> USB
1 1 USB

Fastboot Tool

By default, we use fastboot utility to flash images into on-board eMMC.

[Ubuntu] You can get the package by this way.

$ sudo apt-get install android-tools-fastboot

[Windows] Please get the Android standalone tool here.

To flash the images, the target device must be booted into fastboot mode.

There are 2 ways to do this.

1. Boot from rescue sdcard

  • Download the rescue image from here. It will be named like advantech_sdcard_rescue-<version>.zip.
  • Flash the rescue image into a sdcard. Then, insert the sdcard and boot from it. You will enter the fastboot mode by default.

2. Hold volume down key when booting

  • While holding down volume down key, power on the target device.
  • After a few seconds, release Vol down key. Then, it will enter fastboot mode as well.
  • You can only do this, when bootloader is already flashed on your target device.

Once you enter fastboot mode, you can plug a USB cable from host to target device. To verify the fastboot connection, you can run:

[Ubuntu]

$ sudo fastboot devices

[Windows]

$ cd <android-standalone-tool-unzip-path>
$ fastboot devices

Bootloader

Besides, you also need the bootloader packages from here, it will be named something like advantech_bootloader_emmc_linux-<version>.zip.

Unzip the file and run the flashall script to update bootloader.

Note: You need to add filename extension (.bat) for the flashall script on Windows. In addition, please also make sure the path of fastboot tool is correct or define the path in your PATH envrionment.

Flash into eMMC

At the end of any successful build you will end up with the following artifacts.

  • ${RPB-IMAGES}-${MACHINE}.ext4.gz and
  • boot-${MACHINE}.img

If your ${RPB-IMAGES} is rpb-desktop-image and ${MACHINE} is rsb-4760, the images will be rpb-desktop-image-rsb-4760.ext4.gz and boot-rsb-4760.img respectively.

You can use fastboot to flash them as well.

$ fastboot flash boot boot-${MACHINE}.img

Because fastboot supports sparse image, you have to transform the rootfs image before flashing.

$ gunzip ${RPB-IMAGES}-${MACHINE}.ext4.gz
$ ext2simg -v ${RPB-IMAGES}-${MACHINE}.ext4 ${RPB-IMAGES}-${MACHINE}.img
$ fastboot flash rootfs ${RPB-IMAGES}-${MACHINE}.img

You can also download & flash the pre-built images, e.g. 4760LIV1070_2017-07-30.tgz or 4760DIV1070_2017-07-30.tgz

Both Debian & Yocto Linux have the same boot & rootfs partition names.

$ fastboot flash boot <boot image>
$ fastboot flash rootfs <rootfs image>

Installation SD card

1. Download specific sd-installer images into SD card, e.g. 4760LIV1070_2017-07-30_sd_installer.img.gz or 4760DIV1070_2017-07-30_sd_installer.img.gz

2. Boot from installation SD card, and Click "Install"

DIV for Debian
RTENOTITLE
LIV for Yocto
Install_1

3. Select "Yes" to flash all partitions

Install_2

4. Waiting for process finished

Install_3

5. Finish and Reboot

Install_4

Screenshot

After flashing images, you can boot into OS. Here are the screenshots you should see.

Yocto Linux

A simple desktop environment with Xorg and openbox. You can use Xterm program for terminal.

Rsb4760-yocto-screen.jpg

Debian

A desktop environment using LXQt. You can configure network & other settings via GUI.

Rsb4760-debian-screen1.png

Rsb4760-debian-screen2.png

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

Set Up SDK

You can get the SDK installer from official releases, or build by yourself.

$ tar zxvf 410cLBV1070_2017-07-30_sdk.tgz
$ cd 410cLBV1070_2017-07-30_sdk
-OR-
$ cd ${BSP_HOME}/${BDIR}/tmp-rpb-glibc/deploy/sdk

Perform the following command to install.

$ sudo ./oecore-x86_64-aarch64-toolchain-nodistro.0.sh

Enter new installed directory or just press Enter to use default directory. (/usr/local/oecore-x86_64)

Once you see the following prompt, the SDK is installed successfully.

Extracting SDK......................................................done
Setting it up...done
SDK has been successfully set up and is ready to be used.
Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
 $ . /usr/local/oecore-x86_64/environment-setup-aarch64-oe-linux

Create Debian Images

In this section, we will show you how to generate a Debian image based on the same Yocto kernel.

This is also how we generate the official Debian images. If you are only interested in the images, you can just skip this section and download the DIV binaries, e.g. 4760DIV1070_2017-07-30.tgz or 4760DIV1070_2017-07-30_sd_installer.img.gz for V1.070.

Customize the kernel source code

In Yocto BSP, you can build kernel easily. To learn how to build kernel, you can refer to oe-rpb-manifest.

Then, we need three output files in your build artifacts.

  • Kernel image (Image-MACHINE.bin)
  • DTS image (dt-Image-MACHINE.img)
  • Modules (modules-MACHINE.tgz)

Now you need to create a valid boot image with your own kernel build.

On your host PC, we need to install the following tools:

$ git clone git://codeaurora.org/quic/kernel/skales

To create the boot image, you also need a ramdisk image, and you can get one from the 96Boards release:

$ wget https://builds.96boards.org/releases/dragonboard410c/linaro/debian/16.09/initrd.img-4.4.23-linaro-lt-qcom

The tool mkbootimg is a standalone application that will process all files and create the boot image that can then be booted on the target board, or flash into the on-board eMMC. The boot image also contains the kernel bootargs, which can be changed as needed in the next command:

$ ./skales/mkbootimg --kernel Image-MACHINE.bin \
                   --ramdisk initrd.img-4.4.23-linaro-lt-qcom \
                   --output boot-MACHINE-debian.img \
                   --dt dt-Image-MACHINE.img \
                   --pagesize 2048 \
                   --base 0x80000000 \
                   --cmdline "root=/dev/disk/by-partlabel/rootfs rw rootwait console=ttyMSM0,115200n8"

After this step, you will get a boot image for Debian called boot-MACHINE-debian.img.

Revise Debian Rootfs

Basically, we can adopt Linaro's Debian rootfs directly with a little modifications for kernel modules. First, you can get the Debian rootfs from the 96Boards release:

$ wget https://builds.96boards.org/releases/dragonboard410c/linaro/debian/16.09/linaro-jessie-alip-qcom-snapdragon-arm64-20161006-144.img.gz

Second, unzip the file and transform it from sparse image to raw image.

$ gunzip linaro-jessie-alip-qcom-snapdragon-arm64-20161006-144.img.gz
$ simg2img linaro-jessie-alip-qcom-snapdragon-arm64-20161006-144.img rootfs.raw

Then, you are able to mount the raw rootfs, and update with your kernel modules.

$ sudo mount -o loop rootfs.raw /mnt
$ sudo rm -rf /mnt/lib/modules/

// Copy firmware & modules into /lib
$ tar zxf modules-MACHINE.tgz
$ sudo cp -a lib/* /mnt/lib
$ sudo umount /mnt

Finally, make the rootfs into sparse image.

$ ext2simg -v rootfs.raw linaro-jessie-alip-qcom-snapdragon-arm64-20161006-144-MACHINE.img

Flash Debian Images

Now, you have both boot & rootfs images. You can easily flash them into eMMC via fastboot utility.

$ sudo fastboot erase boot
$ sudo fastboot flash boot boot-MACHINE-debian.img
$ sudo fastboot erase rootfs
$ sudo fastboot flash rootfs linaro-jessie-alip-qcom-snapdragon-arm64-20161006-144-MACHINE.img

Note: After booting up, you have an important thing to do! You have to generate modules.dep and map files.

$ depmod -a

After reboot, the Debian system should work well!

Create Bootable Sdcard

In this section, we will show you how to create a bootable sdcard image based on the same Yocto kernel.

The difference between normal eMMC image & bootable sdcard image are:

  • bootloader
  • boot argument in boot.img

So, we have to replace these two parts in the following way.

First, get the bootloader for sd boot here. It will be named something like advantech_bootloader_sd_linux-<version>.zip.

Second, get the corresponding sdboot boot image from official release. For example, boot-sdboot*.img in 4760LIV1070_2017-07-30_sdboot.tgz for V1.070. Or, you can generate your own sdboot boot image via mkbootimg tool as well.

$ ./skales/mkbootimg --kernel Image-MACHINE.bin \
                   --ramdisk initrd.img \
                   --output boot-sdboot-MACHINE.img \
                   --dt dt-Image-MACHINE.img \
                   --pagesize 2048 \
                   --base 0x80000000 \
                   --cmdline "root=/dev/mmcblk1p13 rw rootwait console=ttyMSM0,115200n8"

Note: The initrd.img is a fake ramdisk image.

$ echo "This is not an initrd" > initrd.img

Now, you should have new bootloader, boot.img for sdboot, and original eMMC image binaries. Please rename boot-sdboot-MACHINE.img to boot.img and unzip rpb-desktop-image-MACHINE-*.rootfs.img.gz to rootfs.img. Then, also unzip bootloader file, and put all the images we mentioned above into the same folder.

Finally, you can use the db-boot-tools to create bootable sdcard image.

git clone https://github.com/ADVANTECH-Corp/db-boot-tools.git
cd db-boot-tools
sudo ./mksdcard -p dragonboard410c/linux/sdcard.txt -s 3G -i ${THE_FOLDER_YOU_PUT_ALL_THE_IMAGES_IN} -o ${SDCARD_IMG_NAME}

Note: The -s option means image size. You can modify as your need.

Add-On Values

RMM

The installation files of RMM (Remote Monitoring and Management) 3.2 Agent are prepared and it's ready to install in our pre-built images.

Please refer to WISE-PaaS/RMM_Agent for details.

OTA

It is a new feature Advantech provides to upgrade your devices easily through OTA (Over The Air). Customers can upload their own update packages onto OTA server, and handle the update procedures via specific website.

Please refer to RISC_FOTA for details.

Note: If your version is 1.090, you have to create the OTA package manually. Please follow the instructions below. Or you can upgrade your device to 1.110 (or later) to fix this OTA issue.

When you generate the OTA package zip file by OTA PACKAGE TOOL, the contents should look like below.

rsb4760-v0.0.0.2-69d11df073258d6de8357614d5cf43ec.zip
|- PackageInfo.xml
|- rsb4760.zip
|- Deploy.xml
|- rsb4760/
|- install.sh
|- OTAPackager SOP-Chinese.pdf
|- OTAPackager-1.0.9.exe
|- result.sh
|- update.zip


Now, we are going to create a similar one by ourselves. The goal is to unzip the 2nd ZIP in the package.

1. First, create new folders we need with specific package name, e.g. rsb4760.

For example, we create a new rsb4760-v0.0.0.1-checksum folder with two rsb4760 folders inside. Totally, we have 3 layers of folder now.

rsb4760-v0.0.0.1-checksum
|- rsb4760/
|- rsb4760/

2. Put PackageInfo.xml into the 1st folder.

Please make sure the <Password> field is empty.

<?xml version="1.0" encoding="utf-8" standalone="no"?> <PackageDescription>
  <BaseSettings>
    <PackageType>rsb4760</PackageType>
    <Version>0.0.0.1</Version>
    <OS></OS>
    <Arch></Arch>
  </BaseSettings>
  <Password></Password>
</PackageDescription>

3. Put Deploy.xml into the 2nd folder.

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<DeployDescription>
  <DeploySetting>
    <DeployFileName>rsb4760/install.sh</DeployFileName>
    <RebootFlag>1</RebootFlag>
    <ResultCheckScript>rsb4760/result.sh</ResultCheckScript>
  </DeploySetting>
</DeployDescription>

4. Finally, put the remainders into the 3rd folder. You can find these files in OTA PACKAGE TOOL.

The update.zip is created by ota-package.sh

- install.sh
- OTAPackager SOP-Chinese.pdf
- OTAPackager-1.0.9.exe
- result.sh
- update.zip

5. ZIP the entire folder, and calculate the MD5 checksum.

cd rsb4760-v0.0.0.1-checksum
zip -r rsb4760-v0.0.0.1-checksum.zip .
md5sum rsb4760-v0.0.0.1-checksum.zip

If the MD5 value is 84c14f0cebb5814b98e61259e88f352a, you have to rename the ZIP file as rsb4760-v0.0.0.1-84c14f0cebb5814b98e61259e88f352a.zip

That's all. This OTA package can be uploaded to the OTA server now!

Package List

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

bitbake -g rpb-desktop-image && 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/${MACHINE}/rpb-desktop-image-${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