From 004427fefe9f0a5d045da211a0eea35e7a579bb6 Mon Sep 17 00:00:00 2001 From: taalojarvi Date: Sat, 29 Jun 2024 01:10:37 +0530 Subject: [PATCH 1/7] config.sh: Move patches to its own subdirectory and recursively apply them Signed-off-by: taalojarvi --- config.sh | 32 +++++++++---------- .../0001-6.1.y-dxgkrnl.patch | 0 ...0002-dxgkrnl-enable-mainline-support.patch | 0 .../0003-bbrv3-fix-clang-build.patch | 0 ...e-fix-clang-uninitialized-var-werror.patch | 0 ...nl-Remove-argument-in-eventfd_signal.patch | 0 6 files changed, 16 insertions(+), 16 deletions(-) rename 0001-6.1.y-dxgkrnl.patch => patches/0001-6.1.y-dxgkrnl.patch (100%) rename 0002-dxgkrnl-enable-mainline-support.patch => patches/0002-dxgkrnl-enable-mainline-support.patch (100%) rename 0003-bbrv3-fix-clang-build.patch => patches/0003-bbrv3-fix-clang-build.patch (100%) rename 0004-nf_nat_fullcone-fix-clang-uninitialized-var-werror.patch => patches/0004-nf_nat_fullcone-fix-clang-uninitialized-var-werror.patch (100%) rename 0005-drivers-hv-dxgkrnl-Remove-argument-in-eventfd_signal.patch => patches/0005-drivers-hv-dxgkrnl-Remove-argument-in-eventfd_signal.patch (100%) diff --git a/config.sh b/config.sh index dbf84af..447a540 100755 --- a/config.sh +++ b/config.sh @@ -1,21 +1,21 @@ -# -# Apply dxgkrnl patch -# -git apply ../0001-6.1.y-dxgkrnl.patch -git apply ../0002-dxgkrnl-enable-mainline-support.patch -git apply ../0003-bbrv3-fix-clang-build.patch -git apply ../0004-nf_nat_fullcone-fix-clang-uninitialized-var-werror.patch -git apply ../0005-drivers-hv-dxgkrnl-Remove-argument-in-eventfd_signal.patch +#!/bin/bash -if [ $? != 0 ]; then - echo "Patch conflict!" - exit 1 # so it can be catched by github action -fi +PATCH_DIR="../patches" + +# Loop through all patch files and apply them +for patch_file in "$PATCH_DIR/"*.patch; do + echo -e "Applying patch: $patch_file" + git apply "$patch_file" + + # Check for patch conflict (exit code 1) + if [ $? -eq 1 ]; then + echo "Patch conflict encountered: $patch_file" + exit 1 + fi +done + +echo -e "All patches applied successfully!" -# -# generate .config -# cp ../wsl2_defconfig ./arch/x86/configs/wsl2_defconfig make LLVM=1 LLVM_IAS=1 wsl2_defconfig make LLVM=1 LLVM_IAS=1 oldconfig - diff --git a/0001-6.1.y-dxgkrnl.patch b/patches/0001-6.1.y-dxgkrnl.patch similarity index 100% rename from 0001-6.1.y-dxgkrnl.patch rename to patches/0001-6.1.y-dxgkrnl.patch diff --git a/0002-dxgkrnl-enable-mainline-support.patch b/patches/0002-dxgkrnl-enable-mainline-support.patch similarity index 100% rename from 0002-dxgkrnl-enable-mainline-support.patch rename to patches/0002-dxgkrnl-enable-mainline-support.patch diff --git a/0003-bbrv3-fix-clang-build.patch b/patches/0003-bbrv3-fix-clang-build.patch similarity index 100% rename from 0003-bbrv3-fix-clang-build.patch rename to patches/0003-bbrv3-fix-clang-build.patch diff --git a/0004-nf_nat_fullcone-fix-clang-uninitialized-var-werror.patch b/patches/0004-nf_nat_fullcone-fix-clang-uninitialized-var-werror.patch similarity index 100% rename from 0004-nf_nat_fullcone-fix-clang-uninitialized-var-werror.patch rename to patches/0004-nf_nat_fullcone-fix-clang-uninitialized-var-werror.patch diff --git a/0005-drivers-hv-dxgkrnl-Remove-argument-in-eventfd_signal.patch b/patches/0005-drivers-hv-dxgkrnl-Remove-argument-in-eventfd_signal.patch similarity index 100% rename from 0005-drivers-hv-dxgkrnl-Remove-argument-in-eventfd_signal.patch rename to patches/0005-drivers-hv-dxgkrnl-Remove-argument-in-eventfd_signal.patch From ca3e39e8eb8e5368c3911b958ec7fa6425e54835 Mon Sep 17 00:00:00 2001 From: taalojarvi Date: Sat, 29 Jun 2024 02:48:35 +0530 Subject: [PATCH 2/7] config.sh: Unify config.sh scripts across LTS and non-LTS builds. Comparing the two config scripts, the only difference is that for LTS builds, a patch is omitted. Assuming the patch does not apply, detect if the build targets LTS branch (through ENV we created in a previous PR, and gracefully proceed to build if true. While we are at it, remove config-lts.sh and all mentions of it. Signed-off-by: taalojarvi --- .github/workflows/build-lts.yml | 2 +- config-lts.sh | 19 ------------------- config.sh | 10 +++++++--- 3 files changed, 8 insertions(+), 23 deletions(-) delete mode 100755 config-lts.sh diff --git a/.github/workflows/build-lts.yml b/.github/workflows/build-lts.yml index 8a6ca12..1f024f8 100644 --- a/.github/workflows/build-lts.yml +++ b/.github/workflows/build-lts.yml @@ -53,7 +53,7 @@ jobs: export CURL_UA="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0" export VERSION_BRANCH=$(curl -s https://xanmod.org/ -A $CURL_UA | grep -A1 LTS | grep -E '[0-9]+\.[0-9]+' -o | head -n1) git clone https://github.com/xanmod/linux.git -b $VERSION_BRANCH --depth 1 linux - cd linux && ../config-lts.sh + cd linux && ../config.sh scripts/config -d GENERIC_CPU3 # avoid override warning for duplicate arch flags scripts/config -e ${{ matrix.arch }} diff --git a/config-lts.sh b/config-lts.sh deleted file mode 100755 index 8532f06..0000000 --- a/config-lts.sh +++ /dev/null @@ -1,19 +0,0 @@ -# -# Apply dxgkrnl patch -# -git apply ../0001-6.1.y-dxgkrnl.patch -git apply ../0002-dxgkrnl-enable-mainline-support.patch -git apply ../0003-bbrv3-fix-clang-build.patch -git apply ../0004-nf_nat_fullcone-fix-clang-uninitialized-var-werror.patch - -if [ $? != 0 ]; then - echo "Patch conflict!" - exit 1 # so it can be catched by github action -fi -# -# generate .config -# -cp ../wsl2_defconfig ./arch/x86/configs/wsl2_defconfig -make LLVM=1 LLVM_IAS=1 wsl2_defconfig -make LLVM=1 LLVM_IAS=1 oldconfig - diff --git a/config.sh b/config.sh index 447a540..b1e54a0 100755 --- a/config.sh +++ b/config.sh @@ -9,12 +9,16 @@ for patch_file in "$PATCH_DIR/"*.patch; do # Check for patch conflict (exit code 1) if [ $? -eq 1 ]; then - echo "Patch conflict encountered: $patch_file" - exit 1 + echo -e "Patch conflict encountered: $patch_file" + if [ "$IS_LTS" = "NO" ]; then + exit 1 + else + echo -e "git patch encountered errors, but choosing to continue as we are an LTS build" + fi fi done -echo -e "All patches applied successfully!" + cp ../wsl2_defconfig ./arch/x86/configs/wsl2_defconfig make LLVM=1 LLVM_IAS=1 wsl2_defconfig From 2bf1678987d79b6c385a94bca9f994958780fea2 Mon Sep 17 00:00:00 2001 From: taalojarvi Date: Mon, 1 Jul 2024 23:49:09 +0530 Subject: [PATCH 3/7] config.sh: Skip patches marked as "_skip_lts" during recursive patching Added logic to skip applying patches with "_skip_lts" in their filename. This ensures that patches that are not intended for LTS builds can be safely skipped. TODO: Expand the conditional check to cover skipping patches based on build type [LTS / main]. Signed-off-by: taalojarvi --- config.sh | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/config.sh b/config.sh index b1e54a0..50378c2 100755 --- a/config.sh +++ b/config.sh @@ -3,19 +3,21 @@ PATCH_DIR="../patches" # Loop through all patch files and apply them +# If the patch filename contains "skip_lts", patch will be ignored +# TODO(taalojarvi): Expand conditional check to cover skipping patches according to buildtype. for patch_file in "$PATCH_DIR/"*.patch; do - echo -e "Applying patch: $patch_file" - git apply "$patch_file" - + if [[ ! "$patch_file" =~ _skip_lts ]]; then + echo -e "Applying patch: $patch_file" + git apply "$patch_file" + else + echo -e "Skipping patch: $patch_file" + fi # Check for patch conflict (exit code 1) if [ $? -eq 1 ]; then - echo -e "Patch conflict encountered: $patch_file" - if [ "$IS_LTS" = "NO" ]; then - exit 1 - else - echo -e "git patch encountered errors, but choosing to continue as we are an LTS build" - fi - fi + echo -e "Patch conflict encountered in $patch_file" + echo -e "Halting build!" + exit 1 + fi done From 8dbb7ee1efef46b511e0b6a512c7aa0306779068 Mon Sep 17 00:00:00 2001 From: taalojarvi Date: Mon, 1 Jul 2024 23:55:32 +0530 Subject: [PATCH 4/7] patches: Mark `0005-drivers-hv-dxgkrnl-Remove-argument-in-eventfd_signal.patch` as _skip_lts Signed-off-by: taalojarvi --- ...s-hv-dxgkrnl-Remove-argument-in-eventfd_signal_skip_lts.patch} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename patches/{0005-drivers-hv-dxgkrnl-Remove-argument-in-eventfd_signal.patch => 0005-drivers-hv-dxgkrnl-Remove-argument-in-eventfd_signal_skip_lts.patch} (100%) diff --git a/patches/0005-drivers-hv-dxgkrnl-Remove-argument-in-eventfd_signal.patch b/patches/0005-drivers-hv-dxgkrnl-Remove-argument-in-eventfd_signal_skip_lts.patch similarity index 100% rename from patches/0005-drivers-hv-dxgkrnl-Remove-argument-in-eventfd_signal.patch rename to patches/0005-drivers-hv-dxgkrnl-Remove-argument-in-eventfd_signal_skip_lts.patch From f9fc05c79e799072cdfb0d0cfc25d4b1b8ae9082 Mon Sep 17 00:00:00 2001 From: taalojarvi Date: Tue, 2 Jul 2024 00:43:51 +0530 Subject: [PATCH 5/7] config.sh: Enhance skip logic for non-LTS builds Introduces a check for the IS_LTS environment variable to conditionally apply patches based on build type. Patches containing "_skip_lts" will now be applied during non-LTS builds, even if the filename suggests skipping. Signed-off-by: taalojarvi --- config.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/config.sh b/config.sh index 50378c2..604d4e5 100755 --- a/config.sh +++ b/config.sh @@ -3,15 +3,24 @@ PATCH_DIR="../patches" # Loop through all patch files and apply them -# If the patch filename contains "skip_lts", patch will be ignored +# If the patch filename contains "skip_lts", patch will be ignored. +# The conditional will also check if the build is LTS before skipping and will peacefully ignore the skip tag if it is a non-LTS build. # TODO(taalojarvi): Expand conditional check to cover skipping patches according to buildtype. for patch_file in "$PATCH_DIR/"*.patch; do if [[ ! "$patch_file" =~ _skip_lts ]]; then - echo -e "Applying patch: $patch_file" + echo -e "Applying patch: $patch_file" git apply "$patch_file" else - echo -e "Skipping patch: $patch_file" + if [[ "$IS_LTS" = "NO" ]]; then + echo -e "Patch skip ignored as this is a non LTS build." + echo -e "Applying patch: $patch_file" + git apply "$patch_file" + else + echo -e "Skipping patch: $patch_file" + fi + fi + # Check for patch conflict (exit code 1) if [ $? -eq 1 ]; then echo -e "Patch conflict encountered in $patch_file" From c5ceb1e38bf16a2509fa39a8b58a2b61eed4dc67 Mon Sep 17 00:00:00 2001 From: Yang Jeong Hun Date: Sun, 1 Sep 2024 08:42:58 +0530 Subject: [PATCH 6/7] [Kernel CI] Change some aur packages to official packages Error Logs: :: Synchronizing package databases... core downloading... extra downloading... archlinuxcn downloading... error: target not found: llvm-git error: target not found: llvm-libs-git error: target not found: clang-git error: target not found: lld-git * llvm-git, llvm-libs-git, clang-git, lld-git is aur packages, It can't install with pacman. * They support at official packages, So change it. Signed-off-by: Yang Jeong Hun Signed-off-by: taalojarvi --- .github/workflows/build-lts.yml | 2 +- .github/workflows/build.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-lts.yml b/.github/workflows/build-lts.yml index 1f024f8..a47b25c 100644 --- a/.github/workflows/build-lts.yml +++ b/.github/workflows/build-lts.yml @@ -42,7 +42,7 @@ jobs: - name: Install dependencies id: dep run: | - pacman -Syu --noconfirm pahole xmlto inetutils bc cpio jq llvm-git llvm-libs-git clang-git lld-git + pacman -Syu --noconfirm pahole xmlto inetutils bc cpio jq llvm llvm-libs clang lld - name: Trust this directory run: git config --global --add safe.directory '*' # v2.35.3 or later diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 812693a..487d993 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,7 +42,7 @@ jobs: - name: Install dependencies id: dep run: | - pacman -Syu --noconfirm pahole xmlto inetutils bc cpio jq llvm-git llvm-libs-git clang-git lld-git ccache + pacman -Syu --noconfirm pahole xmlto inetutils bc cpio jq llvm llvm-libs clang lld ccache - name: Trust this directory run: git config --global --add safe.directory '*' # v2.35.3 or later From dc09c3713e7a30ec2d6a98765fb56362c315c61d Mon Sep 17 00:00:00 2001 From: taalojarvi Date: Sun, 1 Sep 2024 09:47:50 +0530 Subject: [PATCH 7/7] patches: Add `0006-drivers-hv-dxgkrnl-Add-missing-include-vmalloc-header-file_skip_lts.patch` to patches Signed-off-by: taalojarvi --- ...include-vmalloc-header-file_skip_lts.patch | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 patches/0006-drivers-hv-dxgkrnl-Add-missing-include-vmalloc-header-file_skip_lts.patch diff --git a/patches/0006-drivers-hv-dxgkrnl-Add-missing-include-vmalloc-header-file_skip_lts.patch b/patches/0006-drivers-hv-dxgkrnl-Add-missing-include-vmalloc-header-file_skip_lts.patch new file mode 100644 index 0000000..4deb9d2 --- /dev/null +++ b/patches/0006-drivers-hv-dxgkrnl-Add-missing-include-vmalloc-header-file_skip_lts.patch @@ -0,0 +1,63 @@ +From 196681c8eb287df7dd2487f6bd264c09d27b89b3 Mon Sep 17 00:00:00 2001 +From: Yang Jeong Hun +Date: Tue, 16 Jul 2024 07:22:49 +0900 +Subject: [PATCH] drivers: hv: dxgkrnl: Add missing include vmalloc header file + + * Add missing header file to use vzalloc() and vfree(). + +Signed-off-by: Yang Jeong Hun +--- + drivers/hv/dxgkrnl/dxgadapter.c | 1 + + drivers/hv/dxgkrnl/dxgvmbus.c | 1 + + drivers/hv/dxgkrnl/hmgr.c | 1 + + drivers/hv/dxgkrnl/ioctl.c | 1 + + 4 files changed, 4 insertions(+) + +diff --git a/drivers/hv/dxgkrnl/dxgadapter.c b/drivers/hv/dxgkrnl/dxgadapter.c +index 6d3cabb24e6f3..0844ef064a4e3 100644 +--- a/drivers/hv/dxgkrnl/dxgadapter.c ++++ b/drivers/hv/dxgkrnl/dxgadapter.c +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + + #include "dxgkrnl.h" + +diff --git a/drivers/hv/dxgkrnl/dxgvmbus.c b/drivers/hv/dxgkrnl/dxgvmbus.c +index abb6d2af89acc..59149b2969a46 100644 +--- a/drivers/hv/dxgkrnl/dxgvmbus.c ++++ b/drivers/hv/dxgkrnl/dxgvmbus.c +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + #include "dxgkrnl.h" + #include "dxgvmbus.h" + +diff --git a/drivers/hv/dxgkrnl/hmgr.c b/drivers/hv/dxgkrnl/hmgr.c +index 24101d0091ab3..528402a9ee491 100644 +--- a/drivers/hv/dxgkrnl/hmgr.c ++++ b/drivers/hv/dxgkrnl/hmgr.c +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include + + #include "misc.h" + #include "dxgkrnl.h" +diff --git a/drivers/hv/dxgkrnl/ioctl.c b/drivers/hv/dxgkrnl/ioctl.c +index 42f3de31a63cb..d70a4b9153bce 100644 +--- a/drivers/hv/dxgkrnl/ioctl.c ++++ b/drivers/hv/dxgkrnl/ioctl.c +@@ -17,6 +17,7 @@ + #include + #include + #include ++#include + + #include "dxgkrnl.h" + #include "dxgvmbus.h"