@@ -20,25 +20,6 @@ function install_dependencies {
2020 apt install -y bc flex bison gcc make libelf-dev libssl-dev squashfs-tools busybox-static tree cpio curl patch docker.io
2121}
2222
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-
4223function prepare_docker {
4324 nohup /usr/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 &
4425
10283 rootfs_img=" $OUTPUT_DIR /$ROOTFS_NAME .squashfs"
10384 mv $rootfs /root/manifest $OUTPUT_DIR /$ROOTFS_NAME .manifest
10485 mksquashfs $rootfs $rootfs_img -all-root -noappend
105- rootfs_ext4=$OUTPUT_DIR /$ROOTFS_NAME .ext4
106- dir2ext4img $rootfs $rootfs_ext4
10786 rm -rf $rootfs
10887 for bin in fast_page_fault_helper fillmem init readmem; do
10988 rm $PWD /overlay/usr/local/bin/$bin
@@ -235,7 +214,7 @@ function build_al_kernels {
235214 local KERNEL_VERSION=" all"
236215 elif [[ $# -ne 1 ]]; then
237216 die " Too many arguments in '$( basename $0 ) kernels' command. Please use \` $0 help\` for help."
238- else
217+ else
239218 KERNEL_VERSION=$1
240219 if [[ " $KERNEL_VERSION " != @ (5.10| 5.10-no-acpi| 6.1) ]]; then
241220 die " Unsupported kernel version: '$KERNEL_VERSION '. Please use \` $0 help\` for help."
@@ -259,33 +238,33 @@ function build_al_kernels {
259238
260239 # Undo kernel patches on top of AL configuration
261240 git restore $PWD /guest_configs
262- rm -rf $PWD /guest_configs/* .orig
241+ rm -rf $PWD /guest_configs/* .orig
263242}
264243
265244function print_help {
266245 cat << EOF
267246Firecracker CI artifacts build script
268247
269248Usage: $( basename $0 ) [<command>] [<command args>]
270-
249+
271250Available commands:
272-
251+
273252 all (default)
274253 Build CI rootfs and default guest kernels using configurations from
275254 resources/guest_configs.
276255 This will patch the guest configurations with all the patches under
277256 resources/guest_configs/patches.
278257 This is the default command, if no command is chosen.
279-
258+
280259 rootfs
281260 Builds only the CI rootfs.
282-
261+
283262 kernels [version]
284263 Builds our the currently supported CI kernels.
285-
264+
286265 version: Optionally choose a kernel version to build. Supported
287266 versions are: 5.10, 5.10-no-acpi or 6.1.
288-
267+
289268 help
290269 Displays the help message and exits.
291270EOF
@@ -310,7 +289,7 @@ function main {
310289 fi
311290
312291 set -x
313-
292+
314293 install_dependencies
315294
316295 # Create the directory in which we will store the kernels and rootfs
0 commit comments