QorIQ SDK build for T4240QDS - Beginner's guide

Document created by Vigneshwaren Sankaran on Mar 1, 2014
Version 1Show Document
  • View in full screen mode

This tutorial details the basics of how to boot up a Freescale T4240QDS board and also explains how to build an image in yocto and boot it up on the board.

The intended audience is an absolute beginner who is new to the yocto build and working on a board like T4240

 

Download the QorIQ SDK from freescale’s site. The SDK site can be found in:

http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=SDKLINUX

 

The version that is used in this documentation is version 1.4. Version 1.4 can be found in:

http://www.freescale.com/webapp/sps/site/overview.jsp?code=QORIQSDK_1.4

 

The SDK has 3 important components,

The source ISO – The actual SDK source that we are going to use.

The cache state ISO – These files contain sstate-cache directory, i.e all packages pre-downloaded, this

makes the build run faster.

The image ISO – These are pre-built images for all Freescale targets. This is not required for this tutorial,

since we are building our own images.

 

The name of the source ISO that you are looking for is: QorIQ Linux SDK v1.4 Yocto Source ISO

 

Once you click  Source, go ahead and login when the site prompts.

Download the source ISO, we are going to work on this.

 

Open a terminal


Create the iso directory

qoriq@usernsl-Veriton-Series:~$ sudo mkdir /media/sourceiso

 

Mount the iso.

qoriq@usernsl-Veriton-Series:~$ sudo mount -o loop Downloads/QorIQ-SDK-V1.4-SOURCE-20130625-yocto.iso /media/sourceiso/

 

Change into source directory

qoriq@usernsl-Veriton-Series:~$ cd /media/sourceiso/

 

Copy the source SDK

qoriq@usernsl-Veriton-Series:/media/sourceiso$ sudo cp yocto.tar.gz ~/

 

Change into working directory

qoriq@usernsl-Veriton-Series:/media/sourceiso$ cd

 

Create the root SDK directory

qoriq@usernsl-Veriton-Series:~$ mkdir yocto

 

Move the gzip file into directory

qoriq@usernsl-Veriton-Series:~$ mv yocto.tar.gz yocto/

 

Change into working directory

qoriq@usernsl-Veriton-Series:~$ cd yocto/

 

Unzip the source

qoriq@usernsl-Veriton-Series:~/yocto$ tar xvf yocto.tar.gz

 

View the source files/directories

qoriq@usernsl-Veriton-Series:~/yocto$ ls

bitbake LICENSE meta-fsl-ppc meta-oe  meta-yocto README sources documentation meta meta-fsl-ppc-toolchain meta-skeleton meta-yocto-bsp README.hardware yocto.tar.gz fsl-setup-poky meta-fsl-networking meta-hob meta-virtualization oe-init-build-env scripts

 

Preparing the kernel

 

Freescale kernel is configured in the layer ‘yocto/meta-fsl-ppc/recipes-kernel/linux’ folder. It containes recipes (.bb) files that tell the SDK how to download/configure/install the kernel. There are 2 portions to the kernel configuration, one is the kernel itself (linux-qoriq-sdk.bb file) and the kernel headers (linux-qoriq-sdk-headers.bb file). First we are going to show how to prepare the kernel to change the kernel sources within the kernel recipes. This can help us modify the sources.

 

 

Move into home directory

qoriq@usernsl-Veriton-Series:~/yocto$ cd ..

 

Download the freescale kernel that is going to be built for the target

qoriq@usernsl-Veriton-Series:~$ git clone git://git.freescale.com/ppc/sdk/linux.git

 

Cloning into 'linux'...

remote: Counting objects: 2931244, done.

remote: Compressing objects: 100% (481548/481548), done.

remote: Total 2931244 (delta 2449497), reused 2902973 (delta 2421384)

Receiving objects: 100% (2931244/2931244), 581.84 MiB | 92 KiB/s,

done.

Resolving deltas: 100% (2449497/2449497), done.

 

Rename the kernel tree to the Yocto compatible directory (this makes  the build run error free, with minimal changes)

qoriq@usernsl-Veriton-Series:~$ mv linux/ linux-qoriq-sdk

 

Create a gzip file of the kernel source

qoriq@usernsl-Veriton-Series:~$ tar zcvf linux-qoriq-sdk.tar.gz linux-qoriq-sdk/

 

Generate the md5sum of the kernel gzip, (used in the build conf file)

qoriq@usernsl-Veriton-Series:~$ md5sum linux-qoriq-sdk.tar.gz

986feb8581d3521f295884270d7cc5f2 linux-qoriq-sdk.tar.gz

 

Now the kernel is ready to be given as input to the build environment.  The kernel sources (from where the kernel is downloaded/fetched) is, by default, the freescale git repository. Since we downloaded the kernel from the same repository we should remember to change the kernel sources to the gzip file that we created. We show how to do this, further in this tutorial.

 

The Build proceedure

 

These are the build commands to generate the images.

 

Change into the yocto directory

qoriq@usernsl-Veriton-Series:~ cd yocto

 

Source the environment

qoriq@usernsl-Veriton-Series:~/yocto$ source fsl-setup-poky -m

 

Configuring for t4240qds board type

Creating an yocto build output at /home/qoriq/yocto/

build_t4240qds_release

Run the following commands to start a build:

          bitbake fsl-image-core

          bitbake fsl-image-lsb-sdk

          bitbake fsl-image-flash

          bitbake fsl-image-full

          bitbake fsl-image-kvm

          bitbake fsl-image-minimal

 

To return to this build environment later please run:

          source /home/qoriq/yocto/build_t4240qds_release/SOURCE_THIS

 

Sourcing the environment makes all the yocto commands(bitbake, runqemu, runqemu-extract-sdk, yocto-layer etc.) available, it also creates a default environment that can be configured to build for various different architectures and machines. The two important configuration files that need to be modified are:

               conf/local.conf

               conf/bblayers.conf

We will see what these files contain and what we are going to modify.

 

Open conf/local.conf

qoriq@usernsl-Veriton-Series:~/yocto/build_t4240qds_release$ nano conf/local.conf

 

Find the line that has :

#BB_NUMBER_THREADS = "4"

Uncomment the line and change it into

BB_NUMBER_THREADS = "8"

 

This creates 8 threads and does the build in parallel.

 

Find the line that has:

#PARALLEL_MAKE = "-j 4"

Uncomment and change it into

PARALLEL_MAKE = "-j 8"

 

This variable is sent as parameter to all make invocation and performs the make in parallel with 8 threads

 

Find the line that has:

MACHINE ??= "qemux86"

And replace with:

MACHINE ??= "t4240qds"

 

This variable determines the machine that the image is built for.  “qemux86” is a x86 image that can be run virtually on the host system. “t4240qds” is the machine that we are building the images for.

 

Hit Ctrl + X to exit

 

 

Configuring kernel recipes

 

Move to yocto folder

qoriq@usernsl-Veriton-Series:~/yocto/build_t4240qds_release $ cd ..

 

Change into the kernel recipe directory

qoriq@usernsl-Veriton-Series:~/yocto$ cd meta-fsl-ppc/recipes-kernel/linux/

 

The directory contains a set of files.

All .bb files are recipes and they contain configurations to fetch/configure/compile/install packages.All .inc files are include files, they are included within the corresponding .bb file with the “require “ command

The files linux-qoriq-sdk.* are files that configure the kernel.

The files linux-qoriq-sdk-headers.* are files that configure the header files for the kernel

We need to separate the sources for the kernel and the headers and then configure the kernel sources to point to the kernel that we have already zipped and made available

 

 

Make a copy of linux-qoriq-sdk.inc and keep it as linux-qoriq-sdk-headers.inc

qoriq@usernsl-Veriton-Series:~/yocto/meta-fsl-ppc/recipes-kernel/linux$ cp linux-qoriq-sdk.inc linux-qoriq-sdk-headers.inc

 

Open linux-qoriq-sdk-headers.inc

qoriq@usernsl-Veriton-Series:~/yocto/meta-fsl-ppc/recipes-kernel/linux$ nano linux-qoriq-sdk-headers.bb

 

Find the line that has:

require recipes-kernel/linux/linux-qoriq-sdk.inc

 

Edit it to:

require recipes-kernel/linux/linux-qoriq-sdk-headers.inc

 

We have separated the sources for the kernel and the headers, now we proceed to edit the sources of the kernel

 

Open linux-qoriq-sdk.inc file

qoriq@usernsl-Veriton-Series:~/yocto/meta-fsl-ppc/recipes-kernel/linux$ nano linux-qoriq-sdk.inc

 

Edit the file to look like:

 

## File starts here ##

 

LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"

PV = "3.8"

INC_PR = "r9"

#SRCREV = "4b66366af2d77de68f4bd6548d07421e13d3df05"

#SRC_URI = "git://git.freescale.com/ppc/sdk/linux.git \

# "

SRC_URI = "file:///home/qoriq/linux-qoriq-sdk.tar.gz"

SRC_URI[md5sum] = "986feb8581d3521f295884270d7cc5f2"

KSRC ?= ""

S = '${@base_conditional("KSRC", "", "${WORKDIR}/linux-qoriq-sdk", "${KSRC}", d)}'

# make everything compatible for the time being

COMPATIBLE_MACHINE_$MACHINE = "$MACHINE"

python () {

ma = d.getVar("DISTRO_FEATURES", True)

arch = d.getVar("OVERRIDES", True)

# the : after the arch is to skip the message on 64b

if not "multiarch" in ma and ("e5500:" in arch or "e6500:" inarch):

arch requires multiarch to be in DISTRO_FEATURES")

promote_kernel = d.getVar('BUILD_64BIT_KERNEL')

if promote_kernel == "1":

     raise bb.parse.SkipPackage("Building the kernel for this

     d.setVar('KERNEL_CC_append', ' -m64')

     d.setVar('KERNEL_LD_append', ' -melf64ppc')

error_qa = d.getVar('ERROR_QA', True)

if 'arch' in error_qa:

     d.setVar('ERROR_QA', error_qa.replace(' arch', ''))

all_qa = d.getVar('ALL_QA', True)

if 'arch' in all_qa:

     d.setVar('ALL_QA', all_qa.replace(' arch', ''))

 

## File ends here ##

 

(( Note: It is adviceable to copy the entire contents above and replace with the contents of the file. If you are unable to copy the above source and have it properly aligned, follow the list of changes below and change it manually:

 

Find the variable INC_PR and set it to

INC_PR = “r9”

 

Comment out the existing SRCREV and SRC_URI variable:

SRCREV = "4b66366af2d77de68f4bd6548d07421e13d3df05"

SRC_URI = "git://git.freescale.com/ppc/sdk/linux.git \

"

 

And replace with the sources you had built

SRC_URI = file:///home/qoriq/linux-qoriq-sdk.tar.gz

SRC_URI[md5sum] = “986feb8581d3521f295884270d7cc5f2”

 

Make sure the entered md5sum matches that of the kernel source available in that particular location.

 

The build sets a variable S as:

S = '${@base_conditional("KSRC", "", "${WORKDIR}/git", "${KSRC}", d)}'

 

We need to modify it as:

S = '${@base_conditional("KSRC", "", "${WORKDIR}/linux-qoriq-sdk", "${KSRC}", d)}'

))

 

Building the image

 

Now we are ready to run the build, After sourcing the environment, we find that the bitbake (build command) can generate various images:

          bitbake fsl-image-core

          bitbake fsl-image-lsb-sdk

          bitbake fsl-image-flash

          bitbake fsl-image-full

          bitbake fsl-image-kvm

          bitbake fsl-image-minimal

 

These images provide various different functionality within the image, we are going to use the image: fsl-image-core as it can generate a bootable and minimal image with adequate functionality.

 

The build can take a long time to run.

 

Change to build directory

qoriq@usernsl-Veriton-Series:~/yocto/meta-fsl-ppc/recipes-kernel/linux$ cd ~/yocto/build_t4240qds_release/

qoriq@usernsl-Veriton-Series:~/yocto/build_t4240qds_release$ bitbake fsl-image-core

Loading cache: 100% |#################################################################################################| ETA: 00:00:00

Loaded 3120 entries from dependency cache.

 

Build Configuration:

BB_VERSION = "1.18.0"

BUILD_SYS = "i686-linux"

NATIVELSBSTRING = "Ubuntu-12.04"

TARGET_SYS = "powerpc-fsl_networking-linux"

MACHINE = "t4240qds"

DISTRO = "fsl-networking"

DISTRO_VERSION = "1.4"

TUNE_FEATURES = "m32 fpu-hard e6500 altivec"

TARGET_FPU = "hard"

meta

meta-yocto

meta-yocto-bsp = "sdk-v1.4.x:5a7532143a49f59a5c85b08d3daf574fb1eccd8d"

meta-fsl-ppc = "sdk-v1.4.x:f9fd0a617eb6913f87335c551918315ff4ebe18c"

meta-fsl-ppc-toolchain = "sdk-v1.4.x:8ec94cec04527cb971c125b1ddd2c5375034d723"

meta-virtualization = "sdk-v1.4.x:ad6df4f59cd7646f61db29e8fa51f878329d6f93"

meta-fsl-networking

= "(nobranch):00f7a535029ca7ef8c96ba8e9916d4742166bab0"

meta-oe

meta-networking = "sdk-v1.4.x:7c8dd8f096b64a709175d37a08a4fb02ca263616"

 

NOTE: Resolving any missing task queue dependencies

NOTE: Preparing runqueue

NOTE: Executing SetScene Tasks

NOTE: Executing RunQueue Tasks

NOTE: Tasks Summary: Attempted 3164 tasks of which 3162 didn't need to be rerun and all succeeded.

 

Create a temporary folder to extract the root filesystem

qoriq@usernsl-Veriton-Series:~/yocto/build_t4240qds_release$ mkdir ~/rootfs

 

Extract to the folder

qoriq@usernsl-Veriton-Series:~/yocto/build_t4240qds_release$ runqemu-extract-sdk tmp/deploy/images/fsl-image-core-t4240qds-20140218104652.rootfs.tar.gz ../../rootfs

 

(( Note: that the tar.gz file contains the root filesystem of the build and the timestamp in the filename may vary. But essentially the file that has to be extracted will be in the form:

                    fsl-image-core-t4240qds-<timestamp>.rootfs.tar.gz

))

 

Adding packages into the root filesystem

 

Follow this set of instructions if you want to add a sample package into the root directory, else these can be skipped. There are multiple ways with which a package can be included, refer the yocto manual for a complete list of techniques. This tutorial gives an easy way to achieve this. In the yocto, main root directory we can find various directories like “meta-*” these directories contain recipes to include packages/kernels etc. These are called layers. To create a package we are going to create a new layer and within which we are going to create a recipe and thereby a .bb file that configures the package.

 

 

The package that we are showing is the GNU package, htop.

(( Note: This set of instructions depends on the packages that is being installed, but this works for mostly GNU-licensed packages ))

 

Move to the home directory

qoriq@usernsl-Veriton-Series:~/yocto/build_t4240qds_release $ cd

 

Download the package

qoriq@usernsl-Veriton-Series:~$ wget http://hisham.hm/htop/releases/1.0.2/htop-1.0.2.tar.gz

 

--2014-02-24 14:14:40-- http://hisham.hm/htop/releases/1.0.2/htop-1.0.2.tar.gz

Resolving hisham.hm (hisham.hm)... 69.163.170.116

Connecting to hisham.hm (hisham.hm)|69.163.170.116|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 388499 (379K) [application/x-tar]

Saving to: `htop-1.0.2.tar.gz.1'

 

100%[======================================>] 3,88,499 169K/s in 2.2s

2014-02-24 14:14:44 (169 KB/s) - `htop-1.0.2.tar.gz.1' saved [388499/388499]

 

 

Extract the package

qoriq@usernsl-Veriton-Series:~$ tar xvf htop-1.0.2.tar.gz

 

Check the md5sum of the package and make note of it

qoriq@usernsl-Veriton-Series:~$ md5sum htop-1.0.2.tar.gz

0d01cca8df3349c74569cefebbd9919e htop-1.0.2.tar.gz

 

Check the md5sum of the COPYING file (This is to check the license of the package)

 

Change into the directory

qoriq@usernsl-Veriton-Series:~$ cd htop-1.0.2/

 

Check the md5sum of the package and make note of it

qoriq@usernsl-Veriton-Series:~/htop-1.0.2$ md5sum COPYING

c312653532e8e669f30e5ec8bdc23be3 COPYING

 

Yocto has a wide set of commands/scripts, yocto-layer is one such command that creates a layer. Initially we are going to create a new layer and within that layer we are going to create a recipe within the layer and the necessary .bb file to configure the package.

 

Move into the yocto directory

qoriq@usernsl-Veriton-Series:~$ cd yocto

 

Create the layer

qoriq@usernsl-Veriton-Series:~/yocto$ yocto-layer create mylayer

Please enter the layer priority you'd like to use for the layer: [default: 6] <hit Enter>

Would you like to have an example recipe created? (y/n) [default: n] <hit Enter>

Would you like to have an example bbappend file created? (y/n) [default: n] <hit Enter>

New layer created in meta-mylayer.

 

qoriq@usernsl-Veriton-Series:~/yocto$ cd meta-mylayer/

 

Create the package directory

qoriq@usernsl-Veriton-Series:~/yocto/meta-mylayer/hello$ mkdir htop

 

Change into directory

qoriq@usernsl-Veriton-Series:~/yocto/meta-mylayer/hello$ cd htop

 

Create the config file

qoriq@usernsl-Veriton-Series:~/yocto/meta-mylayer/htop$ nano htop_1.0.2.bb

 

(( Note: Naming the .bb file depends on the version of the package that is being included,the format to follow is:

               <package-name>_<version number>.bb

))

 

The contents of the bb file should be like:

 

## File starts here ##

DESCRIPTION = "Htop performance monitor"

SECTION = "performance monitor"

LICENSE = "GPLv2+"

LIC_FILES_CHKSUM = "file://COPYING;md5=c312653532e8e669f30e5ec8bdc23be3"

PR = "r0"

SRC_URI = "file:///home/qoriq/htop-1.0.2.tar.gz"

SRC_URI[md5sum] = "0d01cca8df3349c74569cefebbd9919e"

inherit autotools gettext

## File ends here ##

 

Make sure you have entered the md5sum values that you have generated, and they match perfectly. Now the layer you have created should be added into the layers file conf/bblayers.conf

This file includes all the layers (of packages, kernels and other configurations) into the build, since we created a new yocto layer we need to include it in this file.

 

Change to build directory

qoriq@usernsl-Veriton-Series:~/yocto/meta-mylayer/htop$ cd ../../build_t4240qds_release

 

Open the bblayers file

qoriq@usernsl-Veriton-Series:~/yocto/build_t4240qds_release$ nano conf/bblayers.conf

 

Find the BBLAYERS variable:

 

BBLAYERS ?= " \

                         /home/qoriq/yocto/meta \

                         /home/qoriq/yocto/meta-yocto \

                         /home/qoriq/yocto/meta-yocto-bsp \

                         /home/qoriq/yocto/meta-fsl-ppc \

                         /home/qoriq/yocto/meta-fsl-ppc-toolchain \

                         /home/qoriq/yocto/meta-virtualization \

                         /home/qoriq/yocto/meta-fsl-networking \

                         /home/qoriq/yocto/meta-oe/meta-oe \

                         /home/qoriq/yocto/meta-oe/meta-networking \

"

 

Append the location of your layer in the end

BBLAYERS ?= " \

/home/qoriq/yocto/meta \

/home/qoriq/yocto/meta-yocto \

/home/qoriq/yocto/meta-yocto-bsp \

/home/qoriq/yocto/meta-fsl-ppc \

/home/qoriq/yocto/meta-fsl-ppc-toolchain \

/home/qoriq/yocto/meta-virtualization \

/home/qoriq/yocto/meta-fsl-networking \

/home/qoriq/yocto/meta-oe/meta-oe \

/home/qoriq/yocto/meta-oe/meta-networking \

/home/qoriq/yocto/meta-mylayer \

"

 

Save and proceed to build (as given above).

 

SD card layout

 

 

The SD card should contain a single ext2 partition which holds the uImage files and the root filesystem.

 

Insert the SD card into the host machine, and using the mount command figure out the where it is mounted and the tag of the device.

 

Format the disk

qoriq@usernsl-Veriton-Series:~$ sudo fdisk /dev/sdc

 

(( Note: The device ID of your SD card can be found out by running the mount command ))

 

Delete all partitions

Command (m for help): d

Selected partition 1

 

Print the number of partitions (Hit p and then enter)

Command (m for help): p

Disk /dev/sdc: 3965 MB, 3965190144 bytes

4 heads, 12 sectors/track, 161344 cylinders, total 7744512 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x558eef06

Device Boot Start End Blocks Id System

 

As expected the partition table shows empty

 

Create new partition (Hit n and press Enter)

Command (m for help): n

 

Partition type:

p primary (0 primary, 0 extended, 4 free)

e extended

Select (default p): <Hit Enter>

Using default response p

Partition number (1-4, default 1): <Hit Enter>

Using default value 1

First sector (2048-7744511, default 2048): <Hit Enter>

Using default value 2048

Last sector, +sectors or +size{K,M,G} (2048-7744511, default

7744511):

 

Using default value 7744511

 

Print to see new partition (Hit p and then Enter)

Command (m for help): p

Disk /dev/sdc: 3965 MB, 3965190144 bytes

4 heads, 12 sectors/track, 161344 cylinders, total 7744512 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x558eef06

Device Boot Start End Blocks Id System

/dev/sdc1 2048 7744511 3871232 83 Linux

 

Write the changes and exit (Hit w and then Enter)

Command (m for help): w

 

The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16:

Device or resource busy.

The kernel still uses the old table. The new table will be used

atthe next reboot or after you run partprobe(8) or kpartx(8)

 

Syncing disks.

 

Create the ext2 filesystem in the created partition

qoriq@usernsl-Veriton-Series:~$ mkfs.ext2 /dev/sdc1

 

Copy the kernel image into the SD card

qoriq@usernsl-Veriton-Series:~$ sudo cp -d yocto/build_t4240qds_release/tmp/deploy/images/uImage* /media/7e19cd10-3ed8-436d-956c-3fdb14c84e3d/

 

(( Note: The –d option is necessary, it preserves all symbolic links ))

 

Change into the root directory

qoriq@usernsl-Veriton-Series:~ $ cd rootfs

 

Copy root filesystem into the SD card

qoriq@usernsl-Veriton-Series:~/rootfs$ sudo cp -Rd * /media/7e19cd10-3ed8-436d-956c-3fdb14c84e3d/

 

Sync

qoriq@usernsl-Veriton-Series:~/rootfs$ sync

 

Unmount

qoriq@usernsl-Veriton-Series:~/rootfs$ sudo umount /media/7e19cd10-3ed8-436d-956c-3fdb14c84e3d/

 

 

T4240QDS Booting

 

Open the serial console with

qoriq@usernsl-Veriton-Series:~ $ sudo gtkterm

 

 

Open Configuration -> Port and set the Baudrate to 115200.

Insert the SD card into the machine and power up.

A u-boot prompt appears, hit Enter to disrupt automatic booting.

Once you see the u-boot console, you’ll need to configure the environment variables

Hit print to see all environment variables, mine look like:

 

=> print

 

baudrate=115200

bdev=sda3

bootargs=root=/dev/mmcblk0p1 rw rootdelay=5 console=ttyS0,115200

bootcmd=setenv bootargs root=/dev/mmcblk0p1 rw rootdelay=5

console=$consoledev,$baudrate;mmcinfo;ext2load mmc 0:1 $loadaddr

$bootfile;ext2load mmc 0:1 $fdtaddr $fdtfile; bootm $loadaddr -

$fdtaddr

bootdelay=10

bootfile=uImage

c=ffe

consoledev=ttyS0

ethact=FM1@DTSEC5

ethprime=FM1@DTSEC1

fdtaddr=0x17200000

fdtfile=uImage-t4240qds.dtb

filesize=0x3df080

fman_ucode=0xeff40000

gatewayip=10.116.65.1

hwconfig=fsl_ddr:ctlr_intlv=3way_4KB,bank_intlv=auto;usb1:dr_mode=host,phy_type=utmi

ipaddr=10.116.65.32

loadaddr=0x10000000

netdev=eth0

netmask=255.255.255.0

nfsboot=setenv bootargs root=/dev/nfs rw nfsroot=$serverip:$rootpath

ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:off

console=$consoledev,$baudrate $othbootargs;tftp $loadaddr

$bootfile;tftp $fdtaddr $fdtfile;bootm $loadaddr - $fdtaddr

ramboot=setenv bootargs root=/dev/ram rw console=$consoledev,$baudrate

$othbootargs;tftp $ramdiskaddr $ramdiskfile;tftp $loadaddr

$bootfile;tftp $fdtaddr $fdtfile;bootm $loadaddr $ramdiskaddr $fdtaddr

ramdiskaddr=0x02000000

ramdiskfile=t4240qds/ramdisk.uboot

rootpath=/opt/nfsroot

serverip=10.116.65.38

stderr=serial

stdin=serial

stdout=serial

tftpflash=tftpboot $loadaddr $uboot && protect off $ubootaddr+$filesize && erase $ubootaddr +$filesize && cp.b $loadaddr $ubootaddr $filesize && protect on $ubootaddr +$filesize && cmp.b $loadaddr $ubootaddr $filesize

uboot="u-boot.bin"

ubootaddr=0xeff80000

 

Environment size: 1564/8188 bytes

 

There are a few variables that you need to modify, and they are:

 

$bootfile – file that is used as a kernel to boot

$fdtfile – the device tree file specific to the T4240 from the yocto build

$loadaddr – The temporary RAM address to which the kernel is loaded temporarily before being loadedinto the working memory space

$fdtaddr – The temporary RAM address to which the device tree is loaded temporarily

$bootargs – The boot argument that sets the root parameter to denote where the root filesystem is to be looked for and other variables such as baudrate etc.

 

The values that I set are specific to the files I built, but other variables are common.

 

The $loadaddr should hold a value 0x10000000

The $fdtaddr should hold a value 0x17200000

 

To set the values :

 

=> editenv boot file

edit: uImage

=> editenv fdtfile

edit: uImage-t4240qds.dtb

=> editenv loadaddr

edit: 0x10000000

=> editenv fdtaddr

edit: 0x17200000

=> savenenv

 

Now go ahead and boot the machine, with:

 

=> setenv bootargs root=/dev/mmcblk0p1 rw rootdelay=5 console=$consoledev,$baudrate;mmcinfo;ext2load mmc 0:1 $loadaddr $bootfile;ext2load mmc 0:1 $fdtaddr $fdtfile; bootm $loadaddr - $fdtaddr

 

(( Note: Break down of the above command:

=> setenv bootargs root=/dev/mmcblk0p1 rw rootdelay=5 console=$consoledev,$baudrate

 

The previous command sets the location of the root filesystem, in this case, it is the MMC card, /dev/mmcblk0p1

 

=> mmcinfo

The above command prints out the details of the MMC card

 

=> ext2load mmc 0:1 $loadaddr $bootfile

The above command reads the kernel image from the filesystem to the temporary RAM address for the machine to boot

 

=> ext2load mmc 0:1 $fdtaddr $fdtfile;

The above command reads the fdtfile into RAM memory

 

=> bootm $loadaddr - $fdtaddr

The above command issues the boot command with kernel addresses and fdt address as inputs

))

 

Here the “root=” variable sets the device ID of the root filesystem and ext2load reads a file from an ext2 filesystem.The boot proceeds and then you see a login prompt with…

 

INIT: Entering runlevel: 5 Starting Dropbear SSH server: dropbear.

Starting network benchmark server: netserver.

Starting system log daemon...0

Starting kernel log daemon...0

Stopping Bootlog daemon: bootlogd.

Poky 9.0 (Yocto Project 1.4 Reference Distro) 1.4 t4240qds ttyS0

t4240qds login:

 

Go ahead and login!

 

t4240qds login: root

root@t4240qds:~#

 

You can verify that the build works with

 

root@t4240qds:~# uname -a

Linux t4240qds 3.8.13-rt9-QorIQ-SDK-V1.4 #1 SMP Tue Feb 18 12:26:03 IST 2014 ppc64 GNU/Linux

 

The build date shows the date the image was built! If you have included the htop GNU package into the root filesystem, you can test it out.

 

root@t4240qds:~# htop

This opens the htop application!!

Attachments

    Outcomes