-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_build.sh
executable file
·104 lines (92 loc) · 2.23 KB
/
setup_build.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
95
96
97
98
99
100
101
102
103
104
#!/usr/bin/env bash
#Build Arduino Yun Image for Dragino2. MS14, HE.
SFLAG=
AFLAG=
BFLAG=
APP="Chronos"
BUILD_TIME=`date +%s`
# Architecture specific variables
REPO_PATH=$(pwd)
VERSION="12.04"
NUTTX_PATH="nuttx"
ARCH="xtensa"
CHIP="esp32s3"
BOARD="esp32s3-devkit"
#Modules specific variables
MODULES_NAME="CustomApps"
MODULES_PATH="CustomApps"
APP_PATH="apps"
while getopts 'a:bih' OPTION
do
case $OPTION in
a)
AFLAG=1
APP="$OPTARG"
;;
b)
BFLAG=1
;;
i)
IFLAG=1
;;
h|?) printf "Setup Image for ChronOS\n\n"
printf "Usage: %s [-a <board>] \n" $(basename $0) >&2
printf " -a: Configuration\n"
printf "\n"
exit 1
;;
esac
done
shift $(($OPTIND - 1))
BUILD_TIME="`date`"
if [ ! -z $BFLAG ];then
echo "Copy Modules folder to APP folder"
# Check if the source directory exists
if [ ! -d "$MODULES_PATH" ]; then
echo "Source directory does not exist: $MODULES_PATH"
exit 1
fi
# Check if the destination directory exists, create it if not
if [ ! -d "$APP_PATH" ]; then
echo "Destination directory does not exist: $APP_PATH"
exit 1
fi
#Copy Modules folder to APP folder
rm -rf ./$APP_PATH/$MODULES_NAME
ln -sr ./$MODULES_PATH ./$APP_PATH/
echo "Symbolic links creation completed."
fi
echo ""
if [ ! -z $AFLAG ];then
if [ -f config/$APP/defconfig ];then
echo ""
echo "Found customized .config files"
else
echo ""
echo "***Can't find config/$APP/defconfig file exiting***"
exit
fi
if [[ "$APP" == sim* ]]; then
echo "Simulation configuration detected"
ARCH="sim"
CHIP="sim"
BOARD="sim"
fi
echo "Creates symbolic to archo board"
echo "First erease old symbolic link"
rm -rf ./$NUTTX_PATH/boards/$ARCH/$CHIP/$BOARD/configs/$APP
ln -sr ./config/$APP ./$NUTTX_PATH/boards/$ARCH/$CHIP/$BOARD/configs/
echo "Running config script"
cd $NUTTX_PATH
make clean
make distclean
./tools/configure.sh -l $BOARD:$APP
if [ ! -z $IFLAG ];then
echo "Copy Init Script to APP folder"
rm -rf ./$NUTTX_PATH/boards/$ARCH/$CHIP/$BOARD/include/rcS.template
cp ./config/apolo/scripts/rcS.template ./$NUTTX_PATH/boards/$ARCH/$CHIP/$BOARD/include/rcS.template
cd ./$NUTTX_PATH/boards/$ARCH/$CHIP/$BOARD/include
../../../../../tools/mkromfsimg.sh -nofat ../../../../.. rcS.template
cd ../../../../../../
fi
fi