blob: 2163a685a55df9fe817e1f153633852a9e0e7ce7 [file] [log] [blame]
Lukasz Majewskia4c86bb2014-06-18 11:38:56 +02001#! /bin/bash
Stephen Warren7ad67e52014-06-10 16:28:10 -06002
Lukasz Majewskia4c86bb2014-06-18 11:38:56 +02003set -e # any command return if not equal to zero
4clear
5
6COLOUR_RED="\33[31m"
7COLOUR_GREEN="\33[32m"
8COLOUR_DEFAULT="\33[0m"
9
10LOG_DIR="./log"
Lukasz Majewskia4c86bb2014-06-18 11:38:56 +020011
Stephen Warren54ce79c2014-07-01 12:16:56 -060012TEST_FILES_SIZES="63 64 65 127 128 129 4095 4096 4097 959 960 961 1048575 1048576 8M"
Lukasz Majewskia4c86bb2014-06-18 11:38:56 +020013
14printf "Init script for generating data necessary for DFU test script"
15
16if [ ! -d $LOG_DIR ]; then
17 `mkdir $LOG_DIR`
18fi
19
Lukasz Majewskia4c86bb2014-06-18 11:38:56 +020020for size in $TEST_FILES_SIZES
21do
22 FILE="./dat_$size.img"
23 if [ ! -f $FILE ]; then
24 dd if=/dev/urandom of="./dat_$size.img" bs=$size count=1 > /dev/null 2>&1 || exit $?
25 fi
26done
Stephen Warren7ad67e52014-06-10 16:28:10 -060027dd if=/dev/urandom of="./dfudummy.bin" bs=1024 count=1 > /dev/null 2>&1 || exit $?
Lukasz Majewskia4c86bb2014-06-18 11:38:56 +020028
29printf "$COLOUR_GREEN OK $COLOUR_DEFAULT \n"
30
31exit 0