Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/ddk-lkm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
if [ -n "$EXPECTED_SIZE2" ]; then
EXTRA_ARGS="KSU_EXPECTED_SIZE2=$EXPECTED_SIZE2 KSU_EXPECTED_HASH2=$EXPECTED_HASH2"
fi
CONFIG_KSU=m CC=clang make $EXTRA_ARGS
CONFIG_KSU=m CC=clang make release $EXTRA_ARGS

echo "=== Build completed ==="

Expand All @@ -72,8 +72,6 @@ jobs:
echo "Copied to: /github/workspace/out/$OUTPUT_NAME"
ls -la "/github/workspace/out/$OUTPUT_NAME"
echo "Size: $(du -h "/github/workspace/out/$OUTPUT_NAME" | cut -f1)"
llvm-strip -d "/github/workspace/out/$OUTPUT_NAME"
echo "Size after stripping: $(du -h "/github/workspace/out/$OUTPUT_NAME" | cut -f1)"

- name: Upload kernelsu.ko artifact
uses: actions/upload-artifact@v7
Expand Down
3 changes: 3 additions & 0 deletions kernel/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@ CLAUDE.md
.ddk-version
.vscode/settings.json
check_symbol
gen_keep_globals
trim_local_symnames
ksu_uapi.h
.codex
13 changes: 11 additions & 2 deletions kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,28 @@ MDIR := $(realpath $(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
$(info -- KDIR: $(KDIR))
$(info -- MDIR: $(MDIR))

.PHONY: all compdb clean format check-format
.PHONY: all release tools compdb clean format check-format

all: check_symbol
make -C $(KDIR) M=$(MDIR) modules -j$(shell nproc)
./check_symbol kernelsu.ko $(KDIR)/vmlinux

release: all tools
./tools/localize_symbols.sh kernelsu.ko kernelsu.ko

tools: check_symbol gen_keep_globals trim_local_symnames

compdb:
python3 $(MDIR)/.vscode/generate_compdb.py -O $(KDIR) $(MDIR)
clean:
make -C $(KDIR) M=$(MDIR) clean
rm check_symbol
rm -f check_symbol gen_keep_globals trim_local_symnames
check_symbol: tools/check_symbol.c
$(CC) tools/check_symbol.c -o check_symbol
gen_keep_globals: tools/gen_keep_globals.c
$(CC) -O2 -Wall -Wextra -std=c11 tools/gen_keep_globals.c -o gen_keep_globals
trim_local_symnames: tools/trim_local_symnames.c
$(CC) -O2 -Wall -Wextra -std=c11 tools/trim_local_symnames.c -o trim_local_symnames
format:
find . \( -name "*.c" -o -name "*.h" \) -print0 | xargs -0 clang-format -i
check-format:
Expand Down
3 changes: 1 addition & 2 deletions kernel/build-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ mv .ddk-version .ddk-version.bak || true
for kmi in $KMIS; do
echo "========== Building $kmi =========="
export DDK_TARGET=$kmi
if ddk build -e CONFIG_KSU=m; then
if ddk build -e CONFIG_KSU=m -- release; then
if [ -f kernelsu.ko ]; then
cp kernelsu.ko "kernelsu-${kmi}.ko"
llvm-objcopy --strip-unneeded --discard-locals "kernelsu-${kmi}.ko"
echo "✓ Built kernelsu-${kmi}.ko"
fi
else
Expand Down
Loading