Difference between revisions of "IoTGateway/BSP/Linux/AM335x/AM335x LBV6 User Guide"

From ESS-WIKI
Jump to: navigation, search
(HW module Configuration & driver)
(Modify the correct config command for kernel)
 
(25 intermediate revisions by 3 users not shown)
Line 2: Line 2:
 
__TOC__
 
__TOC__
  
=Start Guide=
+
= Start Guide =
 +
 
 
Generally,to do Linux development, you’ll need a host PC running Linux. In the development with the advantech SDK, it would be strongly recommend to use Ubuntu 12.04 LTS 64 bit/ Ubuntu 14.04 LTS 64 bit as developing environment. Because we have successfully tested our BSP on these OS version. Please install the Ubuntu 12.04 LTS 64 bit / Ubuntu 14.04 LTS 64 bit at your PC/NB in advance.
 
Generally,to do Linux development, you’ll need a host PC running Linux. In the development with the advantech SDK, it would be strongly recommend to use Ubuntu 12.04 LTS 64 bit/ Ubuntu 14.04 LTS 64 bit as developing environment. Because we have successfully tested our BSP on these OS version. Please install the Ubuntu 12.04 LTS 64 bit / Ubuntu 14.04 LTS 64 bit at your PC/NB in advance.
==<span style="color:#0070c0;">Configure your Linux Host</span>==
+
 
After installed this OS, you must install some essential libraries or tools on your host PC for building these source code. We will describe how to install them as follow:<br>
+
== <span style="color:#0070c0">Configure your Linux Host</span> ==
*'''1. build-essential'''
+
 
 +
After installed this OS, you must install some essential libraries or tools on your host PC for building these source code. We will describe how to install them as follow:
 +
 
 +
*'''build-essential'''
 +
 
 
If you have a new Ubuntu system where you have not installed anything for building. The build-essential library is necessary. The command as follow:
 
If you have a new Ubuntu system where you have not installed anything for building. The build-essential library is necessary. The command as follow:
<pre>
+
<pre> # sudo apt-get install build-essential
# sudo apt-get install build-essential
+
 
</pre>
 
</pre>
*'''2. 32-bit compatibility libraries'''
+
 
 +
*'''32-bit compatibility libraries'''
 +
 
 
As we known, the host PC is 64-bit Ubuntu, but some tools are a 32-bit tool. To make them work, you must install this 32-bit compatibility libraries. The command is follow on 64 bit Ubuntu14.04:
 
As we known, the host PC is 64-bit Ubuntu, but some tools are a 32-bit tool. To make them work, you must install this 32-bit compatibility libraries. The command is follow on 64 bit Ubuntu14.04:
<pre>
+
<pre> # dpkg --add-architecture i386
# dpkg --add-architecture i386
+
 
  # cd /etc/apt/sources.list.d
 
  # cd /etc/apt/sources.list.d
 
  # echo "deb http://old-releases.ubuntu.com/ubuntu/ raring main restricted universe multiverse" >ia32-libs-old-release.list
 
  # echo "deb http://old-releases.ubuntu.com/ubuntu/ raring main restricted universe multiverse" >ia32-libs-old-release.list
Line 22: Line 27:
 
  # sudo apt-get update  
 
  # sudo apt-get update  
 
</pre>
 
</pre>
 +
 
On the 64-bit Ubuntu12.04, you need to type the following command:
 
On the 64-bit Ubuntu12.04, you need to type the following command:
<pre>
+
<pre> #sudo apt-get install ia32-libs
#sudo apt-get install ia32-libs
+
 
</pre>
 
</pre>
*'''3. Some essential tools for BSP building '''
+
 
After step1 and step2, you can build some application based linux. But if you want to build BSP source code, you need to install these following tools on ubuntu14.04.  
+
*'''Some essential tools for BSP building'''
<pre>
+
 
# sudo apt-get update libncurses5-dev autoconf automake dos2unix u-boot-tools
+
After step1 and step2, you can build some application based linux. But if you want to build BSP source code, you need to install these following tools on ubuntu14.04.
 +
<pre> # sudo apt-get update libncurses5-dev autoconf automake dos2unix u-boot-tools
 
</pre>
 
</pre>
And On ubuntu14.04, you can type following command to install these software:
+
 
<pre>
+
And On ubuntu12.04, you can type following command to install these software:
# sudo apt-get update libncurses5-dev autoconf automake dos2unix uboot-mkimage
+
<pre> # sudo apt-get update libncurses5-dev autoconf automake dos2unix uboot-mkimage
 
</pre>
 
</pre>
Because starting with Ubuntu 14.04 the package name for uboot-mkimage has changed to u-boot-tools.
 
<br>''' After these steps, you can buid what you want, best wishes! '''
 
<br><br>
 
  
==<span style="color:#0070c0;">Install Advantech SDK</span>==
+
Because starting with Ubuntu 14.04 the package name for uboot-mkimage has changed to u-boot-tools.<br/>'''After these steps, you can buid what you want, best wishes!'''
 +
 
 +
== <span style="color:#0070c0">Install Advantech SDK</span> ==
 +
 
 
When you obtain the advantech Linux source code package, please refer to following instructions to install it to you host PC.
 
When you obtain the advantech Linux source code package, please refer to following instructions to install it to you host PC.
<pre>
+
 
1. Copy "AM335X_LBBxxxx_yyyy-mm-dd.bin" package to /root/.
+
*Copy "AM335X_LBBxxxx_yyyy-mm-dd.bin" package to /root/.
2. Start your "Terminal" on Ubuntu 14.04 LTS.
+
*Start your "Terminal" on Ubuntu host PC.
3. $sudo su (Change to “root” authority)
+
*$sudo su (Change to “root” authority)
4. Input user password
+
*Input user password
5. # cd /root/
+
*#cd /root/
6. # chmod 777 AM335X_LBBxxxx_yyyy-mm-dd.bin  
+
*#chmod 777 AM335X_LBBxxxx_yyyy-mm-dd.bin
7. # ./AM335X_LBBxxxx_yyyy-mm-dd.bin  
+
*#./AM335X_LBBxxxx_yyyy-mm-dd.bin
8. Input “yes”
+
*Input “yes”
9. Then you can see folder "AM335X_LBBxxxx_yyyy-mm-dd" on /root/.  
+
*Then you can see folder "AM335X_LBBxxxx_yyyy-mm-dd" on /root/.
</pre>
+
 
AM335x board source code package (BSP) contains cross compiler, Linux source code, Uboot source code, root file system and some scripts used in development. Some of above components are developed by Advantech and the others are developed by open source community.
+
AM335x board source code package (BSP) contains cross compiler, Linux source code, Uboot source code, root file system and some scripts used in development. Some of above components are developed by Advantech and the others are developed by open source community. AM335x source code package is composed of six main folders: “cross_compiler”, “document”,“image”, “package”, “scripts”, and “source”.<br/><font color="#FF0000">Note! AM335x source code package (BSP) is Advantech’s Intellectual Property. If you need to access this package, please contact your Advantech support window.</font><br/>[[File:Bsp.png|RTENOTITLE]]<br/>The description of AM335x BSP package contents:
AM335x source code package is composed of six main folders: “cross_compiler”, “document”,“image”, “package”, “scripts”, and “source”.  
+
 
<br><font color="#FF0000"> Note! AM335x source code package (BSP) is Advantech’s Intellectual Property. If you need to access this package, please contact your Advantech support window.</font>
+
<br>[[Image: bsp.png]] <br>
+
The description of AM335x BSP package contents:
+
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
| '''cross_compiler''' || Cross compiler tool
+
| '''cross_compiler'''
 +
| Cross compiler tool
 +
|-
 +
| '''document'''
 +
| Some important documents, such as usermanual.
 
|-
 
|-
| ''' document''' || Some important documents, such as usermanual.
+
| '''image'''
 +
| uImage, u-boot.img
 
|-
 
|-
| '''image ''' || uImage, u-boot.img
+
| '''image/rootfs'''
 +
| Linux root file system
 
|-
 
|-
| '''image/rootfs ''' || Linux root file system
+
| '''package'''
 +
| source code provided by TI or open source community without any modification, for example: kernel source, uboot source, libmodbus source
 
|-
 
|-
| '''package ''' || source code provided by TI or open source community without any modification, for example: kernel source, uboot source, libmodbus source
+
| '''scripts'''
 +
| scripts for configure system and compile images automatically.
 
|-
 
|-
| '''scripts ''' || scripts for configure system and compile images automatically.
+
| '''source'''
|-
+
| source code owned by Advantech, the uboot, kernel and libmodbus source code and demo source for AM335x
| '''source ''' || source code owned by Advantech, the uboot, kernel and libmodbus source code and demo source for AM335x  
+
 
|}
 
|}
  
'''1. cross_compiler tools'''<br>
+
'''1. cross_compiler tools'''<br/>You can use the cross compiler tool chain to compile the uboot, uImage, modbus library and related applications. (gcc version is 4.7.3 20130226).
You can use the cross compiler tool chain to compile the uboot, uImage, modbus library and related applications. (gcc version is 4.7.3 20130226).
+
 
 +
'''2. Scripts '''<br/>The scripts provided by Advantech will help you configure system or build the images more quickly. Please check them as follows:
  
'''2. Scripts '''<br>
 
The scripts provided by Advantech will help you configure system or build the images more quickly. Please check them as follows:
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
| '''setenv.sh''' || A script to setup the developing environment quickly.
+
| '''setenv.sh'''
 +
| A script to setup the developing environment quickly.
 
|-
 
|-
| '''cfg_uboot.sh ''' || A script to configure the u-boot building setup quickly.
+
| '''cfg_uboot.sh'''
 +
| A script to configure the u-boot building setup quickly.
 
|-
 
|-
| '''mk_uboot.sh ''' || A script to build the u-boot and copy the “u-boot” to “image” folder after building.
+
| '''mk_uboot.sh'''
 +
| A script to build the u-boot and copy the “u-boot” to “image” folder after building.
 
|-
 
|-
| '''cfg_kernel.sh ''' || A script to build the “uImage” and copy the “uImage” to “image” folder after building.
+
| '''cfg_kernel.sh'''
 +
| A script to build the “uImage” and copy the “uImage” to “image” folder after building.
 
|-
 
|-
| '''mk_kernel.sh ''' || A script to build the “uImage” and copy the “uImage” to“image” folder after building.
+
| '''mk_kernel.sh'''
 +
| A script to build the “uImage” and copy the “uImage” to“image” folder after building.
 
|-
 
|-
| '''mksd-linux.sh ''' || A script to setup up a bootable SD card if users build their images.
+
| '''mksd-linux.sh'''
 +
| A script to setup up a bootable SD card if users build their images.
 
|-
 
|-
| '''mkinand-linux.sh ''' || A script to go to SD card Linux O.S. then burn O.S to eMMC flash
+
| '''mkinand-linux.sh'''
 +
| A script to go to SD card Linux O.S. then burn O.S to eMMC flash
 
|}
 
|}
  
'''3. source '''
+
'''3. source '''<br/>This folder contains sub-directories "linux-xxx" and "u-boot-xxx" and demo. They are the source codes of the Linux kernel, U-boot and demo.
This folder contains sub-directories "linux-3.2.0-psp04.06.00.11" and "u-boot-2013.01.01-psp06.00.00.00" and demo. They are the source codes of the Linux kernel, U-boot and demo.<br><br>
+
  
==<span style="color:#0070c0;">BSP Building Guide</span>==
+
== <span style="color:#0070c0">BSP Building Guide</span> ==
In the following building demo, we always assume building is for RSB4220 platform. others(such as ROM3310,RSB4221) are same。 $(BSP) is your BSP root directory. In order to simplify the description, we use "$(BSP)" to represent actual BSP root path. you need to replace the string to actual path。 <br>
+
 
'''1. Setup uboot and kernel build environment'''  
+
In the following building demo, we always assume building is for RSB4220 platform. others(such as ROM3310,RSB4221) are same。 $(BSP) is your BSP root directory. In order to simplify the description, we use "$(BSP)" to represent actual BSP root path. you need to replace the string to actual path。
<pre>
+
 
2) $ sudo su (Change to “root” authority)
+
'''1. Setup uboot and kernel build environment'''
3) Input user password
+
 
4) # cd $(BSP)/scripts/
+
*$ sudo su (Change to “root” authority)
5) # source setenv.sh (To configure the developing environment automatically)
+
*Input user password
</pre>
+
*#cd $(BSP)/scripts/
Then you can start to code the source code, build uboot and kernel images.  
+
*#source setenv.sh (To configure the developing environment automatically)
 +
 
 +
Then you can start to code the source code, build uboot and kernel images.
  
 
The '''setenv.sh''' script is used to configure the developing environment quickly. It will configure the folder paths for system.
 
The '''setenv.sh''' script is used to configure the developing environment quickly. It will configure the folder paths for system.
  
<font color="#FF0000"> Note! You have to run “#source setenv.sh” every time once you open a new "Terminal" utility. It is suggested to change to “root” authority to use the source code. And the “$(BSP)” is the root directory of BSP source code.  
+
<font color="#FF0000">Note! You have to run “#source setenv.sh” every time once you open a new "Terminal" utility. It is suggested to change to “root” authority to use the source code. And the “$(BSP)” is the root directory of BSP source code. </font><br/>'''2. Build u-boot Image'''<br/>Advantech has a script to build the u-boot quickly. You can build u-boot image by follow below steps:
</font><br>
+
 
'''2. Build u-boot Image'''<br>
+
*Open "Terminal" on Ubuntu host PC.
Advantech has a script to build the u-boot quickly. You can build u-boot image by follow below steps:
+
*$sudo su (Change to “root” authority)
<pre>
+
*Input user password.
1) Open "Terminal" on Ubuntu 14.04 LTS..
+
*#cd $(BSP)/scripts/
2) $sudo su (Change to “root” authority)
+
*#source setenv.sh (To configure the developing environment automatically)
3) Input user password.
+
*#./cfg_uboot.sh am335x_rsb4220_defconfig (To set the u-boot configuration automatically)
4) #cd $(BSP)/scripts/
+
*#./mk_uboot.sh (Start to build the u-boot)
5) #source setenv.sh (To configure the developing environment automatically)
+
 
6) #./cfg_uboot.sh am335x_rsb4220  (To set the u-boot configuration automatically)
+
'''Then you can see u-boot.img is being built and located in ../image. '''<br/><br/>'''3. Build Linux Kernel Image'''<br/>Advantech offer you a script to build the “uImage” quickly. You can build uImage by follow below steps:
7) #./mk_uboot.sh (Start to build the u-boot)
+
 
</pre>
+
*Open "Terminal" on Ubuntu host PC.
'''Then you can see u-boot.img is being built and located in ../image. ''' <br><br>
+
*$sudo su (Change to “root” authority)
'''3. Build Linux Kernel Image'''<br>
+
*Input user password.
Advantech offer you a script to build the “uImage” quickly. You can build uImage by follow below steps:
+
*#cd $(BSP)/scripts/
<pre>
+
*#source setenv.sh (To configure the developing environment automatically)
1) Open "Terminal" on Ubuntu 12.04 LTS.
+
*#./cfg_kernel.sh tisdk_am335x-rsb4220_defconfig (To set the uImage configuration automatically)
2) $sudo su (Change to “root” authority)
+
*#./mk_kernel.sh (Start to build the uImage)
3) Input user password.
+
 
4) # cd $(BSP)/scripts/
+
5) # source setenv.sh (To configure the developing environment automatically)
+
6) #./cfg_kernel.sh am335x_rsb4220_defconfig (To set the uImage configuration automatically)
+
7) #./mk_kernel.sh (Start to build the uImage)
+
</pre>
+
 
'''Then you can see uImage is being built and located in ../image.'''
 
'''Then you can see uImage is being built and located in ../image.'''
  
 +
== <span style="color:#0070c0">Update Linux OS</span> ==
  
==<span style="color:#0070c0;">Update Linux OS</span>==
 
 
All advantech products based on AM335x platform support '''boot from SD card''' or '''onboard flash'''. This section will guide you how to build an image for Linux system boot media.
 
All advantech products based on AM335x platform support '''boot from SD card''' or '''onboard flash'''. This section will guide you how to build an image for Linux system boot media.
  
 
=== Debug Message ===
 
=== Debug Message ===
All advantech risc products can connect to a host PC (Linux or Windows) by using console cable and debug port adapter. In order to communicate with host PC, serial communication program such as HyperTerminal, Tera Term or PuTTY is must required. Suggest use PuTTY in Ubuntu 14.04. Below is the detail instruction of how to setup PuTTY on ubuntu 14.04 hosts:<br>
 
Install putty on ubuntu 14.04 <br>
 
[[Image: putty1.png]]<br>
 
1) Connect target board to your ubuntu PC by using console cable <br>
 
2) Open putty on your ubuntu PC <br>
 
3) power up the target board <br>
 
4) Setting putty as follows <br>
 
[[Image: putty5.png]]<br>
 
Select correct serial line, then click open.
 
Then you will see the console information:
 
[[Image: putty7.png]]<br>
 
Type root to login in system.
 
  
=== Storage Information (eMMC/SD card) ===
+
All advantech risc products can connect to a host PC (Linux or Windows) by using console cable and debug port adapter. In order to communicate with host PC, serial communication program such as HyperTerminal, Tera Term or PuTTY is must required. Suggest use PuTTY on your host PC. Below is the detail instruction of how to setup PuTTY on ubuntu 14.04 hosts:<br/>Install putty as below<br/>[[File:Putty1.png|RTENOTITLE]]
 +
 
 +
*Connect target board to your ubuntu PC by using console cable.
 +
*Open putty on your ubuntu PC.
 +
*power up the target board.
 +
*Setting putty as follows.
 +
 
 +
[[File:Putty5.png|RTENOTITLE]]<br/>Select correct serial line, then click open. Then you will see the console information: [[File:Putty7.png|RTENOTITLE]]<br/>Type root to login in system.
 +
 
 +
=== Storage Information (eMMC/SD card) ===
 +
 
 
The storages devices name as following:
 
The storages devices name as following:
 +
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Device !! Node Name
+
! Device
 +
! Node Name
 
|-
 
|-
| SD caed || /dev/mmcblk0
+
| SD card<br/>
 +
| /dev/mmcblk0
 
|-
 
|-
| eMMC || /dev/mmcblk1
+
| eMMC
 +
| /dev/mmcblk1
 
|}
 
|}
 +
 
If Linux os exists in both SD card and eMMC flash, the linux in SD is default boot option. If no SD card inserted, the eMMC node is "/dev/mmcblk0".
 
If Linux os exists in both SD card and eMMC flash, the linux in SD is default boot option. If no SD card inserted, the eMMC node is "/dev/mmcblk0".
  
=== Create a Linux SD Card System===
+
=== Create a Linux SD Card System ===
'''1. Create system from Pre-built System Image'''<br>
+
 
You are able to find the pre-built image from Advantech website. Please follow below steps to create a SD card for boot up. we still use the RSB-4220 as demo:
+
'''1. Create system from Pre-built System Image'''<br/>You are able to find the pre-built image from Advantech website. Please follow below steps to create a SD card for boot up. we still use the RSB-4220 as demo:
<pre>
+
 
1) Copy “4420LIVxxxx_yyyy-mm-dd.tar.gz” package to your /root/.
+
*Copy “4420LIVxxxx_yyyy-mm-dd.tar.gz” package to your /root/.
2) Open "Terminal" on Ubuntu 14.04 LTS..
+
*Open "Terminal" on Ubuntu host PC.
3) $sudo su (Change to “root” authority)
+
*$sudo su (Change to “root” authority)
4) Input your password.
+
*Input your password.
5) # cd /root/
+
*#cd /root/
6) # tar xzvf 4220LIVxxxx_yyyy-mm-dd.tar.gz (Unzip files)
+
*#tar xzvf 4220LIVxxxx_yyyy-mm-dd.tar.gz (Unzip files)
7) Insert one SD card to your developing computer
+
*Insert one SD card to your developing computer
8) Check the SD card location, like /dev/sdb
+
*Check the SD card location, like /dev/sdb
9) #cd ./4220LIVxxxx_yyyy-mm-dd/scripts
+
*#cd ./4220LIVxxxx_yyyy-mm-dd/scripts
10) #./mksd-linux.sh /dev/sdb
+
*#./mksd-linux.sh /dev/sdb
11) Type “y” (Start to copy files, wait until it shows [Done] )
+
*Type “y” (Start to copy files, wait until it shows [Done] )
</pre>
+
 
 
Then insert the Linux system SD card to target board (like RSB-4220), it will boot up with Linux environment.
 
Then insert the Linux system SD card to target board (like RSB-4220), it will boot up with Linux environment.
  
''' 2.Create system from Source Code Package''' <br>
+
'''2.Create system from Source Code Package'''<br/>When you receive the advantech Linux source code package, you can refer following steps to create a Linux system SD card for booting up from it.we still use the RSB-4220 as demo:
When you receive the advantech Linux source code package, you can refer following steps to create a Linux system SD card for booting up from it.we still use the RSB-4220 as demo:
+
 
<pre>
+
*Open "Terminal" on Ubuntu host PC.
1) Open "Terminal" on Ubuntu 14.04 LTS.
+
*$sudo su (Change to “root” authority)
2) $sudo su (Change to “root” authority)
+
*Input your password.
3) Input your password.
+
*Insert one SD card to your developing computer
4) Insert one SD card to your developing computer
+
*Check the SD card location, like: /dev/sdb
5) Check the SD card location, like: /dev/sdb
+
*Ensure that you have built the uboot and kernel
6) Ensure that you have built the uboot and kernel
+
*#cd $(BSP)/scripts
7) #cd $(BSP)/scripts
+
*#./mksd-linux.sh /dev/sdb
8) #./mksd-linux.sh /dev/sdb
+
*Type “y” (Start to copy files, wait until it shows [Done] )
9) Type “y” (Start to copy files, wait until it shows [Done] )
+
 
</pre>
+
 
Then insert the Linux system SD card to target board's (such as RSB-4220) SD card slot, it will boot up with Linux environment.
 
Then insert the Linux system SD card to target board's (such as RSB-4220) SD card slot, it will boot up with Linux environment.
  
=== Boot from Onboard Flash ===
+
=== Boot from Onboard Flash ===
If you’ve already had a Linux system SD card, you can refer following steps to copy
+
 
the content to onboard flash and then boot from onboard flash. Advantech also
+
If you’ve already had a Linux system SD card, you can refer following steps to copy the content to onboard flash and then boot from onboard flash. Advantech also provide you a script “mkinand-linux.sh” to speed up the process of installing system image to onboard flash.
provide you a script “mkinand-linux.sh” to speed up the process of installing system
+
 
image to onboard flash.
+
*Ensure you have created a linux system on SD card
<pre>
+
*Insert this Linux system SD card to target board and connect serial console.
1) Ensure you have created a linux system on SD card
+
*On your target system, type #root (Login)
2) Insert this Linux system SD card to target board and connect serial console.
+
*On your target system, type #cd /mk_inand
3) On your target system, type #root (Login)
+
*On your target system, type #./mkinand-linux.sh /dev/mmcblk1
4) On your target system, type #cd /mk_inand
+
*Type “y” (Start to copy files, wait until it shows [Done] )
5) On your target system, type #./mkinand-linux.sh /dev/mmcblk1
+
*After done, Power off and remove this SD card.
6) Type “y” (Start to copy files, wait until it shows [Done] )
+
 
7) After done, Power off and remove this SD card.
+
</pre>
+
 
Then you can boot from onboard flash without SD card.
 
Then you can boot from onboard flash without SD card.
  
 
=Developement Guide=
 
=Developement Guide=
==<span style="color:#0070c0;"> HW module Configuration & driver </span>==
+
== <span style="color:#0070c0">HW module Configuration & driver</span> ==
* [[IoTGateway/BSP/Linux/AM335x/Add_a_Driver_to_Kernel_by_menuconfig| Add a Driver to Kernel by menuconfig]]
+
 
* [[IoTGateway/BSP/Linux/AM335x/Hardware_module| Hardware module]]
+
*[[IoTGateway/BSP/Linux/AM335x/Add_a_Driver_to_Kernel_by_menuconfig|Add a Driver to Kernel by menuconfig]]
 +
*[[IoTGateway/BSP/Linux/AM335x/Hardware_module|Hardware module]]
 +
 
 +
== <span style="color:#0070c0;"> C/C++ & Qt Application Development </span>==
 +
* [[IoTGateway/BSP/Linux/AM335x/C/C++_Development| C/C++ Application Development]]
 +
* [[IoTGateway/BSP/Linux/AM335x/Qt_Application_Development| Qt Application Development]]
  
== <span style="color:#0070c0;"> C/C++ & Qt Development </span>==
 
 
== <span style="color:#0070c0;"> System Service & Usage </span>==
 
== <span style="color:#0070c0;"> System Service & Usage </span>==
 +
* [[IoTGateway/BSP/Linux/AM335x/System_Service_and_Usage| System Service & Usage]]

Latest revision as of 05:10, 14 August 2017

Start Guide

Generally,to do Linux development, you’ll need a host PC running Linux. In the development with the advantech SDK, it would be strongly recommend to use Ubuntu 12.04 LTS 64 bit/ Ubuntu 14.04 LTS 64 bit as developing environment. Because we have successfully tested our BSP on these OS version. Please install the Ubuntu 12.04 LTS 64 bit / Ubuntu 14.04 LTS 64 bit at your PC/NB in advance.

Configure your Linux Host

After installed this OS, you must install some essential libraries or tools on your host PC for building these source code. We will describe how to install them as follow:

  • build-essential

If you have a new Ubuntu system where you have not installed anything for building. The build-essential library is necessary. The command as follow:

 # sudo apt-get install build-essential
  • 32-bit compatibility libraries

As we known, the host PC is 64-bit Ubuntu, but some tools are a 32-bit tool. To make them work, you must install this 32-bit compatibility libraries. The command is follow on 64 bit Ubuntu14.04:

 # dpkg --add-architecture i386
 # cd /etc/apt/sources.list.d
 # echo "deb http://old-releases.ubuntu.com/ubuntu/ raring main restricted universe multiverse" >ia32-libs-old-release.list
 # sudo apt-get update
 # sudo apt-get install ia32-libs 
 # sudo rm ia32-libs-old-release.list
 # sudo apt-get update 

On the 64-bit Ubuntu12.04, you need to type the following command:

 #sudo apt-get install ia32-libs
  • Some essential tools for BSP building

After step1 and step2, you can build some application based linux. But if you want to build BSP source code, you need to install these following tools on ubuntu14.04.

 # sudo apt-get update libncurses5-dev autoconf automake dos2unix u-boot-tools

And On ubuntu12.04, you can type following command to install these software:

 # sudo apt-get update libncurses5-dev autoconf automake dos2unix uboot-mkimage

Because starting with Ubuntu 14.04 the package name for uboot-mkimage has changed to u-boot-tools.
After these steps, you can buid what you want, best wishes!

Install Advantech SDK

When you obtain the advantech Linux source code package, please refer to following instructions to install it to you host PC.

  • Copy "AM335X_LBBxxxx_yyyy-mm-dd.bin" package to /root/.
  • Start your "Terminal" on Ubuntu host PC.
  • $sudo su (Change to “root” authority)
  • Input user password
    1. cd /root/
    2. chmod 777 AM335X_LBBxxxx_yyyy-mm-dd.bin
    3. ./AM335X_LBBxxxx_yyyy-mm-dd.bin
  • Input “yes”
  • Then you can see folder "AM335X_LBBxxxx_yyyy-mm-dd" on /root/.

AM335x board source code package (BSP) contains cross compiler, Linux source code, Uboot source code, root file system and some scripts used in development. Some of above components are developed by Advantech and the others are developed by open source community. AM335x source code package is composed of six main folders: “cross_compiler”, “document”,“image”, “package”, “scripts”, and “source”.
Note! AM335x source code package (BSP) is Advantech’s Intellectual Property. If you need to access this package, please contact your Advantech support window.
RTENOTITLE
The description of AM335x BSP package contents:

cross_compiler Cross compiler tool
document Some important documents, such as usermanual.
image uImage, u-boot.img
image/rootfs Linux root file system
package source code provided by TI or open source community without any modification, for example: kernel source, uboot source, libmodbus source
scripts scripts for configure system and compile images automatically.
source source code owned by Advantech, the uboot, kernel and libmodbus source code and demo source for AM335x

1. cross_compiler tools
You can use the cross compiler tool chain to compile the uboot, uImage, modbus library and related applications. (gcc version is 4.7.3 20130226).

2. Scripts
The scripts provided by Advantech will help you configure system or build the images more quickly. Please check them as follows:

setenv.sh A script to setup the developing environment quickly.
cfg_uboot.sh A script to configure the u-boot building setup quickly.
mk_uboot.sh A script to build the u-boot and copy the “u-boot” to “image” folder after building.
cfg_kernel.sh A script to build the “uImage” and copy the “uImage” to “image” folder after building.
mk_kernel.sh A script to build the “uImage” and copy the “uImage” to“image” folder after building.
mksd-linux.sh A script to setup up a bootable SD card if users build their images.
mkinand-linux.sh A script to go to SD card Linux O.S. then burn O.S to eMMC flash

3. source
This folder contains sub-directories "linux-xxx" and "u-boot-xxx" and demo. They are the source codes of the Linux kernel, U-boot and demo.

BSP Building Guide

In the following building demo, we always assume building is for RSB4220 platform. others(such as ROM3310,RSB4221) are same。 $(BSP) is your BSP root directory. In order to simplify the description, we use "$(BSP)" to represent actual BSP root path. you need to replace the string to actual path。

1. Setup uboot and kernel build environment

  • $ sudo su (Change to “root” authority)
  • Input user password
    1. cd $(BSP)/scripts/
    2. source setenv.sh (To configure the developing environment automatically)

Then you can start to code the source code, build uboot and kernel images.

The setenv.sh script is used to configure the developing environment quickly. It will configure the folder paths for system.

Note! You have to run “#source setenv.sh” every time once you open a new "Terminal" utility. It is suggested to change to “root” authority to use the source code. And the “$(BSP)” is the root directory of BSP source code.
2. Build u-boot Image
Advantech has a script to build the u-boot quickly. You can build u-boot image by follow below steps:

  • Open "Terminal" on Ubuntu host PC.
  • $sudo su (Change to “root” authority)
  • Input user password.
    1. cd $(BSP)/scripts/
    2. source setenv.sh (To configure the developing environment automatically)
    3. ./cfg_uboot.sh am335x_rsb4220_defconfig (To set the u-boot configuration automatically)
    4. ./mk_uboot.sh (Start to build the u-boot)

Then you can see u-boot.img is being built and located in ../image.

3. Build Linux Kernel Image
Advantech offer you a script to build the “uImage” quickly. You can build uImage by follow below steps:

  • Open "Terminal" on Ubuntu host PC.
  • $sudo su (Change to “root” authority)
  • Input user password.
    1. cd $(BSP)/scripts/
    2. source setenv.sh (To configure the developing environment automatically)
    3. ./cfg_kernel.sh tisdk_am335x-rsb4220_defconfig (To set the uImage configuration automatically)
    4. ./mk_kernel.sh (Start to build the uImage)

Then you can see uImage is being built and located in ../image.

Update Linux OS

All advantech products based on AM335x platform support boot from SD card or onboard flash. This section will guide you how to build an image for Linux system boot media.

Debug Message

All advantech risc products can connect to a host PC (Linux or Windows) by using console cable and debug port adapter. In order to communicate with host PC, serial communication program such as HyperTerminal, Tera Term or PuTTY is must required. Suggest use PuTTY on your host PC. Below is the detail instruction of how to setup PuTTY on ubuntu 14.04 hosts:
Install putty as below
RTENOTITLE

  • Connect target board to your ubuntu PC by using console cable.
  • Open putty on your ubuntu PC.
  • power up the target board.
  • Setting putty as follows.

RTENOTITLE
Select correct serial line, then click open. Then you will see the console information: RTENOTITLE
Type root to login in system.

Storage Information (eMMC/SD card)

The storages devices name as following:

Device Node Name
SD card
/dev/mmcblk0
eMMC /dev/mmcblk1

If Linux os exists in both SD card and eMMC flash, the linux in SD is default boot option. If no SD card inserted, the eMMC node is "/dev/mmcblk0".

Create a Linux SD Card System

1. Create system from Pre-built System Image
You are able to find the pre-built image from Advantech website. Please follow below steps to create a SD card for boot up. we still use the RSB-4220 as demo:

  • Copy “4420LIVxxxx_yyyy-mm-dd.tar.gz” package to your /root/.
  • Open "Terminal" on Ubuntu host PC.
  • $sudo su (Change to “root” authority)
  • Input your password.
    1. cd /root/
    2. tar xzvf 4220LIVxxxx_yyyy-mm-dd.tar.gz (Unzip files)
  • Insert one SD card to your developing computer
  • Check the SD card location, like /dev/sdb
    1. cd ./4220LIVxxxx_yyyy-mm-dd/scripts
    2. ./mksd-linux.sh /dev/sdb
  • Type “y” (Start to copy files, wait until it shows [Done] )

Then insert the Linux system SD card to target board (like RSB-4220), it will boot up with Linux environment.

2.Create system from Source Code Package
When you receive the advantech Linux source code package, you can refer following steps to create a Linux system SD card for booting up from it.we still use the RSB-4220 as demo:

  • Open "Terminal" on Ubuntu host PC.
  • $sudo su (Change to “root” authority)
  • Input your password.
  • Insert one SD card to your developing computer
  • Check the SD card location, like: /dev/sdb
  • Ensure that you have built the uboot and kernel
    1. cd $(BSP)/scripts
    2. ./mksd-linux.sh /dev/sdb
  • Type “y” (Start to copy files, wait until it shows [Done] )

Then insert the Linux system SD card to target board's (such as RSB-4220) SD card slot, it will boot up with Linux environment.

Boot from Onboard Flash

If you’ve already had a Linux system SD card, you can refer following steps to copy the content to onboard flash and then boot from onboard flash. Advantech also provide you a script “mkinand-linux.sh” to speed up the process of installing system image to onboard flash.

  • Ensure you have created a linux system on SD card
  • Insert this Linux system SD card to target board and connect serial console.
  • On your target system, type #root (Login)
  • On your target system, type #cd /mk_inand
  • On your target system, type #./mkinand-linux.sh /dev/mmcblk1
  • Type “y” (Start to copy files, wait until it shows [Done] )
  • After done, Power off and remove this SD card.

Then you can boot from onboard flash without SD card.

Developement Guide

HW module Configuration & driver

C/C++ & Qt Application Development

System Service & Usage