You've already forked KernelSU
mirror of
https://github.com/tiann/KernelSU.git
synced 2025-08-27 23:46:34 +00:00
kernel: export customized symbols (#58)
This commit is contained in:
31
.github/workflows/build-kernel-5.10.yml
vendored
31
.github/workflows/build-kernel-5.10.yml
vendored
@@ -41,13 +41,23 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
path: KernelSU
|
path: KernelSU
|
||||||
- name: Download kernel source
|
|
||||||
|
- name: Setup kernel source
|
||||||
run: |
|
run: |
|
||||||
cd $GITHUB_WORKSPACE
|
cd $GITHUB_WORKSPACE
|
||||||
git clone https://gerrit.googlesource.com/git-repo
|
git clone https://gerrit.googlesource.com/git-repo
|
||||||
mkdir android-kernel && cd android-kernel
|
mkdir android-kernel && cd android-kernel
|
||||||
../git-repo/repo init --depth=1 --u https://android.googlesource.com/kernel/manifest -b common-${{ matrix.tag }}
|
../git-repo/repo init --depth=1 --u https://android.googlesource.com/kernel/manifest -b common-${{ matrix.tag }}
|
||||||
../git-repo/repo sync -j$(nproc --all)
|
../git-repo/repo sync -j$(nproc --all)
|
||||||
|
curl -Lo gki-kernel.zip https://dl.google.com/android/gki/gki-certified-boot-${{ matrix.tag }}_r1.zip
|
||||||
|
unzip gki-kernel.zip
|
||||||
|
tools/mkbootimg/unpack_bootimg.py --boot_img=$(find . -maxdepth 1 -name "*.img")
|
||||||
|
|
||||||
|
- name: Setup KernelSU
|
||||||
|
env:
|
||||||
|
PATCH_PATH: "5.10"
|
||||||
|
run: |
|
||||||
|
cd $GITHUB_WORKSPACE/android-kernel
|
||||||
echo "[+] KernelSU setup"
|
echo "[+] KernelSU setup"
|
||||||
GKI_ROOT=$(pwd)
|
GKI_ROOT=$(pwd)
|
||||||
echo "[+] GKI_ROOT: $GKI_ROOT"
|
echo "[+] GKI_ROOT: $GKI_ROOT"
|
||||||
@@ -56,13 +66,22 @@ jobs:
|
|||||||
echo "[+] Add kernel su driver to Makefile"
|
echo "[+] Add kernel su driver to Makefile"
|
||||||
DRIVER_MAKEFILE=$GKI_ROOT/common/drivers/Makefile
|
DRIVER_MAKEFILE=$GKI_ROOT/common/drivers/Makefile
|
||||||
grep -q "kernelsu" $DRIVER_MAKEFILE || echo "obj-y += kernelsu/" >> $DRIVER_MAKEFILE
|
grep -q "kernelsu" $DRIVER_MAKEFILE || echo "obj-y += kernelsu/" >> $DRIVER_MAKEFILE
|
||||||
echo "[+] KernelSU setup Done."
|
echo "[+] Apply KernelSU patches"
|
||||||
cd $GKI_ROOT/common/ && git apply $GITHUB_WORKSPACE/KernelSU/.github/patches/5.10/*.patch
|
cd $GKI_ROOT/common/ && git apply $GITHUB_WORKSPACE/KernelSU/.github/patches/$PATCH_PATH/*.patch
|
||||||
cd -
|
cd -
|
||||||
curl -Lo gki-kernel.zip https://dl.google.com/android/gki/gki-certified-boot-${{ matrix.tag }}_r1.zip
|
echo "[+] KernelSU setup Done."
|
||||||
unzip gki-kernel.zip
|
|
||||||
tools/mkbootimg/unpack_bootimg.py --boot_img=$(find . -maxdepth 1 -name "*.img")
|
|
||||||
|
|
||||||
|
- name: Symbol magic
|
||||||
|
run: |
|
||||||
|
echo "[+] Export all symbol from abi_gki_aarch64.xml"
|
||||||
|
COMMON_ROOT=$GITHUB_WORKSPACE/android-kernel/common
|
||||||
|
KSU_ROOT=$GITHUB_WORKSPACE/KernelSU
|
||||||
|
ABI_XML=$COMMON_ROOT/android/abi_gki_aarch64.xml
|
||||||
|
SYMBOL_LIST=$COMMON_ROOT/android/abi_gki_aarch64
|
||||||
|
# python3 $KSU_ROOT/scripts/abi_gki_all.py $ABI_XML > $SYMBOL_LIST
|
||||||
|
echo "[+] Add KernelSU symbols"
|
||||||
|
cat $KSU_ROOT/kernel/export_symbol.txt | awk '{sub("[ \t]+","");print " "$0}' >> $SYMBOL_LIST
|
||||||
|
|
||||||
- name: Build boot.img
|
- name: Build boot.img
|
||||||
working-directory: android-kernel
|
working-directory: android-kernel
|
||||||
run: BUILD_BOOT_IMG=1 SKIP_VENDOR_BOOT=1 KERNEL_BINARY=Image GKI_RAMDISK_PREBUILT_BINARY=out/ramdisk AVB_SIGN_BOOT_IMG=1 AVB_BOOT_PARTITION_SIZE=$((64*1024*1024)) AVB_BOOT_ALGORITHM=SHA256_RSA2048 AVB_BOOT_KEY=prebuilts/kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem BOOT_IMAGE_HEADER_VERSION=4 LTO=thin BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh
|
run: BUILD_BOOT_IMG=1 SKIP_VENDOR_BOOT=1 KERNEL_BINARY=Image GKI_RAMDISK_PREBUILT_BINARY=out/ramdisk AVB_SIGN_BOOT_IMG=1 AVB_BOOT_PARTITION_SIZE=$((64*1024*1024)) AVB_BOOT_ALGORITHM=SHA256_RSA2048 AVB_BOOT_KEY=prebuilts/kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem BOOT_IMAGE_HEADER_VERSION=4 LTO=thin BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh
|
||||||
|
|||||||
28
.github/workflows/build-kernel-5.15.yml
vendored
28
.github/workflows/build-kernel-5.15.yml
vendored
@@ -29,13 +29,23 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
path: KernelSU
|
path: KernelSU
|
||||||
- name: Download Kernel Source
|
|
||||||
|
- name: Setup kernel source
|
||||||
run: |
|
run: |
|
||||||
cd $GITHUB_WORKSPACE
|
cd $GITHUB_WORKSPACE
|
||||||
git clone https://gerrit.googlesource.com/git-repo
|
git clone https://gerrit.googlesource.com/git-repo
|
||||||
mkdir android-kernel && cd android-kernel
|
mkdir android-kernel && cd android-kernel
|
||||||
../git-repo/repo init --depth=1 --u https://android.googlesource.com/kernel/manifest -b common-${{ matrix.tag }}
|
../git-repo/repo init --depth=1 --u https://android.googlesource.com/kernel/manifest -b common-${{ matrix.tag }}
|
||||||
../git-repo/repo sync -j$(nproc --all)
|
../git-repo/repo sync -j$(nproc --all)
|
||||||
|
curl -Lo gki-kernel.zip https://dl.google.com/android/gki/gki-certified-boot-${{ matrix.tag }}_r1.zip
|
||||||
|
unzip gki-kernel.zip
|
||||||
|
tools/mkbootimg/unpack_bootimg.py --boot_img=$(find . -maxdepth 1 -name "*.img")
|
||||||
|
|
||||||
|
- name: Setup KernelSU
|
||||||
|
env:
|
||||||
|
PATCH_PATH: "5.15"
|
||||||
|
run: |
|
||||||
|
cd $GITHUB_WORKSPACE/android-kernel
|
||||||
echo "[+] KernelSU setup"
|
echo "[+] KernelSU setup"
|
||||||
GKI_ROOT=$(pwd)
|
GKI_ROOT=$(pwd)
|
||||||
echo "[+] GKI_ROOT: $GKI_ROOT"
|
echo "[+] GKI_ROOT: $GKI_ROOT"
|
||||||
@@ -44,9 +54,21 @@ jobs:
|
|||||||
echo "[+] Add kernel su driver to Makefile"
|
echo "[+] Add kernel su driver to Makefile"
|
||||||
DRIVER_MAKEFILE=$GKI_ROOT/common/drivers/Makefile
|
DRIVER_MAKEFILE=$GKI_ROOT/common/drivers/Makefile
|
||||||
grep -q "kernelsu" $DRIVER_MAKEFILE || echo "obj-y += kernelsu/" >> $DRIVER_MAKEFILE
|
grep -q "kernelsu" $DRIVER_MAKEFILE || echo "obj-y += kernelsu/" >> $DRIVER_MAKEFILE
|
||||||
echo "[+] KernelSU setup Done."
|
echo "[+] Apply KernelSU patches"
|
||||||
cd $GKI_ROOT/common/ && git apply $GITHUB_WORKSPACE/KernelSU/.github/patches/5.15/*.patch
|
cd $GKI_ROOT/common/ && git apply $GITHUB_WORKSPACE/KernelSU/.github/patches/$PATCH_PATH/*.patch
|
||||||
cd -
|
cd -
|
||||||
|
echo "[+] KernelSU setup Done."
|
||||||
|
|
||||||
|
- name: Symbol magic
|
||||||
|
run: |
|
||||||
|
echo "[+] Export all symbol from abi_gki_aarch64.xml"
|
||||||
|
COMMON_ROOT=$GITHUB_WORKSPACE/android-kernel/common
|
||||||
|
KSU_ROOT=$GITHUB_WORKSPACE/KernelSU
|
||||||
|
ABI_XML=$COMMON_ROOT/android/abi_gki_aarch64.xml
|
||||||
|
SYMBOL_LIST=$COMMON_ROOT/android/abi_gki_aarch64
|
||||||
|
# python3 $KSU_ROOT/scripts/abi_gki_all.py $ABI_XML > $SYMBOL_LIST
|
||||||
|
echo "[+] Add KernelSU symbols"
|
||||||
|
cat $KSU_ROOT/kernel/export_symbol.txt | awk '{sub("[ \t]+","");print " "$0}' >> $SYMBOL_LIST
|
||||||
|
|
||||||
- name: Build boot.img
|
- name: Build boot.img
|
||||||
working-directory: android-kernel
|
working-directory: android-kernel
|
||||||
|
|||||||
2
kernel/export_symbol.txt
Normal file
2
kernel/export_symbol.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
register_kprobe
|
||||||
|
unregister_kprobe
|
||||||
10
scripts/abi_gki_all.py
Normal file
10
scripts/abi_gki_all.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
from xml.dom.minidom import parse
|
||||||
|
import xml.dom.minidom
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
DOMTree = xml.dom.minidom.parse(sys.argv[1])
|
||||||
|
symbols = DOMTree.getElementsByTagName("elf-symbol")
|
||||||
|
print("[abi_symbol_list]")
|
||||||
|
for symbol in symbols:
|
||||||
|
print(" " + symbol.getAttribute("name"))
|
||||||
Reference in New Issue
Block a user