-
Notifications
You must be signed in to change notification settings - Fork 65
/
mkupdate
executable file
·43 lines (30 loc) · 932 Bytes
/
mkupdate
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
39
40
41
42
43
#!/bin/sh
# Copyright (C) 2014 NEO-Technologies
# Author: Julien Chauveau <[email protected]>
PROG=$(basename $0)
if [ $# != 1 ] || [ ! -d $1 ]; then
echo "Usage: $PROG <directory>"
exit 1
fi
ROOT=$(cd $1; pwd)
if [ ! -f "$ROOT/package-file" ]; then
echo "Error: package-file not found!"
exit 1
fi
PARAM=`grep parameter $ROOT/package-file | cut -f2 | tr -d "\r\n"`
if [ ! -f "$ROOT/$PARAM" ]; then
echo "Error: parameter not found!"
exit 1
fi
LOADER=`grep bootloader $ROOT/package-file | cut -f2 | tr -d "\r\n"`
if [ ! -f "$ROOT/$LOADER" ]; then
echo "Error: bootloader not found!"
exit 1
fi
FIRMWARE=`grep FIRMWARE_VER $ROOT/$PARAM | cut -f2 -d: | tr -d "\r\n"`
DATE=`date +%Y%m%d`
echo "\n***** Creating $ROOT-$DATE-update.img (version: $FIRMWARE) *****\n"
TEMP=$(tempfile)
afptool -pack "$ROOT" $TEMP
img_maker -rk31 "$ROOT/$LOADER" 1 0 0 $TEMP "$ROOT-$DATE-update.img"
rm -f $TEMP