summaryrefslogtreecommitdiff
path: root/board/kukui_scp/update_scp
blob: 448a8f74db5b59646e1a2159f6c7b0d7329eb453 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
# Copyright 2022 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

usage() {
  echo "Usage: $0 [kukui_scp/corsola_scp] [IP] [bin/elf]" >&2
  echo >&2
  echo "Deploy kukui_scp/corsola_scp image to DUT, and restart the remoteproc driver" >&2
  exit 2
}

if [[ -z "$1" ]]; then
   usage
fi

if [ "$1" = "kukui_scp" ] || [ "$1" = "corsola_scp" ]; then
   BOARD="$1"
else
   usage
fi

DUT_IP="$2"
INFILE="build/$BOARD/ec.bin"

case "$3" in
bin)
  ;;
elf|"") # Default
  # ec.obj is an elf file that has the right memory layout to be loaded
  # from the AP/kernel.
  INFILE="build/$BOARD/ec.obj"
  ;;
*)
  usage
  ;;
esac

scp "$INFILE" "$DUT_IP":/lib/firmware/scp.img

ssh "$DUT_IP" sh -x -c "'
    sync;
    echo stop > /sys/class/remoteproc/remoteproc0/state;
    echo start > /sys/class/remoteproc/remoteproc0/state'"