Skip to content

Commit

Permalink
build_kernel: check for errors
Browse files Browse the repository at this point in the history
Signed-off-by: Diana Popa <[email protected]>
  • Loading branch information
dianpopa committed Nov 18, 2022
1 parent 50f290e commit 20e18a8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tools/devtool
Original file line number Diff line number Diff line change
Expand Up @@ -2000,23 +2000,25 @@ cmd_build_kernel() {
create_dir "$kernel_dir_host"

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

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

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

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

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

0 comments on commit 20e18a8

Please sign in to comment.