-
Notifications
You must be signed in to change notification settings - Fork 2
/
gen_pack.sh
86 lines (73 loc) · 1.81 KB
/
gen_pack.sh
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
# Version: 1.0
# Date: 2019-02-15
# This bash script generates a CMSIS Software Pack:
#
# Requirements:
# bash shell
# curl
# zip (zip archiving utility)
#
# Pack Vendor
PACK_VENDOR=MDK-Packs
# Pack Name
PACK_NAME=QCA400x_Host_Driver_SDK
# Pack Destination Folder
PACK_DESTINATION=./
# Pack Build Folder
PACK_BUILD=./build
# Pack build utilities Repository
UTILITIES_URL=https://github.com/ARM-software/CMSIS_5/blob/master/
UTILITIES_TAG=1.0.0
UTILITIES_DIR=./Utilities
UTILITIES_OS=Win32
if [ $UTILITIES_OS = "Win32" ]; then
ZIP="/c/Program\ Files/7-Zip/7z.exe"
else
ZIP=zip
fi
# if not present, fetch utilities
if [ ! -d $UTILITIES_DIR ]; then
mkdir $UTILITIES_DIR
pushd $UTILITIES_DIR
mkdir $UTILITIES_OS
# PackChk
curl -L $UTILITIES_URL/CMSIS/Utilities/$UTILITIES_OS/PackChk.exe?raw=true -o $UTILITIES_OS/PackChk.exe
popd
fi
#if $PACK_BUILD folder does not exist create it
if [ ! -d $PACK_BUILD ]; then
mkdir $PACK_BUILD
fi
# Copy file into $PACK_BUILD
cp -f ./$PACK_VENDOR.$PACK_NAME.pdsc $PACK_BUILD/
cp -f ./license_terms.txt $PACK_BUILD/
cp -f ./License.txt $PACK_BUILD/
cp -f ./License_Choice.txt $PACK_BUILD/
cp -vr ./atheros_wifi $PACK_BUILD/
cp -vr ./phy $PACK_BUILD/
cp -vr ./port $PACK_BUILD/
# Run Pack Check and generate PackName file
$UTILITIES_DIR/$UTILITIES_OS/PackChk.exe $PACK_BUILD/$PACK_VENDOR.$PACK_NAME.pdsc -n PackName.txt
errorlevel=$?
if [ $errorlevel -ne 0 ]; then
echo "build aborted: pack check failed"
exit
fi
PACKNAME=`cat PackName.txt`
rm -rf PackName.txt
# Archiving
# $ZIP a $PACKNAME
pushd $PACK_BUILD
/c/Program\ Files/7-Zip/7z.exe a ../$PACKNAME -tzip
popd
errorlevel=$?
if [ $errorlevel -ne 0 ]; then
echo "build aborted: archiving failed"
exit
fi
echo "build of pack succeeded"
# Clean up
echo "cleaning up"
rm -rf $PACK_BUILD
rm -rf $UTILITIES_DIR