1- name : Build Kernel - No Vendor Blobs
1+ name : Build kernel (KSN) & WIFI A16 -- no vendor, no blobs
22
33on :
44 workflow_dispatch :
55 inputs :
66 kernel_source_url :
77 description : " URL of the kernel source repository"
88 required : true
9- default : " https://github.com/crdroidandroid /android_kernel_oneplus_sm8150"
9+ default : " https://github.com/LineageOS /android_kernel_oneplus_sm8150"
1010 kernel_branch :
1111 description : " Branch of the kernel source"
1212 required : true
13- default : " 14 .0"
13+ default : " lineage-23 .0"
1414 kernel_defconfig :
1515 description : " defconfig file to use"
1616 required : true
1717 default : " vendor/sm8150_defconfig"
1818 output_name :
19- description : " Name of the output zip"
19+ description : " Name of the output. zip"
2020 required : false
21- default : " OP7_Kernel-NoVendor .zip"
21+ default : " OP7_KSN_wifi-LOS-noVendor .zip"
2222 apply_kernelsu :
2323 description : " Apply KernelSU patch (true/false)"
24- type : boolean
2524 required : true
26- default : false
25+ default : " false"
2726 kernelsu_patch_url :
28- description : " KernelSU setup.sh URL"
27+ description : " KernelSU setup.sh URL (ignored if apply_kernelsu=false) "
2928 required : false
3029 default : " https://raw.githubusercontent.com/KernelSU-Next/KernelSU-Next/next/kernel/setup.sh"
3130
@@ -42,29 +41,58 @@ jobs:
4241 steps :
4342 - name : Checkout repository
4443 uses : actions/checkout@v4
44+ with :
45+ fetch-depth : 0
4546
4647 - name : Checkout Kernel Source
48+ env :
49+ KERNEL_SOURCE_URL : ${{ github.event.inputs.kernel_source_url || 'https://github.com/LineageOS/android_kernel_oneplus_sm8150' }}
50+ KERNEL_BRANCH : ${{ github.event.inputs.kernel_branch || 'lineage-23.0' }}
4751 run : |
4852 set -euo pipefail
49- git clone --depth=1 --branch "${{ github.event.inputs.kernel_branch }} " "${{ github.event.inputs.kernel_source_url } }" kernel
53+ git clone --depth=1 --branch "${KERNEL_BRANCH} " "${KERNEL_SOURCE_URL }" kernel
5054 cd kernel
5155 git submodule update --init --recursive
5256
57+ - name : Set up ccache
58+ uses : hendrikmuhs/ccache-action@v1.2
59+
60+ - name : Cleanup space
61+ run : |
62+ set -euo pipefail
63+ sudo rm -rf /opt/ghc /usr/local/share/boost /usr/share/dotnet "${AGENT_TOOLSDIRECTORY:-/opt/hostedtoolcache}" || true
64+
5365 - name : Install dependencies
5466 run : |
5567 set -euo pipefail
5668 sudo apt-get update -y
57- sudo apt-get install -y clang-18 llvm-18 lld-18 gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu make python3 libssl-dev build-essential bc bison flex unzip git git-lfs libelf-dev pahole zip
69+ sudo apt-get install -y \
70+ ccache clang-18 llvm-18 lld-18 gcc-aarch64-linux-gnu \
71+ binutils-aarch64-linux-gnu binutils make python3 libssl-dev \
72+ build-essential bc bison flex unzip git git-lfs libelf-dev pahole \
73+ zip
5874 git clone https://github.com/khalidaboelmagd/AnyKernel3
5975 rm -rf AnyKernel3/.git
6076 mkdir -p modules/vendor/lib/modules
6177
62- - name : Prepare "No Vendor" Config
78+ - name : Optional KernelSU-Next setup
79+ if : ${{ github.event.inputs.apply_kernelsu == 'true' }}
80+ working-directory : kernel
81+ env :
82+ KSU_URL : ${{ github.event.inputs.kernelsu_patch_url }}
83+ run : |
84+ set -euo pipefail
85+ export PATH="/usr/lib/llvm-18/bin:$PATH"
86+ curl -LSs "${KSU_URL}" | bash -
87+
88+ - name : Write novendor.defaults
6389 working-directory : kernel
6490 run : |
6591 set -euo pipefail
6692 cat > ../novendor.defaults <<'EOF'
6793 CONFIG_LOCALVERSION_AUTO=y
94+
95+ # Vendor / proprietary modules
6896 CONFIG_VENDOR_EDIT=n
6997 CONFIG_OPLUS_DEVICE_INFO=n
7098 CONFIG_OPLUS_PROJECT_INFO=n
@@ -78,61 +106,138 @@ jobs:
78106 CONFIG_DRM_MSM_OPLUS=n
79107 CONFIG_TOUCHSCREEN_OPLUS=n
80108 CONFIG_SOUND_OPLUS=n
109+
110+ # Wireless stacks (likely require blobs)
81111 CONFIG_MAC80211=n
82112 CONFIG_CFG80211=n
83113 CONFIG_WLAN=n
114+
115+ # Netfilter / xt / nf_conntrack (disable entirely)
84116 CONFIG_NETFILTER=n
85117 CONFIG_NETFILTER_XTABLES=n
86118 CONFIG_NF_CONNTRACK=n
119+ CONFIG_NF_CONNTRACK_IPV4=n
120+ CONFIG_NF_CONNTRACK_IPV6=n
121+ CONFIG_IP_NF_IPTABLES=n
122+ CONFIG_IP_NF_FILTER=n
123+ CONFIG_IP_NF_NAT=n
124+ CONFIG_IP_NF_TARGET_MASQUERADE=n
125+ CONFIG_IP6_NF_IPTABLES=n
126+ CONFIG_IP6_NF_FILTER=n
127+ CONFIG_BRIDGE_NETFILTER=n
128+ CONFIG_NF_TABLES=n
129+ CONFIG_NF_TABLES_IPV4=n
130+ CONFIG_NF_TABLES_IPV6=n
131+
132+ # Optional: reduce debug
87133 CONFIG_DEBUG_INFO=n
88134 CONFIG_DEBUG_KERNEL=n
89135 EOF
90136
91- - name : Apply Config and Blackhole Directories
137+ - name : Prepare defconfig
92138 working-directory : kernel
139+ env :
140+ KERNEL_DEFCONFIG : ${{ github.event.inputs.kernel_defconfig || 'vendor/sm8150_defconfig' }}
93141 run : |
94142 set -euo pipefail
95143 export PATH="/usr/lib/llvm-18/bin:$PATH"
96144 mkdir -p out
97- make O=out ARCH=arm64 ${{ github.event.inputs.kernel_defconfig }}
145+ make O=out ARCH=arm64 "${KERNEL_DEFCONFIG}"
146+
147+ - name : Apply novendor defaults and blackhole dirs
148+ working-directory : kernel
149+ run : |
150+ set -euo pipefail
151+ export PATH="/usr/lib/llvm-18/bin:$PATH"
152+
98153 make O=out ARCH=arm64 olddefconfig KCONFIG_ALLCONFIG=../novendor.defaults
99154
155+ cp out/.config arch/arm64/configs/oneplus_novendor_defconfig || true
156+
157+ # Blackhole problematic dirs (Makefiles to empty obj lists)
100158 blackhole() {
101- if [ -d "$1" ]; then
102- echo -e '# Blackholed for no-vendor build\nobj-y := \nobj-m :=' > "$1/Makefile"
103- echo "Blackholed: $1"
159+ d="$1"
160+ if [ -d "$d" ]; then
161+ printf '%s\n' '# blackholed for no-vendor build' 'obj-y :=' 'obj-m :=' > "$d/Makefile"
162+ chmod 0644 "$d/Makefile"
163+ echo "Blackholed: $d"
104164 fi
105165 }
106166
107167 blackhole drivers/gpu/drm/msm/oplus
108168 blackhole drivers/misc/oplus
169+ for d in drivers/misc/oplus*; do [ -d "$d" ] && blackhole "$d" || true; done
109170 blackhole drivers/soc/oplus
110- blackhole drivers/input/oplus
111- blackhole drivers/oneplus
171+ for d in drivers/input/oplus*; do [ -d "$d" ] && blackhole "$d" || true; done
172+ for d in drivers/oneplus*; do [ -d "$d" ] && blackhole "$d" || true; done
112173 blackhole drivers/staging/qcacld-3.0
174+ blackhole drivers/media/platform/msm/camera
175+ blackhole drivers/thermal/qcom
176+ for d in sound/soc/oplus*; do [ -d "$d" ] && blackhole "$d" || true; done
113177 blackhole net/netfilter
114178 blackhole net/ipv6/netfilter
115179 blackhole net/bridge/netfilter
116180
181+ # Remove vendor fragments from Kconfig includes (best effort)
182+ sed -i '/^source.*vendor/d' arch/arm64/configs/* || true
183+ sed -i '/^# Kconfig: vendor/d' arch/arm64/configs/* || true
184+
185+ # Extra guard: wipe any leftover Makefiles in netfilter families
186+ find net/netfilter net/ipv6/netfilter net/bridge/netfilter -type f -name Makefile -print0 | \
187+ xargs -0 -I{} bash -c "printf '%s\n' '# disabled (no vendor blobs/netfilter)' 'obj-y :=' 'obj-m :=' > '{}'" || true
188+
117189 - name : Build kernel
118190 working-directory : kernel
191+ env :
192+ KBUILD_OUTPUT : out
119193 run : |
120194 set -euo pipefail
121195 export PATH="/usr/lib/llvm-18/bin:$PATH"
122- export KBUILD_OUTPUT=out
123- make ${KERNEL_CMDLINE} CC="ccache clang-18" LD="ld.lld-18" -j$(nproc)
124- cp out/arch/arm64/boot/Image ../AnyKernel3/
196+ export LD_LIBRARY_PATH="/usr/lib/llvm-18/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
197+ export DTC_EXT="dtc"
198+ export HOSTCC="clang-18"
199+ export HOSTCXX="clang++-18"
200+
201+ make ${KERNEL_CMDLINE} V=1 CC="ccache clang-18" LD="ld.lld-18" AR="llvm-ar-18" NM="llvm-nm-18" OBJCOPY="llvm-objcopy-18" OBJDUMP="llvm-objdump-18" STRIP="llvm-strip-18" -j$(nproc)
202+ test -f out/arch/arm64/boot/Image
203+ cp out/arch/arm64/boot/Image ../AnyKernel3
204+
205+ - name : Build Wi-Fi Module (qca_cld3)
206+ working-directory : kernel
207+ run : |
208+ set -euo pipefail
209+ export PATH="/usr/lib/llvm-18/bin:$PATH"
210+ export LD_LIBRARY_PATH="/usr/lib/llvm-18/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
211+ export HOSTCC="clang-18"
212+ export HOSTCXX="clang++-18"
213+
214+ make ${KERNEL_CMDLINE} modules_prepare CC="ccache clang-18"
215+ make ${KERNEL_CMDLINE} V=1 CC="ccache clang-18" LD="ld.lld-18" AR="llvm-ar-18" NM="llvm-nm-18" \
216+ OBJCOPY="llvm-objcopy-18" OBJDUMP="llvm-objdump-18" STRIP="llvm-strip-18" \
217+ -j$(nproc) M=drivers/staging/qcacld-3.0 modules
218+
219+ sudo mkdir -p ../modules/vendor/lib/modules
220+ sudo find out/drivers/staging/qcacld-3.0 -name "*.ko" -exec cp -v {} ../modules/vendor/lib/modules/ \;
221+ sudo chown -R "$(id -u)":"$(id -g)" ../modules
125222
126- - name : Package Kernel
223+ - name : Package Kernel and Wi-Fi Modules
127224 run : |
128225 set -euo pipefail
129226 cd AnyKernel3
130- zip -r "../${OUTPUT_ZIP_NAME}" *
227+ zip -r "../${OUTPUT_ZIP_NAME}.zip" *
228+ cd ../modules
229+ if ls vendor/lib/modules/*.ko >/dev/null 2>&1; then
230+ zip -r "../${OUTPUT_ZIP_NAME}-modules.zip" *
231+ else
232+ echo "No Wi-Fi modules found, skipping modules zip"
233+ fi
131234 cd ..
132235
133- - name : Upload Kernel Artifact
236+ - name : Upload outputs
134237 uses : actions/upload-artifact@v4
135238 with :
136- name : kernel-zip
137- path : ${{ env.OUTPUT_ZIP_NAME }}
138- if-no-files-found : error
239+ name : outputs
240+ path : |
241+ ${{ env.OUTPUT_ZIP_NAME }}.zip
242+ ${{ env.OUTPUT_ZIP_NAME }}-modules.zip
243+ if-no-files-found : warn
0 commit comments