Skip to content

Commit

Permalink
[RFC/Kernel Config] Unify config.sh
Browse files Browse the repository at this point in the history
RFC: OMG! They ACTUALLY Made config.sh USEFUL?! (Recursive Patching UNLOCKED!) #68

Changes to the PR:
* use sub-folder in `patches/` to indicate MAIN/LTS spesific patches, instead of add "skip_lts" in patch's name
* Add `-lts` CLI option for manual override (for testing locally)

Co-authored-by: taalojarvi <sreedevan05@gmail.com>
  • Loading branch information
Locietta and taalojarvi committed Nov 8, 2024
1 parent 897cf2b commit 37eb8d1
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-lts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 | awk '/LTS/{getline; getline; print}' | grep -oP '[0-9]+\.[0-9]+')
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 }}
Expand Down
20 changes: 0 additions & 20 deletions config-lts.sh

This file was deleted.

60 changes: 44 additions & 16 deletions config.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,49 @@
#
# Apply dxgkrnl patch
#
git apply ../0001-6.6.y-dxgkrnl.patch
git apply ../0002-driver-hv-dxgkrnl-add-missing-vmalloc-header.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

if [ $? != 0 ]; then
echo "Patch conflict!"
exit 1 # so it can be catched by github action
#!/bin/bash

PATCH_DIR="../patches"

IS_LTS_OVERRIDE=false

# Check for -lts argument
for arg in "$@"; do
if [[ "$arg" == "-lts" ]]; then
IS_LTS_OVERRIDE=true
break
fi
# Xxx: other arguments
done

# Determine the patch directory
if [[ $IS_LTS_OVERRIDE == true || "$IS_LTS" == "YES" ]]; then
SPESIFIC_PATCH_DIR="../patches/LTS"
else
SPESIFIC_PATCH_DIR="../patches/MAIN"
fi

#
# generate .config
#
function check_patch_error() {
if [ $? -eq 1 ]; then
echo -e "Patch conflict encountered in $patch_file"
echo -e "Halting build!"
exit 1
fi
}

# Apply common patches
for patch_file in "$PATCH_DIR/"*.patch; do
git apply "$patch_file"

# Check for patch conflict (exit code 1)
check_patch_error
done

# Apply specific patches
for patch_file in "$SPESIFIC_PATCH_DIR/"*.patch; do
git apply "$patch_file"

# Check for patch conflict (exit code 1)
check_patch_error
done

cp ../wsl2_defconfig ./arch/x86/configs/wsl2_defconfig
make LLVM=1 LLVM_IAS=1 wsl2_defconfig
make LLVM=1 LLVM_IAS=1 oldconfig

File renamed without changes.
File renamed without changes.
Empty file added patches/LTS/.gitkeep
Empty file.
6 changes: 6 additions & 0 deletions patches/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

### Folder Structure

* `.`: Patches applied to both MAIN and LTS builds
* `MAIN`: Patches only applied to MAIN builds
* `LTS`: Patches only applied to LTS builds

0 comments on commit 37eb8d1

Please sign in to comment.