blob: 640628eecb7af19b487945c52218bd2c3682b2d1 [file] [log] [blame]
Lukasz Majewski98ffe742014-06-18 11:38:56 +02001#! /bin/bash
Stephen Warrenb1c384c2014-06-10 16:28:10 -06002
Lukasz Majewski458934e2014-08-18 12:12:27 +02003# Copyright (C) 2014 Samsung Electronics
4# Lukasz Majewski <l.majewski@samsung.com>
5#
6# Script fixes, enhancements and testing:
7# Stephen Warren <swarren@nvidia.com>
8#
9# Script for test files generation
10#
11# SPDX-License-Identifier: GPL-2.0+
12
Lukasz Majewski98ffe742014-06-18 11:38:56 +020013set -e # any command return if not equal to zero
14clear
15
16COLOUR_RED="\33[31m"
17COLOUR_GREEN="\33[32m"
18COLOUR_DEFAULT="\33[0m"
19
20LOG_DIR="./log"
Lukasz Majewski98ffe742014-06-18 11:38:56 +020021
Lukasz Majewskib1e8cc42014-08-18 12:12:26 +020022if [ $# -eq 0 ]; then
23 TEST_FILES_SIZES="63 64 65 127 128 129 4095 4096 4097 959 960 961 1048575 1048576 8M"
24else
25 TEST_FILES_SIZES=$@
26fi
Lukasz Majewski98ffe742014-06-18 11:38:56 +020027
28printf "Init script for generating data necessary for DFU test script"
29
30if [ ! -d $LOG_DIR ]; then
31 `mkdir $LOG_DIR`
32fi
33
Lukasz Majewski98ffe742014-06-18 11:38:56 +020034for size in $TEST_FILES_SIZES
35do
36 FILE="./dat_$size.img"
37 if [ ! -f $FILE ]; then
38 dd if=/dev/urandom of="./dat_$size.img" bs=$size count=1 > /dev/null 2>&1 || exit $?
39 fi
40done
Stephen Warrenb1c384c2014-06-10 16:28:10 -060041dd if=/dev/urandom of="./dfudummy.bin" bs=1024 count=1 > /dev/null 2>&1 || exit $?
Lukasz Majewski98ffe742014-06-18 11:38:56 +020042
43printf "$COLOUR_GREEN OK $COLOUR_DEFAULT \n"
44
45exit 0