Creating a multilib image for the ZCU102 using Yocto

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".

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.
$ mkdir -p ~/workspace/yocto
$ cd ~/workspace/yocto
Clone the Yocto Poky repository and check out the current branch.
$ 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
$ git clone https://github.com/Xilinx/meta-xilinx.git
$ cd meta-xilinx
$ git checkout -b krogoth origin/krogoth
$ cd ..

Configure the build

Initialize the Yocto build environment
$ source oe-init-build-env
Add meta-xilinx to the conf/bblayers.conf file
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
# 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
$ bitbake -c menuconfig linux-xlnx


Execute the Build

$ bitbake core-image-minimal

Generate 32-bit and 64-bit test applications

Test application
#include <stdio.h>
int main()
 
&#123;
 
printf("Hello World, the size of long int is %zd\n", sizeof(long int));
return 0;
 
&#125;
Compile the test application for 32-bit and 64-bit
$ 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.



Author: Alvin Clark












http://www.yoctoproject.org/docs/current/dev-manual/dev-manual.html#combining-multiple-versions-library-files-into-one-image