Qoriq SDK v2.0-1703 Documentation 5-20-2020

Download as pdf or txt
Download as pdf or txt
You are on page 1of 29

NXP Semiconductors

QorIQ SDK v2.0-1703 Documentation

This PDF was created from content on https://nxp.com. For the most current NXP
product documentation, go to https://nxp.com.

PDF excerpt generated on May 20, 2020

NXP and the NXP logo are trademarks of NXP B.V.


©2006-2019 NXP Semiconductors. All rights reserved.
NXP Semiconductors

Getting Started

Yocto Project is an open-source collaboration project for embedded Linux developers. Yocto Project uses the Poky
build system to make Linux images. For complete information about Yocto Project, see https://
www.yoctoproject.org/.

SDK File System Images

This section describes the file system images that can be built using standard Yocto Project recipes included with
the NXP SDK.

The file system images contain the programs, scripts, and other files that make up Linux user space. There are five
standard images. They are described in the following sections.

In the SDK installation directory, look in meta-freescale/recipes-fsl/images for files that define these
images.

Where to start: “fsl-image-full” contains a rich set of standard Linux features and all special NXP SDK-specific
features. It is the best starting point for exploration and evaluation.

fsl-image-minimal

Contents:

This is a barebones image. It contains a small file set that allows Linux to boot and little else.

Purpose:

This image is intended as a starting point for product development. Users may add packages to it to form an image
that targets their particular project or purpose. Packages may be added by editing conf/local.conf and adding new
packages to be built and installed via

IMAGE_INSTALL_append = " package1 package2 etc"

PDF excerpt generated on May 20, 2020


NXP copyright: NXP B.V. 2019
NXP trademark statement: NXP and the NXP logo are trademarks of NXP B.V.
2
NXP Semiconductors

Then, rebuild the image using bitbake. The result will be an image that is small enough for simple flash devices and
is narrowly focused on a specific goal.

Users must add packages to “fsl-image-minimal” to make it useful. Thus it is not intended for “out-of-the-box”
evaluation. Instead, use it as the basis for targeted images for your specific product.

fsl-image-mfgtool

Contents:

This is a small image that NXP preprograms into the flash on development boards. On many boards, the image is
stored in a NOR flash and is loaded into a RAM disk when Linux boots. It contains disk management functions as
described in the next section.

Purpose:

This image is intended to help users to load much larger images onto disks or disk-like devices such as SDHC
cards or USB thumb drives. Thus, this image contains networking support to transfer images and also standard
Linux disk and file system manipulation commands.

NXP preloads “fsl-image-full” (see below) onto disks on development boards that have them. For these boards, “fsl-
image-mfgtool” can be used to restore the larger disk image if it becomes corrupted.

Users will find that it is often convenient to work with larger images and may wish to install “fsl-image-full” onto a
disk-type device and use it with NXP development boards that do not come with a disk drive.

The networking and disk management commands that NXP supplies are standard Linux commands. They are, in
fact, identical on all architectures and thus are not unique to NXP. Users with Linux experience will find them
familiar. They include:

• ifconfig, ip, route, etc. (configure networking)

• ftp (transfer files via the network)

• scp (another way to transfer files via the network)

• date and rdate (set date and time)

• fdisk (partition disks and disk-type devices)

• mkfs (make file systems)

PDF excerpt generated on May 20, 2020


NXP copyright: NXP B.V. 2019
NXP trademark statement: NXP and the NXP logo are trademarks of NXP B.V.
3
NXP Semiconductors

• tar (extract file system images, and more)

• fsck (check file systems)

• mount/umount (mount and umount file systems)

fsl-image-full

Contents:

This is a large image that contains many standard Linux commands and features including native (target-resident)
versions of the GNU tools including gcc and gdb.

If you boot this image, the resulting Linux environment will be much like a command-line on a full desktop-type
Linux system rather than an embedded system.

Purpose:

While this type of image may not be appropriate for a final embedded product, it can be very helpful for many
development and evaluation tasks. The reason is the full set of standard Linux facilities that are already present in
the image. In fact, users may find that they can use this image instead of installing the Yocto Project-based NXP
SDK onto a development system, at least initially.

For this reason, “fsl-image-full” is preinstalled on the disk drives of NXP development boards that have disks.

For example, the image is complete enough that the standard Linux open source command sequence “configure;
make” stands a decent chance of working for arbitrary open source packages that do not happen to be on the
image already.

To be clear, the NXP SDK is a Yocto Project/Poky-derived embedded distribution. However, the Yocto Project
standard Linux package set is large enough that if one enables a lot of the available packages, the result begins to
have the feel of desk top Linux. NXP added the special NXP-specific packages, and the result is “fsl-image-full.” It is
intended for “out-of-the-box” evaluation because it is rather complete.

fsl-image-core

Contents:

PDF excerpt generated on May 20, 2020


NXP copyright: NXP B.V. 2019
NXP trademark statement: NXP and the NXP logo are trademarks of NXP B.V.
4
NXP Semiconductors

This is a small image somewhat like “fsl-image-minimal” except it contains all of the NXP-specific SDK packages.

Purpose:

This image is useful for evaluating the NXP-specific software packages in the context of a file system image that is
much more embedded-oriented than “fsl-image-full”.

Embedded file system images contain fewer helpful tools and utilities by definition. They are intended to support an
embedded product’s functionality rather than a developer’s tasks. Thus, it can be convenient to begin with “fsl-
image-core” for evaluation and planning and then later narrowly extend “fsl-image-minimal” to support your
embedded product.

fsl-image-virt

Contents:

This is an image which contains the specific packages needed to enable virtualization.

Purpose:

This image is useful for virtualization scenarios (KVM, libvirt, lxc). It contains:

• the guest root filesystem

• the guest image (uImage format for Power based architectures and zImage for ARM based architectures)

• QEMU

• all necessary libraries and tools for libvirt and lxc support

Essential Build Instructions

The following sections are essential to the build process and must be performed when using Yocto Project to build
the SDK. In order to install the SDK, download the necessary ISO's and follow steps for installing SDK 2.0, install
SDK v2.0-1703. When those steps are completed, prepare the host environment, setup Poky, perform builds, and
follow the instructions in the subsequent sections. When these steps are completed, the build process will be
complete. Linux images that have been built will be found in the following directory: build_<machine>/tmp/
deploy/images/<machine>

PDF excerpt generated on May 20, 2020


NXP copyright: NXP B.V. 2019
NXP trademark statement: NXP and the NXP logo are trademarks of NXP B.V.
5
NXP Semiconductors

See Additional Instructions for Developers for more information on using Yocto Project.

Install SDK V2.0-1703

SDK-V2.0-1703 is an incremental update to SDK 2.0. Prior to installing SDK-V2.0-1703, install SDK 2.0. Both SDK
2.0 and SDK V2.0-1703 can be downloaded from www.nxp.com/sdk. SDK 2.0 documentation and installation
instructions can be found on Install SDK 2.0 section.

SDK-V2.0-1703 includes all the changes of previous incremental/NPI releases, such as SDK-V2.0-1701/SDK-
V2.0-1611/SDK-V2.0-1609/LS1046A-SDK-V0.4. They can't be installed at the same time. The install script will
detect conflict releases and prompt the steps to deal with them.

How to install SDK-V2.0-1703 on a host machine.

1. Extract the SDK-V2.0-1703.tar.bz2, and run the 'install' script to install the incremental updates:

$ tar -xjf SDK-V2.0-1703.tar.bz2


$ ./SDK-V2.0-1703/install

2. During the install process, the user will be prompted to input the SDK 2.0 ISO installed location, i.e.,
<ISO_INSTALL_PATH>/QorIQ-SDK-V2.0-20160527-yocto.

Install SDK 2.0

How to install Yocto Project on the host machine.

1. Mount the ISO on your machine:

$ sudo mount -o loop QorIQ-SDK-<version>-<target>-<yyyymmdd>-yocto.iso /mnt/cd


rom

2. As a non-root user, install Yocto Project:

$ /mnt/cdrom/install

PDF excerpt generated on May 20, 2020


NXP copyright: NXP B.V. 2019
NXP trademark statement: NXP and the NXP logo are trademarks of NXP B.V.
6
NXP Semiconductors

3. When you are prompted to input the install path, ensure that the current user has the correct permission for
the install path.

There is no uninstall script. To uninstall Yocto Project, you can remove the <yocto_install_path>/QorIQ-SDK-
<version>-<yyyymmdd>-yocto directory manually.

Note:

* The source ISO contains the package source tarballs and Yocto Project recipes. It can be installed and used to
do non-cache build.

* The cache ISO contains the pre-built cache binaries. To avoid a long time build, you can install the source ISO
and the cache ISO in the same installation folder.

* The image ISO includes all prebuilt images: flash images, standalone toolchain installer, HD rootfs images and
small images.

* The source ISO can be used separately. The cache ISO and the source ISO should work together.

Set Up Host Environment

Yocto Project requires some packages to be installed on the host.

Use the following steps to prepare the Yocto Project environment.

In general, Yocto Project can work on most recent Linux distributions with Python-2.7.3 or greater (excluding
python3 which is not supported), git-1.7.8 or greater, tar-1.24 or greater and required packages installed. The
default Python is not 2.7.x on some Linux distros, e.g. CentOS 6.5 installs python 2.6.6. Follow the instructions
below to install the Python 2.7.x in custom path instead of override the system default python, the override may
cause system utilities breaking.

$ wget https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
[NOTE: Python 2.7.3 and python 2.7.5 can be used as well.]
$ tar -xf Python-2.7.6.tar.xz
$ cd Python-2.7.6
$ ./configure --prefix=/opt/python-2.7.6

PDF excerpt generated on May 20, 2020


NXP copyright: NXP B.V. 2019
NXP trademark statement: NXP and the NXP logo are trademarks of NXP B.V.
7
NXP Semiconductors

$ make
$ sudo make install

Run the export command below to ensure python 2.7.x is used for Yocto build.

$ export PATH=/opt/python-2.7.6/bin:$PATH

Yocto Project supports typical Linux distributions: Ubuntu, Fedora, CentOS, Debian, OpenSUSE, etc. More Linux
distributions are continually being verified. This SDK has been verified on following Linux distributions: Ubuntu
14.04, CentOS-7.1.1503, Debian 8.2, Fedora 22 and OpenSUSE 13.2

For a list of the Linux distributions tested by the Yocto Project community see SANITY_TESTED_DISTROS in poky/
meta-yocto/conf/distro/poky.conf.

To ensrure Yocto can run on host machine with different Linux distribution, the following packages should be
installled on the host.

For CentOS hosts:

$ sudo yum install gawk make wget tar bzip2 gzip python unzip perl patch \
diffutils diffstat git cpp gcc gcc-c++ glibc-devel texinfo chrpath socat SDL-
devel xterm

For the Fedora hosts:

$ sudo yum install gawk make wget tar bzip2 gzip python unzip perl patch \
diffutils diffstat git cpp gcc gcc-c++ glibc-devel texinfo chrpath \
ccache perl-Data-Dumper perl-Text-ParseWords perl-Thread-Queue socat \
findutils which SDL-devel xterm

For Ubuntu and Debian hosts:

$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
build-essential chrpath socat libsdl1.2-dev xterm

PDF excerpt generated on May 20, 2020


NXP copyright: NXP B.V. 2019
NXP trademark statement: NXP and the NXP logo are trademarks of NXP B.V.
8
NXP Semiconductors

Extra packages are needed for Ubuntu-64b:

$ sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 ia32-libs lib32ncurses5-


dev

For OpenSUSE host:

$ sudo zypper install python gcc gcc-c++ libtool subversion git chrpath automake m
ake wget diffstat makeinfo freeglut-devel libSDL-devel

Set Up Poky
Source the following poky script to set up your environment for your particular NXP platform. This script needs to be
run once for each terminal, before you begin building source code. Make sure that you are currently in the
<install_path> when running the commands below.

$ . ./fsl-setup-env -m <machine>

For example:

$ . ./fsl-setup-env -m b4860qds-64b

The following shows the usage text for the fsl-setup-env command:

Usage:

$ . ./fsl-setup-env -h
Usage: . fsl-setup-env -m <machine>

Supported machines
QorIQ: b4420qds-64b b4420qds b4860qds-64b b4860qds c293pcie ls1021atwr ls1043a
rdb p2041rdb p3041ds p4080ds p5020ds-64b p5020ds p5040ds-64b p5040ds t1023rdb-64b
t1023rdb t1024rdb-64b t1024rdb t1040d4rdb-64b t1040d4rdb t1042d4rdb-64b t1042d4rd
b t2080qds-64b t2080qds t2080rdb-64b t2080rdb t4160qds-64b t4160qds t4240qds-64b t

PDF excerpt generated on May 20, 2020


NXP copyright: NXP B.V. 2019
NXP trademark statement: NXP and the NXP logo are trademarks of NXP B.V.
9
NXP Semiconductors

4240qds t4240rdb-64b t4240rdb ls1012afrdm-32b ls1012afrdm ls1012ardb-32b ls1012ard


b ls1043ardb-32b ls1046ardb-32b ls1046ardb ls2088ardb

Op tional parameters:
* [-m machine]: the target machine to be built.
* [-b path]: non-default path of project build folder.
* [-j jobs]: number of jobs for make to spawn during the compilation stage.
* [-t tasks]: number of BitBake tasks that can be issued in parallel.
* [-d path]: non-default path of DL_DIR (downloaded source)
* [-c path]: non-default path of SSTATE_DIR (shared state Cache)
* [-g]: enable Carrier Grade Linux
* [-l]: lite mode. To help conserve disk space, deletes the building
directory once the package is built.
* [-h]: help

Perform Builds

How to Set Up a Cross Compile Environment and Perform Builds

Follow these steps to do builds using Yocto Project. Be sure to set up the host environment before doing these
steps.

1. $ cd <sdk-install-dir>/build_<machine>

2. $ bitbake <image-target>

Where <image-target> is one of the following:

• fsl-image-minimal: contains basic packages to boot up a board

• fsl-image-core: contains common open source packages and NXP specific packages.

• fsl-image-full: contains all packages in the full package list.

• fsl-image-kernelitb: A FIT image comprising the Linux image, dtb and rootfs image.

PDF excerpt generated on May 20, 2020


NXP copyright: NXP B.V. 2019
NXP trademark statement: NXP and the NXP logo are trademarks of NXP B.V.
10
NXP Semiconductors

• fsl-image-mfgtool: contains all the user space apps needed to deploy the fsl-image-mfgtool image
to a USB stick, hard drive, or other large physical media.

• fsl-image-virt: contains toolkit to interact with the virtualization capabilities of Linux

• core-image-x11: NXP image with a very basic X11 image with a terminal

• fsl-toolchain: the cross compiler binary package

• package-name(usdpaa): build a specific package

Contents of the Built Images Directory:

A Yocto Project build produces images that will be located in the following directory:

<sdk-install-dir>/build_<machine>/tmp/deploy/images/<machine>/

The following list shows the typical directory/image files (exact contents depend on the setting of the
<IMAGE_FSTYPES> variable):

• fsl-image-<machine>.ext2.gz.u-boot - ramdisk image that can be loaded with U-Boot

• fsl-image-<machine>.ext2.gz - gzipped ramdisk image

• fsl-image-<machine>.tar.gz - gzipped tar archive of the image

• uImage-<machine>.bin - kernel binary of the image

• u-boot-<machine>.bin - U-Boot binary image that can be programmed into board Flash

• uImage-<machine>.dtb - device tree binary (dtb).

• fsl_fman_ucode_<machine>_<version>.bin - fman ucode for <machine> board

• hv/hv.uImage - uImage for hypervisor

• hv-cfg/*/*/hv.dtb - dtb for hypervisor

• rcw/*/rcw_*.bin - rcw

Note: For additional Yocto Project usage information, please refer to the https://www.yoctoproject.org/.

Additional Instructions for Developers

PDF excerpt generated on May 20, 2020


NXP copyright: NXP B.V. 2019
NXP trademark statement: NXP and the NXP logo are trademarks of NXP B.V.
11
NXP Semiconductors

This section describes additional "How To" instructions for getting started with Yocto Project.

Each set of instructions is aimed towards developers that are interested in modifying and configuring the source
beyond the default build. Each section will describe instructions on how to use Yocto Project to achieve a specific
development task.

Customize U-boot

How to Configure, Modify, or Rebuild U-Boot

To Modify U-Boot Configuration:

Modify UBOOT_CONFIG. Values for UBOOT_CONFIG are listed in <sdk-install-dir>/sources/meta-


freescale/conf/machine/<machine>.conf

e.g. UBOOT_CONFIG ??= "nor"

To Modify U-Boot Source Code:

If source code has already been installed, please skip steps 1 & 2 and proceed modifying source code.

1. $ bitbake -c cleansstate u-boot


Note:

Other helpful bitbake cleaning commands:

bitbake -c clean <target>


• Removes work directory in build_<machine>/tmp/work

bitbake -c cleansstate <target>


• Removes work directory in build_<machine>/tmp/work

• Removes cache files in <sdk-install-dir>/sstate-cache/ directory.

2. $ bitbake -c patch u-boot

3. $ cd <S> and modify the source code. Follow instructions to "Rebuild U-Boot Image" when you are finished
modifying source code.
Note: Use bitbake -e <package-name> | grep ^S= to get value of <S>, the package source code
directory.

PDF excerpt generated on May 20, 2020


NXP copyright: NXP B.V. 2019
NXP trademark statement: NXP and the NXP logo are trademarks of NXP B.V.
12
NXP Semiconductors

To Rebuild U-Boot Image:

1. $ cd build_<machine>

2. $ bitbake -c compile -f u-boot

3. $ bitbake u-boot
Note: U-Boot image can be found in build_<machine>/tmp/deploy/images/<machine>/

Customize the Linux Kernel

How to Configure, Modify, or Rebuild the Linux Kernel

To Modify Kernel Source Code:

If source code has already been installed, please skip steps 1 & 2 and proceed modifying source code.

1. $ bitbake -c cleansstate virtual/kernel

2. $ bitbake -c patch virtual/kernel

3. $ cd <S> and change the source code. Follow instructions to "Rebuild Kernel Image" when you are finished
modifying source code.
Note: Use bitbake -e <package-name> | grep ^S= get the value of <S> (package source code
directory).

To Change the Kernel defconfig:

1. Update KERNEL_DEFCONFIG variable in <sdk-install-dir>/sources/meta-freescale/conf/machine/


<machine>.conf

To Change dts:

1. Update KERNEL_DEVICETREE variable in <sdk-install-dir>/sources/meta-freescale/conf/machine/


<machine>.conf

To Do menuconfig:

1. $ bitbake -c menuconfig virtual/kernel

PDF excerpt generated on May 20, 2020


NXP copyright: NXP B.V. 2019
NXP trademark statement: NXP and the NXP logo are trademarks of NXP B.V.
13
NXP Semiconductors

Note: If you are going to reuse this new kernel configuration for future builds, tell menuconfig to "Save
Configuration to Alternate File" and give it an absolute path of /tmp/my-defconfig. If you do not do this,
the new defconfig file will be removed when doing a clean/cleansstate for kernel.
Note: This runs the normal kernel menuconfig within the Yocto Project environment. If the kernel configure
UI cannot open, edit /<yocto_install_path>/build_<machine>/conf/local.conf and add the
following based on your environment (prior to issuing the bitbake command).

For a non-X11 environment:

• OE_TERMINAL = "screen"

The following commands can be used for the other environments:

For a GNOME environment (default):

• OE_TERMINAL = "gnome"

For a KDE environment:

• OE_TERMINAL = "konsole"

For non-GNOME and non-KDE environments:

• OE_TERMINAL = "auto"

To Rebuild Kernel Image:

1. $ cd build_<machine>

2. $ bitbake -c compile -f virtual/kernel

3. $ bitbake virtual/kernel

4. $ bitbake fsl-image-kernelitb
Note: Kernel images can be found in <sdk-install-dir>/build_<machine>/tmp/deploy/images/
<machine>/

Patch Packages

How to Patch and Rebuild a Package

PDF excerpt generated on May 20, 2020


NXP copyright: NXP B.V. 2019
NXP trademark statement: NXP and the NXP logo are trademarks of NXP B.V.
14
NXP Semiconductors

1. $ cd <sdk-install-dir>/build_<machine>

2. $ bitbake -c cleansstate <package-name>

3. $ cd <RECIPE_FOLDER>
Note: Use bitbake <package-name> -e | grep ^FILE_DIR to get the value of
<RECIPE_FOLDER>

4. $ mkdir -p <RECIPE_FOLDER>/files

5. Copy patch into <RECIPE_FOLDER>/files

6. Modify <BB_FILE> and add follow content in package-name-<version>.bb file

SRC_URI += "file://<name-of-patch1> \
file://<name-of-patch2> \
... \
file://<name-of-patchn>"

7. Rebuild this package:

$ bitbake <package-name>

Extract Source Code

How to Extract the Source Code for a Package

To extract the source code of a package, do the following:

1. $ bitbake -c cleansstate <package-name>

2. $ bitbake -c patch <package-name>

3. $ cd <S>
Note: Use bitbake -e <package-name> | grep ^S= to get the value of <S>.

For example, to do a U-boot of a T2080RDB processor.

1. $ bitbake -c cleansstate u-boot

PDF excerpt generated on May 20, 2020


NXP copyright: NXP B.V. 2019
NXP trademark statement: NXP and the NXP logo are trademarks of NXP B.V.
15
NXP Semiconductors

2. $ bitbake -c patch u-boot


Note: U-boot source code is installed in the folder: build_t2080rdb/tmp/work/t2080rdb-fsl-
linux/u-boot-qoriq/2016.01+fslgit-r0/git/

Customize Root Filesystem

How to Customize a Root Filesystem

Packages included in a rootfs can be customized by editing the corresponding recipe:

fsl-image-mfgtool:sources/meta-freescale/recipes-fsl/images/fsl-image-mfgtool.bb
fsl-image-core:sources/meta-freescale/recipes-fsl/images/fsl-image-core.bb
fsl-image-full:sources/meta-freescale/recipes-fsl/images/fsl-image-full.bb
fsl-image-virt: sources/meta-freescale/recipes-fsl/images/fsl-image-virt.bb
fsl-image-minimal:sources/meta-freescale/recipes-fsl/images/fsl-image-minimal.bb
fsl-image-kernelitb:sources/meta-freescale/recipes-fsl/images/fsl-image-kernelitb.
bb
fsl-toolchain:sources/meta-freescale/recipes-fsl/images/fsl-tooichain.bb

The rootfs type can be customized by setting the IMAGE_FSTYPES variable in the above recipes.

Supported rootfs types include the following:

cpio
cpio.gz cpio.xz
cpio.lzma
cramfs
ext2
ext2.gz
ext2.gz.u-boot
ext2.bz2.u-boot
ext3

PDF excerpt generated on May 20, 2020


NXP copyright: NXP B.V. 2019
NXP trademark statement: NXP and the NXP logo are trademarks of NXP B.V.
16
NXP Semiconductors

ext3.gz.u-boot
ext2.lzma
jffs2
live
squashfs
squashfs-lzma
ubi
tar
tar.gz
tar.bz2
tar.xz

Path of source tarballs and patches:

• Package source tarballs are in the folder named sources, which is in the same folder level as
build_<machine>.

• Patches are in the corresponding recipe folder

Specify the preferred version of package:

<PREFERRED_VERSION_pkgname> is used to configure the required version of a package.

If <PREFERRED_VERSION> is not defined, Yocto Project will pick up the recent version. For example, to downgrade
Samba from 3.4.0 to 3.1.0: add PREFERRED_VERSION_samba = "3.1.0" in <sdk-install-dir>/sources/
meta-freescale/conf/machine/<machine>.conf

Rebuild rootfs:

$ bitbake <image-target>

Build Native Packages

How to Build Native Packages for the Host

Native packages such as cst-native are supported in Yocto Project. To build a native package, do the following:

PDF excerpt generated on May 20, 2020


NXP copyright: NXP B.V. 2019
NXP trademark statement: NXP and the NXP logo are trademarks of NXP B.V.
17
NXP Semiconductors

$ bitbake cst-native
Note: The binaries can be found in build_<machine>/tmp/sysroot/

Install the Standalone Toolchain

Build and install the standalone toolchain with Yocto Project:

1. $ . ./fsl-setup-env -m <machine>

2. $ bitbake fsl-toolchain

3. $ cd build_<machine>/tmp/deploy/sdk

4. $ ./fsl-qoriq-glibc-<host_arch>-<core>-toolchain-<release>.sh

Note: The default installation path for standalone toolchain is /opt/fsl-qoriq/2.0/. The install folder can
be specified during the installation procedure.

To use the installed toolchain, go the the location where the toolchain is installed and source the environment-
setup-<core> file. This will set up the correct path to the build tools and also export some environment variables
relevant for development (eg. $CC, $ARCH, $CROSS_COMPILE, $LDFLAGS etc).

To invoke the compiler, use the $CC variable (eg. $CC <source files>).

Note: This is a sysrooted toolchain. GCC needs option --sysroot=<path-to-target-sysroot> to find target
fragments and libraries (eg. crt*, libgcc.a) as the default sysroot is poisoned to /not/exist. However, when invoking
the compiler through the $CC variable, there is no need to pass the --sysroot parameter as it is already included in
the variable (check by running echo $CC).

How to Use Multilib

Build an rootfs image with multilib libraries (e.g. ppc64 rootfs with lib32).

PDF excerpt generated on May 20, 2020


NXP copyright: NXP B.V. 2019
NXP trademark statement: NXP and the NXP logo are trademarks of NXP B.V.
18
NXP Semiconductors

1. Use the following setting in local.conf (this example is for e6500 targets)

require conf/multilib.conf
MULTILIBS = "multilib:lib32"
DEFAULTTUNE_virtclass-multilib-lib32 = "ppce6500"

2. Add IMAGE_INSTALL += "lib32-<pkg>" in <image_target>.bb

3. $ bitbake <rootfs_image>

Mixture Build Mode for e6500 targets

Both "64bit kernel + 32bit userspace" and "64bit kernel + 64bit userspace" are supported by e6500 targets.

Below introduces how to built 64bit rootfs for e6500 targets.

1. Install both source ISO and e6500-64b cache ISO in the same folder

2. $ cd <sdk-install-dir>

3. $ . ./fsl-setup-env -m <machine> # e.g. . ./fsl-setup-env -m t2080rdb-64b

4. $ bitbake <rootfs-target>

The standalone toolchain generated by Yocto Project doesn't support multilib, 32bit and 64bit build should be done
by different toolchain. This SDK supports to build 32-bit and 64-bit standalone toolchains. Both prebuilt toolchains
are provided in the image ISO. The kernel image should be built using fsl-qoriq-glibc-*-
ppc64e6500-.toolchain-<sdk_version>+*.sh.

• fsl-qoriq-glibc-i686-ppce6500-toolchain-<sdk_version>.sh: toolchain for building 32-bit


images on i686 machine.

• fsl-qoriq-glibc-i686-ppc64e6500-toolchain-<sdk_version>.sh: toolchain for building 64-bit


images on i686 machine.

• fsl-qoriq-glibc-x86_64-ppce6500-toolchain-<sdk_version>.sh: toolchain for building 32-bit


images on x86_64 machine.

• fsl-qoriq-glibc-x86_64-ppc64e6500-toolchain-<sdk_version>.sh: toolchain for building 64-bit


images on x86_64 machine.

PDF excerpt generated on May 20, 2020


NXP copyright: NXP B.V. 2019
NXP trademark statement: NXP and the NXP logo are trademarks of NXP B.V.
19
NXP Semiconductors

Build rootfs which Supports OpenJDK

How to build the rootfs which supports openjdk.

The SDK supports openjdk-7 on 32b targets and 64b targets, Jtreg has been used to verify the openjdk.

Following describes how to build the rootfs image of java support.

1. $ . ./fsl-setup-env -m <machine>

2. $ bitbake java-test-image

Note: The rootfs image with openjdk support can be found in build_<machine>/tmp/deploy/images/
<machine>/

Deploy Openstack

How to deploy OpenStack on QorIQ platform

Setup Diagram

Host Machine based on QorIQ platform can be used for Openstack Multiple Node demo in the following way:

PDF excerpt generated on May 20, 2020


NXP copyright: NXP B.V. 2019
NXP trademark statement: NXP and the NXP logo are trademarks of NXP B.V.
20
NXP Semiconductors

Host Machine based on QorIQ Platform Setup Diagram

Build Openstack images for QorIQ Platform

To build Openstack images for QorIQ Platform, X86 Laptop/Host machine for Yocto Project build should be
available. After build environment is ready, refer to following steps to build images:

PDF excerpt generated on May 20, 2020


NXP copyright: NXP B.V. 2019
NXP trademark statement: NXP and the NXP logo are trademarks of NXP B.V.
21
NXP Semiconductors

1. Install QorIQ SDK ISO on X86 host


a. Install cache ISO(QorIQ-SDK-<version>-<target>-CACHE-<yyyymmdd>-yocto.iso )

b. Then install source(QorIQ-SDK-<version>-SOURCE-<yyyymmdd>-yocto.iso ) ISO

2. After those two ISOs install successfully, create project for target platform

$ . ./fsl-setup-poky -m <targer_platform>

Or

$ . ./fsl-setup-poky -m <targer_platform>

3. Add following line into conf/local.conf

sources/meta-DELTA_KERNEL_DEFCONFIG_append = " <ISO Install folder>/meta-fsl-n


etworking/recipes-kernel/linux/files/openstack_config “

4. Build images for Openstack

Openstack Controller
$ bitbake openstack-image-controller
Openstack Network Node
$ bitbake openstack-image-network
Openstack Compute Node
$ bitbake openstack-image-compute

5. After the image builds successfully, you will see following images under directory

cd tmp/deploy/images/<target_platform>
Controller Rootfs:
openstack-image-controller-<target_platfrom>.tar.gz
Network Node Rootfs:
openstack-image-network-<target_platform>.tar.gz
Compute Node Rootfs:
openstack-image-compute-<target_platform>.tar.gz

PDF excerpt generated on May 20, 2020


NXP copyright: NXP B.V. 2019
NXP trademark statement: NXP and the NXP logo are trademarks of NXP B.V.
22
NXP Semiconductors

6. Transfer those images to tftpserver for SATA Boot Deployment

Deploy Openstack images(controller/compute/network) on Target platform

1. Bootup target platform by referring target platform deployment guide

2. After booting, login using username ‘root’

3. Unmount the Hard drive if it’s already mounted

4. Create the partition in the Hard drive using the following commands:
a. Run the following command to enter into partitioning system

$ fdisk /dev/sda

b. Enter ‘n’ and press enter to create new partition

Command (m for help): n

c. Enter ‘p’ and press enter to create a primary partition

Command action
e extended
p primary partition (1-4)
p

d. Enter ‘1’ and press enter to create partition number 1

Partition number (1-4):1

e. Press enter to select first cylinder as ‘1’

First cylinder (1-1018, default 1):

f. Press enter to select complete disk size

Last cylinder or +size or +sizeM or +sizeK (1-1018, default 1018):

g. Enter ‘w’ and press enter to write the changes to Hard drive

PDF excerpt generated on May 20, 2020


NXP copyright: NXP B.V. 2019
NXP trademark statement: NXP and the NXP logo are trademarks of NXP B.V.
23
NXP Semiconductors

Command (m for help): w

5. Format the partition as ext3 file system using following command

$ mkfs.ext2 /dev/sda1

6. Mount the formatted partition to local folder. Run the following command to execute it

$ mkdir /media/sda1
$ mount /dev/sda1 /media/sda1

7. Download the openstack rootfs to SATA HDD Drirve

$ scp <username>@<tftp_server>:<Openstack_image_dir>/openstack-image-controlle
r-<target_platform>.tar.gz /media/sda1

8. Uncompress the tarball to SATA HDD Drive.

$ cd /media/sda1
$ tar –zxf openstack-image-controller-<target_platform>.tar.gz

9. Umount the SATA HDD Drive and reboot system

$ umount /media/sda1; reboot

10. Boot the board with Hard drive

For PPC platform:


=> setenv sataboot 'setenv bootargs root=/dev/sda1 rootfstype=ext2 rootdelay=1
0 rw console=$consoledev,$baudrate $othbootargs;tftp $loadaddr $bootfile;tftp
$fdtaddr $fdtfile;bootm $loadaddr - $fdtaddr'
Note: assume the SATA HDD drive is sda1
=> run sataboot
For LS2085ARDB/LS2088AARDB platform:
=> tftp a0000000 <ls2085ardb_kernel_itb>.itb
=> setenv bootargs 'root=/dev/sda1 rw rootdelay=10 console=ttyS1,115200 earlyc

PDF excerpt generated on May 20, 2020


NXP copyright: NXP B.V. 2019
NXP trademark statement: NXP and the NXP logo are trademarks of NXP B.V.
24
NXP Semiconductors

on=uart8250,mmio,0x21c0600 default_hugepagesz=2m hugepagesz=2m hugepages=256


=> bootm a0000000:kernel@1 - a0000000:fdt@1
For LS1043ARDB platform:
=> tftp a0000000 <ls1043ardb_kernel_itb>.itb
=> setenv bootargs 'root=/dev/sda1 rw rootdelay=10 console=ttyS0,115200 earlyp
rintk=uart8250-8bit,0x21c0600,115200 default_hugepagesz=2m hugepagesz=2m hugep
ages=256
=> bootm a0000000:kernel@1 - a0000000:fdt@1

Note: Make sure at least two ethernet ports on target platform are available. One port is for management interface,
another one is for data interface.
Configuration for Openstack

1. Please refer to Openstak Kilo configuration as following link:

http://docs.openstack.org/kilo/install-guide/install/apt/content/index.html

References

OpenStack Installation Guide:

*http://docs.openstack.org/kilo/config-reference/content/list-of-compute-config-op
tions.html
*hhttp://docs.openstack.org/kilo/install-guide/install/apt/openstack-install-guide
-apt-kilo.pdf

Shared State (sstate) Cache

BitBake has the capability to accelerate builds based on previously built output. This is done using "shared state"
files which can be thought of as cache objects and this option determines where those files are placed. The shared
state cache (sstate-cache), as pointed to by SSTATE_DIR.

1. Use the following setting in local.conf:

PDF excerpt generated on May 20, 2020


NXP copyright: NXP B.V. 2019
NXP trademark statement: NXP and the NXP logo are trademarks of NXP B.V.
25
NXP Semiconductors

SSTATE_DIR="<absolute_path_of_cache_folder>"
e.g. SSTATE_DIR = "/home/yocto/sdk/sstate-cache/"

Note: Some packages have no caches because the ISO uses 4GB of space. Thus, cache size is limited by ISO
size. Some packages (e.g. u-boot, kernel, rcw, hv-cfg, fmc, depmodwrapper-cross, keymaps, base-files, merge-
files, shadow-securetty, etc.) have no caches and building them requires about 20 minutes.

FAQ

Frequently Asked Questions about Yocto Project

Q: How do I install source code, modify source code and rebuild u-boot/kernel?

A: Use the following steps:

1. $ cd <sdk-install-dir>/build_<machine>

2. If the source code has been installed, please skip this step.
• $ bitbake -c patch <package-name>

• $ cd <S> and do change


Note: Use bitbake -e <package-name> | grep ^S = to get the value of <S>.

3. Modify configure (dts can also be modified):


• Modify the UBOOT_CONFIG variable in sources/meta-freescale/conf/machine/
<machine>.conf or update the KERNEL_DEFCONFIG variable in sources/meta-freescale/
conf/machine/<machine>.conf

4. Rebuild images:
• $ cd <sdk-install-dir>/build_<machine>

• $ bitbake -c compile -f <package-name>

• $ bitbake <package-name>

Note: u-boot.bin, Image and dtb files can be found in build_<machine>/tmp/deploy/images/


<machine>.

Or set <ARCH> and <CROSS_COMPILE> and build the u-boot/kernel manually

PDF excerpt generated on May 20, 2020


NXP copyright: NXP B.V. 2019
NXP trademark statement: NXP and the NXP logo are trademarks of NXP B.V.
26
NXP Semiconductors

Q: How do I build u-boot/kernel with debugger (CodeWarrior support)?

A: For u-boot:

1. $ cd <sdk-install-dir/build_<machine>

2. $ bitbake -c cleansstate u-boot

3. Modify the u-boot-qoriq_<version>.bb file and add following content:


• $ cd sources/meta-freescale/recipes-bsp/u-boot

• $ add 'EXTRA_OEMAKE += "CONFIG_CW=1"' in u-boot-qoriq_<version>.bb file

4. Rebuild u-boot:
• $ bitbake u-boot

For kernel:

1. $ cd <sdk-install-dir>/build_<machine>.

2. If kernel source code is not installed, install the kernel source code first.
• $ bitbake -c cleansstate virtual/kernel

• $ bitbake -c patch virtual/kernel

3. Configure kernel to enable CW support:


• $ bitbake -c menuconfig virtual/kernel

• Enable Kernel hacking -> Include CodeWarrior kernel debugging in kernel configuration UI.

4. Rebuild kernel:
• $ bitbake virtual/kernel

Q: How do I view the content of rootfs?

A: The expanded rootfs is in <IMAGE_ROOTFS>

Note: Use bitbake -e <rootfs-name> | grep ^IMAGE_ROOTFS= to get the value of <IMAGE_ROOTFS>.

Q: How do I add a pre-built binary into the rootfs?

A: Do the following:

1. $ cd <sdk-install-dir>.

PDF excerpt generated on May 20, 2020


NXP copyright: NXP B.V. 2019
NXP trademark statement: NXP and the NXP logo are trademarks of NXP B.V.
27
NXP Semiconductors

2. Add the files:


• $ cd sources/meta-freescale/recipes-extended/merge-files

• Put the files into files/merge, e.g. put bash into files/merge/, bash will be included in /home/root/
of the new rootfs.

3. Build new rootfs image:


• $ bitbake <rootfs-target>

Q: What's an example of using dtc to reverse to a dts from a dtb?

A: Do the following

1. $ export PATH=<path-of-dtc>:$PATH

2. $ dtc -I dtb -O dts -o name-of-dts name-of-dtb

Q: How do I build fsl-toolchain?

A: Do the following

1. $bitbake fsl-toolchain

Note: fsl-qoriq-glibc-x86_64-<target>-toolchain-<VERSION>.sh can be found in build_<machine>/tmp/


deploy/sdk/
Note: fsl-qoriq-glibc-x86_64-<target>-toolchain-<VERSION>.sh runs and the toolchain can be installed in
special path

Q: I failed to get source tarball of a packages with wget. What should I do?

A: Use the --no-check-certificates optionwhen Yocto Project uses wget to fetch source tarball from
internet, the option is only available when wget was configured at build time with SSH support. Ensure that wget
on your host is built with SSH support.

Q: How do I include toolchain in rootfs?

A: The toolchain runs on target board, which is the same exact version as the cross tools in this SDK, is only
included in fsl-image-full rootfs, if you want to add toolchain into other rootfs images, do the following:

PDF excerpt generated on May 20, 2020


NXP copyright: NXP B.V. 2019
NXP trademark statement: NXP and the NXP logo are trademarks of NXP B.V.
28
NXP Semiconductors

1. Edit fsl-image-minimal.bb/fsl-image-core.bb to add packagegroup-core-buildessential in


the IMAGE_INSTALL variable.

2. $ bitbake <rootfs-target>.

Q: How do I use standalone toolchain to build kernel?

A: If you want to build the linux kernel using toolchain, you can do the following:

1. cd <toolchain-install-dir>

2. source environment-setup-<core>-fsl-linux

3. export LDFLAGS=""

4. cd <linux-src-dir>

5. make mrproper

6. ./scripts/kconfig/merge_config.sh
arch/arm64/configs/defconfig
arch/arm64/configs/freescale.config

7. make CC="$CC" LD="$LD"

PDF excerpt generated on May 20, 2020


NXP copyright: NXP B.V. 2019
NXP trademark statement: NXP and the NXP logo are trademarks of NXP B.V.
29

You might also like