Skip to content

Commit

Permalink
Dev (bmax121#46)
Browse files Browse the repository at this point in the history
1. Embed KPM support, add KPM control interface
2. Re-patch kernel image support
3. Start supporting KALLSYMS_ALL=n, but still some issues
4. bug fix
  • Loading branch information
bmax121 authored Jan 27, 2024
1 parent f89cc0e commit 47f299a
Show file tree
Hide file tree
Showing 85 changed files with 5,790 additions and 1,621 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,20 @@ name: Build CI
on:
push:
branches: ["main"]
paths:
- ".github/workflows/build.yml"
- "kernel/**"
- "user/**"
- "tools/**"
- "version"
pull_request:
branches: ["main"]
paths:
- ".github/workflows/build.yml"
- "kernel/**"
- "user/**"
- "tools/**"
- "version"

jobs:
Build-kpimg:
Expand Down
19 changes: 18 additions & 1 deletion .github/workflows/build_dev.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
name: Build CI
name: Build DEV CI

on:
push:
branches: ["dev"]
paths:
- ".github/workflows/build.yml"
- "kernel/**"
- "user/**"
- "tools/**"
- "version"
pull_request:
branches: ["dev"]
paths:
- ".github/workflows/build.yml"
- "kernel/**"
- "user/**"
- "tools/**"
- "version"

jobs:
Build-kpimg:
Expand Down Expand Up @@ -57,6 +69,7 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.parse_version.outputs.VERSION }}-dev
commit: dev
artifacts: |
kernel/kpimg-linux
kernel/kpimg-android
Expand Down Expand Up @@ -95,6 +108,7 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.parse_version.outputs.VERSION }}-dev
commit: dev
artifacts: |
kpuser.zip
allowUpdates: true
Expand Down Expand Up @@ -167,6 +181,7 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.parse_version.outputs.VERSION }}-dev
commit: dev
artifacts: |
user/build/android/kpatch-android
user/build/android/libapjni.so
Expand Down Expand Up @@ -212,6 +227,7 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.parse_version.outputs.VERSION }}-dev
commit: dev
artifacts: |
tools/build/kptools-linux
allowUpdates: true
Expand Down Expand Up @@ -254,6 +270,7 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.parse_version.outputs.VERSION }}-dev
commit: dev
artifacts: |
tools/build/kptools-mac
allowUpdates: true
Expand Down
73 changes: 73 additions & 0 deletions .github/workflows/build_kpm_demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Build KPM-DEMO CI

on:
push:
branches: ["main", "dev"]
paths:
- ".github/workflows/build_kpm_demo.yml"
- "kernel/**"
- "kpm-demo/**"
- "version"
pull_request:
branches: ["main", "dev"]
paths:
- ".github/workflows/build_kpm_demo.yml"
- "kernel/**"
- "kpm-demo/**"
- "version"

jobs:
Build-kpm-demos:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out
uses: actions/checkout@v3
with:
submodules: "recursive"
fetch-depth: 0
- name: Generate version
id: parse_version
run: |
MAJOR=$(grep '#define MAJOR' version | awk '{print $3}')
MINOR=$(grep '#define MINOR' version | awk '{print $3}')
PATCH=$(grep '#define PATCH' version | awk '{print $3}')
VERSION="$MAJOR.$MINOR.$PATCH"
echo "Generated Version: $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Extract branch name
shell: bash
id: extract_branch
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT

- name: Install Compiler
run: |
curl -o arm-gnu-toolchain-12.2.rel1-x86_64-aarch64-none-elf.tar.xz https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu/12.2.rel1/binrel/arm-gnu-toolchain-12.2.rel1-x86_64-aarch64-none-elf.tar.xz
tar -Jxf arm-gnu-toolchain-12.2.rel1-x86_64-aarch64-none-elf.tar.xz
- name: Build kpimg
run: |
export TARGET_COMPILE=`pwd`/arm-gnu-toolchain-12.2.rel1-x86_64-aarch64-none-elf/bin/aarch64-none-elf-
cd kpm-demo
cd hello
make
mv hello.kpm hello-demo.kpm
cd ../inlinehook
make
mv inlinehook.kpm inlinehook-demo.kpm
cd ../syscallhook
make
mv syscallhook.kpm syscallhook-demo.kpm
- name: Release
uses: ncipollo/release-action@v1.12.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.parse_version.outputs.VERSION }}-${{ steps.extract_branch.outputs.branch }}
artifacts: |
kpm-demo/hello/hello-demo.kpm
kpm-demo/inlinehook/inlinehook-demo.kpm
kpm-demo/syscallhook/syscallhook-demo.kpm
allowUpdates: true
replacesArtifacts: true
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ If you are using Android, [APatch](https://github.com/bmax121/APatch) would be a
## Requirement
CONFIG_KALLSYMS=y
CONFIG_KALLSYMS_ALL=y (CONFIG_KALLSYMS_ALL=n, Planned support)
## Supported Versions
Expand Down
4 changes: 2 additions & 2 deletions doc/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

## Build kpimg

Need to use a bare-metal cross-compiler.
[Download](https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads)
Require a bare-metal cross compiler
[Download here](https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads)

```shell
export TARGET_COMPILE=aarch64-none-elf-
Expand Down
Empty file removed doc/faq.md
Empty file.
1 change: 1 addition & 0 deletions kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ BASE_SRCS += base/fphook.c
BASE_SRCS += base/hmem.c
BASE_SRCS += base/predata.c
BASE_SRCS += base/symbol.c
BASE_SRCS += base/baselib.c

BASE_SRCS += $(wildcard patch/*.c)
BASE_SRCS += $(wildcard patch/common/*.c)
Expand Down
Loading

0 comments on commit 47f299a

Please sign in to comment.