Skip to content

Commit

Permalink
services: create remoteHW-deploy (zephyrproject-rtos#6)
Browse files Browse the repository at this point in the history
* services: add RemoteHW-Deploy w/ snapshot of zephyrtest-blue

* update target directory
  • Loading branch information
chrisvintc authored Dec 16, 2021
1 parent 7c1a63a commit 6eb7640
Show file tree
Hide file tree
Showing 20 changed files with 1,426 additions and 44 deletions.
44 changes: 0 additions & 44 deletions .github/workflows/1RTOS-ci-ci.yaml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/RemoteHW-Deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# RemoteHW-Deploy
# triggered on push to main:src/remotehw/, this workflow uses scp to deploy
# remoteHW configuration & scripts to zephyrtest-blue. This method requires
# the runner user be pre-authenticated. See FMOS-DevOps-KeyRoll workflow.

name: RemoteHW-Deploy
on:
push:
branches: [ main ]
paths:
- 'src/remotehw/**'
workflow_dispatch:

jobs:
deploy_zephyrtest-blue:
defaults:
run:
shell: bash
runs-on: testhead
steps:
- uses: actions/checkout@v2
with:
path: 'repo'
- name: scp src/remotehw/opt/*
run: scp repo/src/remotehw/opt/* zephyrtest-blue.jf.intel.com:/opt/remotehw/
- name: scp src/remotehw/profile/*
run: scp repo/src/remotehw/profile/* zephyrtest-blue.jf.intel.com:/etc/profile.d/
Binary file added src/remotehw/opt/acrn-binaries.zip
Binary file not shown.
28 changes: 28 additions & 0 deletions src/remotehw/opt/acrn-test-pty.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/expect -f

set dev [lindex $argv 0]

set stty_init raw

set timeout 300

spawn bash -c "source /etc/profile.d/remotehw*; remotehw-$dev-reset; remotehw-$dev-get-console"

set timeout -1

expect "*add_pte, pte 0x813a6000 is already present*" { send "\r" }

set timeout -1

expect "*ACRN\:\\\\>"

set timeout -1

send "vm_console 0\r"

set timeout -1

expect "PROJECT EXECUTION*"

expect eof

16 changes: 16 additions & 0 deletions src/remotehw/opt/efi-shell-test-pty.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/expect -f

set dev [lindex $argv 0]

send_user ">>>>>>>>>>>>>> starting expect for $dev <<<<<<<<<<<<<<<<<<\n"

set stty_init raw

set timeout 120

spawn bash -c "source /etc/profile.d/remotehw*; remotehw-$dev-power-on; remotehw-$dev-get-console"
send_user ">>>>>>>>>>>>>> remotehw called <<<<<<<<<<<<<<<<<<\n"

expect "Shell>" { send "exit\r" }

exit
7 changes: 7 additions & 0 deletions src/remotehw/opt/grub.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
set timeout=3
set default=0

menuentry "user-provided zephyr.elf" {
multiboot /zephyr.elf
}

45 changes: 45 additions & 0 deletions src/remotehw/opt/remotehw-x86-acrn.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

# remotehw-x86-acrn - zephyr sanitycheck interface for remoteHW infrastructure
#

HELP="/opt/remotehw-x86-acrn.sh <zephyr build path> <remotehw-system>"

printf "\nremotehw-x86-acrn ($REMOTEHW_VER) [$1,$2]\n"

if [ -z "$1" ]; then
echo "Missing parameters. Abort."
echo "$HELP"
exit 1
fi

if [ ! -d "$1" ]; then
echo "remotehw-x86-acrn: $1 is not a directory or is inaccessible. Abort."
echo "$HELP"
exit 1
fi

# attempt to find a zephyr.efi under the provided search path... HACK/todo/help!
# Since ACRN v2.6 we are using zephyr.elf instead of zephyr.bin as zephyr image.
ZBIN=$(find "$1" -name zephyr.elf)

if [ ! -f "$ZBIN" ]; then
echo "remotehw-x86-acrn: Unable to locate zephyr.bin under provided search path ($1). Abort."
echo "$HELP"
exit 1
fi
echo "remotehw-x86-acrn: found zephyr.elf ($ZBIN)"

# source remotehw definitions on this system
. /etc/profile.d/remotehw*

echo "remotehw-x86-acrn: starting ACRN boot via emulated USB provided by remotehw"
echo "-------------------------------------------------------------------------"
# reset, power-off & transfer binary to USB disk emulator
"remotehw-$2-reset"
"remotehw-$2-power-off"
"remotehw-$2-usb-acrn" "$ZBIN"
"remotehw-$2-power-on"
echo "-------------------------------------------------------------------------"
printf "remotehw-x86-acrn: completed remotehw ACRN boot. System is powered-on.\n\n"
exit 0
45 changes: 45 additions & 0 deletions src/remotehw/opt/remotehw-x86-efi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

# remotehw-x86-efi - zephyr sanitycheck interface for remoteHW infrastructure
#

HELP="/opt/remotehw-x86-efi.sh <zephyr build path> <remotehw-system>"

printf "\nremotehw-x86-efi ($REMOTEHW_VER) [$1,$2]\n"

if [ -z "$1" ]; then
echo "Missing parameters. Abort."
echo "$HELP"
exit 1
fi

if [ ! -d "$1" ]; then
echo "remotehw-x86-efi: $1 is not a directory or is inaccessible. Abort."
echo "$HELP"
exit 1
fi

# attempt to find a zephyr.efi under the provided search path... HACK/todo/help!
ZEFI=$(find "$1" -name zephyr.efi)

if [ ! -f "$ZEFI" ]; then
echo "remotehw-x86-efi: Unable to locate zephyr.efi under provided search path ($1). Abort."
echo "$HELP"
exit 1
fi
echo "remotehw-x86-efi: found zephyr.efi ($ZEFI)"

# source remotehw definitions on this system
. /etc/profile.d/remotehw*

echo "remotehw-x86-efi: starting EFI boot via emulated USB provided by remotehw"
echo "-------------------------------------------------------------------------"
# reserve, power-off & transfer binary to USB disk emulator
"remotehw-$2-reserve"
"remotehw-$2-power-off"
"remotehw-$2-usb-efi" "$ZEFI"
# power-on system
"remotehw-$2-power-on"
echo "-------------------------------------------------------------------------"
printf "remotehw-x86-efi: completed remotehw EFI boot. Exit.\n\n"
exit 0
36 changes: 36 additions & 0 deletions src/remotehw/opt/remotehw-x86-elf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# remotehw-x86-elf - zephyr sanitycheck interface for remoteHW infrastrcture
#
#
# usage: /opt/remotehw-x86-elf.sh <remotehw-system> <zephyr.elf>

echo "remotehw-x86-elf: Called with param1=$1 and param2=$2"

if [ -z "$1" ]; then
echo "Missing parameters. Abort."
echo " Usage: remotehw-x86-elf <remotehw-system> <zephyr.elf>."
exit 1;
fi

if [ ! -f "$2" ]; then
echo "remotehw-x86-elf: Input file not found or inaccessible. Abort."
echo " Usage: remotehw-x86-elf <remotehw-system> <zephyr.elf>."
exit 1;
fi

# source remotehw definitions on this system
. /etc/profile.d/remotehw*

# reserve, power-off & transfer binary to USB disk emulator
"remotehw-$1-reserve"
"remotehw-$1-power-off"
"remotehw-$1-usb-grub" "$2"

# power-on system
"remotehw-$1-power-on"

echo "remotehw-x86-elf: RemoteHW target $1 powered-on with $2 as USB grub multiboot payload."
echo "remotehw-x86-elf: Exit."


54 changes: 54 additions & 0 deletions src/remotehw/opt/sample-twister-ehl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash

# remotehw-ehl-example.sh
# Run twister on zephyr-intel with device-testing via remoteHW API
# -> clones from innersource/os.rtos.zephyr.zephyr-intel via SSH

# select target remotehw system
REMOTEHW_SYSTEM=ehlsku7

# sets build location
WRKSPC=./zephyrproject-remotehw

# use our remoteHW API for flash command
WEST_FLASH_CMD="/opt/remotehw/remotehw-x86-efi.sh"

# set SDK
export ZEPHYR_SDK_INSTALL_DIR=/opt/toolchains/zephyr-sdk-0.13.2
export ZEPHYR_TOOLCHAIN_VARIANT=zephyr

# Step 1: Create os.rtos.zephyr.zephyr-intel workspace if it doesn't exist
if [ ! -d "$WRKSPC" ]; then
echo "Creating a new zephyr remotehw workspace at $WRKSPC"

# install west & update PATH
pip3 install --user west
source ~/.profile # update PATH for new west install

# init zephyr repo from our internal tree
west init -m [email protected]:intel-innersource/os.rtos.zephyr.zephyr-intel.git $WRKSPC
if [ ! -d "$WRKSPC" ]; then
echo "Could not create workspace at $WRKSPC. Aborting."
exit
fi
cd $WRKSPC

# swap innersource http urls to ssh in west.yml
sed -i 's#https://github.com/intel-innersource#[email protected]:intel-innersource#g' zephyr-intel/west.yml

west update

# get python deps
pip3 install --user -r zephyr/scripts/requirements.txt

cd -
fi
cd $WRKSPC

# Step 2: Run Twister using remoteHW API

source zephyr/zephyr-env.sh

./zephyr/scripts/twister -v -A zephyr-intel/boards/ -p ehl_crb \
--device-testing --device-serial="$(remotehw-$REMOTEHW_SYSTEM-get-tty)" \
--west-flash="$WEST_FLASH_CMD,$REMOTEHW_SYSTEM" $TWISTER_OPTS
Binary file added src/remotehw/opt/sbl.disk.gz
Binary file not shown.
Loading

0 comments on commit 6eb7640

Please sign in to comment.