Skip to content

Repository files navigation

meta-openaia

Build Github All Releases

Yocto BSP layer for the Edgeble OpenAIA - https://www.openaia.io

This project is based on upstream - https://git.yoctoproject.org/meta-rockchip

Please see the corresponding sections below for details.

Table of Contents

I. Build Host

II. Configure Yocto

III. Build Yocto

Build Host

To install the required packages on a Debian based distribution (Ubuntu etc) run

sudo apt install gawk wget git diffstat unzip texinfo gcc build-essential \
chrpath socat cpio python3 python3-pip python3-pexpect xz-utils \
debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa \
libsdl1.2-dev pylint xterm python3-subunit mesa-common-dev zstd liblz4-tool

Configure Yocto/OE

In order to build an image with BSP support for a given release, you need to download the corresponding layers described in the "Dependencies" section. Be sure that everything is in the same directory.

~ $ mkdir yocto; cd yocto
~/yocto $ git clone git://git.openembedded.org/bitbake -b master
~/yocto $ git clone git://git.openembedded.org/openembedded-core -b kirkstone
~/yocto $ git clone git://git.yoctoproject.org/meta-arm -b kirkstone
~/yocto $ git clone git://git.openembedded.org/meta-openembedded -b kirkstone
~/yocto $ git clone git@github.com:edgeble/meta-openaia.git -b kirkstone
~/yocto $ git clone git@github.com:edgeble/meta-update.git -b kirkstone
~/yocto $ git clone git@github.com:edgeble/meta-fleet.git -b kirkstone

And put the meta-openaia layer here too.

Then you need to source the configuration script:

~/yocto $ source openembedded-core/oe-init-build-env

Having done that, you can build a image for a edgeble boards by adding the location of the meta-openaia layer to bblayers.conf, along with any other layers needed.

For example:

# conf/bblayers.conf
BBLAYERS ?= " \
  ${TOPDIR}/../openembedded-core/meta\
  ${TOPDIR}/../meta-arm/meta-arm \
  ${TOPDIR}/../meta-arm/meta-arm-toolchain \
  ${TOPDIR}/../meta-openaia \
  ${TOPDIR}/../meta-update \
  ${TOPDIR}/../meta-fleet \
  ${TOPDIR}/../meta-openembedded/meta-oe \
  ${TOPDIR}/../meta-openembedded/meta-python \
  ${TOPDIR}/../meta-openembedded/meta-networking \
  ${TOPDIR}/../meta-swupdate \
  ${TOPDIR}/../meta-swupdate-boards \
  "

To enable a particular machine, you need to add a MACHINE line naming the BSP to the local.conf file:

For v5.10 kernel with swupdate:-

  MACHINE = "neu6b-fleet"

For upstream kernel with swupdate:-

  MACHINE = "neu6b-up-fleet"

Enable systemd in your Yocto configuration by adding the following to your local.conf file

INIT_MANAGER = "systemd"

Enable disto features needed to support the pacakges by adding the following to your local.conf file

DISTRO_FEATURES:append = " bluetooth wifi"

To enable Wifi using wpa_supplicant

Create the wpa_supplicant configuration file by running the following command on your desktop. This will prompt you for the passphrase for your WiFi. You may want to then edit the file to remove the clear-text passphrase:

wpa_passphrase 'YOUR_SSID' >  ../meta-openaia/recipes-connectivity/wpa-supplicant/files/wpa_supplicant-nl80211-wlan0.conf

All supported machines can be found in meta-openaia/conf/machine.

Building meta- BSP Layers

You should then be able to build a image as such:

bitbake core-image-full-cmdline
bitbake update-image

At the end of a successful build, you should have an .wic image in /path/to/yocto/build/tmp-glibc/deploy/<MACHINE>/

If you want to boot the image on microSD card the follow below steps.

cd tmp-glibc/deploy/images/\<MACHINE\>
sudo bmaptool copy --bmap core-image-full-cmdline-neu2a-io.wic.bmap core-image-full-cmdline-neu2a-io.wic.xz /dev/sdX

Configure and run swupdate using Hawkbit server

Steps to Configure Hawkbit

Step 1 : Open the terminal and run the command given below. This command will start a hawkbit server for you at the port 8080.

sudo docker run -p 8080:8080 hawkbit/hawkbit-update-server:latest

Step 2 : Now go your favorite browser. Run the following command in your browser. Your_ip:8080 (like 192.168.xxx.xxx:8080). If you don’t know your IP, simply run “ifconfig” command in your terminal and it will show you network configurations

Screenshot from 2023-09-22 14-05-16

Step 3 : Now, you will see the below screen in your browser. Simply use admin as username and password. Now, you are officially inside the Hawkbit server. You can now configure Hawkbit to send updates to your remote embedded devices.

step-2

Step 4 : First of all, you need to define authentication configuration for receiving updates from Hawkbit. Go to System Config tab in the left pane of the server. It will show you 4 types of authentications for target devices to receive updates.The most common authentications used are gateway authentication and target authentications.

  • Copy gateway token by selecting 'Allow a gateway to authenticate and manage multiple targets through a gateway security token' this token helps to connect the device to hawkbit server.

command run from Board to connect the hawkbit server with help of swupdate command which uses gateway token :-

root@neu6b-v1-5: swupdate -H neu6b-v1:1.0 -f /etc/swupdate.cfg -l 5 -u '-t DEFAULT -u http://192.168.0.105:8080 -i neu6b-v1 -g 883726480bf128a0f8985344b021464c'

  • Enable 'Allow targets to authenticate directly with their target security token'
  • Select your desired 'Polling Configuration',to make board polling time to Hawkbit server.
  • Don’t forget to press save button at the bottom .

step-3

Steps to Register the Board using SWUpdate to Hawkbit Server in Targets section in Deployment Management

We can add the Board details to the Hawkbit Server in the Targets section in two ways :-

  1. Before Build (or)
  2. After Boot

Before build :-

  • Add the required configurations of swupdate in meta-openaia and the build the yocto setup .
  • These helps to connect the board to hawkbit server and poll for the update after first boot itself.

Required changes to be done in meta-openai layer :-

In recipes-support/swupdate/swupdate/neu6b-v1-5.10-swu/swupdate.cfg :-

  • Modify the local host url , update the local host ip address of your local host.

In recipes-support/swupdate/swupdate/neu6b-v1-5.10-swu/01-swupdate-args :-

  • To SWUPDATE_SURICATTA_ARGS , add the required board details and update the gateway token which you got in ' Steps to Configure Hawkbit '

Eg:- SWUPDATE_SURICATTA_ARGS="-i neu6b-v1-${DEVICE_ID} -g 44f7e0fc67919b3144f3f07c404139d9"

  • To SWUPDATE_ARGS , for -H field , add the board hardware configuration details and version ,as per sw-description file which is present in recipes-extended/images/update-image/neu6b-v1-5.10-swu/sw-description

After Boot :-

Add the required configurations of swupdate after the boot , save the changes and reboot the board to update and connect

Required changes to be done after boot :-

  • Update the local host url in /etc/swupdate.cfg in suricatta section.

  • Update the required board details and gateway token to SWUPDATE_SURICATTA_ARGS field in 01-swupdate-args file which is present in /etc/swupdate/conf.d/

  • Update the board hardware configuration details and version to SWUPDATE_SURICATTA_ARGS field in 01-swupdate-args file which is present in /etc/swupdate/conf.d/

After following the above steps,Now boot the Board,we can see a target device will be created on the Hawkbit server, as shown below.

target-created

Upload the Swupdate Image (.swu) file in the upload Section of Hawkbit server

When we push the latest change , meta-openaia layer , automatically yml builds the yocto setup and upload the latest update-image(.swu) file of board to Hawkbit server .

Note :- Prior to push the latest change to meta-layer , we should run hawkbit server as per steps followed by 'Steps to Configure Hawkbit ' and github runner setup in our local host , before pushing our latest change.

To run Github runner setup with self hosted follow the below link:-

https://github.com/manojams/meta-fleet/blob/kirkstone/runner-self-host-setup-README.md

After running the Github runner setup and hawkbit server , push the latest change to meta layer , yml file builds the yocto setup in our host and uploads swu file to Hawkbit server.

Github runner build

Screenshot from 2023-09-25 15-17-27

After push latest commit on meta-openaia , we can see latest swu file in software module section of Hawkbit panel by yml file.

upload-swu-img

Steps for Update campaign rollout

Distribution Management :-

  • Go to the Distributions Management tab from the left selector
  • Create a Distribution of type "OS with app(s)", named DISTRO of version 1.0
  • Drag and drop the software module on the right pane onto the DISTRO distribution on the left pane

Create Distro :- step-5

Assigned swu file to Distro:- step-6

Target Filters :-

  • Go to the Target Filters tab from the left selector
  • Create a new filter named "Default filter" and use a generic filter such as "name==*"

step-7

Rollout :-

  • Go to the Rollout tab from the left selector
  • Create a new rollout campaign named "Neu6b-v1". Select the distribution set, the default filter and enter 1 in the "Number of groups" field. You should see stats of deployment appearing.

create new Rollout :

step-8

Rollout Management :-

step-9

Applying the update :-

  • Press the "Play" icon on the right side of your rollout campaign to activate the deployment.

At this point, you can either wait for a while, so that SWUpdate polls for updates and finds the new deployment campaign or kill and restart SWUpdate. You should find detailed information on the installation process in the standard output of SWUpdate.

step-10

check update is running in Board :-

sample swupdate log of swupdate running in Board :-

* Mark bundle as not supporting multiuse
[TRACE] : SWUPDATE running :  [extract_file_to_tmp] : Found file
* HTTP 1.1 or later with persistent connection
[TRACE] : SWUPDATE running :  [extract_file_to_tmp] :   filename sw-description
< HTTP/1.1 200 
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
[TRACE] : SWUPDATE running :  [extract_file_to_tmp] :   size 1812
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
[DEBUG] : SWUPDATE running :  [parse_cfg] : Parsing config file /tmp/sw-description
< Expires: 0
< X-Frame-Options: DENY
< Content-Length: 0
< Date: Mon, 25 Sep 2023 06:44:10 GMT
< 
* STATE: PERFORMING => DONE handle 0x7f8c001250; line 2464 (connection #0)
[TRACE] : SWUPDATE running :  [get_common_fields] : Version 0.1.0
* multi_done: status: 0 prem: 0 done: 0
* Connection #0 to host 192.168.0.105 left intact
* Expire cleared (transfer 0x7f8c001250)
[TRACE] : SWUPDATE running :  [channel_log_effective_url] : Channel's effective URL resolved to http://192.168.0.105:8080/DEFAULT/controller/v1/neu6b-v1-ce:60:71:de:f1:e7/deploymentBase/1/feedback
[TRACE] : SWUPDATE running :  [parse_hw_compatibility] : Accepted Hw Revision : 1.0
[TRACE] : SWUPDATE running :  [channel_log_reply] : Channel operation returned HTTP status code 200.
[TRACE] : SWUPDATE running :  [parse_reply] : Got channel reply: 
[TRACE] : SWUPDATE running :  [_parse_images] : Found compressed Image: core-image-full-cmdline-neu6b-v1-5.10-swu.ext4.gz in device : /dev/mmcblk1p9 for handler raw
[TRACE] : SWUPDATE running :  [_parse_scripts] : Found Script: emmcsetup.lua
[TRACE] : SWUPDATE running :  [_parse_bootloader] : Bootloader var: bootcount = 3
[TRACE] : SWUPDATE running :  [_parse_bootloader] : Bootloader var: upgrade_available = 1
[TRACE] : SWUPDATE running :  [parse] : Number of found artifacts: 1
[TRACE] : SWUPDATE running :  [parse] : Number of scripts: 1
[TRACE] : SWUPDATE running :  [parse] : Number of steps to be run: 3
[TRACE] : SWUPDATE running :  [check_hw_compatibility] : Hardware neu6b-v1 Revision: 1.0
[TRACE] : SWUPDATE running :  [check_hw_compatibility] : Hardware compatibility verified
[DEBUG] : SWUPDATE running :  [preupdatecmd] : Running Pre-update command
[TRACE] : SWUPDATE running :  [extract_files] : Found file
[TRACE] : SWUPDATE running :  [extract_files] :         filename emmcsetup.lua
[TRACE] : SWUPDATE running :  [extract_files] :         size 174 required
[TRACE] : SWUPDATE running :  [extract_files] : Found file
[TRACE] : SWUPDATE running :  [extract_files] :         filename core-image-full-cmdline-neu6b-v1-5.10-swu.ext4.gz
[TRACE] : SWUPDATE running :  [extract_files] :         size 57071162 required
[DEBUG] : SWUPDATE running :  [channel_callback_xferinfo] : Downloaded 1% (557 of 55736 kB).
[DEBUG] : SWUPDATE running :  [channel_callback_xferinfo] : Downloaded 2% (1116 of 55736 kB).
[DEBUG] : SWUPDATE running :  [channel_callback_xferinfo] : Downloaded 3% (1674 of 55736 kB).
[DEBUG] : SWUPDATE running :  [channel_callback_xferinfo] : Downloaded 4% (2230 of 55736 kB).
[DEBUG] : SWUPDATE running :  [channel_callback_xferinfo] : Downloaded 5% (2787 of 55736 kB).
[DEBUG] : SWUPDATE running :  [channel_callback_xferinfo] : Downloaded 6% (3344 of 55736 kB).
  • After applying swupdate , Board will get booted with altbootcmd
U-Boot 2023.07 (Sep 05 2023 - 16:00:14 +0000)

Model: Edgeble Neu6B IO Board
DRAM:  4 GiB (effective 3.7 GiB)
Core:  288 devices, 21 uclasses, devicetree: separate
MMC:   mmc@fe2c0000: 1, mmc@fe2e0000: 0
Loading Environment from MMC... OK
In:    serial@feb50000
Out:   serial@feb50000
Err:   serial@feb50000
Model: Edgeble Neu6B IO Board
Net:   No ethernet found.
Saving Environment to MMC... Writing to MMC(1)... OK
Warning: Bootlimit (3) exceeded. Using altbootcmd.
Hit any key to stop autoboot:  0 

Pause and cancel swupdate in Hawkbit server :-

step-pause-update-11

cancel the running action of swupdate in action history in Deployment section.

## Maintainers

* Jagan Teki `<jagan@edgeble.ai>`

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages