Skip to content

Commit

Permalink
feat: add defconfig specification, switch to uv
Browse files Browse the repository at this point in the history
  • Loading branch information
seppzer0 authored Sep 14, 2024
1 parent 1e2cf7f commit d0a0133
Show file tree
Hide file tree
Showing 46 changed files with 1,026 additions and 1,377 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/github-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ jobs:
python-version: "3.12"
- name: Build And Assemble
run: |
python3 -m pip install poetry
python3 -m poetry config virtualenvs.create false
python3 -m poetry install --no-root
python3 -m pip install -r uv-version.txt
python3 -m uv sync --frozen --no-install-project
export PYTHONPATH=$(pwd)
python3 scripts/run_tests.py
python3 scripts/multi_build.py
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# basic
__pycache__
.venv
.vscode
.coverage
.pytest_cache
Expand Down
5 changes: 2 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ job-build:
- docker:dind
script:
- apk update && apk add python3 py3-pip
- python3 -m pip install poetry --break-system-packages
- python3 -m poetry config virtualenvs.create false
- python3 -m poetry install --no-root
- python3 -m pip install -r uv-version.txt --break-system-packages
- python3 -m uv sync --frozen --no-install-project
- export PYTHONPATH=$(pwd)
- python3 scripts/run_tests.py
- python3 scripts/multi_build.py
Expand Down
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ RUN \

# configure Python environment
RUN python3 -m pip install pip --upgrade && \
python3 -m pip install poetry && \
python3 -m poetry config virtualenvs.create false && \
python3 -m poetry install --no-root
python3 -m pip install -r uv-version.txt && \
python3 -m uv sync --frozen --no-install-project

# install shared tools from tools.json;
#
Expand Down
File renamed without changes.
62 changes: 24 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ The kernel has the following features:
- Kali NetHunter support;
- RTL8812/21AU + RTL8814AU + RTL8187 Wi-Fi drivers;
- packet injection support for internal Wi-Fi chipset;
- optional KernelSU support.
- optional KernelSU support (v0.9.5, max compatible version for non-GKI kernels).

## Supported Devices & ROMs

Expand Down Expand Up @@ -92,7 +92,7 @@ Commands:
- `bundle`.

```help
$ python3 builder --help
$ uv run builder --help
usage: builder [-h] [--clean] {kernel,assets,bundle} ...
A custom builder for the zero_kernel.
Expand Down Expand Up @@ -120,24 +120,25 @@ To run this tool in a `local` environment, you will need:
- a Debian-based Linux distribution (other types of distros are untested);
- a few [packages](Dockerfile#L15) installed in your system.

You will also need to configure your Python installation, including some of the packages installation:
You will also need to install [uv](https://github.com/astral-sh/uv). Please refer to [installation guide](https://docs.astral.sh/uv/getting-started/installation/) to choose an option fit for you. It is recommended to use `pip` to install the version tracked and confirmed to be working in the project.

```sh
# making "builder" executable from source
export PYTHONPATH=$(pwd)
python3 -m pip install poetry
python3 -m poetry install --no-root
# installing uv via pip
python3 -m pip install -r uv-version.txt
# collecting project dependencies into a local .venv
uv sync --frozen --no-install-project
```

### Kernel

Kernel build process can be launched using the `kernel` subcommand.

```help
$ python3 builder kernel --help
usage: builder kernel [-h] --build-env {local,docker,podman} --base
{los,pa,x,aosp} --codename CODENAME --lkv LKV [-c]
[--clean-image] [--log-level {normal,verbose,quiet}]
[-o OUTLOG] [--ksu]
$ uv run builder kernel --help
usage: builder kernel [-h] --build-env {local,docker,podman} --base {los,pa,x,aosp}
--codename CODENAME --lkv LKV [-c] [--clean-image] [--ksu]
options:
-h, --help show this help message and exit
Expand All @@ -150,24 +151,18 @@ options:
-c, --clean don't build anything, only clean kernel directories
--clean-image remove Docker/Podman image from the host machine after
build
--log-level {normal,verbose,quiet}
select log level
-o OUTLOG, --output OUTLOG
save logs to a file
--ksu add KernelSU support
```

### Assets

As mentioned, there is also an asset downloader, which can collect latest versions of ROM, TWRP, Magisk and it's modules, Kali Chroot etc.

```help
$ python3 builder assets --help
usage: builder assets [-h] --build-env {local,docker,podman} --base
{los,pa,x,aosp} --codename CODENAME --chroot
{full,minimal} [--rom-only] [--clean-image] [--clean]
[--log-level {normal,verbose,quiet}] [-o OUTLOG] [--ksu]
$ uv run builder assets --help
usage: builder assets [-h] --build-env {local,docker,podman} --base {los,pa,x,aosp}
--codename CODENAME --chroot {full,minimal} [--rom-only]
[--clean-image] [--clean] [--ksu]
options:
-h, --help show this help message and exit
Expand All @@ -182,11 +177,9 @@ options:
--clean-image remove Docker/Podman image from the host machine after
build
--clean autoclean 'assets' folder if it exists
--log-level {normal,verbose,quiet}
select log level
-o OUTLOG, --output OUTLOG
save logs to a file
--ksu add KernelSU support
--defconfig DEFCONFIG
specify path to custom defconfig
```

### Bundle
Expand All @@ -208,12 +201,10 @@ Options `full` and `conan` collect all of the assets required to successfuly fla
Option named `slim` is a much lighter version of `full` packaging, as only the ROM is collected from the asset list. This is done to reduce package sizes while ensuring the kernel+ROM compatibility.

```help
$ python3 builder bundle --help
usage: builder bundle [-h] --build-env {local,docker,podman} --base
{los,pa,x,aosp} --codename CODENAME --lkv LKV
--package-type {conan,slim,full} [--conan-upload]
[--clean-image] [--log-level {normal,verbose,quiet}]
[-o OUTLOG] [--ksu]
$ uv run builder bundle --help
usage: builder bundle [-h] --build-env {local,docker,podman} --base {los,pa,x,aosp}
--codename CODENAME --lkv LKV --package-type
{conan,slim,full} [--conan-upload] [--clean-image] [--ksu]
options:
-h, --help show this help message and exit
Expand All @@ -228,10 +219,6 @@ options:
--conan-upload upload Conan packages to remote
--clean-image remove Docker/Podman image from the host machine after
build
--log-level {normal,verbose,quiet}
select log level
-o OUTLOG, --output OUTLOG
save logs to a file
--ksu add KernelSU support
```

Expand All @@ -242,19 +229,19 @@ Here are some examples of commands:
**(Recommended)** Build kernel and collect ROM via Docker:

```sh
python3 builder bundle --build-env=docker --base=los --codename=dumpling --lkv=4.4 --package-type=slim
uv run builder bundle --build-env=docker --base=los --codename=dumpling --lkv=4.4 --package-type=slim
```

Build kernel locally:

```sh
python3 builder kernel --build-env=local --base=los --codename=dumpling --lkv=4.4
uv run builder kernel --build-env=local --base=los --codename=dumpling --lkv=4.4
```

Collect all of the assets locally:

```sh
python3 builder assets --build-env=local --base=los --codename=dumpling --package-type=full
uv run builder assets --build-env=local --base=los --codename=dumpling --package-type=full
```

## See also
Expand All @@ -266,6 +253,5 @@ python3 builder assets --build-env=local --base=los --codename=dumpling --packag
## Credits

- [x_kernel_oneplus_msm8998](https://github.com/ederekun/x_kernel_oneplus_msm8998): OnePlus 5/T kernel with many optimizations and improvements;
- [x-ft_kernel_oneplus_msm8998](https://github.com/ederekun/x-ft_kernel_oneplus_msm8998): 4.14-based variation of x_kernel;
- [4.14-kernel-oneplus-msm8998](https://github.com/roberto-sartori-gl/4.14-kernel-oneplus-msm8998): a base of 4.14 kernels for OnePlus 5/T, with KernelSU patches;
- [kali-nethunter-kernel](https://gitlab.com/kalilinux/nethunter/build-scripts/kali-nethunter-kernel): official kernel patches from Kali NetHunter project.
Loading

0 comments on commit d0a0133

Please sign in to comment.