#!/bin/sh # Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Script used to flash, prepare and configure Minnowboard MAX. # Compatibile with both (32-bit and 64-bit) versions. # Configuration file in $TL_IP_CONF is required; format is: # # It leaves CONNECT_CNT in sysctl.result to be later used by minnow_run.sh # # Synatx is: minnow_prepare_conf_flash.sh $SDMUX $IMAGE # # Author: Aleksander Mistewicz export TESTLAB_SCRIPTS="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)" . "${TESTLAB_SCRIPTS}/common.sh" . "${TESTLAB_SCRIPTS}/flash/flash.sh" . "${TESTLAB_SCRIPTS}/conf/conf.sh" SDMUX="$1" IMAGE="$2" test -n "${SDMUX}" || die "Missing argument: sdmux!" test -n "${IMAGE}" || die "Missing argument: image!" test -f "${IMAGE}" || die "Image file does not exist or is not a regular file: ${IMAGE}!" IP="$(get_ip "${SDMUX}")" || die "Error: get_ip failed!" echo "### prepare ###" switch2testserver "${SDMUX}" echo "### flash ###" UUID_FILE="/var/tmp/uuid-${SDMUX}" DEV_SDCARD=$(uuid2dev "${UUID_FILE}" "${SDMUX}") || die "sdcard not found!" echo "Bmaptool: start" test -b "${DEV_SDCARD}" || die "File does not exist or is not block special" sudo timeout "${BMAP_TIME_LIMIT}" bmaptool -q copy "${IMAGE}" "${DEV_SDCARD}" RET=$? echo "Bmaptool: finish" # wait a little for OS to notice the change and partitions to appear sleep "${INIT_SLEEP}" change_uuid "${UUID_FILE}" "${DEV_SDCARD}" if [ $RET -ne 0 ]; then die "Bmaptool exited with an error" "$RET" fi switch2device "${SDMUX}" restart_device "${SDMUX}" echo "### conf ###" CONNECT_CNT="$(wait_ssh "${SDMUX}")" printf "\n" echo "CONNECT_CNT $CONNECT_CNT" > sysctl.result