Using VxWorks 7 Containers With Dockerhub on a Raspberry Pi 4 Model B Board

Aug 4, 2021 | Docker, VxWorks

Raspberry Pi 4 Specifications

1 Introduction

Containers allow the packaging of VxWorks applications that are isolated from the rest of the system. VxWorks containers can be deployed into the cloud repository called Dockerhub, and distributed to VxWorks target boards from there.

VxWorks is a Real Time Operating System built by Wind River.

VxWorks has board support package (BSP) for the Raspberry Pi 4 model B target board.

The Raspberry Pi 4 board is a small and affordable computer board.

DockerHub is a repository where Docker users store and distribute container images.

This blog describes how to configure VxWorks with support for Containers on the Rasberry Pi 4 and also the DockerHub cloud registry.

2 Prerequisites

These instructions assume that you are using:

1) A Raspberry Pi 4 model B board with 4GB RAM
2) A USB-Serial TTL serial cable
3) A micro-SD card
4) A Windows workstation with the following installed on it:
5) Wind River VxWorks 7, SR21.07

The instructions assume you have a Docker Hub login. Refer to https://hub.docker.com/ for details.

They also assume you have configured your workstation with the buildah utility. This is used to build OCI compliant containers. For details, refer to the VxWorks Container Programmer’s Guide, Configure the Build Workstation for Containers.

3 Related Documentation

For more information on these topics, refer to:

Wind River documentation:
VxWorks Container Programmer’s Guide

4 Prepare the Raspberry Pi 4 Target Board

4.1 Install driver for TTL serial cable (on Windows workstation only)

Follow the instructions here to install an obsolete Windows 10 driver for the USB-Serial TTL serial cable:
http://wp.brodzinski.net/2014/10/01/fake-pl2303-how-to-install/

4.2 Attach the TTL serial cable to the Raspberry Pi 4 board

Locate the pin header on the target board. Pin 1 is on the second row of pins from the edge, and it is the column of pins closest to the top edge of the board (the edge furthest away fom the ethernet RJ45 and USB connectors).

Attach TTL serial cable wires to pins as follows:
pin 06 – black wire
pin 08 – white wire
pin 10 – green wire

NOTE: leave the red wire unconnected.

4.3 Get the Raspbery Pi 4 Firmware

Follow the instructions documented in the BSP target.txt file to locate the firmware:
installDir\vxworks\21.07\os\unsupported\rpi_4\rpi_4\target.txt
First, clone the Raspberry Pi firmware git repo. For example:

git clone https://github.com/raspberrypi/firmware.git

Second, checkout the correct firmware version.
NOTE: When you run the git checkout command, add the parameter -f to force the checkout of the correct firmware version. For example:

git checkout -f d9c382e0f3a546e9da153673dce5dd4ba1200994

4.4 Copy the contents of the boot directory to the root of the SD Card

The git repo downloads to a directory called firmware. Copy the contents of firmware\boot to the root of the SD Card.

4.5 Attach the cables to the Raspberry Pi 4 board

Attach the TTL serial cable USB connector to the workstation.

Attach the power and network cables to the Raspberry Pi 4 board.

4.6 Verify the U-Boot console appears on the Raspberry Pi 4 console

The default serial configuration for the workstation terminal is:
Baud Rate : 115200
Data : 8 bit
Stop : 1 bit
Parity : None
Flow Ctrl : None

5 Prepare the Container-Enabled VxWorks Projects

5.1 Create and Build the Containers VxWorks Source Build (VSB) Project

Open a Windows command shell, configure the build environment, and then add the containers libraries to a newly created VxWorks source build (VSB) project:

cd <WIND_HOME>                  // your installation directory
wrenv -p vxworks\21.07
cd <YOUR_WORKSPACE>             // your workspace
vxprj vsb create -S -bsp rpi_4 -smp rpiVSB
cd rpiVSB                       // your VSB directory
                                // add the Containers runtime
vxprj vsb layer add CONTAINER_RUNTIME 
                                // add the Containers manager
vxprj vsb layer add CONTAINER_MANAGER      
                                // add the Containers Examples
vxprj vsb layer add PYTHON 
vxprj vsb layer add CONTAINER_EXAMPLES
vxprj vsb config -s -add _WRS_CONFIG_CONTAINER_PYTHON_WEB_SERVER=y 
                                // Build the VSB
vxprj vsb build -j 16
cd ..       

5.2 Create and Build the Containers VxWorks Image Project (VIP)

Create the VxWorks image project (VIP) as follows:

vxprj vip create -vsb rpiVSB llvm -profile PROFILE_DEVELOPMENT rpiVIP
cd rpiVIP
                                  // enable VIP container components
vxprj vip component add INCLUDE_CONTAINER_RUNTIME INCLUDE_CONTAINER_SHELL_CMD
vxprj vip component add INCLUDE_DISK_UTIL INCLUDE_RAM_DISK INCLUDE_OVERLAY_FS
vxprj vip parameter set RAM_DISK_SIZE 0x4000000
vxprj vip component add INCLUDE_STANDALONE_SYM_TBL
vxprj vip component add INCLUDE_STANDALONE_DTB
                                    // enable PYTHON and ROMFS
vxprj vip component add INCLUDE_PYTHON_SUPPORT INCLUDE_ROMFS
mkdir romfs

5.3 Prepare the VxWorks Configuration for Public Internet Access

vxprj vip component add INCLUDE_CONTAINER_MANAGER INCLUDE_IPDNSC
vxprj vip component add INCLUDE_PING INCLUDE_IFCONFIG
vxprj vip parameter setstring DNSC_PRIMARY_NAME_SERVER "8.8.8.8"
vxprj vip parameter set SEC_VAULT_KEY_ENCRYPTING_PW \"vault_passwd\"
vxprj vip component add INCLUDE_IPCOM_USE_TIME_CMD

NOTE:
On linux hosts, set the SEC_VAULT_KEY_ENCRYPTING_PW as follows:

vxprj parameter set SEC_VAULT_KEY_ENCRYPTING_PW \"\vault_passwd\"

NOTE:
Set SEC_VAULT_KEY_ENCRYPTING_PW to an appropriate password which includes letters of varying case, and numbers.

5.4 Add Raspberry Pi 4 Specific Components

vxprj vip component add DRV_END_FDT_BCM_GENETv5 INCLUDE_XBD_PART_LIB
vxprj vip component add DRV_FDT_BRCM_2711_PCIE DRV_FDT_BRCM_2711_EMMC2
vxprj vip component add DRV_SDSTORAGE_CARD

5.5 Copy the VxWorks Container Certificate to the VIP ROMFS Directory

mkdir romfs\vxc\ca-certs
copy ..\..\vxworks\21.07\os\container\manager\ca-certs\ca-certificates.crt romfs\vxc\ca-certs\

5.6 Update the VxWorks bootline in the DTS File

Open the DTS file rpi_4_0_1_2_0\rpi-4b.dts in an editor.

Locate the chosen node in the DTS file.

Select an IP address for the target and configure the IP addresses in the VxWorks bootline correctly. For example:

bootargs = "genet(0,0)host:vxworks h=192.168.1.105 e=192.168.1.107:ffffff00 g=192.168.1.1 u=target pw=vx tn=RPi4";

5.7 Build the VIP

vxprj build

6 Push the web_server Example Container to DockerHub

cd ..\myVSB\usr\containers\web_server\
wsl buildah pull oci:web_server.oci
wsl buildah push --creds dockerAccountName:dockerAccountPassword web_server.oci docker://dockerAccountName/web_server.oci

Note:
dockerAccountName = the docker ID for your Docker Hub account
dockerAccountPassword = your Docker Hub account password

7 Boot VxWorks on the Raspberry Pi 4 Target Board

7.1 Copy the VxWorks Boot Files to the SD Card

Power-down the Raspberry Pi 4, remove the SD card. Insert the SD card into the workstation.
Copy the VIP uVxWorks file to the root of the SD card.
Copy the contents of the diretory rpiVIP\rpi_4_0_1_2_0\_sd_card_files to the root of the SD card.
Remove the SD card from the workstation, and replace in the Raspberry Pi 4 target board.

7.2 Boot VxWorks from the U-Boot Console

Power-up the target. U-Boot should run the boot scripts automatically and the VxWorks kernel shell should appear on the serial console.

Alternatively, to boot the VxWorks kernel manually:
First, press return to interrupt the U-Boot boot process.
Second, load the uVxWorks file.

fatload mmc 0:1 0x10000000 uVxWorks

Third, run the uVxWorks file.

bootm 0x10000000

7.3 Identify the target network IP address

From the VxWorks kernel shell:

-> ifconfig
.
.
.
gei0      Link type:Ethernet HWaddr 7a:7a:9a:00:00:02
          inet 192.168.1.107 mask 255.255.255.0 broadcast 192.168.1.255
.
.
.
value = 0 = 0x0
->

NOTE: Sometimes the VxWorks network stack takes a few minutes to establish a network connection after VxWorks boots. The LEDs on the RJ45 network connector will flash while the driver is connecting.
You may need to disconnect and reconnect the network cable to make the LEDs start flashing. Once the green and orange LEDS are stable, you should then be able to access the network successfully.

7.4 Set the VxWorks date correctly

-> cmd
[vxWorks *]# date 2021-06-15
ok
[vxWorks *]#

Note:
This instruction assumes the date of 15th June 2021. Set the date to the current date at time of using this blog.

8 Download and Run the web_server Container

8.1 Check your Internet connectivity

[vxWorks *]# C
-> ping "www.google.com"
Pinging lhr25s34-in-f4.1e100.net (142.250.187.228) with 64 bytes of data:
Reply from 142.250.187.228 bytes=64 ttl=114 seq=0 time=16ms
--- lhr25s34-in-f4.1e100.net ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 17 ms
rtt min/avg/max = 16/16/16 ms
value = 0 = 0x0
-> cmd
[vxWorks *]# 

Note:
You may need to wait a while until the END driver finishes configuring the ethernet PHY. Once the RJ45 connector LEDs have stopped flashing, configuration is done.

8.2 Pull the Web Server VxWorks container to the Target

[vxWorks *]# vxc pull dockerAccountName/web_server.oci 
[vxWorks *]# vxc unpack --image web_server.oci --rootfs flattened /ram0/bundle

Note:
dockerAccountName = the docker ID for your Docker Hub account

8.3 Run the web_server Container

[vxWorks *]# vxc run --bundle /ram0/bundle web_server
Starting server using port 8888

8.4 Open a Web Browser from your Workstation to Verify Example Container is Running

Assuming a target ip address of 192.168.1.107, navigate in your browser bar to http://192.168.1.107:8888 and view the example Wind River web page displayed in your browser.

You will also receive debug messages on the kernel shell while the web server is serving content to your browser. For example:

[vxWorks *]# vxc run --bundle /ram0/bundle web_server
Starting server using port 8888
192.168.1.105 - - [06/Jul/2021 01:43:54] "GET / HTTP/1.1" 200 -
192.168.1.105 - - [06/Jul/2021 01:43:54] "GET / HTTP/1.1" 200 -
192.168.1.105 - - [06/Jul/2021 01:43:55] "GET /wndrvr.png HTTP/1.1" 200 -
192.168.1.105 - - [06/Jul/2021 01:43:55] "GET /GettyImages.jpg HTTP/1.1" 200 -
192.168.1.105 - - [06/Jul/2021 01:43:55] code 404, message File not found
192.168.1.105 - - [06/Jul/2021 01:43:55] "GET /favicon.ico HTTP/1.1" 404 -
192.168.1.105 - - [06/Jul/2021 01:44:13] "GET / HTTP/1.1" 200 -
192.168.1.105 - - [06/Jul/2021 01:44:13] "GET /wndrvr.png HTTP/1.1" 200 -
192.168.1.105 - - [06/Jul/2021 01:44:13] "GET /GettyImages.jpg HTTP/1.1" 200 -
192.168.1.105 - - [06/Jul/2021 01:44:13] code 404, message File not found
192.168.1.105 - - [06/Jul/2021 01:44:13] "GET /favicon.ico HTTP/1.1" 404 -
192.168.1.105 - - [06/Jul/2021 01:44:51] "GET / HTTP/1.1" 200 -
192.168.1.105 - - [06/Jul/2021 01:44:51] "GET /wndrvr.png HTTP/1.1" 200 -
192.168.1.105 - - [06/Jul/2021 01:44:51] "GET /GettyImages.jpg HTTP/1.1" 200 -

Browse Category

Join our DO-178C group on LinkedIn

Got A Project In Mind?

We fix, develop and test embedded software for the aerospace & defence industry specialising in DO-178C safety-critical testing. Speak to us. We have laser focus, unprecedented attention-to-detail and provide phenomenal value.