Skip to content

Commit 20e18a8

Browse files
committed
build_kernel: check for errors
Signed-off-by: Diana Popa <[email protected]>
1 parent 50f290e commit 20e18a8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tools/devtool

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2000,23 +2000,25 @@ cmd_build_kernel() {
20002000
create_dir "$kernel_dir_host"
20012001

20022002
# Extract the kernel version from the config file provided as parameter.
2003-
KERNEL_VERSION=$(cat "$KERNEL_CFG" | grep -Po "^# Linux\/$cfg_pattern (([0-9]+.)[0-9]+)" | cut -d ' ' -f 3)
2003+
KERNEL_VERSION=$(grep -Po "^# Linux\/$cfg_pattern (([0-9]+.)[0-9]+)" "$KERNEL_CFG" | cut -d ' ' -f 3)
20042004
validate_kernel_version "$KERNEL_VERSION"
20052005

20062006
recipe_commit="b551cccc405a73a6d316c0c09dfe0b3e7a73ba3f"
20072007
recipe_url="https://raw.githubusercontent.com/rust-vmm/vmm-reference/$recipe_commit/resources/kernel/make_kernel.sh"
20082008
run_devctr \
20092009
--user "$(id -u):$(id -g)" \
20102010
--workdir "$kernel_dir_ctr" \
2011-
-- /bin/bash -c "curl -LO "$recipe_url" && source make_kernel.sh && extract_kernel_srcs "$KERNEL_VERSION""
2011+
-- /bin/bash -c "curl -LO $recipe_url && source make_kernel.sh && extract_kernel_srcs $KERNEL_VERSION"
2012+
ok_or_die "Could not extract kernel sources with recipe $recipe_url!"
20122013

20132014
cp "$KERNEL_CFG" "$kernel_dir_host/linux-$KERNEL_VERSION/.config"
20142015

20152016
KERNEL_BINARY_NAME="vmlinux-$KERNEL_VERSION-$arch.bin"
20162017
run_devctr \
20172018
--user "$(id -u):$(id -g)" \
20182019
--workdir "$kernel_dir_ctr" \
2019-
-- /bin/bash -c "source make_kernel.sh && make_kernel "$kernel_dir_ctr/linux-$KERNEL_VERSION" $format $target "$nprocs" "$KERNEL_BINARY_NAME""
2020+
-- /bin/bash -c "source make_kernel.sh && make_kernel "$kernel_dir_ctr/linux-"$KERNEL_VERSION"" $format $target $nprocs $KERNEL_BINARY_NAME"
2021+
ok_or_die "Could not build kernel!"
20202022

20212023
say "Successfully built kernel!"
20222024
say "Kernel binary placed in: $kernel_dir_host/linux-$KERNEL_VERSION/$KERNEL_BINARY_NAME"

0 commit comments

Comments
 (0)