diff --git a/kernel/build-kernel.sh b/kernel/build-kernel.sh index 102e71c34c..16524f825d 100755 --- a/kernel/build-kernel.sh +++ b/kernel/build-kernel.sh @@ -271,7 +271,13 @@ get_config_and_patches() { if [ -z "${patches_path}" ]; then info "Clone config and patches" patches_path="${default_patches_dir}" - [ -d "${patches_path}" ] || git clone "https://${patches_repo}.git" "${patches_repo_dir}" + if [ ! -d "${patches_path}" ]; then + tag="${kata_version:-$NEW_VERSION}" + git clone "https://${patches_repo}.git" "${patches_repo_dir}" + pushd "${patches_repo_dir}" >> /dev/null + git checkout $tag + popd >> /dev/null + fi fi }