From e828fa953ced2fa50d3facb295d0ee2a4444d4ea Mon Sep 17 00:00:00 2001 From: Eric Ernst Date: Wed, 4 Sep 2019 16:03:14 -0700 Subject: [PATCH] kernel: add whitelist for config options we expect to fail Experimental kernel is much newer, and many configuration options have dropped since 4.19. Let's use a whitelist to itemize what we expect to be dropped in the final config if experimental kernel us utilized. Signed-off-by: Eric Ernst --- kernel/build-kernel.sh | 22 +++++++++++++++++----- kernel/configs/fragments/whitelist.conf | 11 +++++++++++ 2 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 kernel/configs/fragments/whitelist.conf diff --git a/kernel/build-kernel.sh b/kernel/build-kernel.sh index 59124c63cb..e885aab689 100755 --- a/kernel/build-kernel.sh +++ b/kernel/build-kernel.sh @@ -37,6 +37,7 @@ readonly default_patches_dir="${patches_repo_dir}/kernel/patches/" readonly default_kernel_config_dir="${GOPATH}/src/${kernel_config_repo}/kernel/configs" # Default path to search for kernel config fragments readonly default_config_frags_dir="${GOPATH}/src/${kernel_config_repo}/kernel/configs/fragments" +readonly default_config_whitelist="${GOPATH}/src/${kernel_config_repo}/kernel/configs/fragments/whitelist.conf" #Path to kernel directory kernel_path="" #Experimental kernel support. Pull from virtio-fs GitLab instead of kernel.org @@ -109,7 +110,7 @@ get_kernel() { if [[ ${experimental_kernel} == "true" ]]; then kernel_tarball="linux-${version}.tar.gz" curl --fail -OL "https://gitlab.com/virtio-fs/linux/-/archive/${version}/${kernel_tarball}" - tar xvf "${kernel_tarball}" + tar xf "${kernel_tarball}" mv "linux-${version}" "${kernel_path}" else @@ -182,9 +183,20 @@ get_kernel_frag_path() { fi info "Constructing config from fragments: ${config_path}" - local results=$(export KCONFIG_CONFIG=${config_path}; \ - export ARCH=${arch_target}; \ - cd ${kernel_path}; ${cmdpath} -r -n ${all_configs}) + + + export KCONFIG_CONFIG=${config_path} + export ARCH=${arch_target} + cd ${kernel_path} + + local results + results=$( ${cmdpath} -r -n ${all_configs} ) + # Only consider results highlighting "not in final" + results=$(grep "${not_in_string}" <<< "$results") + # Do not care about options that are in whitelist if using experimental kernel + if [[ ${experimental_kernel} == "true" ]]; then + results=$(grep -v -f ${default_config_whitelist} <<< "$results") + fi # Did we request any entries that did not make it? local missing=$(echo $results | grep -v -q "${not_in_string}"; echo $?) @@ -268,6 +280,7 @@ get_config_version() { setup_kernel() { local kernel_path=${1:-} [ -n "${kernel_path}" ] || die "kernel_path not provided" + if [ -d "$kernel_path" ]; then info "${kernel_path} already exist" return @@ -295,7 +308,6 @@ setup_kernel() { kernel_patches=$(find "${patches_dir_for_version}" -name '*.patch' -type f) else info "kernel patches directory does not exit" - fi [ -n "${arch_target}" ] || arch_target="$(uname -m)" diff --git a/kernel/configs/fragments/whitelist.conf b/kernel/configs/fragments/whitelist.conf new file mode 100644 index 0000000000..0c0e706bb8 --- /dev/null +++ b/kernel/configs/fragments/whitelist.conf @@ -0,0 +1,11 @@ +# configuration options which may dropped in newer kernels +# without generating an error in fragment merging +CONFIG_INET6_XFRM_MODE_BEET +CONFIG_INET6_XFRM_MODE_TRANSPORT +CONFIG_INET6_XFRM_MODE_TUNNEL +CONFIG_NF_NAT_IPV4 +CONFIG_NF_NAT_NEEDED +CONFIG_NF_NAT_PROTO_DCCP +CONFIG_NF_NAT_PROTO_GRE +CONFIG_NF_NAT_PROTO_SCTP +CONFIG_NF_NAT_PROTO_UDPLITE