-
Notifications
You must be signed in to change notification settings - Fork 7
/
buildAndShip.bootloader.sh
executable file
·94 lines (75 loc) · 2.38 KB
/
buildAndShip.bootloader.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
87
88
89
90
91
92
93
94
#!/bin/bash
set -e
#Change into script directory
cd $(cd -P -- "$(dirname -- "$0")" && pwd -P)
#Change to repository root
cd ..
ROOT=$PWD
source ${ROOT}/common/make/sdkPath
source ${ROOT}/common/make/armGccPath
export PATH="${ARMGCC_BIN}:$PATH"
if [ "$1" == "debug" ]; then
DEBUG_APPENDIX_RELOC=Debug
DEBUG_APPENDIX=Log
DEBUG_APPENDIX_ZIP=_debug
DEBUG_PATH_APPENDIX=debug/
else
DEBUG_APPENDIX=""
DEBUG_APPENDIX_ZIP=""
DEBUG_PATH_APPENDIX="build/"
fi
OUT_DIR=${ROOT}/exe/sd-bootloader-ng
OUT_FILE=${ROOT}/exe/sd-bootloader-ng${DEBUG_APPENDIX_ZIP}.zip
DRIVELIB_DIR=${SDKROOT}/driverlib/gcc
SIMPLELINK_DIR=${SDKROOT}/simplelink/gcc
RELOC_DIR=${ROOT}/sd-bootloader-ng/relocator
BOOTMGR_DIR=${ROOT}/sd-bootloader-ng/bootmanager
BOOTMGR_SRC_BIN=${BOOTMGR_DIR}/exe/${DEBUG_PATH_APPENDIX}/bootloader/bootmgr.relocator.bin
BOOTMGR_SRC_SD=${BOOTMGR_DIR}/sd/revvox/boot
PRELOAD_SRC_BIN=${BOOTMGR_DIR}/exe/${DEBUG_PATH_APPENDIX}/preloader/bootmgr.relocator.bin
PRELOAD_DES_DIR=${OUT_DIR}/flash/sys
BOOTMGR_DES_DIR=${OUT_DIR}/sd/revvox/boot
PRELOAD_DES_BIN=${PRELOAD_DES_DIR}/mcuimg.bin
BOOTMGR_DES_BIN=${BOOTMGR_DES_DIR}/ngbootloader.bin
if [ -d "$RELOC_DIR" ] && [ -d "$BOOTMGR_DIR" ]; then
echo Clean output directory
rm -f ${OUT_FILE}
rm -rf ${OUT_DIR}
echo
echo Create output directory
mkdir -p ${OUT_DIR}
mkdir -p ${PRELOAD_DES_DIR}
mkdir -p ${BOOTMGR_DES_DIR}/patch
echo
echo Build driverlib
cd ${DRIVELIB_DIR}
make -f ${ROOT}/common/make/MakefileDriverlib clean all
echo
echo Build libsimplelink_nonos_opt
cd ${SIMPLELINK_DIR}
make -f ${ROOT}/common/make/MakefileSimplelink_opt target=NONOS clean all
echo
echo Build relocator
cd ${RELOC_DIR}
make -f Makefile${DEBUG_APPENDIX_RELOC} clean all
echo
echo Build Preloader
cd ${BOOTMGR_DIR}
make -f Makefile${DEBUG_APPENDIX}Preloader clean all
cp ${PRELOAD_SRC_BIN} ${PRELOAD_DES_BIN}
echo
echo Build Bootmanager
cd ${BOOTMGR_DIR}
make -f Makefile${DEBUG_APPENDIX} clean all
cp ${BOOTMGR_SRC_BIN} ${BOOTMGR_DES_BIN}
echo
echo Copy additional files
cp ${BOOTMGR_SRC_SD}/ngCfg.json ${BOOTMGR_DES_DIR}/ngCfg.json
cp ${BOOTMGR_SRC_SD}/patch/* ${BOOTMGR_DES_DIR}/patch/
cd ${OUT_DIR}
zip -r ${OUT_FILE} *
else
echo Wrong directory, missing subdirectories...
echo ROOT=${ROOT}
exit 1
fi