1 #!/bin/bash 2 3 # 4 # Copyright (C) 2016 The Android Open Source Project 5 # 6 # Licensed under the Apache License, Version 2.0 (the "License"); 7 # you may not use this file except in compliance with the License. 8 # You may obtain a copy of the License at 9 # 10 # http://www.apache.org/licenses/LICENSE-2.0 11 # 12 # Unless required by applicable law or agreed to in writing, software 13 # distributed under the License is distributed on an "AS IS" BASIS, 14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 # See the License for the specific language governing permissions and 16 # limitations under the License. 17 # 18 19 # Exit in error if we use an undefined variable (i.e. commit a typo). 20 set -u 21 22 usage () { #show usage and bail out 23 echo "USAGE:" >&2 24 echo " $1 <PRIV_KEY_FILE> <PUB_KEY_FILE> nanohub.update.bin" >&2 25 exit 1 26 } 27 28 if [ $# != 3 ] ; then 29 usage $0 30 fi 31 32 priv=$1 33 pub=$2 34 raw_image=$3 35 36 # make signed image with header; suitable for BL 37 # to be consumed by BL it has to be named nanohub.kernel.signed 38 nanoapp_postprocess -n os -r ${raw_image} ${raw_image}.oshdr 39 nanoapp_sign -s -e ${priv} -m ${pub} -r ${raw_image}.oshdr nanohub.kernel.signed 40 41 # embed this image inside nanoapp container 42 43 nanoapp_postprocess -n os nanohub.kernel.signed ${raw_image}.napp 44