forked from starfive-tech/meta-starfive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
300 lines (271 loc) · 9.21 KB
/
setup.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
#!/bin/bash
# Bootstrapper for buildbot slave
DIR="build"
MACHINE="starfive-dubhe"
CONFFILE="conf/auto.conf"
BITBAKEIMAGE="virtual/kernel"
# clean up the output dir
#echo "Cleaning build dir"
#rm -rf $DIR
# make sure sstate is there
#echo "Creating sstate directory"
#mkdir -p ~/sstate/$MACHINE
# fix permissions set by buildbot
#echo "Fixing permissions for buildbot"
#umask -S u=rwx,g=rx,o=rx
#chmod -R 755 .
# Reconfigure dash on debian-like systems
which aptitude > /dev/null 2>&1
ret=$?
if [ "$(readlink /bin/sh)" = "dash" -a "$ret" = "0" ]; then
sudo aptitude install expect -y
expect -c 'spawn sudo dpkg-reconfigure -freadline dash; send "n\n"; interact;'
elif [ "${0##*/}" = "dash" ]; then
echo "dash as default shell is not supported"
return
fi
# bootstrap OE
if [[ ":$PATH:" != *":$PWD/meta-starfive:"* ]]; then
export PATH=$PATH:$PWD/meta-starfive
fi
echo "Init OE"
export BASH_SOURCE="poky/oe-init-build-env"
source poky/oe-init-build-env
# Symlink the cache
#echo "Setup symlink for sstate"
#ln -s ~/sstate/${MACHINE} sstate-cache
# add the missing layers
echo "Adding layers"
bitbake-layers add-layer ../meta-openembedded/meta-oe
bitbake-layers add-layer ../meta-openembedded/meta-python
bitbake-layers add-layer ../meta-openembedded/meta-multimedia
bitbake-layers add-layer ../meta-openembedded/meta-filesystems
bitbake-layers add-layer ../meta-openembedded/meta-networking
bitbake-layers add-layer ../meta-openembedded/meta-gnome
bitbake-layers add-layer ../meta-openembedded/meta-xfce
bitbake-layers add-layer ../meta-openembedded/meta-webserver
bitbake-layers add-layer ../meta-starfive
bitbake-layers add-layer ../meta-clang
# fix the configuration
echo "Creating auto.conf"
if [ -e $CONFFILE ]; then
rm -rf $CONFFILE
fi
cat <<EOF > $CONFFILE
MACHINE ?= "${MACHINE}"
#IMAGE_FEATURES += "tools-debug"
#IMAGE_FEATURES += "tools-tweaks"
#IMAGE_FEATURES += "dbg-pkgs"
# rootfs for debugging
#IMAGE_GEN_DEBUGFS = "1"
#IMAGE_FSTYPES_DEBUGFS = "tar.gz"
#EXTRA_IMAGE_FEATURES:append = " ssh-server-dropbear"
EXTRA_IMAGE_FEATURES:append = " package-management"
PACKAGECONFIG:append:pn-qemu-native = " sdl"
PACKAGECONFIG:append:pn-nativesdk-qemu = " sdl"
USER_CLASSES ?= "buildstats buildhistory buildstats-summary"
INHERIT += "uninative"
DISTRO_FEATURES:append = " largefile opengl ptest multiarch wayland pam systemd "
#DISTRO_FEATURES:append = " largefile opengl ptest multiarch wayland pam "
DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"
VIRTUAL-RUNTIME_init_manager = "systemd"
##VIRTUAL-RUNTIME_initscripts = ""
##VIRTUAL-RUNTIME_syslog = ""
HOSTTOOLS_NONFATAL:append = " ssh"
DISTRO_NAME = "StarFive Linux SDK"
#DISTRO_VERSION = ""
#DISTRO_CODENAME = ""
EOF
echo "---------------------------------------------------"
echo "Example: MACHINE=${MACHINE} bitbake ${BITBAKEIMAGE}"
echo "---------------------------------------------------"
echo ""
echo "Buildable machine info"
echo "---------------------------------------------------"
echo "* qemuriscv64 : The 64-bit RISC-V machine"
echo "* starfive-dubhe : The StarFive Dubhe machine"
echo "---------------------------------------------------"
# start build
#echo "Starting build"
#bitbake $BITBAKEIMAGE
# Launch build script
# Terminal Style
PURPLE='\E[1;35m'
YELLOW='\E[1;33m'
GREEN='\E[0;32m'
RED='\E[0;31m'
NC='\E[0m'
MARK="\033[0;32m\xE2\x9C\x94\033[0m"
#Function
runprog(){
read -p "Do you want to runqemu?[Y/n]:" RES
case $RES in
[Yy])
MACHINE=starfive-dubhe runqemu nographic $1;;
[Nn])
return;;
*)
echo "Invalid option $RES , [Y/n] only.";;
esac
}
dubhe(){
# Menu script
echo ""
echo -e "${PURPLE}*******************************************************************"
echo "* *"
echo "* StarFive Dubhe Build Menu *"
echo "* *"
echo -e "*******************************************************************${NC}"
echo "";
echo -e "${YELLOW}Description : ";
echo "";
echo "This build script can build three types of image.";
echo "";
echo "1) core-image-minimal";
echo " - QSPI boot firmware with that boots image via TFTP and NFS";
echo " - Generated output : ";
echo " starfive-dubhe-qspi-firmware.bin";
echo " Image";
echo " Image-initramfs-starfive-dubhe.bin";
echo " Image-nfs-starfive-dubhe.tar.gz";
echo " Image-sd-starfive-dubhe.img";
echo -e " dubhe_fpga.dtb${NC}";
echo "";
PS3="Select your action : "
options=("Build core-image-minimal" "Quit")
select opt in "${options[@]}"
do
case $opt in
"Build core-image-minimal")
cur_ter=$(tty);
output=$(MACHINE=starfive-dubhe bitbake core-image-minimal | tee $cur_ter);
if [[ $output != *"ERROR"* ]]; then
echo -e "\U0002705 ${GREEN}Build Complete${NC}"
else echo -e "\U000274C ${RED}Build Failed${NC}"
fi;;
"Quit")
break;;
*)
echo "Invalid option $REPLY. Kindly select choice between menu range."
esac
REPLY=
done
}
vf2(){
# Menu script
echo ""
echo -e "${PURPLE}*******************************************************************"
echo "* *"
echo "* StarFive Visionfive2 Build Menu *"
echo "* *"
echo -e "*******************************************************************${NC}"
echo "";
echo -e "${YELLOW}Description : ";
echo "";
echo "This build script can build two types of image.";
echo "";
echo "1) core-image-minimal";
echo " - Minimal image with ext4 support.";
echo " - Generated output : ";
echo " starfive-visionfive2-core-image-minimal.img";
echo "2) core-image-minimal-xfce";
echo " - Minimal image with XFCE desktop environment.";
echo " - Generated output : ";
echo " starfive-visionfive2-core-image-minimal-xfce.img";
echo -e "3) Quit${NC}";
echo "";
PS3="Select your action : "
options=("Build core-image-minimal" "Build core-image-minimal-xfce" "Quit")
select opt in "${options[@]}"
do
case $opt in
"Build core-image-minimal")
cur_ter=$(tty);
output_min=$(MACHINE=starfive-visionfive2 bitbake core-image-minimal | tee $cur_ter);
if [[ $output_min != *"ERROR"* ]]; then
echo -e "\U0002705 ${GREEN}Build Complete${NC}"
else echo -e "\U000274C ${RED}Build Failed${NC}"
fi;;
"Build core-image-minimal-xfce")
cur_ter=$(tty);
output_min=$(MACHINE=starfive-visionfive2 bitbake core-image-minimal-xfce | tee $cur_ter);
if [[ $output_min != *"ERROR"* ]]; then
echo -e "\U0002705 ${GREEN}Build Complete${NC}"
else echo -e "\U000274C ${RED}Build Failed${NC}"
fi;;
"Quit")
break;;
*)
echo "Invalid option $REPLY. Kindly select choice between menu range."
esac
REPLY=
done
}
jh8100(){
# Menu script
echo ""
echo -e "${PURPLE}*******************************************************************"
echo "* *"
echo "* StarFive JH8100 Build Menu *"
echo "* *"
echo -e "*******************************************************************${NC}"
echo "";
echo -e "${YELLOW}Description : ";
echo "";
echo "This build script can build two types of image.";
echo "";
echo "1) core-image-minimal";
echo " - Minimal image with ext4 support.";
echo " - Generated output : ";
echo " starfive-jh8100-core-image-minimal.img";
echo -e "2) Quit${NC}";
echo "";
PS3="Select your action : "
options=("Build core-image-minimal" "Quit")
select opt in "${options[@]}"
do
case $opt in
"Build core-image-minimal")
cur_ter=$(tty);
output_min=$(MACHINE=starfive-jh8100 bitbake core-image-minimal | tee $cur_ter);
if [[ $output_min != *"ERROR"* ]]; then
echo -e "\U0002705 ${GREEN}Build Complete${NC}"
else echo -e "\U000274C ${RED}Build Failed${NC}"
fi;;
"Quit")
break;;
*)
echo "Invalid option $REPLY. Kindly select choice between menu range."
esac
REPLY=
done
}
# Menu script
echo ""
echo -e "${PURPLE}*******************************************************************"
echo "* *"
echo "* Welcome to StarFive Yocto *"
echo "* *"
echo -e "*******************************************************************${NC}"
echo "";
echo -e "${YELLOW}List below shows machine supported : ";
echo "1) StarFive Dubhe";
echo "2) StarFive JH8100";
echo -e "3) Quit${NC}";
echo "";
PS3="Select machine : "
options=("StarFive Dubhe" "StarFive JH8100" "Quit")
select opt in "${options[@]}"
do
case $opt in
"StarFive Dubhe")
dubhe;;
"StarFive JH8100")
jh8100;;
"Quit")
break;;
*)
echo "Invalid option $REPLY. Kindly select choice between menu range."
esac
REPLY=
done