summaryrefslogtreecommitdiff
path: root/board/kukui_scp/update_scp
blob: 846095a7f9de4be4a5398e456521d6f732db5bca (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
#!/bin/bash
# Copyright 2019 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 [IP] [bin/elf]" >&2
  echo >&2
  echo "Deploy kukui_scp image to DUT, and restart the remoteproc driver" >&2
  exit 2
}

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

KUKUI_IP="$1"
INFILE="build/kukui_scp/ec.bin"

case "$2" 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/kukui_scp/ec.obj"
  ;;
*)
  usage
  ;;
esac

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

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