Creating a multilib image for the ZCU102 using Yocto
"The Yocto build system offers the ability to build libraries with different target optimizations or architecture formats and combine these together into one system image". 1.
This page provides instructions for creating a multilib version of the core-image-minimal target for the ZCU102 Zynq UltraScale+ MPSoC eval board, allowing the user to run both 32-bit and 64-bit applications.
Please note that the process outlined on this page is provided for informational purposes only and is not officially supported by Xilinx.
Instructions
Fetch the required sources
Create a workspace directory. Code Block |
---|
|
$ mkdir -p ~/workspace/yocto
$ cd ~/workspace/yocto |
Clone the Yocto Poky repository and check out the current branch. Code Block |
---|
|
$ git clone http://git.yoctoproject.org/git/poky
$ cd poky
$ git checkout -b krogoth origin/krogoth |
Clone the Xilinx meta layer and check out the current branch Code Block |
---|
|
$ git clone https://github.com/Xilinx/meta-xilinx.git
$ cd meta-xilinx
$ git checkout -b krogoth origin/krogoth
$ cd .. |
Initialize the Yocto build environment Code Block |
---|
|
$ source oe-init-build-env |
Add meta-xilinx to the conf/bblayers.conf file Code Block |
---|
|
BBLAYERS ?= " \
/home/user/workspace/yocto/poky/meta \
/home/user/workspace/yocto/poky/meta-poky \
/home/user/workspace/yocto/meta-yocto-bsp \
/home/user/workspace/yocto/meta-xilinx \
" |
Edit local.conf file Code Block |
---|
|
# Set target machine to zcu102
MACHINE ??= "zcu102-zynqmp"
# Define multilib target
require conf/multilib.conf
MULTILIBS = "multilib:lib32"
DEFAULTTUNE_virtclass-multilib-lib32 = "armv7athf-neon"
# Bundle image as an INITRAM image
INITRAMFS_IMAGE = "core-image-minimal"
INITRAMFS_IMAGE_BUNDLE = "1"
IMAGE_FSTYPES += "cpio.gz"
# Specify the 32-bit libraries to be added to all images
IMAGE_INSTALL_append = "lib32-glibc lib32-libgcc lib32-libstdc++"
|
Enable support for 32-bit EL0 applications under a 64-bit kernel at EL1 Code Block |
---|
|
$ bitbake -c menuconfig linux-xlnx |
Image Modified Execute the Build
Code Block |
---|
|
$ bitbake core-image-minimal |
Generate 32-bit and 64-bit test applications
Test application Code Block |
---|
|
#include <stdio.h>
int main()
|
{ ("Hello World, the size of long int is %zd\n", sizeof(long int));
return 0 |
; } Compile the test application for 32-bit and 64-bit Code Block |
---|
|
$ aarch64-linux-gnu-gcc -Wall hello_world.c -o hello_world_64b
$ arm-linux-gnueabihf-gcc -Wall hello_world.c -o hello_world_32b |
Test the Image
Generate BOOT.bin (not covered here). Copy the following files to an SD Card- Boot.bin
- build/tmp/deploy/images/zcu102-zynqmp/Image-initramfs-zcu102.bin (Rename to Image)
- build/tmp/deploy/zcu102-zynqmp/images (Rename to system.dtb)
- hello_world_64b
- hello_world_32b
Boot the ZCU102 Mount the SD Card and run the test applications.
Image Modified
Author: Alvin Clark
Anchor |
---|
1. | 1.
http://www.yoctoproject.org/docs/current/dev-manual/dev-manual.html#combining-multiple-versions-library-files-into-one-image