ci: Attempting to resolve the issue with DDK compilation being unavailable
This commit is contained in:
35
.github/workflows/ddk-lkm.yml
vendored
35
.github/workflows/ddk-lkm.yml
vendored
@@ -25,48 +25,16 @@ jobs:
|
|||||||
- name: Checkout source code
|
- name: Checkout source code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Get version info from GitHub API
|
|
||||||
id: version
|
|
||||||
run: |
|
|
||||||
REPO_OWNER="SukiSU-Ultra"
|
|
||||||
REPO_NAME="SukiSU-Ultra"
|
|
||||||
REPO_BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}"
|
|
||||||
KSU_VERSION_API="3.2.0"
|
|
||||||
|
|
||||||
GITHUB_VERSION=$(curl -s "https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
|
|
||||||
GITHUB_COMMIT_COUNT=$(curl -sI "https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/commits?sha=$REPO_BRANCH&per_page=1" | grep -i '^link:' | sed -n 's/.*page=\([0-9]*\)>; rel="last".*/\1/p')
|
|
||||||
|
|
||||||
KSU_VERSION=$((10000 + GITHUB_COMMIT_COUNT + 700))
|
|
||||||
|
|
||||||
FAKE_HASH=$(curl -s "https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/commits/$REPO_BRANCH" | grep '"sha":' | head -n 1 | sed -E 's/.*"([^"]+)".*/\1/' | cut -c1-8)
|
|
||||||
|
|
||||||
KSU_VERSION_FULL="v${GITHUB_VERSION:-$KSU_VERSION_API}-${FAKE_HASH}@$REPO_BRANCH"
|
|
||||||
|
|
||||||
echo "KSU_VERSION=$KSU_VERSION" >> $GITHUB_ENV
|
|
||||||
echo "KSU_VERSION_FULL=$KSU_VERSION_FULL" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
echo "Branch: $REPO_BRANCH"
|
|
||||||
echo "Version: $KSU_VERSION"
|
|
||||||
echo "Full Version: $KSU_VERSION_FULL"
|
|
||||||
|
|
||||||
- name: Build kernelsu.ko
|
- name: Build kernelsu.ko
|
||||||
env:
|
|
||||||
CI_KSU_VERSION: ${{ env.KSU_VERSION }}
|
|
||||||
CI_KSU_VERSION_FULL: ${{ env.KSU_VERSION_FULL }}
|
|
||||||
run: |
|
run: |
|
||||||
git config --global --add safe.directory /__w/SukiSU-Ultra/SukiSU-Ultra
|
git config --global --add safe.directory /__w/SukiSU-Ultra/SukiSU-Ultra
|
||||||
|
|
||||||
cd kernel
|
cd kernel
|
||||||
|
|
||||||
echo "=== Building kernelsu.ko for KMI: ${{ inputs.kmi }} ==="
|
echo "=== Building kernelsu.ko for KMI: ${{ inputs.kmi }} ==="
|
||||||
|
CONFIG_KSU=m CONFIG_KSU_KPROBES_HOOK=y make
|
||||||
CONFIG_KSU=m CONFIG_KPROBES=y CONFIG_KSU_KPROBES_HOOK=y CONFIG_KSU_MANUAL_SU=y make
|
|
||||||
|
|
||||||
echo "=== Build completed ==="
|
echo "=== Build completed ==="
|
||||||
|
|
||||||
# Create output directory in GitHub workspace
|
# Create output directory in GitHub workspace
|
||||||
mkdir -p /github/workspace/out
|
mkdir -p /github/workspace/out
|
||||||
|
|
||||||
# Copy with KMI-specific naming
|
# Copy with KMI-specific naming
|
||||||
OUTPUT_NAME="${{ inputs.kmi }}_kernelsu.ko"
|
OUTPUT_NAME="${{ inputs.kmi }}_kernelsu.ko"
|
||||||
cp kernelsu.ko "/github/workspace/out/$OUTPUT_NAME"
|
cp kernelsu.ko "/github/workspace/out/$OUTPUT_NAME"
|
||||||
@@ -76,7 +44,6 @@ jobs:
|
|||||||
echo "Size: $(du -h "/github/workspace/out/$OUTPUT_NAME" | cut -f1)"
|
echo "Size: $(du -h "/github/workspace/out/$OUTPUT_NAME" | cut -f1)"
|
||||||
llvm-strip -d "/github/workspace/out/$OUTPUT_NAME"
|
llvm-strip -d "/github/workspace/out/$OUTPUT_NAME"
|
||||||
echo "Size after stripping: $(du -h "/github/workspace/out/$OUTPUT_NAME" | cut -f1)"
|
echo "Size after stripping: $(du -h "/github/workspace/out/$OUTPUT_NAME" | cut -f1)"
|
||||||
|
|
||||||
- name: Upload kernelsu.ko artifact
|
- name: Upload kernelsu.ko artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
|||||||
3
.github/workflows/gki-kernel.yml
vendored
3
.github/workflows/gki-kernel.yml
vendored
@@ -211,9 +211,6 @@ jobs:
|
|||||||
|
|
||||||
- name: Build Kernel/LKM
|
- name: Build Kernel/LKM
|
||||||
working-directory: android-kernel
|
working-directory: android-kernel
|
||||||
env:
|
|
||||||
CI_KSU_VERSION: ${{ env.KSU_VERSION }}
|
|
||||||
CI_KSU_VERSION_FULL: ${{ env.KSU_VERSION_FULL }}
|
|
||||||
run: |
|
run: |
|
||||||
if [ ! -z ${{ vars.EXPECTED_SIZE }} ] && [ ! -z ${{ vars.EXPECTED_HASH }} ]; then
|
if [ ! -z ${{ vars.EXPECTED_SIZE }} ] && [ ! -z ${{ vars.EXPECTED_HASH }} ]; then
|
||||||
export KSU_EXPECTED_SIZE=${{ vars.EXPECTED_SIZE }}
|
export KSU_EXPECTED_SIZE=${{ vars.EXPECTED_SIZE }}
|
||||||
|
|||||||
11
kernel/.vscode/c_cpp_properties.json
vendored
11
kernel/.vscode/c_cpp_properties.json
vendored
@@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"name": "Linux",
|
|
||||||
"cStandard": "c11",
|
|
||||||
"intelliSenseMode": "gcc-arm64",
|
|
||||||
"compileCommands": "${workspaceFolder}/compile_commands.json"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"version": 4
|
|
||||||
}
|
|
||||||
92
kernel/.vscode/generate_compdb.py
vendored
92
kernel/.vscode/generate_compdb.py
vendored
@@ -1,92 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
from __future__ import print_function, division
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
import fnmatch
|
|
||||||
import functools
|
|
||||||
import json
|
|
||||||
import math
|
|
||||||
import multiprocessing
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
CMD_VAR_RE = re.compile(r'^\s*(?:saved)?cmd_(\S+)\s*:=\s*(.+)\s*$', re.MULTILINE)
|
|
||||||
SOURCE_VAR_RE = re.compile(r'^\s*source_(\S+)\s*:=\s*(.+)\s*$', re.MULTILINE)
|
|
||||||
|
|
||||||
|
|
||||||
def print_progress_bar(progress):
|
|
||||||
progress_bar = '[' + '|' * int(50 * progress) + '-' * int(50 * (1.0 - progress)) + ']'
|
|
||||||
print('\r', progress_bar, "{0:.1%}".format(progress), end='\r', file=sys.stderr)
|
|
||||||
|
|
||||||
|
|
||||||
def parse_cmd_file(out_dir, cmdfile_path):
|
|
||||||
with open(cmdfile_path, 'r') as cmdfile:
|
|
||||||
cmdfile_content = cmdfile.read()
|
|
||||||
|
|
||||||
commands = { match.group(1): match.group(2) for match in CMD_VAR_RE.finditer(cmdfile_content) }
|
|
||||||
sources = { match.group(1): match.group(2) for match in SOURCE_VAR_RE.finditer(cmdfile_content) }
|
|
||||||
|
|
||||||
return [{
|
|
||||||
'directory': out_dir,
|
|
||||||
'command': commands[o_file_name],
|
|
||||||
'file': source,
|
|
||||||
'output': o_file_name
|
|
||||||
} for o_file_name, source in sources.items()]
|
|
||||||
|
|
||||||
|
|
||||||
def gen_compile_commands(cmd_file_search_path, out_dir):
|
|
||||||
print("Building *.o.cmd file list...", file=sys.stderr)
|
|
||||||
|
|
||||||
out_dir = os.path.abspath(out_dir)
|
|
||||||
|
|
||||||
if not cmd_file_search_path:
|
|
||||||
cmd_file_search_path = [out_dir]
|
|
||||||
|
|
||||||
cmd_files = []
|
|
||||||
for search_path in cmd_file_search_path:
|
|
||||||
if (os.path.isdir(search_path)):
|
|
||||||
for cur_dir, subdir, files in os.walk(search_path):
|
|
||||||
cmd_files.extend(os.path.join(cur_dir, cmdfile_name) for cmdfile_name in fnmatch.filter(files, '*.o.cmd'))
|
|
||||||
else:
|
|
||||||
cmd_files.extend(search_path)
|
|
||||||
|
|
||||||
if not cmd_files:
|
|
||||||
print("No *.o.cmd files found in", ", ".join(cmd_file_search_path), file=sys.stderr)
|
|
||||||
return
|
|
||||||
|
|
||||||
print("Parsing *.o.cmd files...", file=sys.stderr)
|
|
||||||
|
|
||||||
n_processed = 0
|
|
||||||
print_progress_bar(0)
|
|
||||||
|
|
||||||
compdb = []
|
|
||||||
pool = multiprocessing.Pool()
|
|
||||||
try:
|
|
||||||
for compdb_chunk in pool.imap_unordered(functools.partial(parse_cmd_file, out_dir), cmd_files, chunksize=int(math.sqrt(len(cmd_files)))):
|
|
||||||
compdb.extend(compdb_chunk)
|
|
||||||
n_processed += 1
|
|
||||||
print_progress_bar(n_processed / len(cmd_files))
|
|
||||||
|
|
||||||
finally:
|
|
||||||
pool.terminate()
|
|
||||||
pool.join()
|
|
||||||
|
|
||||||
print(file=sys.stderr)
|
|
||||||
print("Writing compile_commands.json...", file=sys.stderr)
|
|
||||||
|
|
||||||
with open('compile_commands.json', 'w') as compdb_file:
|
|
||||||
json.dump(compdb, compdb_file, indent=1)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
cmd_parser = argparse.ArgumentParser()
|
|
||||||
cmd_parser.add_argument('-O', '--out-dir', type=str, default=os.getcwd(), help="Build output directory")
|
|
||||||
cmd_parser.add_argument('cmd_file_search_path', nargs='*', help="*.cmd file search path")
|
|
||||||
gen_compile_commands(**vars(cmd_parser.parse_args()))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
||||||
35
kernel/.vscode/settings.json
vendored
35
kernel/.vscode/settings.json
vendored
@@ -1,35 +0,0 @@
|
|||||||
{
|
|
||||||
"files.exclude": {
|
|
||||||
"**/*.o.cmd": true,
|
|
||||||
"**/*.ko.cmd": true,
|
|
||||||
"**/*.mod.cmd": true,
|
|
||||||
"**/*.cmd": true,
|
|
||||||
"**/*.order": true,
|
|
||||||
"**/*.symvers": true,
|
|
||||||
"**/*.o": true,
|
|
||||||
"**/*.mod": true,
|
|
||||||
"**/android-wuwa.mod.c": true,
|
|
||||||
"**/android-wuwa.lds": true,
|
|
||||||
"**/.*.*.cmd": true,
|
|
||||||
"**/.*.d": true,
|
|
||||||
"**/.*.S": true
|
|
||||||
},
|
|
||||||
"[c]": {
|
|
||||||
"editor.detectIndentation": false,
|
|
||||||
"editor.tabSize": 4,
|
|
||||||
"editor.insertSpaces": true,
|
|
||||||
"editor.rulers": [80,100]
|
|
||||||
},
|
|
||||||
"files.associations": {
|
|
||||||
"*.h": "c",
|
|
||||||
"ratio": "c",
|
|
||||||
"array": "c",
|
|
||||||
"string_view": "c",
|
|
||||||
"initializer_list": "c",
|
|
||||||
"random": "cpp"
|
|
||||||
},
|
|
||||||
"editor.indentSize": 4,
|
|
||||||
"editor.insertSpaces": true,
|
|
||||||
"editor.detectIndentation": false,
|
|
||||||
"clangd.path": "/opt/ddk/clang/clang-r450784e/bin/clangd"
|
|
||||||
}
|
|
||||||
16
kernel/.vscode/tasks.json
vendored
16
kernel/.vscode/tasks.json
vendored
@@ -1,16 +0,0 @@
|
|||||||
{
|
|
||||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
|
||||||
// for the documentation about the tasks.json format
|
|
||||||
"version": "2.0.0",
|
|
||||||
"tasks": [
|
|
||||||
{
|
|
||||||
"label": "Generate compile_commands.json",
|
|
||||||
"type": "process",
|
|
||||||
"command": "python",
|
|
||||||
"args": [
|
|
||||||
"${workspaceRoot}/.vscode/generate_compdb.py"
|
|
||||||
],
|
|
||||||
"problemMatcher": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -36,12 +36,6 @@ ifeq ($(CONFIG_KSU),m)
|
|||||||
ccflags-y += -DKSU_MODULE
|
ccflags-y += -DKSU_MODULE
|
||||||
endif
|
endif
|
||||||
|
|
||||||
KDIR := $(KDIR)
|
|
||||||
MDIR := $(realpath $(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
|
|
||||||
|
|
||||||
$(info -- KDIR: $(KDIR))
|
|
||||||
$(info -- MDIR: $(MDIR))
|
|
||||||
|
|
||||||
|
|
||||||
REPO_OWNER := SukiSU-Ultra
|
REPO_OWNER := SukiSU-Ultra
|
||||||
REPO_NAME := SukiSU-Ultra
|
REPO_NAME := SukiSU-Ultra
|
||||||
@@ -51,22 +45,25 @@ KSU_VERSION_API := 3.2.0
|
|||||||
GIT_BIN := /usr/bin/env PATH="$$PATH":/usr/bin:/usr/local/bin git
|
GIT_BIN := /usr/bin/env PATH="$$PATH":/usr/bin:/usr/local/bin git
|
||||||
CURL_BIN := /usr/bin/env PATH="$$PATH":/usr/bin:/usr/local/bin curl
|
CURL_BIN := /usr/bin/env PATH="$$PATH":/usr/bin:/usr/local/bin curl
|
||||||
|
|
||||||
|
KDIR := $(KDIR)
|
||||||
|
MDIR := $(realpath $(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
|
||||||
|
|
||||||
|
$(info -- KDIR: $(KDIR))
|
||||||
|
$(info -- MDIR: $(MDIR))
|
||||||
|
|
||||||
KSU_GITHUB_VERSION := $(shell $(CURL_BIN) -s "https://api.github.com/repos/$(REPO_OWNER)/$(REPO_NAME)/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
|
KSU_GITHUB_VERSION := $(shell $(CURL_BIN) -s "https://api.github.com/repos/$(REPO_OWNER)/$(REPO_NAME)/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
|
||||||
KSU_GITHUB_VERSION_COMMIT := $(shell $(CURL_BIN) -sI "https://api.github.com/repos/$(REPO_OWNER)/$(REPO_NAME)/commits?sha=$(REPO_BRANCH)&per_page=1" | grep -i "link:" | sed -n 's/.*page=\([0-9]*\)>; rel="last".*/\1/p')
|
KSU_GITHUB_VERSION_COMMIT := $(shell $(CURL_BIN) -sI "https://api.github.com/repos/$(REPO_OWNER)/$(REPO_NAME)/commits?sha=$(REPO_BRANCH)&per_page=1" | grep -i "link:" | sed -n 's/.*page=\([0-9]*\)>; rel="last".*/\1/p')
|
||||||
|
|
||||||
ifdef CI_KSU_VERSION
|
|
||||||
KSU_VERSION := $(CI_KSU_VERSION)
|
|
||||||
KSU_VERSION_FULL := $(CI_KSU_VERSION_FULL)
|
|
||||||
$(info -- $(REPO_NAME) version (CI override): $(KSU_VERSION))
|
|
||||||
$(info -- $(REPO_NAME) full version (CI override): $(KSU_VERSION_FULL))
|
|
||||||
else
|
|
||||||
|
|
||||||
ifeq ($(findstring $(srctree),$(src)),$(srctree))
|
ifeq ($(findstring $(srctree),$(src)),$(srctree))
|
||||||
KSU_SRC := $(src)
|
KSU_SRC := $(src)
|
||||||
else
|
else
|
||||||
KSU_SRC := $(srctree)/$(src)
|
KSU_SRC := $(srctree)/$(src)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifneq ($(shell test -e $(KSU_SRC)/../.git && echo "in-tree"),in-tree)
|
||||||
|
KSU_SRC := $(MDIR)
|
||||||
|
endif
|
||||||
|
|
||||||
LOCAL_GIT_EXISTS := $(shell test -e $(KSU_SRC)/../.git && echo 1 || echo 0)
|
LOCAL_GIT_EXISTS := $(shell test -e $(KSU_SRC)/../.git && echo 1 || echo 0)
|
||||||
|
|
||||||
define get_ksu_version_full
|
define get_ksu_version_full
|
||||||
@@ -103,7 +100,6 @@ else
|
|||||||
KSU_VERSION_FULL := $(call get_ksu_version_full,$(KSU_GITHUB_VERSION))
|
KSU_VERSION_FULL := $(call get_ksu_version_full,$(KSU_GITHUB_VERSION))
|
||||||
$(info -- $(REPO_NAME) version (Github): $(KSU_VERSION_FULL))
|
$(info -- $(REPO_NAME) version (Github): $(KSU_VERSION_FULL))
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
|
|
||||||
ccflags-y += -DKSU_VERSION=$(KSU_VERSION)
|
ccflags-y += -DKSU_VERSION=$(KSU_VERSION)
|
||||||
ccflags-y += -DKSU_VERSION_FULL=\"$(KSU_VERSION_FULL)\"
|
ccflags-y += -DKSU_VERSION_FULL=\"$(KSU_VERSION_FULL)\"
|
||||||
@@ -135,19 +131,15 @@ $(info -- SukiSU: CONFIG_KSU_MANUAL_HOOK)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
KERNEL_VERSION := $(VERSION).$(PATCHLEVEL)
|
KERNEL_VERSION := $(VERSION).$(PATCHLEVEL)
|
||||||
VERSION := $(or $(VERSION),0)
|
|
||||||
PATCHLEVEL := $(or $(PATCHLEVEL),0)
|
|
||||||
|
|
||||||
# Check for GKI 2.0 (5.10+ or 6.x+)
|
|
||||||
ifeq ($(shell \
|
|
||||||
[ "$(VERSION)" -gt 5 ] || { [ "$(VERSION)" -eq 5 ] && [ "$(PATCHLEVEL)" -ge 10 ]; } || \
|
|
||||||
[ "$(VERSION)" -ge 6 ]; echo $$?),0)
|
|
||||||
KERNEL_TYPE := GKI 2.0
|
|
||||||
# Check for GKI 1.0 (5.4)
|
|
||||||
else ifeq ($(VERSION)-$(PATCHLEVEL),5-4)
|
|
||||||
KERNEL_TYPE := GKI 1.0
|
|
||||||
else
|
|
||||||
KERNEL_TYPE := Non-GKI
|
KERNEL_TYPE := Non-GKI
|
||||||
|
# Check for GKI 2.0 (5.10+ or 6.x+)
|
||||||
|
ifneq ($(shell test \( $(VERSION) -ge 5 -a $(PATCHLEVEL) -ge 10 \) -o $(VERSION) -ge 6; echo $$?),0)
|
||||||
|
# Check for GKI 1.0 (5.4)
|
||||||
|
ifeq ($(shell test $(VERSION)-$(PATCHLEVEL) = 5-4; echo $$?),0)
|
||||||
|
KERNEL_TYPE := GKI 1.0
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
KERNEL_TYPE := GKI 2.0
|
||||||
endif
|
endif
|
||||||
$(info -- KERNEL_VERSION: $(KERNEL_VERSION))
|
$(info -- KERNEL_VERSION: $(KERNEL_VERSION))
|
||||||
$(info -- KERNEL_TYPE: $(KERNEL_TYPE))
|
$(info -- KERNEL_TYPE: $(KERNEL_TYPE))
|
||||||
@@ -172,11 +164,8 @@ endif
|
|||||||
ccflags-y += -Wno-implicit-function-declaration -Wno-strict-prototypes -Wno-int-conversion -Wno-gcc-compat
|
ccflags-y += -Wno-implicit-function-declaration -Wno-strict-prototypes -Wno-int-conversion -Wno-gcc-compat
|
||||||
ccflags-y += -Wno-declaration-after-statement -Wno-unused-function
|
ccflags-y += -Wno-declaration-after-statement -Wno-unused-function
|
||||||
|
|
||||||
|
|
||||||
all:
|
all:
|
||||||
make -C $(KDIR) M=$(MDIR) modules
|
make -C $(KDIR) M=$(MDIR) modules
|
||||||
compdb:
|
|
||||||
python3 $(MDIR)/.vscode/generate_compdb.py -O $(KDIR) $(MDIR)
|
|
||||||
clean:
|
clean:
|
||||||
make -C $(KDIR) M=$(MDIR) clean
|
make -C $(KDIR) M=$(MDIR) clean
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user