@@ -20,25 +20,6 @@ function install_dependencies {
20
20
apt install -y bc flex bison gcc make libelf-dev libssl-dev squashfs-tools busybox-static tree cpio curl patch docker.io
21
21
}
22
22
23
- function dir2ext4img {
24
- # ext4
25
- # https://unix.stackexchange.com/questions/503211/how-can-an-image-file-be-created-for-a-directory
26
- local DIR=$1
27
- local IMG=$2
28
- # Default size for the resulting rootfs image is 300M
29
- local SIZE=${3:- 300M}
30
- local TMP_MNT=$( mktemp -d)
31
- truncate -s " $SIZE " " $IMG "
32
- mkfs.ext4 -F " $IMG "
33
- mount " $IMG " " $TMP_MNT "
34
- tar c -C $DIR . | tar x -C " $TMP_MNT "
35
- # cleanup
36
- # Use the -l flag for lazy unmounting since sometimes umount fails
37
- # with "device busy" and simply calling `sync` doesn't help
38
- umount -l " $TMP_MNT "
39
- rmdir $TMP_MNT
40
- }
41
-
42
23
function prepare_docker {
43
24
nohup /usr/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 &
44
25
102
83
rootfs_img=" $OUTPUT_DIR /$ROOTFS_NAME .squashfs"
103
84
mv $rootfs /root/manifest $OUTPUT_DIR /$ROOTFS_NAME .manifest
104
85
mksquashfs $rootfs $rootfs_img -all-root -noappend
105
- rootfs_ext4=$OUTPUT_DIR /$ROOTFS_NAME .ext4
106
- dir2ext4img $rootfs $rootfs_ext4
107
86
rm -rf $rootfs
108
87
for bin in fast_page_fault_helper fillmem init readmem; do
109
88
rm $PWD /overlay/usr/local/bin/$bin
@@ -235,7 +214,7 @@ function build_al_kernels {
235
214
local KERNEL_VERSION=" all"
236
215
elif [[ $# -ne 1 ]]; then
237
216
die " Too many arguments in '$( basename $0 ) kernels' command. Please use \` $0 help\` for help."
238
- else
217
+ else
239
218
KERNEL_VERSION=$1
240
219
if [[ " $KERNEL_VERSION " != @ (5.10| 5.10-no-acpi| 6.1) ]]; then
241
220
die " Unsupported kernel version: '$KERNEL_VERSION '. Please use \` $0 help\` for help."
@@ -259,33 +238,33 @@ function build_al_kernels {
259
238
260
239
# Undo kernel patches on top of AL configuration
261
240
git restore $PWD /guest_configs
262
- rm -rf $PWD /guest_configs/* .orig
241
+ rm -rf $PWD /guest_configs/* .orig
263
242
}
264
243
265
244
function print_help {
266
245
cat << EOF
267
246
Firecracker CI artifacts build script
268
247
269
248
Usage: $( basename $0 ) [<command>] [<command args>]
270
-
249
+
271
250
Available commands:
272
-
251
+
273
252
all (default)
274
253
Build CI rootfs and default guest kernels using configurations from
275
254
resources/guest_configs.
276
255
This will patch the guest configurations with all the patches under
277
256
resources/guest_configs/patches.
278
257
This is the default command, if no command is chosen.
279
-
258
+
280
259
rootfs
281
260
Builds only the CI rootfs.
282
-
261
+
283
262
kernels [version]
284
263
Builds our the currently supported CI kernels.
285
-
264
+
286
265
version: Optionally choose a kernel version to build. Supported
287
266
versions are: 5.10, 5.10-no-acpi or 6.1.
288
-
267
+
289
268
help
290
269
Displays the help message and exits.
291
270
EOF
@@ -310,7 +289,7 @@ function main {
310
289
fi
311
290
312
291
set -x
313
-
292
+
314
293
install_dependencies
315
294
316
295
# Create the directory in which we will store the kernels and rootfs
0 commit comments