...
TI makes their Processor-SDK-03.00.00.04 Arago build scripts available via the following GIT repository:
Info | ||
---|---|---|
| ||
If you’re interested in TI’s overall Processor SDK build and test process you should analyze the following repository:
Info | ||
---|---|---|
| ||
|
It is this repository that actually pulls in the oe-layersetup project to perform the Linux Processor-SDK builds for TI’s entire suite of ARM CortextA chips. In this document we are only concerned with the oe-layersetup project.
Generating SSH Keys
We recommend you use SSH keys to establish a secure connection between your computer and Embedian Gitlab server. The steps below will walk you through generating an SSH key and then adding the public key to our Gitlab account.
Step 1. Check for SSH keys
First, we need to check for existing ssh keys on your computer. Open up Git Bash and run:
Code Block | ||||
---|---|---|---|---|
| ||||
$ cd ~/.ssh $ ls # Lists the files in your .ssh directory |
Check the directory listing to see if you have a file named either id_rsa.pub
or id_dsa.pub
. If you don't have either of those files go to step 2. Otherwise, you already have an existing keypair, and you can skip to step 3.
Step 2. Generate a new SSH key
To generate a new SSH key, enter the code below. We want the default settings so when asked to enter a file in which to save the key, just press enter.
Code Block | ||||
---|---|---|---|---|
| ||||
$ ssh-keygen -t rsa -C "your_email@example.com" # Creates a new ssh key, using the provided email as a label # Generating public/private rsa key pair. # Enter file in which to save the key (/c/Users/you/.ssh/id_rsa): [Press enter] $ ssh-add id_rsa |
Now you need to enter a passphrase.
Code Block | ||||
---|---|---|---|---|
| ||||
Enter passphrase (empty for no passphrase): [Type a passphrase] Enter same passphrase again: [Type passphrase again] |
Which should give you something like this:
Code Block | ||||
---|---|---|---|---|
| ||||
Your identification has been saved in /c/Users/you/.ssh/id_rsa. Your public key has been saved in /c/Users/you/.ssh/id_rsa.pub. The key fingerprint is: 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@example.com |
Step 3. Add your SSH key to Embedian Gitlab Server
Copy the key to your clipboard.
Code Block | ||||
---|---|---|---|---|
| ||||
$ cat ~/.ssh/id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAABDAQABAAABAQDQUEnh8uGpfxaZVU6+uE4bsDrs/tEE5/BPW7jMAxak 6qgOh6nUrQGBWS+VxMM2un3KzwvLRJSj8G4TnTK2CSmlBvR+X8ZeXNTyAdaDxULs/StVhH+QRtFEGy4o iMIzvIlTyORY89jzhIsgZzwr01nqoSeWWASd+59JWtFjVy0nwVNVtbek7NfuIGGAPaijO5Wnshr2uChB Pk8ScGjQ3z4VqNXP6CWhCXTqIk7EQl7yX2GKd6FgEFrzae+5Jf63Xm8g6abbE3ytCrMT/jYy5OOj2XSg 6jlxSFnKcONAcfMTWkTXeG/OgeGeG5kZdtqryRtOlGmOeuQe1dd3I+Zz3JyT your_email@example.c om |
Go to Embedian Git Server. At Profile Setting --> SSH Keys --> Add SSH Key
Paste your public key and press "Add Key" and your are done.
Overview of the meta-smarct335x-sdk-03-00-00-04 Yocto Layer
The supplied meta-smarct335x-sdk-03-00-00-04 Yocto compliant layer has the following organization:
Info | ||
---|---|---|
| ||
|
Notes on meta-smarct335x-sdk-03-00-00-04 layer content
conf/machine/*
This folder contains the machine definitions for the smarct335x platform and backup repository in Embedian. These select the associated kernel, kernel config, u-boot, u-boot config, and UBI image settings.
recipes-bsp/u-boot/*
This folder contains recipes used to build DAS U-boot for smarct335x platform.
recipes-connectivity/lftp/*
This folder adds lftp ftp client utility for smarct335x platform.
recipes-core/base-files/*
This recipe is used to amend the device hostname for the platform.
recipes-core/busybox/*
This recipe modifies TI’s BusyBox configuration to remove telnet from the image.
recipes-core/images/*
These recipes are used to create the final target images for the devices. When you run Bitbake one of these recipes would be specified. For example, to build the root file system for the smarct335x platform:
Info | ||
---|---|---|
| ||
|
recipes-core/init-ifupdown*
This recipe is used to amend device network interfaces
recipes-devtools/nodejs/*
These recipes build the Node.js Javascript server execution environment.
recipes-kernel/linux/*
Contains the recipes needed to build the smarct335x Linux kernels.
recipes-support/boost/*
Adds Boost to the images. Boost provides various C++ libraries that encourage cross-platform development.
recipes-support/ntp/*
Network time protocol support.
recipes-tisdk/ti-tisdk-makefile/*
Add smarct335x device tree into Makefile.
Setting Up the Tools and Build Environment
To build the latest TI AM335X Processor-SDK-03-00-00-04, you first need an Ubuntu 14.04LTS or 16.04LTS installation. Because of support for 32-bit host is dropped as Linaro toolchain is available only for 64-bit machines., an x86_64 ubuntu 14.04 is highly recommended. Since bitbake does not accept building images using root privileges, please do not login as a root user when performing the instructions in this section.
Once you have Ubuntu 12.04 LTS or Ubuntu 14.04LTS running, install the additional required support packages using the following console command:
Info | ||
---|---|---|
| ||
|
If you are using a 64-bit Linux, then you'd also need to install 32-bit support libraries, needed by the pre-built Linaro toolchain and other binary tools.
Info | ||
---|---|---|
| ||
|
Note |
---|
If you saw error like the following after running "sudo dpkg --add-architecture i386"
make sure the only file present in /etc/dpkg/dpkg.cfg.d/ is "multiarch"
if output is
execute the following commands as it is else replace "multiarch" with the name of file present in that directory.
The above command will add i386 architecture. |
You’ll also need to change the default shell to bash from Ubuntu’s default dash shell (select the <No> option):
Info | ||
---|---|---|
| ||
|
To build TI’s am335x Processor-SDK-03.00.00.04 you will need to install the Linaro arm compiler that TI used for the release:
Info | ||
---|---|---|
| ||
$ wget https://releases.linaro.org/components/toolchain/binaries/5.3-2016.02/arm-linux-gnueabihf/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf.tar.xz $ sudo tar -C /opt -xJf gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf.tar.xz |
PATH
definition to the .bashrc
file in your $HOME
directory:
Info | ||
---|---|---|
| ||
|
Info | ||
---|---|---|
| ||
|
meta-smarct335x-sdk-03-00-00-04
layer to the build process.
Info | ||
---|---|---|
| ||
|
Edit the ~/smarct3x-sdk-03.00.00.04/build/conf/bblayers.conf file to include the meta-smarct335x-sdk-03-00-00-04 layer in the layer list. It should look something like this (the example reflects the absolute paths on my machine):
Info | ||
---|---|---|
| ||
# This template file was created by taking the oe-core/meta/conf/bblayers.conf # LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf BBPATH = "${TOPDIR}" # Layers configured by oe-core-setup script /home/eric/smarct3x-sdk-03.00.00.04/sources/meta-smarct335x-sdk-03-00-00-04 \ |
Building the target platforms
To build the Embedian SMARC-T335X developer board images, respectively, use the following commands:
Info | ||
---|---|---|
| ||
|
Note | ||
---|---|---|
| ||
|
Once it done, you can find all required images under ~/smarct3x-sdk-03.00.00.04/build/arago-tmp-external-linaro-toolchain/deploy/images/smarct335x/
You may want to build programs that aren’t installed into a root file system so you can make them available via a feed site (described below.) To do this you can build the package directly and then build the package named package-index to add the new package to the feed site.
The following example builds the minicom program and makes it available on the feed site:
Info | ||
---|---|---|
| ||
|
~/smarct3x-processor-sdk-03.00.00.04/build/arago-tmp-external-linaro-toolchain/deploy/
deploy/images/smarct335x/*
This folder contains the binary images for the root file system and the Embedian SMARC-T335X specific version of the am335X SDK. Specifically the images are:
deploy/images/smarct335x/u-boot.img
This u-boot bootloader binary for SMARC T335X
deploy/images/smarct335x/MLO
The "Stage 1 Boot Loader" for SMARC-T335X. Its purpose is load the Stage 2 Boot Loader (u-boot.img).
deploy/images/smarct335x/zImage
The kernel zImage for SMARC-T335X.
deploy/images/smarct335x/zImage-am335x-smarct335x.dtb
The device tree binary file for SMARC-T335X.
deploy/images/smarct335x/smarct335x-rootfs-image-smarct335x*
Embedian root file system images for software development on Embedian’s SMARC-T335X platforms.
deploy/ipk/*
This folder contains all the packages used to construct the root file system images. They are in opkg format (similar format to Debian packages) and can be dynamically installed on the target platform via a properly constructed feed file. Here is an example of the feed file (named base-feeds.conf) that is used internally at Embedian to install upgrades onto a smarct335x platform without reflashing the file system:
Info | ||
---|---|---|
| ||
|
deploy/licenses/*
deploy/sdk/arago-2015.12-cortexa9-linux-gnueabi-tisdk.sh
Setup SD Card
For these instruction, we are assuming: DISK=/dev/mmcblk0, "lsblk" is very useful for determining the device id.
Info | ||
---|---|---|
| ||
$ export DISK=/dev/mmcblk0 |
Erase SD card:
Info | ||
---|---|---|
| ||
$ |
Create Partition Layout:
With util-linux v2.26, sfdisk was rewritten and is now based on libfdisk.
Info | ||||
---|---|---|---|---|
| ||||
$ sudo sfdisk --version sfdisk from util-linux 2.27.1 |
Create Partitions:
Info | ||
---|---|---|
| ||
$ sudo sfdisk ${DISK} <<-__EOF__ 1M , 48M , 0xE ,* ,,,- __EOF__ |
Info | ||
---|---|---|
| ||
$ sudo sfdisk --in-order --Linux --unit M ${DISK} <<-__EOF__ 1 , 48 , 0xE ,* ,,,- __EOF__ |
Format Partitions:
Info | ||
---|---|---|
| ||
for : DISK=/dev/mmcblk0 $ sudo mkfs.vfat -F 16 ${DISK}p1 -n boot $ sudo mkfs.ext4 ${DISK}p2 -L rootfs for : DISK=/dev/sdX $ sudo mkfs.vfat -F 16 ${DISK} 1 -n boot $ sudo mkfs.ext4 ${DISK} 2 -L rootfs |
Mount Partitions:
On some systems, these partitions may be auto-mounted...
Info | ||
---|---|---|
| ||
$ sudo mkdir -p /media/boot/ $ sudo mkdir -p /media/rootfs/ for : DISK=/dev/mmcblk0 $ sudo mount ${DISK}p1 /media/boot/ $ sudo mount ${DISK}p2 /media/rootfs/ for : DISK=/dev/sdX $ sudo mount ${DISK} 1 /media/boot/ $ sudo mount ${DISK} 2 /media/rootfs/ |
Install Bootloader
Copy MLO/u-boot.img to the boot partition
Info | ||||
---|---|---|---|---|
| ||||
$ sudo cp -v MLO /media/boot/ $ sudo cp -v u-boot.img /media/boot/ |
uEnv.txt based bootscript
Create "uEnv.txt" boot script: (vim uEnv.txt)
Info | ||||
---|---|---|---|---|
| ||||
optargs="consoleblank=0 mem=512M" loadaddr=0x82000000 initrd_high=0xffffffff loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${kernel_file} ##Un-comment to enable systemd in Debian Wheezy console=ttyS3,115200n8 mmcargs=setenv bootargs console=${console} root=${mmcroot} rootfstype=${mmcrootfstype} ${optargs} #zImage: #zImage + uInitrd: where uInitrd has to be generated on the running system. ###Begin Rootfs from NFS ###Begin Load kernel from TFTP |
Install Kernel zImage
Copy zImage to the boot partition:
Info | ||||
---|---|---|---|---|
| ||||
$ sudo cp -v zImage /media/boot |
Install Kernel Device Tree Binary
Info | ||||
---|---|---|---|---|
| ||||
$ sudo mkdir -p /media/boot/dtbs $ sudo cp -v zImage-am335x-smarct335x.dtb /media/boot/dtbs/am335x-smarct335x.dtb |
Install Root File System and Kernel Modules
Info | ||||
---|---|---|---|---|
| ||||
$ sudo tar xvfz smarct335x-rootfs-image-smarct335x.tar.gz -C /media/rootfs |
Note |
---|
Kernel modules are built into root filesystems. |
Remove SD card:
Info | ||
---|---|---|
| ||
$ sync $ sudo umount /media/boot $ sudo umount /media/rootfs |
Setup eMMC
Setting up eMMC usually is the last step at development stage after the development work is done at your SD card or NFS environments. eMMC on module will be always emulated as /dev/mmcblk0. Setting up eMMC now is nothing but changing the device descriptor.
This section gives a step-by-step procedure to setup eMMC flash. Users can write a shell script your own at production to simplify the steps.
First, we need to backup the final firmware from your SD card or NFS.
Prepare for eMMC binaries from SD card (or NFS):
Insert SD card into your Linux PC. For these instructions, we are assuming: DISK=/dev/mmcblk0, "lsblk" is very useful for determining the device id.
For these instruction, we are assuming: DISK=/dev/mmcblk0, "lsblk" is very useful for determining the device id.
Info | ||
---|---|---|
| ||
$ export DISK=/dev/mmcblk0 |
Mount Partitions:
On some systems, these partitions may be auto-mounted...
Info | ||
---|---|---|
| ||
$ sudo mkdir -p /media/boot/ $ sudo mkdir -p /media/rootfs/ for : DISK=/dev/mmcblk0 $ sudo mount ${DISK}p1 /media/boot/ $ sudo mount ${DISK}p2 /media/rootfs/ for : DISK=/dev/sdX $ sudo mount ${DISK} 1 /media/boot/ $ sudo mount ${DISK} 2 /media/rootfs/ |
Copy MLO to rootfs partition:
Info | ||
---|---|---|
| ||
$ sudo cp -v /media/boot/MLO /media/rootfs/home/root |
Copy u-boot.img to rootfs partition:
Info | ||
---|---|---|
| ||
$ sudo cp -v /media/boot/u-boot.img /media/rootfs/home/root |
Note |
---|
The U-Boot for eMMC Boot up has one line difference in include/configs/smarct335x_evm.h. The mmcdev in SD boop up is 0 and is 1 in eMMC boot up. Please go to recipes-bsp/u-boot/u-boot-smarct335x_2016.05-smarct335x.bb and make changes as follows. BRANCH = "v2016.05-smarct3x" SRCREV = "cd7520d6afe9ed5916619394538aabb56a738378" # If Boot up from on module eMMC # SRCREV = "b08695ae0d33b53b1c44e001fddc542497d2f7e6" |
Copy zImage to rootfs partition:
Info | ||||
---|---|---|---|---|
| ||||
$ sudo cp -v zImage /media/rootfs/home/root |
Copy uEnv.txt to rootfs partition:
Copy and paste the following contents to /media/rootfs/home/root ($ sudo vim /media/rootfs/home/root/uEnv.txt)
Info | ||
---|---|---|
| ||
optargs="consoleblank=0 mem=512M" |
Copy real rootfs to rootfs partition:
Info | ||
---|---|---|
| ||
$ pushd /media/rootfs $ sudo tar cvfz ~/smarct335x-emmc-rootfs.tar.gz . $ sudo mv ~/smarct335x-emmc-rootfs.tar.gz /media/rootfs/home/root $ popd |
Remove SD card:
Info | ||
---|---|---|
| ||
$ sync $ sudo umount /media/boot $ sudo umount /media/rootfs |
Insert this SD card into your SMARC T335X device and boot up from SD card.
Now it will be almost the same as you did when setup your SD card, but the eMMC device descriptor is /dev/mmcblk1 now.
Info | ||
---|---|---|
| ||
$ export DISK=/dev/mmcblk0 |
Erase SD card:
Info | ||
---|---|---|
| ||
$ |
Create Partition Layout:
Info | ||
---|---|---|
| ||
$ sudo sfdisk --in-order --Linux --unit M ${DISK} <<-__EOF__ 1 , 48 , 0xE ,* ,,,- __EOF__ |
Format Partitions:
Info | ||
---|---|---|
| ||
$ sudo mkfs.vfat -F 16 ${DISK}p1 -n boot $ sudo mkfs.ext4 ${DISK}p2 -L rootfs |
Mount Partitions:
Info | ||
---|---|---|
| ||
$ sudo mkdir -p /media/boot/ $ sudo mkdir -p /media/rootfs/ $ sudo mount ${DISK}p1 /media/boot/ $ sudo mount ${DISK}p2 /media/rootfs/ |
Install binaries for partition 1
Copy MLO/u-boot.img/uEnv.txt/zImage to the boot partition
Info | ||
---|---|---|
| ||
$ sudo cp -v MLO u-boot.img zImage uEnv.txt /media/boot/ |
Install Kernel Device Tree Binary
Info | ||
---|---|---|
| ||
|
Install Root File System
Info | ||
---|---|---|
| ||
|
Unmount eMMC:
Info | ||
---|---|---|
| ||
$ sync $ sudo umount /media/boot $ sudo umount /media/rootfs |
Switch your Boot Select to eMMC and you will be able to boot up from eMMC now.
Feed Packages
The following procedure can be used on a Embedian SMARC-T335X device to download and utilize the feed file show above to install the minicom terminal emulation program:
Info | ||
---|---|---|
| ||
Only keep the following three lines:
|
Info |
---|
|
Writing Bitbake Recipes
In order to package your application and include it in the root filesystem image, you must write a BitBake recipe for it.
When starting from scratch, it is easiest to learn by example from existing recipes.
Example HelloWorld recipe using autotools
For software that uses autotools (./configure; make; make install), writing recipes can be very simple:
Code Block | ||||
---|---|---|---|---|
| ||||
DESCRIPTION = "Hello World Recipe using autotools" HOMEPAGE = "http://www.embedian.com/" SECTION = "console/utils" PRIORITY = "optional" LICENSE = "GPL" PR = "r0" SRC_URI = "git://git@git.embedian.com/developer/helloworld-autotools.git;protocol=ssh;tag=v1.0" S = "${WORKDIR}/git" inherit autotools |
SRC_URI
specifies the location to download the source from. It can take the form of any standard URL using http://, ftp://, etc. It can also fetch from SCM systems, such as git in the example above.
PR
is the package revision variable. Any time a recipe is updated that should require the package to be rebuilt, this variable should be incremented.
inherit autotools
brings in support for the package to be built using autotools, and thus no other instructions on how to compile and install the software are needed unless something needs to be customized.
S
is the source directory variable. This specifies where the source code will exist after it is fetched from SRC_URI and unpacked. The default value is ${WORKDIR}/${PN}-${PV}
, where PN
is the package name and PV
is the package version. Both PN
and PV
are set by default using the filename of the recipe, where the filename has the format PN_PV.bb
.
Example HelloWorld recipe using a single source file
This example shows a simple case of building a helloworld.c file directly using the default compiler (gcc). Since it isn’t using autotools or make, we have to tell BitBake how to build it explicitly.
Code Block | ||||
---|---|---|---|---|
| ||||
DESCRIPTION = "HelloWorld" SECTION = "examples" LICENSE = "GPL" SRC_URI = "file://helloworld.c" S = "${WORKDIR}" do_compile() { ${CC} ${CFLAGS} ${LDFLAGS} helloworld.c -o helloworld } do_install() { install -d ${D}${bindir} install -m 0755 helloworld ${D}${bindir} } |
In this case, SRC_URI
specifies a file that must exist locally with the recipe. Since there is no code to download and unpack, we set S
to WORKDIR
since that is where helloworld.c will be copied to before it is built.
WORKDIR
is located at ${OETREE}/build/arago-tmp-external-linaro-toolchain/work/cortexa8hf-vfp-neon-linux-gnueabi/<package name and version>
for most packages. If the package is machine-specific (rather than generic for the armv7ahf architecture), it may be located in the smarct335x-linux-gnueabi subdirectory depending on your hardware (this applies to kernel packages, images, etc).
do_compile
defines how to compile the source. In this case, we just call gcc directly. If it isn’t defined, do_compile
runs make
in the source directory by default.
do_install
defines how to install the application. This example runs install
to create a bin directory where the application will be copied to and then copies the application there with permissions set to 755.
D
is the destination directory where the application is installed to before it is packaged.
${bindir}
is the directory where most binary applications are installed, typically /usr/bin
.
For a more in-depth explanation of BitBake recipes, syntax, and variables, see the Recipe Chapter of the OpenEmbedded User Manual.
-- End of Document --
version 1.0a, 08/28/2016
Last updated 2016-08-28