2
2
set -eu
3
3
. " $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) /common"
4
4
set -- ${cli_build:- } " $@ "
5
- mkdir -p " ${out_dir } "
6
- br2_cli_file=" ${out_dir } /br2_cli"
5
+ mkdir -p " ${common_out_dir } "
6
+ br2_cli_file=" ${common_out_dir } /br2_cli"
7
7
rm -f " $br2_cli_file "
8
8
touch " $br2_cli_file "
9
- kernel_config_fragment_cli_file=" ${out_dir } /kernel_config_fragment_cli"
9
+ kernel_config_fragment_cli_file=" ${common_out_dir } /kernel_config_fragment_cli"
10
10
kernel_config_fragment_cli_file_tmp=" ${kernel_config_fragment_cli_file} _tmp"
11
11
rm -f " $kernel_config_fragment_cli_file_tmp "
12
12
touch " $kernel_config_fragment_cli_file_tmp "
13
13
configure=true
14
- config_fragments=" ${root_dir } /br2/default"
14
+ config_fragments=" ${common_root_dir } /br2/default"
15
15
extra_make_args=
16
16
j=" $( nproc) "
17
17
linux_reconfigure=false
18
18
linux_kernel_custom_config_file=
19
19
kernel_config_fragments=
20
20
post_script_args=
21
21
qemu_sdl=' --enable-sdl --with-sdlabi=2.0'
22
- suffix=
23
22
v=0
24
23
while getopts ' a:B:b:C:c:fGgj:hIiK:kL:lM:p:Q:qSst::v' OPT; do
25
24
case " $OPT " in
26
25
a)
27
- arch =" $OPTARG "
26
+ common_arch =" $OPTARG "
28
27
;;
29
28
B)
30
29
echo " $OPTARG " >> " $br2_cli_file "
@@ -44,7 +43,7 @@ while getopts 'a:B:b:C:c:fGgj:hIiK:kL:lM:p:Q:qSst::v' OPT; do
44
43
g)
45
44
extra_make_args=" ${extra_make_args} gem5-reconfigure \\
46
45
"
47
- gem5 =true
46
+ common_gem5 =true
48
47
;;
49
48
h)
50
49
cat build-usage.adoc 1>&2
@@ -99,7 +98,7 @@ BR2_TARGET_ROOTFS_INITRAMFS=n
99
98
qemu_sdl=
100
99
;;
101
100
s)
102
- suffix =" $OPTARG "
101
+ common_suffix =" $OPTARG "
103
102
;;
104
103
t)
105
104
common_gem5_build_type=" $OPTARG "
@@ -114,9 +113,9 @@ BR2_TARGET_ROOTFS_INITRAMFS=n
114
113
done
115
114
shift $(( $OPTIND - 1 ))
116
115
extra_make_args=" ${extra_make_args} $@ "
117
- set_common_vars -L " $common_linux_variant " -M " $common_gem5_variant " " $arch " " $gem5 " " $suffix "
118
- config_file=" ${buildroot_out_dir } /.config"
119
- case " $arch " in
116
+ common_setup
117
+ config_file=" ${common_buildroot_out_dir } /.config"
118
+ case " $common_arch " in
120
119
x86_64)
121
120
defconfig=qemu_x86_64_defconfig
122
121
;;
@@ -130,7 +129,7 @@ case "$arch" in
130
129
defconfig=qemu_mips64r6_malta_defconfig
131
130
;;
132
131
esac
133
- config_fragments=" ${config_fragments} ${root_dir } /br2/qemu ${br2_cli_file} "
132
+ config_fragments=" ${config_fragments} ${common_root_dir } /br2/qemu ${br2_cli_file} "
134
133
135
134
time {
136
135
# Configure.
@@ -139,16 +138,16 @@ if "$configure"; then
139
138
# Only copy if modified, otherwise the kernel always rebuilds.
140
139
cp " ${kernel_config_fragment_cli_file_tmp} " " ${kernel_config_fragment_cli_file} "
141
140
fi
142
- cd " ${buildroot_dir } "
143
- for p in $( find " ${root_dir } /buildroot_patches/" -maxdepth 1 -name ' *.patch' -print) ; do
141
+ cd " ${common_buildroot_dir } "
142
+ for p in $( find " ${common_root_dir } /buildroot_patches/" -maxdepth 1 -name ' *.patch' -print) ; do
144
143
patch -N -r - -p 1 < " $p " || :
145
144
done
146
145
br2_external=' ../kernel_module:../gem5:../parsec-benchmark'
147
- packages_dir=" ${root_dir } /packages"
146
+ packages_dir=" ${common_root_dir } /packages"
148
147
for package_dir in " ${packages_dir} " /* /; do
149
148
br2_external=" ${br2_external} :../packages/$( basename " ${package_dir} " ) "
150
149
done
151
- make O=" $buildroot_out_dir " BR2_EXTERNAL=" $br2_external " " $defconfig "
150
+ make O=" $common_buildroot_out_dir " BR2_EXTERNAL=" $br2_external " " $defconfig "
152
151
# TODO Can't get rid of these for now.
153
152
# http://stackoverflow.com/questions/44078245/is-it-possible-to-use-config-fragments-with-buildroots-config
154
153
for config_fragment in $config_fragments ; do
@@ -159,7 +158,7 @@ BR2_JLEVEL=${j}
159
158
BR2_DL_DIR=\" ${common_dir} /dl\"
160
159
BR2_ROOTFS_POST_SCRIPT_ARGS=\" ${post_script_args} \"
161
160
" >> " $config_file "
162
- if " $gem5 " ; then
161
+ if " $common_gem5 " ; then
163
162
printf " BR2_PACKAGE_GEM5=y\n" >> " ${config_file} "
164
163
fi
165
164
kernel_config_fragment_dir=../kernel_config_fragment
@@ -182,11 +181,11 @@ BR2_ROOTFS_POST_SCRIPT_ARGS=\"${post_script_args}\"
182
181
# https://stackoverflow.com/questions/49260466/why-when-i-change-br2-linux-kernel-custom-config-file-and-run-make-linux-reconfi
183
182
touch " ${kernel_config_fragment_dir} /min"
184
183
fi
185
- if [ " $arch " = ' mips64' ]; then
184
+ if [ " $common_arch " = ' mips64' ]; then
186
185
# Workaround for: https://bugs.busybox.net/show_bug.cgi?id=10276
187
186
sed -Ei ' s/^BR2_PACKAGE_LINUX_TOOLS_GPIO/BR2_PACKAGE_LINUX_TOOLS_GPIO=n/' " $config_file "
188
187
fi
189
- make O=" $buildroot_out_dir " olddefconfig
188
+ make O=" $common_buildroot_out_dir " olddefconfig
190
189
fi
191
190
echo ' config time:'
192
191
}
@@ -214,13 +213,13 @@ symlink_buildroot_variant "$common_qemu_custom_dir" "$common_qemu_variant_dir"
214
213
# symlink_buildroot_variant "$common_qemu_guest_custom_dir" "$common_qemu_guest_variant_dir"
215
214
216
215
# Manage gem5 variants.
217
- if " $gem5 " ; then
216
+ if " $common_gem5 " ; then
218
217
if [ ! -e " ${common_gem5_src_dir} /.git" ]; then
219
218
git -C " $common_gem5_default_src_dir " worktree add -b " wt/${common_gem5_variant} " " ${common_gem5_src_dir} "
220
219
fi
221
220
fi
222
221
223
- cd " $buildroot_dir "
222
+ cd " $common_buildroot_dir "
224
223
# HOST_QEMU_OPTS is a hack that happens to work because the QEMU package luckly uses += at all times.
225
224
# It shouldn't be necessary in the first place: https://bugs.busybox.net/show_bug.cgi?id=9936
226
225
#
@@ -233,7 +232,7 @@ cmd="time \\
233
232
env \\
234
233
-u LD_LIBRARY_PATH \\
235
234
make \\
236
- O='${buildroot_out_dir } ' \\
235
+ O='${common_buildroot_out_dir } ' \\
237
236
HOST_QEMU_OPTS='--enable-debug --enable-trace-backends=simple ${qemu_sdl} ' \\
238
237
GEM5_LKMC_GEM5_BUILD_TYPE=" $common_gem5_build_type " \\
239
238
GEM5_LKMC_OUTDIR=" $common_gem5_out_dir " \\
@@ -242,4 +241,4 @@ V='${v}' \\
242
241
${extra_make_args} \
243
242
all \\
244
243
"
245
- " ${root_dir } /eeval" " $cmd " " ${out_arch_dir } /build.sh"
244
+ " ${common_root_dir } /eeval" " $cmd " " ${common_out_arch_dir } /build.sh"
0 commit comments