~~NOCACHE~~
{{template>en:templates:tabs|lang="en"|mod_name="tqmt10xx"|mod_name_head="TQMT10xx"|mod_arch="power"|bsp_name="linux"|bsp_name_head="Linux"}}
\\
\\
The Virtual Machine includes a pre-installed Yocto Project build environment including the Linux BSP for TQMT104x.
===== Using Yocto Project =====
==== Prerequisites ====
Initialize the build environment by executing
cd /opt/tq-powerarch-bsp/yocto
loadenv
Among other things this creates the //Build Directory// ''/opt/tq-powerarch-bsp/yocto/build'' and a default //Local Configuration File// ''/opt/tq-powerarch-bsp/yocto/build/conf/local.conf''.
After the script runs, your current working directory is set to the //Build Directory//. Later, when the build completes, the //Build Directory// contains all the files created during the build.
All subsequent tasks need to be executed from within the //Build Directory//.
==== Yocto Local Configuration File ====
The file ''/opt/tq-powerarch-bsp/yocto/build/conf/local.conf'' holds configuration variables that define the BSP build process.\\ In the scope of the TQMT104x, these are:
^ Variable ^ Valid Values ^ Description ^
| **''MACHINE''** | ''tqmt1042-stk'' | Defines target architecture / hardware platform |
| ::: | ''tqmt1042-64b-stk'' | ::: |
| ::: | ''tqmt1040-stk'' | ::: |
| ::: | ''tqmt1040-64b-stk'' | ::: |
| **''FSL_RCW''** | ''TQMT1042_SERDES86'' | Selects RCW w/ specific SerDes configuration for using a TQMT1040/TQMT1042 on STKT104x |
| ::: | ''TQMT1042_SERDES88'' | ::: |
| ::: | ''TQMT1042_SERDES8E''((requires ''KERNEL_DEVICETREE=fsl/tqmt1042_serdes8e.dtb'')) | ::: |
| ::: | ''TQMT1040_SERDES66'' | ::: |
| **''KERNEL_DEVICETREE''** | ''fsl/tqmt1042.dtb'' | Selects device tree blob |
| ::: | ''fsl/tqmt1042_serdes8e.dtb'' ((requires ''FSL_RCW=TQMT1042_SERDES8E'')) | ::: |
| ::: | ''fsl/tqmt1040.dtb'' | ::: |
Following excerpt from ''local.conf'' file shows the default configuration (# = commented out):
FSL_RCW = "TQMT1042_SERDES86"
#FSL_RCW = "TQMT1042_SERDES88"
#FSL_RCW = "TQMT1042_SERDES8E"
#FSL_RCW = "TQMT1040_SERDES66"
#MACHINE = "tqmt1042-stk"
MACHINE = "tqmt1042-64b-stk"
#MACHINE = "tqmt1040-stk"
#MACHINE = "tqmt1040-64b-stk"
KERNEL_DEVICETREE = "fsl/tqmt1042.dtb"
#KERNEL_DEVICETREE = "fsl/tqmt1042_serdes8e.dtb"
#KERNEL_DEVICETREE = "fsl/tqmt1040.dtb"
Whenever you wish to deviate from the default BSP configuration, e.g. select a different RCW, simply edit the ''local.conf'' file accordingly.
For a full documentation of Yocto Project in general and the ''local.conf'' file in particular, please see:
* [[http://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html|Full Yocto Documentation]]
* [[http://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#usingpoky-extend-customimage-localconf| Chapter 5.2.1. Customizing Images Using local.conf]]
==== Build BSP images ====
To build an BSP image execute
bitbake
from within the //Build Directory//, where '''' can be one of the following:
^ Image name ^ Description ^
| ''core-image-minimal'' | A small image just capable of allowing a device to boot. |
| ''core-image-full-cmdline'' | A console-only image with more full-featured Linux system functionality installed. |
This will effectively
* Build U-Boot for the TQMT104[02] module on STKT104x starterkit
* Build the Linux Kernel for the TQMT104[02] module on STKT104x starterkit
* Build a small-size minimal root file system
* Build a self-contained, bootable NOR flash and SD card image
* Deploy U-Boot, kernel uImage, device tree, NOR flash and SD card image and root file system to:\\ ''/opt/tq-powerarch-bsp/yocto/build/tmp/deploy/images/tqmt1042-64b-stk''
Names of possible root file systems images can be obtained by typing:
ls /opt/tq-powerarch-bsp/yocto/poky/meta*/recipes*/images/*.bb
Note that not all images may be buildable in the default yocto configuration.
Tests have been performed with **"core-image-minimal"** only.
For a description of the scope of these images / root file systems, please see the yocto documentation.
Note that the building process may take a large amount of time, depending on the hardware resources of your host system.
==== Build U-Boot only ====
bitbake u-boot
==== Build Linux kernel only ====
bitbake kernel
===== Manual builds =====
U-Boot and the Linux kernel can also be build outside Yocto Project.
==== Linux kernel & device tree ====
Checkout devel branch:
cd /opt/tq-powerarch-bsp/linux/
git checkout 4.4_devel
Initialize the build environment:
The file ''environment'' required by the ''loadenv'' script is missing in the VM.\\
Please download the following file and put it in the ''/opt/tq-powerarch-bsp/linux/'' directory before running the ''loadenv'' script.
source /opt/tq-powerarch-sdk64/environment-setup-ppc64e5500-poky-linux
# Remove "-Wl," from LDFLAGS as the Makefiles from Das U-Boot and Linux call the
# linker directly and not GCC for linking.
export LDFLAGS="${LDFLAGS//-Wl,/}"
# Use packages from the build system. This fixes e.g. 'make menuconfig'
export PKG_CONFIG_PATH=
export PKG_CONFIG_SYSROOT_DIR=
export LOADENV_USER=tq
loadenv
Configure:
make 85xx/tqmt1042_defconfig
make 85xx/_defconfig
'''' can be either ''tqmt1042_64'' or ''tqmt1042''.\\
Build the kernel and device tree:
make uImage
make fsl/tqmt1042.dtb
==== U-Boot ====
Initialize the build environment:
cd /opt/tq-powerarch-bsp/u-boot/
loadenv
Configure and start the build:
make [_SDCARD]_defconfig
make
'''' can be either ''TQMT1040'' or ''TQMT1042''.\\
If the optional ''[_SDCARD]'' is given U-Boot is built for booting from SD card, otherwise it is built for booting from NOR flash.\\
In case you want to modify some aspects of the U-Boot configuration (e.g. selecting another RCW) you can do so by executing:
make menuconfig
The RCW is implicitly built and included in the U-Boot image, to build a "stand-alone" RCW binary simply execute:
make fsl_rcw.bin