From 13895000711c40809e66c070bfe1e5ff8008b808 Mon Sep 17 00:00:00 2001 From: Jimmy Xu Date: Fri, 20 Mar 2020 02:10:18 +0800 Subject: [PATCH] kernel: support force setup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add option '-f' in build-kernel.sh to force the generation of .config Signed-off-by: Jimmy Xu n 请为您的变更输入提交说明。以 '#' 开始的行将被忽略,而一个空的提交 --- kernel/build-kernel.sh | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/kernel/build-kernel.sh b/kernel/build-kernel.sh index d470e40124..16d5316827 100755 --- a/kernel/build-kernel.sh +++ b/kernel/build-kernel.sh @@ -47,6 +47,8 @@ readonly GV_NVIDIA="nvidia" kernel_path="" #Experimental kernel support. Pull from virtio-fs GitLab instead of kernel.org experimental_kernel="false" +#Force generate config when setup +force_setup_generate_config="false" #GPU kernel support gpu_vendor="" # @@ -89,6 +91,7 @@ Options: -c : Path to config file to build a the kernel. -d : Enable bash debug. -e : Enable experimental kernel. + -f : Enable force generate config when setup. -g : GPU vendor, intel or nvidia. -h : Display this help. -k : Path to kernel to build. @@ -314,23 +317,27 @@ setup_kernel() { if [ -d "$kernel_path" ]; then info "${kernel_path} already exist" - return + if [[ "${force_setup_generate_config}" != "true" ]];then + return + else + info "Force generate config due to '-f'" + fi + else + info "kernel path does not exist, will download kernel" + download_kernel="true" + [ -n "$kernel_version" ] || die "failed to get kernel version: Kernel version is emtpy" + + if [[ ${download_kernel} == "true" ]]; then + get_kernel "${kernel_version}" "${kernel_path}" + fi + + [ -n "$kernel_path" ] || die "failed to find kernel source path" + + get_config_and_patches + + [ -d "${patches_path}" ] || die " patches path '${patches_path}' does not exist" fi - info "kernel path does not exist, will download kernel" - download_kernel="true" - [ -n "$kernel_version" ] || die "failed to get kernel version: Kernel version is emtpy" - - if [[ ${download_kernel} == "true" ]]; then - get_kernel "${kernel_version}" "${kernel_path}" - fi - - [ -n "$kernel_path" ] || die "failed to find kernel source path" - - get_config_and_patches - - [ -d "${patches_path}" ] || die " patches path '${patches_path}' does not exist" - local major_kernel major_kernel=$(get_major_kernel_version "${kernel_version}") local patches_dir_for_version="${patches_path}/${major_kernel}.x" @@ -425,7 +432,7 @@ install_kata() { } main() { - while getopts "a:c:deg:hk:p:t:v:" opt; do + while getopts "a:c:defg:hk:p:t:v:" opt; do case "$opt" in a) arch_target="${OPTARG}" @@ -440,6 +447,9 @@ main() { e) experimental_kernel="true" ;; + f) + force_setup_generate_config="true" + ;; g) gpu_vendor="${OPTARG}" [[ "${gpu_vendor}" == "${GV_INTEL}" || "${gpu_vendor}" == "${GV_NVIDIA}" ]] || die "GPU vendor only support intel and nvidia"