Message-ID: <970440977.5217.1711653099035.JavaMail.root@dns3> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_5216_938040572.1711653099035" ------=_Part_5216_938040572.1711653099035 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html SMARC T335X SDK7

SMARC T335X SDK7

=20 =20
=20 =20 = =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20
=20 =20
=20
=20
=20

Building TI/Embedian=E2=80=99s Ar= ago SDK 7.0 Distribution

Eric Lee

version 1.0a, 8/19/2014

 

 

This document describes how Embedian builds a customized version of TI= =E2=80=99s am335x AMSDK 7.0 release for Embedian's SMARC T335X product plat= form. The approach is to pull from Embedian's public facing GIT repository = and build that using bitbake. The reason why we use this approach is that i= t allows co-development. The build output is comprised of binary image= s, feed packages, and an SDK for SMARC T335X specific development.

 

TI makes their AMSDK Arago build scripts available via the following GIT= repository:

=20 =20

 

If you=E2=80=99re interested in TI=E2=80= =99s overall EZSDK build and test process you should analyze the following = repository:  

 

=20 =20

 

It is this repository that actually p= ulls in the oe-layersetup=  project to perform the Linu= x AMSDK builds for TI=E2=80=99s entire suite of ARM CortextA chips. In this= document we are only concerned with the oe-layersetup&nbs= p;project.

Overview of the meta-embedian-SDK7 Yocto Layer


The supplied meta-embedian-sdk7 Yocto compliant layer has the following organization:

=20
=20
=20

.
|-- conf
|  
|-- layer.conf
|   |-- site.conf
|   |-- machine=
|   | &n= bsp; `-- smarct335x.conf
|-- REA= DME
|-- recipes-bsp
|   |-- u-boot
|       
|-- u-boot_201= 4.04-smarct335x.bb
|   = ;    `-- u-boot_2013.10-smarct335= x.bb

|-- recipes-connectivity
| &= nbsp; |-- lftp
|  
  =    `=E2= =80=93lftp_4.0.5.bb
|-- recipes-core
|  =  |-- base-files
|  <= /span>  &nbs= p;  `-- = ;base-files_3.0.14.bbappend
|  =  |-- busybox
|       |-- busybox_1.20.2.bbappend
| &= nbsp;     |=    |-- busybox
|       |   |   `-- defconfig
=
|&nbs= p;  |-- images
|   |   |-- arago-base-smarct= 335x-image.bb
|   |   |-- arago-image.inc
<= span style=3D"color: rgb(0,51,102);">|   |   |-- meta-t= oolchain-smarc-tisdk.bb
|=    |   |-- smarct335x-initramfs-image.bb
|&= nbsp;  |   `-- smarct335x-rootfs-image.bb
= |   |-- init-ifupdown
| =       |-- init-ifupdown_1.0.bb= append
| 
  =     | &n= bsp; |-- init-ifupd= own
|      =  |   |  &nb= sp;`-- interfaces
|   |-- initscripts <= br />|   |   `-- initscripts_1.0.bbappend
| =   `-- packagegroups
      |-- packagegroup-arago-smarct335x-base.bb
|&nb= sp;    =   |-- package= group-arago-smarct335x-console.bb
|       |-- packagegroup-arago-smarct335x-matrix.bb=
|     
  = |-- packagegroup-arago-smarct335x-sdk.bb
|    <= /span>  &nbs= p;`-- packagegroup-initramfs-b= oot.bb
|-- recipes-devtools
|   |-- nodejs
|   |   |-- nodejs_0.10.11.bb
|   |&nb= sp;  |-- nodejs_0.10.17.bb
|   |   |-- nodej= s_0.10.4.bb
|   |   |-- nodejs_0.8.14.bb
|&= nbsp;  |   `-- nodejs_0.8.21.bb
|   |-- ltp-= ddt
|  =  |  &nb= sp;|-- ltp-ddt_0.0.4.bbappend
| = ;  |   |-- ltp-ddt
|       <= span style=3D"color: rgb(0,51,102);"> 
   `-- 0001-add-smarct335x-platform-support.patch
|  
|-- pinmux-utility
|  
|   `-- p= inmux-utility_2.5.2.0.bbappend
|-- recipes-kernel
| = ;  |-- linux
|       |-- linu= x.inc
|       |-- linux-dt= b.inc
|  
   
  |-- copy-defconfig.inc <= br />|  &nbs= p;  &= nbsp; |-- setup-defconfig.inc
| &= nbsp;     |-- linux-smarct335x-3.2
|       |   `-- defconfig
|&n= bsp;      |-- linux-smarct335x_3.2.bb
|<= span style=3D"color: rgb(0,51,102);">       |-- linux-smarct335x-staging_3.12.bb
|=        `-- linux-smarct335x-staging
|      = ; |   `-- defconfig
|  &n= bsp;|-- cryptodev
| =   &nb= sp;  =  `-- cryptodev_1.6.bbappend
|-- recipes-multimedia
|   |-- amsdk-av-files
|       |-- amsdk-av-files_1.1.bbappend
|  =  |-- x264
|   |   `-- = x264_git.bbappend
|-- recipes-support
|   |-- boost
|   | &= nbsp; |-- boost_1.53.0.bb
|   | &nbs= p; |-- boost.inc
|   |   `-- fi= les
|   |-- ntp
| = ;  |   |-- files
|   = |   |-- ntp_4.2.6p5.bb
|   |&nb= sp;  `-- ntp.inc
`-- recipes-tisdk
    `-- ti-tisdk-makefile
  = ;  &n= bsp;   `-- ti-tisdk-makefile_1.0.bbappend

 

=20
=20
=20

 

Notes on meta-embedian-sdk7 layer content

conf/machine/*

This folder contains the machine definiti= ons for the smarct335x platform and bac= kup repository in Embedian. These select the associated kernel, kernel conf= ig, u-boot, u-boot config, and UBI image settings.

recipes-bsp/u-boot/*

This folder contains recipes used to buil= d 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 h= ostname  for the platform.

recipes-core/busybox/*

This recipe modifies TI=E2=80=99s BusyBox= configuration to remove telnet from the image.

recipes-core/images/*

These recipes are used to create the fina= l 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&n= bsp;platform:

=20
=20
=20

MACHINE=3Dsmarct335x bitbake -k smarct335x-rootfs-image=20

=20
=20

recipes-core/init-ifupdown*

This recipe is used to amend device netwo= rk interfaces

recipes-devtools/nodejs/*<= /span>

These recipes build the Node.js Javascrip= t server execution environment.

recipes-kernel/linux/*

Contains the recipes needed to build the&= nbsp;smarct335x Linux kernels.

recipes-multimedia/amsdk-a= v-files/*

This recipe is to add smarct335x compatib= le machine for the platform. 

recipes-multimedia/x264/*<= /span> 

This original commit history has been rew= ritten.

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-mak= efile/*

Add smarct335x device tree into Makefile.=

Setting Up the Tools and Build Environment


To build the latest TI am335x 7.0 AMSDK you first need an Unbuntu Linux 12= .04LTS or Ubuntu 14.04LTS installation (preferably 32bit). Since bitbake do= es 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 add= itional required support packages using the following console command:

=20
=20
=20

$ sudo apt-get install gawk = wget git-core diffstat unzip texinfo build-essential chrpath libsdl1.2-dev = xterm python-m2crypto bc

=20
=20
=20

If you are using a 64-bit Linux, then= you'd also need to install 32-bit support libraries, needed by the pre-bui= lt Linaro toolchain and other binary tools.

=20
=20
=20
$ sudo dpkg --add-architecture i386 && sudo apt-get update &am=
p;& sudo apt-get install lib32ncurses5
=20
=20
=20

You=E2=80=99ll also need to change th= e default shell to bash from Ubuntu=E2=80=99s default=  dash shell (select the <No>=  option):

=20
=20
=20

$ sudo dpkg-reconfigure dash=

=20
=20
=20

 To build TI=E2=80=99s am335x SDK you will need to install the Li= naro arm compiler that TI used for the release:

=20
=20
=20

$ wget http://releases.linaro.org/= archive/13.04/components/toolchain/binaries/gcc-linaro-arm-linux-gnueabihf-= 4.7-2013.04-20130415_linux.tar.xz
$ sudo tar -C /opt -xJf g= cc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux.tar.xz

=20
=20
=20

Add the following  PATH  definition to the  .bashrc  file in your  $HOME  directory:

 

=20
=20
=20

export PATH=3D/opt/gcc-linar= o-arm-linux-gnueabihf-4.7-2013.04-20130415_linux/bin:$PATH=20

=20
=20

Next clone and intialize TI=E2=80=99s am= 335x SDK build process:

 

=20 =20
 = ;  
Add the Embedian=E2=80=99s  meta-embedian-sdk7  layer to the build process .

 

=20
=20
=20

$ cd ~/oe-layersetup-smarct3= 3-sdk7/sources 
$ git clone git@git.embedian.com:developer/me= ta-embedian-sdk7.git
 =
$ cd ~/oe-layersetup-sdk= 7/build

=20
=20
=20

Edit the  ~/oe-layersetup-sdk7/build/conf/bblay= ers.conf  file to include the  meta-embedian-sdk7  layer in the layer list. It should= look something like this (the example reflects the absolute paths on my ma= chine):

 

=20
=20
=20

# This template file was created by taking the oe-core/meta/conf/bblayer= s.conf

# file and removing the BBLAYERS section at the end.

 

# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf

# changes incompatibly

LCONF_VERSION =3D "5"

 

BBPATH =3D "${TOPDIR}"

BBFILES ?=3D ""

 

# Layers configured by oe-core-setup script

BBLAYERS +=3D " \

/home/oeeric/oe-layersetup-sdk7/so= urces/meta-embedian-sdk7 \
/home/oeeric/oe-layersetup-sdk7/sou= rces/meta-arago/meta-arago-distro \
/home/oeeric/oe-layersetup-sdk7/s= ources/meta-arago/meta-arago-extras \
/home/oeeric/oe-layersetup= -sdk7/sources/meta-qt5 \
/home/oeeric/oe-layersetup-sdk7/sourc= es/meta-openembedded/toolchain-layer \
/home/oeeric/oe-layerset= up-sdk7/sources/meta-openembedded/meta-networking \
/home/oeer= ic/oe-layersetup-sdk7/sources/meta-openembedded/meta-oe \
/home/oeeri= c/oe-layersetup-sdk7/sources/meta-ti \
/home/oeeric/oe-layersetu= p-sdk7/sources/meta-linaro/meta-linaro-toolchain \
/home/oeeri= c/oe-layersetup-sdk7/sources/oe-core/meta \
"

=20
=20
=20

 

 

=20
=20

Note:

=20 Icon=20
=20

If your platform is SMARC T3354 (with= sgx features), you can simply add "sgx" in the MACHINE_FEATURES = to have the powervr driver loaded by editing the ~/oe-layersetup-sdk7/source/meta-embedian/conf/mach= ine/smarct335x.conf file. Find M= ACHINE_FEATURES and add "sgx" in the very bottom:

=20
=20
=20

 

 

=20
=20
=20

MACHINE_FEATURES =3D "kernel26 alsa usbgadget usbhost apm vfat ext2= screen touchscreen ethernet sgx"

=20
=20
=20

Please do not enable the sgx MACHINE FEATURES if your platform is SMARC = T3352.

Building the target platforms


To build the Embedian SMARC T335X and=  am335x-evm developer board images, respectively, us= e the following commands:

=20
=20
=20

$ cd ~/oe-layersetup-sdk7/bu= ild
$ source conf/setenv
$ MACHINE=3Dsmarct335x bitbake -k smar= ct335x-rootfs-image

=20
=20
=20
=20

Note

=20 Icon=20
=20

The first clean build might take more= than 10 hours. If you met errors during the building process, let it finis= h and usually build again should be fine.

=20
=20
=20

 

Once it done, you can find all required images under ~/oe-layersetup-sdk7/build/arago-tmp-external-linar= o-toolchain/deploy/images/

You may want to build programs that aren=E2=80=99t installed into a root= file system so you can make them available via a feed site (described belo= w.) To do this you can build the package directly and then build the packag= e named package-index&nbs= p;to add the new package to the feed site.

 

The following example builds the minicom program and makes it available on the feed site:=20

=20
=20

$ MACHINE=3Dsmarct335x bitba= ke minicom
$ MACHINE=3Dsmarct335x bitbake package-index
=

=20
=20
=20

Once the build(s) are completed you=E2= =80=99ll find the resulting images, feeds and licenses in folder  ~/oe-layersetup-sdk7/build/arag= o-tmp-external-linaro-toolchain/deploy .

deploy/images/* 

This folder contains the binary images for = the root file system and the Embedian SMARCT335X specific version of the am= 335x SDK. Specifically the images are:

 

deploy/images/u-boot.img 

This u-boot bootloader binary for SMARC T33= 5X

deploy/images/MLO

The &= quot;Stage 1 Boot Loader" for SMARC T335X.  Its purpose is load&n= bsp;the Stage 2 Boot Loader (u= -boot.img).

deploy/images/zImage<= /span>

The k= ernel zImage for SMARC T335X.  

deploy/images/zImage-am335x-= smarct335x.dtb

The d= evice tree binary file for SMARC T335X. 

deploy/images/smarct335x-rootf= s-image-smarct335x*

Embedian root file system images for softwa= re development on Embedian=E2=80=99s SMARC T335X platforms.


deploy/images/smarct335x-ams= dk-image*

 = These files contain the entire TI AMSDK augmented with Boost a= nd other options to simplify Embedian SMARC T335X software development= .

 deploy/imag= es/arago-base-tisdk-image-smarct335x*

 = ;These images are used to create the SMARC T335X AMSDK (see&nb= sp;smarct335x-amsdk-imag= e-smarct335x*).

 deploy/imag= es/tisdk-rootfs-image-am335x-evm*

TI Arago root file system images for softwa= re development on TI=E2=80=99s am335x-evm and BeagleBone platforms.<= /span>

 

 deploy/ipk/*<= /code>

 = ;This folder contains all the packages used to construct the r= oot file system images. They are in opkg format (similar format t= o Debian packages) and can be dynamically installed on the target plaform v= ia a properly  constructed feed file. Here is an example of the feed= file (named arago-smarct= 335x-feed.conf) that is used internally at Embedian to install= upgrades onto a = smarct335x platform without reflashing the file = system:

=20 =20

deploy/licenses/* 
A = database of all licenses used in all packages built for the system.<= /span>

 

&n= bsp;deploy/sdk/arago-2013.= 12-cortexa8-linux-gnueabi-tisdk.sh
Th= e installer for ARM toolchain that was created for the target platform. In = Embedian=E2=80=99s case that means that the headers for the Boost libraries= are baked into the tools. (Generate by meta-toolchain-smarc-tisdk ima= ge)

Setup SD Card


For these instruction, we are assuming: DISK=3D/dev/mmcblk0, "lsblk= " is very useful for determining the device id.

=20
=20
=20

$ export DISK=3D/dev/mmcblk0

=20
=20
=20

Erase SD card:

=20
=20
=20

$ sudo = dd if=3D/dev/zero of=3D${DISK} bs=3D1M count=3D16

=20
=20
=20

Create Partition Layout:

With util-linux v2.26, sfdisk was rewritten and is now based on = libfdisk.

=20
=20

sfdisk

=20
=20
$ sudo sfd= isk --version
sfdisk from util-linux 2.27.1
=20
=20
=20

Create Partitions:

=20
=20

sfdisk >=3D2.26.x

=20 Icon=20
=20
$ sudo sfd= isk ${DISK} <<-__EOF__
1M<= code class=3D"java plain">,48M,0xE,*
,,,-
__EOF__
=20
=20
=20
=20

sfdisk <=3D2.25

=20 Icon=20
=20
$ sudo sfd= isk --in-order --Linux --unit M ${DISK} <<-__EOF__
1,48,0xE,*
,,,-
__EOF__
=20
=20
=20

Format Partitions:

=20
=20
=20
for: DISK=3D/dev/mmcblk0
$ sudo mkf= s.vfat -F 16 ${DISK}p1 -n boot
$ sudo mkf= s.ext4 ${DISK}p2 -L rootfs
 
for: DISK=3D/dev/sdX
$ sudo mkf= s.vfat -F 16 ${DISK}1 -n boot
$ sudo mkf= s.ext4 ${DISK}2 -L rootfs
=20
=20
=20

Mount Partitions:

On some systems, these partitions may be auto-mounted...

=20
=20
=20
$ sudo mkd= ir -p /media/boot/dtbs
$ sudo mkd= ir -p /media/rootfs/
 
for: DISK=3D/dev/mmcblk0
$ sudo mou= nt ${DISK}p1 /media/boot/
$ sudo mou= nt ${DISK}p2 /media/rootfs/
 
for: DISK=3D/dev/sdX
$ sudo mou= nt ${DISK}1 /media/boot/
$ sudo mou= nt ${DISK}2 /media/rootfs/
=20
=20
=20

Install Bootloader

Copy MLO/u-boot.img to the boot partition

=20
=20

deploy/images

=20
=20

$ sudo cp = -v MLO /media/boot/
$ sudo cp = -v u-boot.img /media/boot/ 
=20
=20
=20

uEnv.txt based bootscript

Create "uEnv.txt" boot script: (vim uEnv.txt)

For 3.12.y or after :

=20
=20

~/uEnv.txt

=20
=20

optargs=3D"consoleblank=3D0 mem=3D512M"
#u-boot eMMC spec= ific overrides; Angstrom Distribution (SMARC T335X) 2014-05-20
kernel_= file=3DzImage
initrd_file=3Dinitrd.img

loadaddr=3D0x82000000
initrd_addr=3D0x88080000
fdtaddr=3D0x880= 00000
fdtfile=3Dam335x-smarct335x.dtb 

initrd_high=3D0xffffffff
fdt_high=3D0xffffffff

loadimage=3Dload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${kernel_file}
loadinitrd=3Dload mmc ${mmcdev}:${mmcpart} ${initrd_addr} ${initrd_file};= setenv initrd_size ${filesize}
loadfdt=3Dload mmc ${mmcdev}:${mmcpart= } ${fdtaddr} /dtbs/${fdtfile}
#

##Un-comment to enable systemd in Debian Wheezy
#optargs=3Dquiet in= it=3D/lib/systemd/systemd

console=3DttyO3,115200n8
mmcroot=3D/dev/mmcblk1p2 ro
mmcrootfs= type=3Dext4 rootwait fixrtc

mmcargs=3Dsetenv bootargs console=3D${console} root=3D${mmcroot} rootfst= ype=3D${mmcrootfstype} ${optargs}

#zImage:
uenvcmd=3Drun loadimage; run loadfdt; run mmcargs; bootz $= {loadaddr} - ${fdtaddr}

#zImage + uInitrd: where uInitrd has to be generated on the running syst= em.
#boot_fdt=3Drun loadimage; run loadinitrd; run loadfdt
#uenvc= md=3Drun boot_fdt; run mmcargs; bootz ${loadaddr} ${initrd_addr}:${initrd_s= ize} ${fdtaddr}

###Begin Rootfs from NFS
#serverip=3D192.168.1.51
#rootpath=3D= /srv/nfs/smarct335x/ubuntu1204/
#nfsopts=3Dnolock,acdirmin=3D60
#= netargs=3Dsetenv bootargs console=3D${console} ${optargs} root=3D/dev/nfs n= fsroot=3D${serverip}:${rootpath},${nfsopts} rw ip=3Ddhcp
##netboot=3De= cho Loading kernel from SDCARD and booting from NFS ...; run loadimage; run= netargs; bootz ${loadaddr} - ${fdtaddr}
##uenvcmd=3Drun netboot
= ###End Rootfs from NFS

###Begin Load kernel from TFTP
#netmask=3D255.255.255.0
#ipadd= r=3D192.168.1.65
#serverip=3D192.168.1.51
#netboot=3Decho Loading= kernel and device tree from TFTP and booting from NFS ...; setenv autoload= no; tftp ${loadaddr} ${kernel_file}; tftp ${fdtaddr} ${fdtfile}; run netar= gs; bootz ${loadaddr} - ${fdtaddr}
#uenvcmd=3Drun netboot
###End = Load kernel from TFTP

=20
=20
=20

 

Copy uEnv.txt to the boot partition:

=20
=20

~/

=20
=20

$ sudo cp -v ./uEnv.txt /media/boo= t/

=20
=20
=20

Install Kernel zImage

Copy zImage to the boot partition:

=20
=20

deploy/images

=20
=20

$ sudo cp -v zImage /media/boot

=20
=20
=20

Install Kernel Device Tree Binary

Copy device tree binary to /media/boot/dtbs (Note: the file name in /med= ia/boot/dtbs/ has to be am335x-smarct335x.dtb) 

=20
=20
=20

$ sudo cp -v zImage-am335x-smarct3= 35x.dtb /media/boot/dtbs/am335x-smarct335x.dtb

=20
=20
=20

 

Install Root File System and Kernel Modules

Install Root File System


Copy Root File System:

Arago:

=20
=20

deploy/images

=20
=20

$ sudo tar xvfz smarct335x-rootfs-= image-smarct335x.tar.gz -C /media/rootfs

=20
=20
=20

Note:

Kernel modules are included in root file systems. 


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= :

=20
=20
=20

# cd /etc/opkg <= /span>

# wget http://www.embedian.com/feedfiles-sdk7/arago-smarct335x-f= eed.conf 

# opkg update 

# opkg upgrade <= /span>

# opkg install minicom

=20
=20
=20

Writing Bitbake Recipes


In order to package your application and include it in the root filesyst= em image, you must write a BitBake recipe for it.

When starting from scratch, it is easiest to learn by example from exist= ing recipes. 

Example Hel= loWorld recipe using autotools

For software that uses autotools (./configure; make; make install), writ= ing recipes can be very simple:

=20
DESCRIPTION =3D "Hello World Recipe using autotools"
HOMEPAGE =3D "http://www.embedian.com/"
SECTION =3D "console/utils"
PRIORITY =3D "optional"
LICENSE =3D "GPL"
PR =3D "r0"
=20
SRC_URI =3D "git://git@git.embedian.com/developer/helloworld-autotools=
.git;protocol=3Dssh;tag=3Dv1.0"
S =3D "${WORKDIR}/git"
=20
inherit autotools
=20

SRC_URI sp= ecifies the location to download the source from. It can take the form of a= ny standard URL using http://, ftp://, etc. It can also fetch from SCM syst= ems, 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 n= eeded unless something needs to be customized.

S is the s= ource directory variable. This specifies where the source code will exist a= fter it is fetched from SRC_URI and unpacked. The default value is ${WORKDIR}/${PN}-${PV}, where PN&n= bsp;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.

Exa= mple HelloWorld recipe using a single source file

This example shows a simple case of building a helloworld.c file directl= y using the default compiler (gcc). Since it isn=E2=80=99t using autotools = or make, we have to tell BitBake how to build it explicitly.

=20
DESCRIPTION =3D "HelloWorld"
SECTION =3D "examples"
LICENSE =3D "GPL"
=20
SRC_URI =3D "file://helloworld.c"
=20
S =3D "${WORKDIR}"
=20
do_compile() {
    ${CC} ${CFLAGS} ${LDFLAGS} helloworld.c -o helloworld
}
=20
do_install() {
    install -d ${D}${bindir}
    install -m 0755 helloworld ${D}${bindir}
}
=20

 

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 he= lloworld.c will be copied to before it is built.

WORKDIR is= located at ${OETREE}/build= /arago-tmp-external-linaro-tool= chain/work/armv7ahf-vfp-neon-3.8-oe-linux-gnueabi/<package name and vers= ion> for most packages. If the package is machine-spe= cific (rather than generic for the armv7ahf architecture), it may be locate= d in the smarct335x-oe-linux-gnueabi subdirectory depending on your hardwar= e (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=E2=80=99t 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 appli= cation there with permissions set to 755.

D is the d= estination directory where the application is installed to before it is pac= kaged.

${bindir} = is the directory where most binary applications are installed, typically&nb= sp;/usr/bin.

For a more in-depth explanation of BitBake recipes, syntax, and variable= s, see the Recipe Ch= apter of the OpenEmbedded User Manual.

S= etup 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 modul= e will be always emulated as /dev/mmcblk0. Setting up eMMC now is noth= ing but changing the device descriptor. 

This section gives a step-by-step procedure to setup eMMC flash. Users c= an 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 NF= S):

Insert SD card into your Linux PC. For these instructions, we are assumi= ng: DISK=3D/dev/mmcblk0, "lsblk" is very useful for determining t= he device id.

For these instruction, we are assuming: DISK=3D/dev/mmcblk0, "lsblk= " is very useful for determining the device id.

=20
=20
=20

$ export DISK=3D/dev/mmcblk0

=20
=20
=20

Mount Partitions:

On some systems, these partitions may be auto-mounted...

=20
=20
=20
$ sudo mkd= ir -p /media/boot/
$ sudo mkd= ir -p /media/rootfs/
 
for: DISK=3D/dev/mmcblk0
$ sudo mou= nt ${DISK}p1 /media/boot/
$ sudo mou= nt ${DISK}p2 /media/rootfs/
 
for: DISK=3D/dev/sdX
$ sudo mou= nt ${DISK}1 /media/boot/
$ sudo mou= nt ${DISK}2 /media/rootfs/
=20
=20
=20

Copy MLO to rootfs part= ition:

=20
=20
=20

$ sudo cp -v /media/boot/MLO /medi= a/rootfs/home/root

=20
=20
=20

 

Copy u-boot.img to root= fs partition:

=20
=20
=20

$ sudo cp -v /media/boot/u-boot.im= g /media/rootfs/home/root

=20
=20
=20

 

Copy initramfs zImage t= o rootfs partition:

=20
=20

arago-tmp-external-linaro-toolchain/deploy/images

=20
=20

$ sudo cp -v zImage /media/rootfs/= home/root

=20
=20
=20

 

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)

     For= kernel v3.12.y+:

=20
=20
=20

optargs=3D"consoleblank=3D0 mem=3D512M"
#u-boot eMMC spec= ific overrides; Angstrom Distribution (SMARC T335X) 2014-05-20
kernel_= file=3DzImage
initrd_file=3Dinitrd.img

loadaddr=3D0x82000000
initrd_addr=3D0x88080000
fdtaddr=3D0x880= 00000
fdtfile=3Dam335x-smarct335x.dtb 

initrd_high=3D0xffffffff
fdt_high=3D0xffffffff

loadimage=3Dload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${kernel_file}
loadinitrd=3Dload mmc ${mmcdev}:${mmcpart} ${initrd_addr} ${initrd_file};= setenv initrd_size ${filesize}
loadfdt=3Dload mmc ${mmcdev}:${mmcpart= } ${fdtaddr} /dtbs/${fdtfile}
#

##Un-comment to enable systemd in Debian Wheezy
#optargs=3Dquiet in= it=3D/lib/systemd/systemd

console=3DttyO3,115200n8
mmcr= oot=3D/dev/mmcblk0p2 ro
mmcrootfstype=3Dext4 rootwait fixrtc

mmcargs=3Dsetenv bootargs console=3D${console} root=3D${mmcroot} rootfst= ype=3D${mmcrootfstype} ${optargs}

#zImage:
uenvcmd=3Drun loadimage; run loadfdt; run mmcargs; bootz $= {loadaddr} - ${fdtaddr}

#zImage + uInitrd: where uInitrd has to be generated on the running syst= em.
#boot_fdt=3Drun loadimage; run loadinitrd; run loadfdt
#uenvc= md=3Drun boot_fdt; run mmcargs; bootz ${loadaddr} ${initrd_addr}:${initrd_s= ize} ${fdtaddr}

###Begin Rootfs from NFS
#serverip=3D192.168.1.51
#rootpath=3D= /srv/nfs/smarct335x/ubuntu1204/
#nfsopts=3Dnolock,acdirmin=3D60
#= netargs=3Dsetenv bootargs console=3D${console} ${optargs} root=3D/dev/nfs n= fsroot=3D${serverip}:${rootpath},${nfsopts} rw ip=3Ddhcp
##netboot=3De= cho Loading kernel from SDCARD and booting from NFS ...; run loadimage; run= netargs; bootz ${loadaddr} - ${fdtaddr}
##uenvcmd=3Drun netboot
= ###End Rootfs from NFS

###Begin Load kernel from TFTP
#netmask=3D255.255.255.0
#ipadd= r=3D192.168.1.65
#serverip=3D192.168.1.51
#netboot=3Decho Loading= kernel and device tree from TFTP and booting from NFS ...; setenv autoload= no; tftp ${loadaddr} ${kernel_file}; tftp ${fdtaddr} ${fdtfile}; run netar= gs; bootz ${loadaddr} - ${fdtaddr}
#uenvcmd=3Drun netboot
###End = Load kernel from TFTP

=20
=20
=20

Copy real rootfs to roo= tfs partition:

=20
=20
=20

$ pushd /media/rootfs

$ sudo tar cvfz ~/smarct335x-emmc-= rootfs.tar.gz .

$ sudo mv ~/smarct335x-emmc-rootfs= .tar.gz /media/rootfs/home/root

$ popd

=20
=20
=20

 

Remove SD card:

=20
=20
=20
$ sync
$ sudo umo= unt /media/boot
$ sudo umo= unt /media/rootfs
=20
=20
=20

 

Insert this SD card into your SMARC T335X device.

Now it will be almost the same as you did when setup your SD card, but t= he eMMC device descriptor is /dev/mmcblk1 now.

=20
=20
=20

$ export DISK=3D/dev/mmcblk0

=20
=20
=20

Erase SD card:

=20
=20
=20

$ sudo = dd if=3D/dev/zero of=3D${DISK} bs=3D1M count=3D16

=20
=20
=20

Create Partition Layout:

=20
=20
=20
$ sudo sfd= isk --in-order --Linux --unit M ${DISK} <<-__EOF__
1,48,0xE,*
,,,-
__EOF__
=20
=20
=20

 

Format Partitions:

=20
=20
=20
$ sudo mkfs.vfat -F  16   ${DISK}p1 -n boot
$ sudo mkf= s.ext4 ${DISK}p2 -L rootfs
=20
=20
=20

 

Mount Partitions:

=20
=20
=20
$ sudo mkd= ir -p /media/boot/
$ sudo mkd= ir -p /media/rootfs/
$ sudo mou= nt ${DISK}p1 /media/boot/
$ sudo mou= nt ${DISK}p2 /media/rootfs/
=20
=20
=20


Install binaries for partition 1

Copy MLO/u-boot.img/uEnv.txt/zImage to the boot par= tition

=20
=20
=20

$ sudo cp = -v MLO u-boot.img zImage uEnv.txt /media/boot/
=20
=20
=20

Install Kernel Device Tree Binary

=20
=20
=20

$ sudo mkdir -p /media/boot/dtbs

$ sudo cp -v am335x-smarct335x.dtb= /media/boot/dtbs

=20
=20
=20

 

Install Root File System


=20
=20
=20

$ sudo tar -zxvf smarct335x-emmc-r= ootfs.tar.gz -C /media/rootfs

=20
=20
=20

 

Unmount eMMC:

=20
=20
=20
$ sync
$ sudo umo= unt /media/boot
$ sudo umo= unt /media/rootfs
=20
=20
=20

 

Switch your Boot Select to eMMC and you will be able to boot up from eMM= C now.


version 1.0a, 8/19/2014

Last updated 2015-12-07

 

------=_Part_5216_938040572.1711653099035--