Introduction
familiarity with Quasar: creating Quasar projects, working with Design, attaching custom code, storing them on git. Experience with writing build config files for Quasar (involving cross-compiler toolchain) is a plus.
familiarity with Yocto: building images for qemu and/or real hardware, deploying layers and recipes.
Yocto, different versions (including Rocko and Sumo),
PetaLinux 2017.4, which uses Yocto behind the scenes, to build OPC-UA server for a PetaLinux-based project. Note that only few points of those presented here will be of use for PetaLinux integration, especially the recipes will be of value.
The terminology
~/gitProjects/quasar is where I have my quasar repo (i.e. a git clone from https://github.com/quasar-team/quasar). I will call it quasar repo.
~/gitProjects/poky is where I have my reference Yocto distribution usually called poky (in this manual it was in the krogoth version). I cloned it from Yocto git repo. I will call it poky repo.
~/gitProjects/poky-quasar is where I will have my Quasar-based OPC-UA server project. I will call it project repo.
The procedure
Make sure you’re using the Quasar branch with Yocto support
git checkout OPCUA-1016_yocto_quasar
Create a new Quasar project
./quasar.py create_project ~/gitProjects/poky-quasar
Put your new Quasar project under git version control
cd ~/gitProjects/poky-quasar git init . git add * git commit -m ‘Initial commit’
Copy the reference build config from quasar repo, select it and store it
cp ~/gitProjects/quasar/Extra/yocto/yocto_open62541_config.cmake . ./quasar.py set_build_config yocto_open62541_config.cmake git add yocto_open62541_config.cmake FrameworkInternals/build_config_selector.cmake git commit -a -m ‘Added build config’
Add CMake epilogue with install statements
cp ~/gitProjects/quasar/Extra/yocto/CMakeEpilogue.cmake . git add CMakeEpilogue.cmake git commit -a -m ‘Added the epilogue’
Generate CMake headers and store them
./quasar.py generate cmake_headers git add AddressSpace/cmake_generated.cmake -f git add Device/generated/cmake_header.cmake -f git commit -m ‘Added CMake headers’
Comment: this step is normally done behind the scenes by quasar when its usual entry point (quasar.py) is used rather than plain CMake. **That’s why -f (force) is used. **
Force to use host machine JRE
Enable open62541-compat module
./quasar.py enable_module open62541-compat pnikiel-yocto-fix git add FrameworkInternals/EnabledModules/open62541-compat.* git commit -m ‘Stored open62541-compat’
Check if project builds for your host system
./quasar.py build
Create a branch in Yocto reference distribution for your developments
git branch my-yocto-dev git checkout my-yocto-dev
Source Yocto’s oe-init-build-env
. oe-init-build-env
Build core-image-minimal (in case it’s your first Yocto build)
bitbake core-image-minimal
Create a new Yocto layer for your quasar OPC-UA server(s)
bitbake-layers create-layer meta-quasar-servers cd build bitbake-layers add-layer ../meta-quasar-servers
Deploy the Yocto recipe for your OPC-UA server
mkdir recipes-opcua-servers cd recipes-opcua-servers mkdir opcua-servers cd opcua-servers
Fix the path in the my-opcua-server recipe
Deploy xsd Yocto recipe (if not provided by anything else)
Deploy meta-openembedded layer to get some required Python modules
git clone git://git.openembedded.org/meta-openembedded -b sumo –depth=1 cd build bitbake-layers add-layer ../meta-openembedded/meta-oe bitbake-layers add-layer ../meta-openembedded/meta-python
git clone git://git.openembedded.org/meta-openembedded -b krogoth –depth=1 cd build bitbake-layers add-layer ../meta-openembedded/meta-oe bitbake-layers add-layer ../meta-openembedded/meta-python
Add your OPC-UA server artifacts to be installed on the target image
Build the minimal image
bitbake core-image-minimal
bitbake my-opcua-server
Run the minimal image in qemu
runqemu qemux86 core-image-minimal
Run the OPC-UA server
cd /opt/QuasarServer ./OpcUaServer