Linux BSP User Guide for AM335x series
Start your Linux Development
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:
- 1. 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
- 2. 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
- 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.
# sudo apt-get update libncurses5-dev autoconf automake dos2unix u-boot-tools
And On ubuntu14.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.
1. Copy "AM335X_LBBxxxx_yyyy-mm-dd.bin" package to /root/. 2. Start your "Terminal" on Ubuntu 14.04 LTS. 3. $sudo su (Change to “root” authority) 4. Input user password 5. # cd /root/ 6. # chmod 777 AM335X_LBBxxxx_yyyy-mm-dd.bin 7. # ./AM335X_LBBxxxx_yyyy-mm-dd.bin 8. Input “yes” 9. 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.
The description of AM335x BSP package contents:
|cross_compiler||Cross compiler tool|
|document||Some important documents, such as usermanual.|
|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).
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|
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.
BSP Building Guide
1. Setup uboot and kernel build environment
1) Open "Terminal" on Ubuntu 14.04 LTS. 2) $ sudo su (Change to “root” authority) 3) Input user password 4) # cd $(BSP)/scripts/ 5) # 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
3. Build Linux Kernel Image