diff --git a/.github/workflows/slim.yml b/.github/workflows/cd.yml similarity index 97% rename from .github/workflows/slim.yml rename to .github/workflows/cd.yml index 59020e6..4c0ed23 100644 --- a/.github/workflows/slim.yml +++ b/.github/workflows/cd.yml @@ -12,8 +12,8 @@ on: default: "false" type: choice options: - - true - - false + - "true" + - "false" permissions: contents: write diff --git a/.gitignore b/.gitignore index 470e3e4..d21d7f6 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ /rtl8812au /AnyKernel3 /KernelSU +/*_kernel_* # misc local artifacts /*.log @@ -17,3 +18,4 @@ /source /bundle /localversion +/multi-slim \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index e232560..bed217e 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ -FROM python:3.11-slim-bookworm as base +FROM python:3.12-slim-bookworm as base # variable store -ARG WDIR="/s0nh_build" +ARG WDIR="/zero_build" ENV CONAN_UPLOAD_CUSTOM 0 # install basic packages @@ -19,7 +19,9 @@ RUN \ make \ zip \ bc \ - libgpgme-dev + libgpgme-dev \ + bison \ + flex # place sources from host to container COPY . $WDIR diff --git a/README.md b/README.md index 74ea915..2bc7f1a 100755 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# s0nh_kernel — an Android kernel w/ Kali NetHunter support +# zero_kernel — an Android kernel w/ Kali NetHunter support ## **Disclaimer** @@ -8,24 +8,26 @@ **Anything you do with this kernel you do at your own risk. By using it, you take the responsibility upon yourself and in case of any issue you are not to blame me or other related contributors.** -## **Contents** +## Contents -- [s0nh\_kernel — an Android kernel w/ Kali NetHunter support](#s0nh_kernel--an-android-kernel-w-kali-nethunter-support) +- [zero\_kernel — an Android kernel w/ Kali NetHunter support](#zero_kernel--an-android-kernel-w-kali-nethunter-support) - [**Disclaimer**](#disclaimer) - - [**Contents**](#contents) - - [**Kernel Features**](#kernel-features) - - [**Supported ROMs and devices**](#supported-roms-and-devices) - - [**ROMs**](#roms) - - [**Devices**](#devices) - - [**Usage**](#usage) - - [**Prerequisites**](#prerequisites) - - [**Kernel**](#kernel) - - [**Assets**](#assets) - - [**Bundle**](#bundle) - - [**Examples**](#examples) - - [**See also**](#see-also) - -## **Kernel Features** + - [Contents](#contents) + - [Kernel Features](#kernel-features) + - [Supported ROMs and devices](#supported-roms-and-devices) + - [ROMs](#roms) + - [Devices](#devices) + - [Important Note](#important-note) + - [Usage](#usage) + - [Prerequisites](#prerequisites) + - [Kernel](#kernel) + - [Assets](#assets) + - [Bundle](#bundle) + - [Examples](#examples) + - [Credits](#credits) + - [See also](#see-also) + +## Kernel Features The kernel has the following features: @@ -34,21 +36,32 @@ The kernel has the following features: - packet injection support for internal Wi-Fi chipset; - KernelSU support. -## **Supported ROMs and devices** +## Supported ROMs and devices -#### **ROMs** +#### ROMs - LineageOS; -- ParanoidAndroid. +- ParanoidAndroid; +- x_kernel supported (universal)*. -#### **Devices** +\* -- this is mostly relevant to ROMs based on LineageOS; however, technically speaking, this includes ParanoidAndroid as well, which makes x_kernel-based builds universal. + +#### Devices - OnePlus 5; - OnePlus 5T. -## **Usage** +## Important Note + +The contents of each release include ROM builds compatible with corresponding kernel builds. These ROM files are **unmodified and mirrored from official sources**. + +This can be verified with the checksums, which should be identical to the ones presented on the ROM project's official web page. + +You can always download the same ROM file from official sources if you'd like. The mirroring in this repository is done due to the fact that some ROM projects remove their older builds once they become too outdated. + +## Usage -The custom build wrapper consists of 3 main parts: +The custom build wrapper consists of 3 main components: - kernel builder; - assets collector; @@ -58,7 +71,7 @@ The custom build wrapper consists of 3 main parts: $ python3 wrapper --help usage: wrapper [-h] [--clean] {kernel,assets,bundle} ... -A custom wrapper for the s0nh_kernel. +A custom wrapper for the zero_kernel. positional arguments: {kernel,assets,bundle} @@ -71,7 +84,7 @@ optional arguments: --clean clean the root directory ``` -### **Prerequisites** +### Prerequisites **It is highly recommended to use `docker` option to run this tool.** For that you need Docker Engine or Docker Desktop, depending on your OS. @@ -83,12 +96,12 @@ To run this tool in a `local` environment, you will need: You will also need a few Python packages. To install them, use: ```sh -python3 -m poetry install +python3 -m poetry install --no-root ``` To install `poetry`, use `python3 -m pip install poetry`. -### **Kernel** +### Kernel Kernel build process can be launched by using the `python3 wrapper kernel ` command. @@ -98,15 +111,15 @@ For more options you can refer to the help message below. $ python3 wrapper kernel --help usage: wrapper kernel [-h] [-c] [--clean-image] [--log-level {normal,verbose,quiet}] [-o OUTLOG] [--ksu] - {local,docker,podman} {los,pa} codename + {local,docker,podman} {los,pa,x} codename positional arguments: {local,docker,podman} select build environment - {los,pa} select a ROM for the build + {los,pa,x} select a ROM for the build codename select device codename -optional arguments: +options: -h, --help show this help message and exit -c, --clean don't build anything, just clean the environment --clean-image remove Docker/Podman image from the host machine after @@ -118,7 +131,7 @@ optional arguments: --ksu add KernelSU support ``` -### **Assets** +### 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. @@ -127,17 +140,16 @@ $ python3 wrapper assets --help usage: wrapper assets [-h] [--extra-assets EXTRA_ASSETS] [--rom-only] [--clean-image] [--clean] [--log-level {normal,verbose,quiet}] [-o OUTLOG] [--ksu] - {local,docker,podman} {los,pa} codename - {full,minimal} + {local,docker,podman} {los,pa,x} codename {full,minimal} positional arguments: {local,docker,podman} select build environment - {los,pa} select a ROM for the build + {los,pa,x} select a ROM for the build codename select device codename {full,minimal} select Kali chroot type -optional arguments: +options: -h, --help show this help message and exit --extra-assets EXTRA_ASSETS select a JSON file with extra assets @@ -152,7 +164,7 @@ optional arguments: --ksu add KernelSU support ``` -### **Bundle** +### Bundle There is an option named `bundle` which combines build artifacts of both `kernel` and `assets` modules into a single package. @@ -174,17 +186,17 @@ An option named `slim` is a much lighter version of `full` packaging, as only th $ python3 wrapper bundle --help usage: wrapper bundle [-h] [--conan-upload] [--clean-image] [--log-level {normal,verbose,quiet}] [-o OUTLOG] [--ksu] - {local,docker,podman} {los,pa} codename + {local,docker,podman} {los,pa,x} codename {conan,slim,full} positional arguments: {local,docker,podman} select build environment - {los,pa} select a ROM for the build + {los,pa,x} select a ROM for the build codename select device codename {conan,slim,full} select package type of the bundle -optional arguments: +options: -h, --help show this help message and exit --conan-upload upload Conan packages to remote --clean-image remove Docker/Podman image from the host machine after @@ -196,7 +208,7 @@ optional arguments: --ksu add KernelSU support ``` -## **Examples** +## Examples Here are some examples of commands: @@ -207,7 +219,12 @@ Here are some examples of commands: - Collect all the assets locally: - `python3 wrapper assets local los dumpling full`. -## **See also** +## Credits + +- [x_kernel_oneplus_msm8998](https://github.com/ederekun/x_kernel_oneplus_msm8998): OnePlus 5/T kernel with many optimizations and improvements; +- [kali-nethunter-kernel](https://gitlab.com/kalilinux/nethunter/build-scripts/kali-nethunter-kernel): official kernel patches from Kali NetHunter project. + +## See also - [FAQ](docs/FAQ.md); - [TODO List](docs/TODO.md); diff --git a/conanfile.py b/conanfile.py index 159535f..8e47c0c 100644 --- a/conanfile.py +++ b/conanfile.py @@ -2,15 +2,15 @@ class S0nhConan(ConanFile): - name = "s0nh" - version = "0.3.2" + name = "zero" + version = "0.3.3" author = "seppzer0" url = "https://gitlab.com/api/v4/projects/40803264/packages/conan" description = "An Android kernel w/ Kali NetHunter support." - topics = ("s0nh_kernel", "kali-nethunter") + topics = ("zero_kernel", "kali-nethunter") settings = None options = { - "rom": ("los, pa"), + "rom": ("los", "pa", "x"), "chroot": ("minimal", "full"), "codename": ("dumpling", "cheeseburger") } diff --git a/docs/FLASHING.md b/docs/FLASHING.md index 8bab8be..fad684b 100755 --- a/docs/FLASHING.md +++ b/docs/FLASHING.md @@ -27,7 +27,7 @@ Listed below files are required: - DM-Verity and Force Encrypt disabler; - Kali NetHunter + Kali NetHunter Terminal apps; - Kali NetHunter Chroot (you can do this later, but it would be easier to download this beforehand); -- `nhpatch.sh` script from this repo (fixes NetHunter permissions for Android 12+). +- ~~`nhpatch.sh` script from this repo (fixes NetHunter permissions for Android 12+)~~ with recent NetHunter app versions, `nhpatch.sh` usage is no longer required. Currently, all of the mentioned assets can be collected via the `assets` subcommand in the wrapper (use `full` option). @@ -63,9 +63,7 @@ Before doing anything, please ensure that you have: - install Magisk apk, open it and do what the pop-up says (finish root installation, which will automatically reboot your device; if you don't see the pop-up, close the Magisk app and open it again); - once booted back into OS, open Magisk app again and proceed with finishing the installation (when prompted with "Additional Setup", select the default `Patch vbmeta in boot image` in `Options` and `Direct install` in `Method` submenus); - install NetHunter + NetHunter Terminal apps; -- open NetHunter app and grant all the permissions (at some point you will see an error indicating that some permissions are not granted; that's normal, the next step will fix that); -- in NetHunter Terminal app open `AndroidSu` shell, navigate through your storage and launch the `nhpatch.sh`; -- open NetHunter app (permissions should be fixed now); +- open NetHunter app (if seeing a Busybox-related error, press "OK" and re-open the app); - navigate to the `Kali Chroot Manager` submenu and install the chroot (if you downloaded it beforehand, use the "restore" option); - in NetHunter Terminal app open `Kali` shell (if it opens properly, then congratulations, you have a working Kali NetHunter on your device). @@ -74,8 +72,10 @@ Before doing anything, please ensure that you have: - install KernelSU Manager app, open it and verify that the `Superuser` tab works properly (should show the `Shell` item); - install NetHunter and NetHunter Terminal apps, but do not open them yet; - open KernelSU Manager app, grant SU permissions to both NetHunter and NetHunter Terminal apps via `Superuser` tab; -- in NetHunter Terminal app open `AndroidSu` shell, navigate through your storage and launch the `nhpatch.sh`; -- open the NetHunter app; -- when seeing the Busybox-related error, ignore it and re-open the app; +- open the NetHunter app (if seeing a Busybox-related error, press "OK" and re-open the app); - navigate to the `Kali Chroot Manager` submenu and install the chroot (if you downloaded it beforehand, use the "restore" option); - in NetHunter Terminal app open `Kali` shell (if it opens properly, then congratulations, you have a working Kali NetHunter on your device). + +#### For x_kernel-based kernel + ParanoidAndroid users + +This is a small side-note for using x_kernel-based build with ParanoidAndroid ROM. When booting into OS, you will see a message that `There is an internal problem with this device. Please call manufacturer.`. This warning is essentially similar to the unlocked bootloader message and is completely harmless. Press "OK" and proceed. diff --git a/docs/TODO.md b/docs/TODO.md index 79c02e4..88b0aa7 100755 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -52,4 +52,6 @@ - [x] decompose `run()` method in `ContainerEngine`; - [x] skip building Docker/Podman image if it's already present in local cache; - [x] for containerized build, download the contents of manifests during image build; -- [ ] add system app debloater. +- [ ] add system app debloater; +- [ ] add a new argument respobsible for Linux kernel version selection; +- [ ] add 4.14 Linux kernel version builds. diff --git a/pyproject.toml b/pyproject.toml index cc53e00..a334ce2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] -name = "s0nh-kernel-builder" -version = "0.3.2" +name = "zero-kernel-builder" +version = "0.3.3" description = "" authors = ["seppzer0"] packages = [{include = "wrapper"}] diff --git a/scripts/multi_build.py b/scripts/multi_build.py index 558a36d..145782f 100644 --- a/scripts/multi_build.py +++ b/scripts/multi_build.py @@ -34,29 +34,41 @@ def ucopy(src: Path, dst: Path, exceptions: list[str] = []) -> None: apath = Path(Path(__file__).absolute().parents[1]) # those with "bundle" module usage are primarily tested builds argsets = ( - { - "module": "bundle", - "rom": "los", - "codename": "dumpling", - "ksu": "false", - "size": "slim" - }, - { - "module": "bundle", - "rom": "pa", - "codename": "dumpling", - "ksu": "false", - "size": "slim" - }, + #{ + # "module": "bundle", + # "rom": "los", + # "codename": "dumpling", + # "ksu": "false", + # "size": "slim" + #}, + #{ + # "module": "bundle", + # "rom": "pa", + # "codename": "dumpling", + # "ksu": "false", + # "size": "slim" + #}, + #{ + # "module": "kernel", + # "rom": "los", + # "codename": "dumpling", + # "ksu": "true" + #}, + #{ + # "module": "kernel", + # "rom": "pa", + # "codename": "dumpling", + # "ksu": "true" + #}, { "module": "kernel", - "rom": "los", + "rom": "x", "codename": "dumpling", - "ksu": "true" + "ksu": "false" }, { "module": "kernel", - "rom": "pa", + "rom": "x", "codename": "dumpling", "ksu": "true" }, diff --git a/wrapper/__main__.py b/wrapper/__main__.py index 8ad457c..9d43775 100644 --- a/wrapper/__main__.py +++ b/wrapper/__main__.py @@ -23,7 +23,7 @@ def parse_args() -> argparse.Namespace: # show the 'help' message if no arguments supplied args = None if sys.argv[1:] else ["-h"] # parser and subparsers - parser_parent = argparse.ArgumentParser(description="A custom wrapper for the s0nh kernel.") + parser_parent = argparse.ArgumentParser(description="A custom wrapper for the zero kernel.") subparsers = parser_parent.add_subparsers(dest="command") parser_kernel = subparsers.add_parser("kernel", help="build the kernel") parser_assets = subparsers.add_parser("assets", help="collect assets") @@ -43,7 +43,7 @@ def parse_args() -> argparse.Namespace: help_loglvl = "select log level" choices_buildenv = ("local", "docker", "podman") choices_loglvl = ("normal", "verbose", "quiet") - choices_rom = ("los", "pa") + choices_rom = ("los", "pa", "x") help_logfile = "save logs to a file" help_ksu = "add KernelSU support" default_loglvl = "normal" diff --git a/wrapper/clients/github.py b/wrapper/clients/github.py index 2ff3410..4053020 100644 --- a/wrapper/clients/github.py +++ b/wrapper/clients/github.py @@ -36,7 +36,7 @@ def run(self) -> str: except Exception: pass try: - # get direct download URL and optionally filter it by the given file filter + # get direct download URL and optionally filter it with the given parameter data = response["assets"] browser_download_urls = [] for elem in data: @@ -52,7 +52,7 @@ def run(self) -> str: else: data = "".join(browser_download_urls) except Exception: - # if not available via API -- use "git clone" + # if not available via API -- use regular "git clone" rdir = Path(self._assetdir, self._direct_url.rsplit("/", 1)[1]) msg.note(f"Non-API GitHub resolution for {self._project}") cm.remove(rdir) diff --git a/wrapper/clients/pa.py b/wrapper/clients/pa.py index 5f456c9..875c259 100644 --- a/wrapper/clients/pa.py +++ b/wrapper/clients/pa.py @@ -15,7 +15,7 @@ def __init__(self, codename: str, rom_only: bool) -> None: @property def _codename_pa(self) -> str: - """Custom codename-to-device mapper for PA API specifically.""" + """Custom codename-to-device mapper for PA API.""" name_dict = { "dumpling": "oneplus5t", "cheeseburger": "oneplus5", diff --git a/wrapper/engines/container.py b/wrapper/engines/container.py index 126a6aa..6c2231a 100644 --- a/wrapper/engines/container.py +++ b/wrapper/engines/container.py @@ -11,13 +11,13 @@ class ContainerEngine: """Use containers (Docker/Podman) for the build.""" - _name_image: str = "s0nh-image" - _name_container: str = "s0nh-container" + _name_image: str = "zero-kernel-image" + _name_container: str = "zero-kernel-container" _dir_init: Path = Path.cwd() _dir_kernel: Path = Path(cfg.DIR_KERNEL) _dir_assets: Path = Path(cfg.DIR_ASSETS) _dir_bundle: Path = Path(cfg.DIR_BUNDLE) - _wdir_docker: Path = Path("/", "s0nh_build") + _wdir_docker: Path = Path("/", "zero_build") _wdir_local: Path = cfg.DIR_ROOT def __init__(self, config: dict) -> None: @@ -61,13 +61,13 @@ def _wrapper_cmd(self) -> str: "--clean-kernel": self._clean_kernel, "--clean-assets": self._clean_assets, } - # extend with arguments in mind + # extend the command with given arguments for arg, value in arguments.items(): if value not in (None, False, True): cmd += f" {arg}={value}" elif value in (True,): cmd += f" {arg}" - # extend with packaging option in mind + # extend the command with the selected packaging option if self._build_module == "bundle": if self._package_type in ("slim", "full"): cmd += f" && chmod 777 -R {Path(self._wdir_docker, self._dir_bundle)}" @@ -77,8 +77,8 @@ def _wrapper_cmd(self) -> str: @property def _container_options(self) -> list[str]: - """Form a list of Docker options to pass.""" - # declare a base of options + """Form the list of Docker options.""" + # declare the base options = [ "-i", "--rm", @@ -151,9 +151,9 @@ def _build(self) -> None: alias = self._buildenv.capitalize() msg.note(f"Building the {alias} image..") os.chdir(self._wdir_local) - # do so only if it is not present in local cache + # build only if it is not present in local cache if self._name_image not in ccmd.launch("docker images --format '{{.Repository}}'", get_output=True): - # force enable Docker Buildkit to create Docker image + # force enable Docker Buildkit if self._buildenv == "docker": os.environ["DOCKER_BUILDKIT"] = "1" cmd = "{} build . -f {} -t {} --load".format( @@ -169,14 +169,14 @@ def _build(self) -> None: def run(self) -> None: self._build() - # form the "run" final command + # form the final "docker run" command cmd = '{} run {} {} /bin/bash -c "{}"'.format( self._buildenv, " ".join(self._container_options), self._name_image, self._wrapper_cmd ) - # prepare directories if required + # prepare directories self._create_dirs() ccmd.launch(cmd) # navigate to root directory and clean image from host machine diff --git a/wrapper/manifests/devices.json b/wrapper/manifests/devices.json index 4356286..6ef394d 100644 --- a/wrapper/manifests/devices.json +++ b/wrapper/manifests/devices.json @@ -13,6 +13,13 @@ "url": "https://github.com/AOSPA/android_kernel_oneplus_msm8998", "branch": "topaz", "commit": "" + }, + "x": { + "type": "git", + "path": "x_kernel_oneplus_msm8998", + "url": "https://github.com/ederekun/x_kernel_oneplus_msm8998", + "branch": "base", + "commit": "" } }, "cheeseburger": { @@ -29,6 +36,13 @@ "url": "https://github.com/AOSPA/android_kernel_oneplus_msm8998", "branch": "topaz", "commit": "" + }, + "x": { + "type": "git", + "path": "x_kernel_oneplus_msm8998", + "url": "https://github.com/ederekun/x_kernel_oneplus_msm8998", + "branch": "base", + "commit": "" } } } diff --git a/wrapper/manifests/tools.json b/wrapper/manifests/tools.json index 528ea17..320f333 100644 --- a/wrapper/manifests/tools.json +++ b/wrapper/manifests/tools.json @@ -25,7 +25,7 @@ "path": "rtl8812au", "url": "https://github.com/aircrack-ng/rtl8812au", "branch": "v5.6.4.2", - "commit": "" + "commit": "04f600e" }, "clang": { "type": "generic", @@ -36,7 +36,7 @@ "type": "git", "path": "KernelSU", "url": "https://github.com/tiann/KernelSU", - "branch": "v0.6.8", + "branch": "v0.7.0", "commit": "" } } diff --git a/wrapper/models/assets.py b/wrapper/models/assets.py index f34845a..fdf1558 100755 --- a/wrapper/models/assets.py +++ b/wrapper/models/assets.py @@ -37,7 +37,7 @@ def __init__( self._ksu = ksu def run(self) -> None: - msg.banner("s0nh Asset Collector") + msg.banner("zero asset collector") os.chdir(self._root) self._check() os.chdir(self._dir_assets) @@ -48,11 +48,12 @@ def run(self) -> None: rom_collector_dto = LineageOsApi(self._codename, self._rom_only) else: rom_collector_dto = ParanoidAndroidApi(self._codename, self._rom_only) - # process the ROM-only download + # process the "ROM-only" download if self._rom_only: fo.download(rom_collector_dto.run()) print("\n", end="") msg.done("ROM-only asset collection complete!") + # process the non-"RON-only" download else: assets = [ rom_collector_dto.run(), @@ -61,14 +62,19 @@ def run(self) -> None: assetdir=self._dir_assets, file_filter=".apk" ).run(), + GitHubApi( + project="seppzer0/Disable_Dm-Verity_ForceEncrypt", + assetdir=self._dir_assets + ).run(), GitHubApi( project="klausw/hackerskeyboard", assetdir=self._dir_assets, file_filter=".apk" ).run(), GitHubApi( - project="seppzer0/Disable_Dm-Verity_ForceEncrypt", - assetdir=self._dir_assets + project="aleksey-saenko/TTLChanger", + assetdir=self._dir_assets, + file_filter=".apk" ).run(), GitHubApi( project="ukanth/afwall", @@ -76,7 +82,12 @@ def run(self) -> None: file_filter=".apk" ).run(), GitHubApi( - project="laurent22/joplin-android", + project="emanuele-f/PCAPdroid", + assetdir=self._dir_assets, + file_filter=".apk" + ).run(), + GitHubApi( + project="nfcgate/nfcgate", assetdir=self._dir_assets, file_filter=".apk" ).run(), @@ -130,7 +141,7 @@ def run(self) -> None: def _check(self) -> None: """Initiate some checks before execution.""" os.chdir(self._root) - # directory validation + # directory check if not self._dir_assets.is_dir(): os.mkdir(self._dir_assets) else: diff --git a/wrapper/models/bundle.py b/wrapper/models/bundle.py index 28cdf3a..93465e6 100644 --- a/wrapper/models/bundle.py +++ b/wrapper/models/bundle.py @@ -34,7 +34,7 @@ def __init__( def run(self) -> None: os.chdir(self._root) - # get either a "kernel+ROM" or "kernel+assets=Conan" or "kernel+assets" bundle + # determine the bundle type and process it match self._package_type: case "slim" | "full": self._build_kernel(self._rom) @@ -65,7 +65,7 @@ def run(self) -> None: ) case "conan": # form Conan reference - name = "s0nh" + name = "zero_kernel" version = os.getenv("KVERSION") user = self._codename channel = "" @@ -178,7 +178,7 @@ def _conan_upload(reference: str) -> None: """ # configure Conan client and upload packages url = "https://gitlab.com/api/v4/projects/40803264/packages/conan" - alias = "s0nh-conan" + alias = "zero-kernel-conan" cmd = f"conan remote add {alias} {url} && "\ f"conan user -p {os.getenv('CONAN_PASSWORD')} -r {alias} {os.getenv('CONAN_LOGIN_USERNAME')} && "\ f"conan upload -f {reference} -r {alias}" diff --git a/wrapper/models/kernel.py b/wrapper/models/kernel.py index d4623ac..57e9a8d 100755 --- a/wrapper/models/kernel.py +++ b/wrapper/models/kernel.py @@ -26,7 +26,7 @@ def __init__(self, codename: str, rom: str, clean: bool, ksu: bool) -> None: self._rcs = Resources(codename=codename, rom=rom) def run(self) -> None: - msg.banner("s0nh Kernel Builder") + msg.banner("zero kernel builder") os.chdir(self._root) msg.note("Setting up tools and links..") # manage build resources @@ -41,11 +41,27 @@ def run(self) -> None: with open("localversion", "w") as f: f.write("~NetHunter-seppzer0") msg.done("Done! Tools are configured!") + # prepare defconfig if required + if self._linux_kernel_version == "4.14" and self._rom == "pa": + fo.ucopy( + self._rcs.paths[self._codename]["path"] /\ + "arch" /\ + "arm64" /\ + "configs" /\ + "vendor" /\ + self._defconfig, + + self._rcs.paths[self._codename]["path"] /\ + "arch" /\ + "arm64" /\ + "configs" /\ + self._defconfig, + ) # apply various patches self._patch_all() # build and package self._build() - self._form_release(f"{os.getenv('KNAME', 's0nh')}-{self._ucodename}") + self._form_release() @property def _ucodename(self) -> str: @@ -58,8 +74,17 @@ def _ucodename(self) -> str: @property def _defconfig(self) -> str: - """Determine defconfig file name based on ROM.""" - return "lineage_oneplus5_defconfig" if self._rom == "los" else "paranoid_defconfig" + """Determine defconfig file name. + + Depending on Linux kernel version (4.4 or 4.14) + the location for PA's defconfig is different. + """ + defconfigs = { + "los": "lineage_oneplus5_defconfig", + "pa": "paranoid_defconfig", + "x": "oneplus5_defconfig" + } + return defconfigs[self._rom] def _clean_build(self) -> None: """Clean environment from potential artifacts.""" @@ -137,14 +162,6 @@ def _patch_strict_prototypes(self) -> None: "msm_vidc_common.c": ("void msm_comm_handle_thermal_event()",), - self._rcs.paths[self._codename]["path"] /\ - "drivers" /\ - "soc" /\ - "qcom" /\ - "qdsp6v2" /\ - "voice_svc.c": - ("void msm_bus_rpm_set_mt_mask()",), - self._rcs.paths[self._codename]["path"] /\ "drivers" /\ "soc" /\ @@ -161,14 +178,6 @@ def _patch_strict_prototypes(self) -> None: "msm_bus_rpm_smd.c": ("void msm_bus_rpm_set_mt_mask()",), - self._rcs.paths[self._codename]["path"] /\ - "drivers" /\ - "soc" /\ - "qcom" /\ - "qdsp6v2" /\ - "voice_svc.c": - ("static int voice_svc_dummy_reg()",), - self._rcs.paths[self._codename]["path"] /\ "drivers" /\ "staging" /\ @@ -189,12 +198,6 @@ def _patch_strict_prototypes(self) -> None: "wlan_hdd_main.c": ("hdd_adapter_t *hdd_get_first_valid_adapter()",), - self._rcs.paths[self._codename]["path"] /\ - "drivers" /\ - "thermal" /\ - "msm_thermal-dev.c": - ("int msm_thermal_ioctl_init()", "void msm_thermal_ioctl_cleanup()",), - self._rcs.paths[self._codename]["path"] /\ "drivers" /\ "video" /\ @@ -211,9 +214,27 @@ def _patch_strict_prototypes(self) -> None: "mdss_util.c": ("struct mdss_util_intf *mdss_get_util_intf()",) } + # the following files are not present in 4.14 + if self._linux_kernel_version != "4.14": + extra_non_414 = { + self._rcs.paths[self._codename]["path"] /\ + "drivers" /\ + "soc" /\ + "qcom" /\ + "qdsp6v2" /\ + "voice_svc.c": + ("void msm_bus_rpm_set_mt_mask()", "static int voice_svc_dummy_reg()"), + + self._rcs.paths[self._codename]["path"] /\ + "drivers" /\ + "thermal" /\ + "msm_thermal-dev.c": + ("int msm_thermal_ioctl_init()", "void msm_thermal_ioctl_cleanup()",), + } + data.update(extra_non_414) # PA needs this, LineageOS does not if self._rom == "pa": - extra_data = { + extra_pa = { self._rcs.paths[self._codename]["path"] /\ "drivers" /\ "staging" /\ @@ -232,7 +253,7 @@ def _patch_strict_prototypes(self) -> None: "wlan_cfg.c": ("struct wlan_cfg_dp_soc_ctxt *wlan_cfg_soc_attach()",), } - data.update(extra_data) + data.update(extra_pa) # start the patching process contents = "" for fname, funcnames in data.items(): @@ -260,55 +281,45 @@ def _patch_anykernel3(self) -> None: def _patch_rtl8812au_source_mod_v5642(self) -> None: """Modifications specific to v5.6.4.2 driver version.""" - # modifying Makefile - og_lines = ( - "#EXTRA_CFLAGS += -Wno-parentheses-equality", - "#EXTRA_CFLAGS += -Wno-pointer-bool-conversion", - "$(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KSRC) M=$(shell pwd) modules", - "CONFIG_PLATFORM_I386_PC = y", - "CONFIG_PLATFORM_ANDROID_ARM64 = n" - ) - nw_lines = ( - "EXTRA_CFLAGS += -Wno-parentheses-equality", - "EXTRA_CFLAGS += -Wno-pointer-bool-conversion\nEXTRA_CFLAGS += -Wno-parentheses-equality\nEXTRA_CFLAGS += -Wno-pointer-bool-conversion\nEXTRA_CFLAGS += -Wno-pragma-pack", - '$(MAKE) ARCH=$(ARCH) SUBARCH=$(ARCH) REAL_CC=${CC_DIR}/clang CLANG_TRIPLE=aarch64-linux-gnu- CROSS_COMPILE=$(CROSS_COMPILE) -C $(KSRC) M=$(shell pwd) O="$(KBUILD_OUTPUT)" modules', - "CONFIG_PLATFORM_I386_PC = n", - "CONFIG_PLATFORM_ANDROID_ARM64 = y\nCONFIG_CONCURRENT_MODE = n", - ) + # Makefile fo.replace_lines( Path("Makefile").absolute(), - og_lines, - nw_lines - ) - # same with ioctl_cfg80211.h - og_lines = ( - "#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0))", - ) - nw_lines = ( - "#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0))", + ( + "#EXTRA_CFLAGS += -Wno-parentheses-equality", + "#EXTRA_CFLAGS += -Wno-pointer-bool-conversion", + "$(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KSRC) M=$(shell pwd) modules", + "CONFIG_PLATFORM_I386_PC = y", + "CONFIG_PLATFORM_ANDROID_ARM64 = n", + ), + ( + "EXTRA_CFLAGS += -Wno-parentheses-equality", + "EXTRA_CFLAGS += -Wno-pointer-bool-conversion\nEXTRA_CFLAGS += -Wno-pointer-bool-conversion\nEXTRA_CFLAGS += -Wno-pragma-pack\nEXTRA_CFLAGS += -Wno-unused-variable", + '$(MAKE) ARCH=$(ARCH) SUBARCH=$(ARCH) REAL_CC=${CC_DIR}/clang CLANG_TRIPLE=aarch64-linux-gnu- CROSS_COMPILE=$(CROSS_COMPILE) -C $(KSRC) M=$(shell pwd) O="$(KBUILD_OUTPUT)" modules', + "CONFIG_PLATFORM_I386_PC = n", + "CONFIG_PLATFORM_ANDROID_ARM64 = y\nCONFIG_CONCURRENT_MODE = n", + ) ) + # ioctl_cfg80211.h fo.replace_lines( Path("os_dep", "linux", "ioctl_cfg80211.h").absolute(), - og_lines, - nw_lines - ) - # ...and same with ioctl_cfg80211.c - og_lines = ( - "sinfo->bss_param.flags |= STATION_INFO_BSS_PARAM_SHORT_PREAMBLE;", - "sinfo->bss_param.flags |= STATION_INFO_BSS_PARAM_SHORT_SLOT_TIME;", - "sinfo->bss_param.flags |= STATION_INFO_BSS_PARAM_CTS_PROT;", - "sinfo->bss_param.flags |= STATION_INFO_BSS_PARAM_DTIM_PERIOD;", - ) - nw_lines = ( - "sinfo->bss_param.flags |= NL80211_STA_BSS_PARAM_SHORT_PREAMBLE;", - "sinfo->bss_param.flags |= NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME;", - "sinfo->bss_param.flags |= NL80211_STA_BSS_PARAM_CTS_PROT;", - "sinfo->bss_param.flags |= NL80211_STA_BSS_PARAM_DTIM_PERIOD;", + ("#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0))",), + ("#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0))",) ) + # ioctl_cfg80211.c fo.replace_lines( Path("os_dep", "linux", "ioctl_cfg80211.c").absolute(), - og_lines, - nw_lines + ( + "sinfo->bss_param.flags |= STATION_INFO_BSS_PARAM_SHORT_PREAMBLE;", + "sinfo->bss_param.flags |= STATION_INFO_BSS_PARAM_SHORT_SLOT_TIME;", + "sinfo->bss_param.flags |= STATION_INFO_BSS_PARAM_CTS_PROT;", + "sinfo->bss_param.flags |= STATION_INFO_BSS_PARAM_DTIM_PERIOD;", + ), + ( + "sinfo->bss_param.flags |= NL80211_STA_BSS_PARAM_SHORT_PREAMBLE;", + "sinfo->bss_param.flags |= NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME;", + "sinfo->bss_param.flags |= NL80211_STA_BSS_PARAM_CTS_PROT;", + "sinfo->bss_param.flags |= NL80211_STA_BSS_PARAM_DTIM_PERIOD;", + ) ) def _patch_rtl8812au(self) -> None: @@ -316,7 +327,7 @@ def _patch_rtl8812au(self) -> None: NOTE: .patch files are unreliable in this case, have to replace lines manually """ - # copy RTL8812AU sources into kernel path + # copy RTL8812AU sources into kernel sources msg.note("Adding RTL8812AU drivers into the kernel..") fo.ucopy( self._rcs.paths["rtl8812au"]["path"], @@ -327,7 +338,7 @@ def _patch_rtl8812au(self) -> None: "realtek" /\ "rtl8812au" ) - # modify sources depending on tested driver versions + # modify sources depending on driver version os.chdir( self._rcs.paths[self._codename]["path"] /\ "drivers" /\ @@ -387,11 +398,11 @@ def _patch_ksu(self) -> None: .git data. And having .git data in kernel sources is not ideal. """ msg.note("Adding KernelSU into the kernel..") - # extract KSU_GIT_VERSION env var manually + # extract KSU_GIT_VERSION environment variable manually goback = Path.cwd() os.chdir(self._rcs.paths["KernelSU"]["path"]) os.environ["KSU_GIT_VERSION"] = str( - # formula is retrieved from KernelSU's Makefile itself + # official formula documented in KernelSU's Makefile 10000 + int(ccmd.launch("git rev-list --count HEAD", get_output=True)) + 200 ) os.chdir(goback) @@ -403,7 +414,7 @@ def _patch_ksu(self) -> None: "Kconfig" # include into the build process via symlink os.symlink( - self._rcs.paths["KernelSU"]["path"] / cfg.DIR_KERNEL, + self._rcs.paths["KernelSU"]["path"] / "kernel", self._rcs.paths[self._codename]["path"] /\ "drivers" /\ "kernelsu" @@ -416,14 +427,13 @@ def _patch_ksu(self) -> None: "endmenu", "source \"drivers/kernelsu/Kconfig\"" ) - # update KernelSU source via .patch file + # apply related patch fo.ucopy( - self._root / "wrapper" / "modifications" / self._ucodename / cfg.DIR_KERNEL / "kernelsu-compat.patch", + self._root / "wrapper" / "modifications" / self._ucodename / self._linux_kernel_version / "kernelsu-compat.patch", self._rcs.paths[self._codename]["path"] ) os.chdir(self._rcs.paths[self._codename]["path"]) - for pf in Path.cwd().glob("*.patch"): - fo.apply_patch(pf) + fo.apply_patch("kernelsu-compat.patch") os.chdir(goback) # add configs into defconfig defconfig = self._rcs.paths[self._codename]["path"] /\ @@ -447,20 +457,34 @@ def _patch_ksu(self) -> None: f.write("\n".join(extra_configs)) f.write("\n") - def _patch_qcald(self) -> None: + def _patch_qcacld(self) -> None: """Patch QCACLD-3.0 defconfig to add support for monitor mode. Currently, this is required only for ParanoidAndroid. """ - qdefconfig = self._rcs.paths[self._codename]["path"] /\ - "drivers" /\ - "staging" /\ - "qcacld-3.0" /\ - "configs" /\ - "default_defconfig" - og_lines = ("CONFIG_FEATURE_MONITOR_MODE_SUPPORT := n",) - nw_lines = ("CONFIG_FEATURE_MONITOR_MODE_SUPPORT := y",) - fo.replace_lines(qdefconfig, og_lines, nw_lines) + goback = Path.cwd() + fo.ucopy( + self._root / "wrapper" / "modifications" / self._ucodename / self._linux_kernel_version / "qcacld_pa.patch", + self._rcs.paths[self._codename]["path"] + ) + os.chdir(self._rcs.paths[self._codename]["path"]) + fo.apply_patch("qcacld_pa.patch") + os.chdir(goback) + + def _patch_ioctl(self) -> None: + """Patch IOCTL buffer allocation.""" + ioctl = self._rcs.paths[self._codename]["path"] /\ + "drivers" /\ + "platform" /\ + "msm" /\ + "ipa" /\ + "ipa_v3" /\ + "ipa.c" + fo.replace_lines( + ioctl.absolute(), + (" u8 header[128] = { 0 };",), + (" u8 header[512] = { 0 };",), + ) def _patch_kernel(self) -> None: """Patch kernel sources. @@ -475,15 +499,14 @@ def _patch_kernel(self) -> None: self._patch_strict_prototypes() # apply .patch files fo.ucopy( - self._root / "wrapper" / "modifications" / self._ucodename / cfg.DIR_KERNEL, + self._root / "wrapper" / "modifications" / self._ucodename / self._linux_kernel_version, self._rcs.paths[self._codename]["path"], - ("kernelsu-compat.patch",) + ("kernelsu-compat.patch", "qcacld_pa.patch") ) os.chdir(self._rcs.paths[self._codename]["path"]) for pf in Path.cwd().glob("*.patch"): - if "kernelsu" not in str(pf): - fo.apply_patch(pf) - # additionally, add support for CONFIG_MAC80211 kernel option + fo.apply_patch(pf) + # add support for CONFIG_MAC80211 kernel option data = "" files = ("tx.c", "mlme.c") for fn in files: @@ -491,13 +514,15 @@ def _patch_kernel(self) -> None: data = f.read().replace("case IEEE80211_BAND_60GHZ:", "case NL80211_BAND_60GHZ:") with open(Path("net", "mac80211", fn), "w") as f: f.write(data) - # for ParanoidAndroid -- patch QCACLD-3.0 + # some patches only for ParanoidAndroid if self._rom == "pa": - self._patch_qcald() + if self._linux_kernel_version == "4.4": + self._patch_qcacld() + self._patch_ioctl() os.chdir(self._root) def _patch_all(self) -> None: - """Apply various patches.""" + """Apply all patches.""" self._patch_anykernel3() self._patch_kernel() # optionally include KernelSU support @@ -552,11 +577,26 @@ def _build(self) -> None: secs %= 60 msg.done("Done! Time spent for the build: %02d:%02d:%02d" % (hours, mins, secs)) - def _form_release(self, name: str) -> None: - """Pack build artifacts into a .zip archive. - - :param name: The name of the archive. - """ + @property + def _linux_kernel_version(self) -> str: + """Extract Linux kernel version number from sources.""" + data = "" + version = [] + with open(self._rcs.paths[self._codename]["path"] / "Makefile") as f: + data = f.read() + params = ("VERSION", "PATCHLEVEL") + # find the required lines in a single data run-through + for line in data.splitlines(): + for p in params: + if line.split(" =")[0] == p: + version.append(line.split(f"{p} = ")[1]) + # stop the loop when all values are found + if len(version) == len(params): + break + return ".".join(version) + + def _form_release(self) -> None: + """Pack build artifacts into a .zip archive.""" print("\n", end="") msg.note("Forming final ZIP file..") fo.ucopy( @@ -569,13 +609,12 @@ def _form_release(self, name: str) -> None: self._rcs.paths["AnyKernel3"]["path"] / "Image.gz-dtb" ) # define kernel versions: Linux and internal - with open(self._rcs.paths[self._codename]["path"] / "Makefile") as f: - head = [next(f) for x in range(3)] - ver_base = ".".join([i.split("= ")[1].splitlines()[0] for i in head]) + ver_base = self._linux_kernel_version ver_int = os.getenv("KVERSION") # form the final ZIP file - pretag = f"{name}-{self._rom}-ksu" if self._ksu else f"{name}-{self._rom}" - full_name = f"{pretag}-{ver_base}-{ver_int}" + name_base = f"{os.getenv('KNAME', 'zero')}-{self._ucodename}-{self._rom}" + name_midd = f"{name_base}-ksu" if self._ksu else name_base + full_name = f"{name_midd}-{ver_base}-{ver_int}" kdir = self._root / cfg.DIR_KERNEL if not kdir.is_dir(): os.mkdir(kdir) diff --git a/wrapper/modifications/dumplinger/4.14/add-wifi-injection-4.14.patch b/wrapper/modifications/dumplinger/4.14/add-wifi-injection-4.14.patch new file mode 100644 index 0000000..0b872f8 --- /dev/null +++ b/wrapper/modifications/dumplinger/4.14/add-wifi-injection-4.14.patch @@ -0,0 +1,130 @@ +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -580,7 +580,8 @@ static int ieee80211_set_monitor_channel + ret = ieee80211_vif_use_channel(sdata, chandef, + IEEE80211_CHANCTX_EXCLUSIVE); + } +- } else if (local->open_count == local->monitors) { ++ // Patch: Always allow channel change, even if a normal virtual interface is present ++ } else /*if (local->open_count == local->monitors)*/ { + local->_oper_chandef = *chandef; + ieee80211_hw_config(local, 0); + } +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -795,11 +795,19 @@ ieee80211_tx_h_sequence(struct ieee80211 + + /* + * Packet injection may want to control the sequence +- * number, if we have no matching interface then we +- * neither assign one ourselves nor ask the driver to. ++ * number, so if an injected packet is found, skip ++ * renumbering it. Also make the packet NO_ACK to avoid ++ * excessive retries (ACKing and retrying should be ++ * handled by the injecting application). ++ * FIXME This may break hostapd and some other injectors. ++ * This should be done using a radiotap flag. + */ +- if (unlikely(info->control.vif->type == NL80211_IFTYPE_MONITOR)) ++ if (unlikely((info->flags & IEEE80211_TX_CTL_INJECTED) && ++ !(tx->sdata->u.mntr.flags & MONITOR_FLAG_COOK_FRAMES))) { ++ if (!ieee80211_has_morefrags(hdr->frame_control)) ++ info->flags |= IEEE80211_TX_CTL_NO_ACK; + return TX_CONTINUE; ++ } + + if (unlikely(ieee80211_is_ctl(hdr->frame_control))) + return TX_CONTINUE; +@@ -1659,7 +1667,10 @@ void ieee80211_xmit(struct ieee80211_sub + } + } + +- ieee80211_set_qos_hdr(sdata, skb); ++ // Don't overwrite QoS header in monitor mode ++ if (likely(info->control.vif->type != NL80211_IFTYPE_MONITOR)) { ++ ieee80211_set_qos_hdr(sdata, skb); ++ } + ieee80211_tx(sdata, sta, skb, false); + } + +--- a/net/wireless/chan.c ++++ b/net/wireless/chan.c +@@ -857,8 +857,10 @@ int cfg80211_set_monitor_channel(struct + { + if (!rdev->ops->set_monitor_channel) + return -EOPNOTSUPP; +- if (!cfg80211_has_monitors_only(rdev)) +- return -EBUSY; ++ // Always allow user to change channel, even if there is another normal ++ // virtual interface using the device. ++ //if (!cfg80211_has_monitors_only(rdev)) ++ // return -EBUSY; + + return rdev_set_monitor_channel(rdev, chandef); + } +--- a/drivers/net/wireless/zydas/zd1211rw/zd_mac.c ++++ b/drivers/net/wireless/zydas/zd1211rw/zd_mac.c +@@ -242,14 +242,19 @@ void zd_mac_clear(struct zd_mac *mac) + static int set_rx_filter(struct zd_mac *mac) + { + unsigned long flags; +- u32 filter = STA_RX_FILTER; ++ struct zd_ioreq32 ioreqs[] = { ++ {CR_RX_FILTER, STA_RX_FILTER}, ++ { CR_SNIFFER_ON, 0U }, ++ }; + + spin_lock_irqsave(&mac->lock, flags); +- if (mac->pass_ctrl) +- filter |= RX_FILTER_CTRL; ++ if (mac->pass_ctrl) { ++ ioreqs[0].value |= 0xFFFFFFFF; ++ ioreqs[1].value = 0x1; ++ } + spin_unlock_irqrestore(&mac->lock, flags); + +- return zd_iowrite32(&mac->chip, CR_RX_FILTER, filter); ++ return zd_iowrite32a(&mac->chip, ioreqs, ARRAY_SIZE(ioreqs)); + } + + static int set_mac_and_bssid(struct zd_mac *mac) +@@ -1057,7 +1062,8 @@ int zd_mac_rx(struct ieee80211_hw *hw, c + /* Caller has to ensure that length >= sizeof(struct rx_status). */ + status = (struct rx_status *) + (buffer + (length - sizeof(struct rx_status))); +- if (status->frame_status & ZD_RX_ERROR) { ++ if ((status->frame_status & ZD_RX_ERROR) || ++ (status->frame_status & ~0x21)) { + if (mac->pass_failed_fcs && + (status->frame_status & ZD_RX_CRC32_ERROR)) { + stats.flag |= RX_FLAG_FAILED_FCS_CRC; +@@ -1400,7 +1406,7 @@ struct ieee80211_hw *zd_mac_alloc_hw(str + ieee80211_hw_set(hw, MFP_CAPABLE); + ieee80211_hw_set(hw, HOST_BROADCAST_PS_BUFFERING); + ieee80211_hw_set(hw, RX_INCLUDES_FCS); +- ieee80211_hw_set(hw, SIGNAL_UNSPEC); ++ ieee80211_hw_set(hw, SIGNAL_DBM); + + hw->wiphy->interface_modes = + BIT(NL80211_IFTYPE_MESH_POINT) | +--- a/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c ++++ b/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c +@@ -251,8 +251,17 @@ static void rtl8187_tx(struct ieee80211_ + flags |= RTL818X_TX_DESC_FLAG_NO_ENC; + + flags |= ieee80211_get_tx_rate(dev, info)->hw_value << 24; ++ ++ // When this flag is set the firmware waits untill ALL fragments have ++ // reached the USB device. Then it sends the first fragment and waits ++ // for ACKS's. Of course in monitor mode it won't detect these ACK's. + if (ieee80211_has_morefrags(tx_hdr->frame_control)) +- flags |= RTL818X_TX_DESC_FLAG_MOREFRAG; ++ { ++ // If info->control.vif is NULL it's most likely in monitor mode ++ if (likely(info->control.vif != NULL && info->control.vif->type != NL80211_IFTYPE_MONITOR)) { ++ flags |= RTL818X_TX_DESC_FLAG_MOREFRAG; ++ } ++ } + + /* HW will perform RTS-CTS when only RTS flags is set. + * HW will perform CTS-to-self when both RTS and CTS flags are set. diff --git a/wrapper/modifications/dumplinger/kernel/fix-ath9k-naming-conflict.patch b/wrapper/modifications/dumplinger/4.14/fix-ath9k-naming-conflict.patch similarity index 100% rename from wrapper/modifications/dumplinger/kernel/fix-ath9k-naming-conflict.patch rename to wrapper/modifications/dumplinger/4.14/fix-ath9k-naming-conflict.patch diff --git a/wrapper/modifications/dumplinger/4.14/kernelsu-compat.patch b/wrapper/modifications/dumplinger/4.14/kernelsu-compat.patch new file mode 100644 index 0000000..36ff14e --- /dev/null +++ b/wrapper/modifications/dumplinger/4.14/kernelsu-compat.patch @@ -0,0 +1,57 @@ +diff --git a/drivers/kernelsu/core_hook.c b/drivers/kernelsu/core_hook.c +index ee28fee..6521032 100644 +--- a/drivers/kernelsu/core_hook.c ++++ b/drivers/kernelsu/core_hook.c +@@ -375,7 +375,7 @@ static int ksu_task_prctl(int option, unsigned long arg2, unsigned long arg3, + return -ENOSYS; + } + // kernel 4.4 and 4.9 +-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) ++#if 1 + static int ksu_key_permission(key_ref_t key_ref, const struct cred *cred, + unsigned perm) + { +@@ -400,7 +400,7 @@ static int ksu_inode_rename(struct inode *old_inode, struct dentry *old_dentry, + LSM_HOOK_INIT(task_prctl, ksu_task_prctl), + LSM_HOOK_INIT(inode_rename, ksu_inode_rename), + LSM_HOOK_INIT(task_fix_setuid, ksu_task_fix_setuid), +-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) ++#if 1 + LSM_HOOK_INIT(key_permission, ksu_key_permission) + #endif + }; +diff --git a/drivers/kernelsu/kernel_compat.c b/drivers/kernelsu/kernel_compat.c +index 339650f..4121a20 100644 +--- a/drivers/kernelsu/kernel_compat.c ++++ b/drivers/kernelsu/kernel_compat.c +@@ -12,7 +12,7 @@ + #endif + #include "klog.h" // IWYU pragma: keep + +-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) ++#if 1 + #include "linux/key.h" + #include "linux/errno.h" + struct key *init_session_keyring = NULL; +@@ -80,7 +80,7 @@ void ksu_android_ns_fs_check() + + struct file *ksu_filp_open_compat(const char *filename, int flags, umode_t mode) + { +-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) ++#if 1 + if (init_session_keyring != NULL && !current_cred()->session_keyring && + (current->flags & PF_WQ_WORKER)) { + pr_info("installing init session keyring for older kernel\n"); +diff --git a/drivers/kernelsu/kernel_compat.h b/drivers/kernelsu/kernel_compat.h +index 8daa404..540ff61 100644 +--- a/drivers/kernelsu/kernel_compat.h ++++ b/drivers/kernelsu/kernel_compat.h +@@ -9,7 +9,7 @@ extern long ksu_strncpy_from_user_nofault(char *dst, + const void __user *unsafe_addr, + long count); + +-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) ++#if 1 + extern struct key *init_session_keyring; + #endif + \ No newline at end of file diff --git a/wrapper/modifications/dumplinger/kernel/add-wifi-injection-4.4.patch b/wrapper/modifications/dumplinger/4.4/add-wifi-injection-4.4.patch similarity index 100% rename from wrapper/modifications/dumplinger/kernel/add-wifi-injection-4.4.patch rename to wrapper/modifications/dumplinger/4.4/add-wifi-injection-4.4.patch diff --git a/wrapper/modifications/dumplinger/4.4/fix-ath9k-naming-conflict.patch b/wrapper/modifications/dumplinger/4.4/fix-ath9k-naming-conflict.patch new file mode 100644 index 0000000..8cb48c2 --- /dev/null +++ b/wrapper/modifications/dumplinger/4.4/fix-ath9k-naming-conflict.patch @@ -0,0 +1,138 @@ +From a947cee612f6a896740b66395f7d22f77b39900f Mon Sep 17 00:00:00 2001 +From: Re4son +Date: Thu, 22 Aug 2019 12:02:38 +1000 +Subject: [PATCH] Resolve conflict with wcn39xx driver + +Signed-off-by: Re4son +--- + drivers/net/wireless/ath/ath9k/htc_drv_init.c | 2 +- + drivers/net/wireless/ath/ath9k/htc_drv_main.c | 6 +++--- + drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 2 +- + drivers/net/wireless/ath/ath9k/htc_hst.c | 6 +++--- + drivers/net/wireless/ath/ath9k/htc_hst.h | 6 +++--- + drivers/net/wireless/ath/ath9k/wmi.c | 2 +- + 6 files changed, 12 insertions(+), 12 deletions(-) + +diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c +index da2164b0cccc..752bdcf50bfc 100644 +--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c +@@ -134,7 +134,7 @@ static inline int ath9k_htc_connect_svc(struct ath9k_htc_priv *priv, + req.ep_callbacks.rx = ath9k_htc_rxep; + req.ep_callbacks.tx = tx; + +- return htc_connect_service(priv->htc, &req, ep_id); ++ return htc_connect_service_hst(priv->htc, &req, ep_id); + } + + static int ath9k_init_htc_services(struct ath9k_htc_priv *priv, u16 devid, +diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c +index a553c91d41a1..c4328f351c5d 100644 +--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c +@@ -226,7 +226,7 @@ void ath9k_htc_reset(struct ath9k_htc_priv *priv) + WMI_CMD_BUF(WMI_SET_MODE_CMDID, &htc_mode); + + WMI_CMD(WMI_ENABLE_INTR_CMDID); +- htc_start(priv->htc); ++ htc_start_hst(priv->htc); + ath9k_htc_vif_reconfig(priv); + ieee80211_wake_queues(priv->hw); + +@@ -302,7 +302,7 @@ static int ath9k_htc_set_channel(struct ath9k_htc_priv *priv, + if (ret) + goto err; + +- htc_start(priv->htc); ++ htc_start_hst(priv->htc); + + if (!test_bit(ATH_OP_SCANNING, &common->op_flags) && + !(hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)) +@@ -955,7 +955,7 @@ static int ath9k_htc_start(struct ieee80211_hw *hw) + "Failed to update capability in target\n"); + + clear_bit(ATH_OP_INVALID, &common->op_flags); +- htc_start(priv->htc); ++ htc_start_hst(priv->htc); + + spin_lock_bh(&priv->tx.tx_lock); + priv->tx.flags &= ~ATH9K_HTC_OP_TX_QUEUES_STOP; +diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +index b38a586ea59a..aecf391bd4c5 100644 +--- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +@@ -543,7 +543,7 @@ void ath9k_htc_tx_drain(struct ath9k_htc_priv *priv) + * Ensure that all pending TX frames are flushed, + * and that the TX completion/failed tasklets is killed. + */ +- htc_stop(priv->htc); ++ htc_stop_hst(priv->htc); + tasklet_kill(&priv->wmi->wmi_event_tasklet); + tasklet_kill(&priv->tx_failed_tasklet); + +diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c +index 1bf63a4efb4c..13755c7c50ca 100644 +--- a/drivers/net/wireless/ath/ath9k/htc_hst.c ++++ b/drivers/net/wireless/ath/ath9k/htc_hst.c +@@ -228,7 +228,7 @@ int htc_init(struct htc_target *target) + return htc_setup_complete(target); + } + +-int htc_connect_service(struct htc_target *target, ++int htc_connect_service_hst(struct htc_target *target, + struct htc_service_connreq *service_connreq, + enum htc_endpoint_id *conn_rsp_epid) + { +@@ -301,12 +301,12 @@ int htc_send_epid(struct htc_target *target, struct sk_buff *skb, + return htc_issue_send(target, skb, skb->len, 0, epid); + } + +-void htc_stop(struct htc_target *target) ++void htc_stop_hst(struct htc_target *target) + { + target->hif->stop(target->hif_dev); + } + +-void htc_start(struct htc_target *target) ++void htc_start_hst(struct htc_target *target) + { + target->hif->start(target->hif_dev); + } +diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.h b/drivers/net/wireless/ath/ath9k/htc_hst.h +index 06474ccc7696..0bd3e6b7199b 100644 +--- a/drivers/net/wireless/ath/ath9k/htc_hst.h ++++ b/drivers/net/wireless/ath/ath9k/htc_hst.h +@@ -203,14 +203,14 @@ struct htc_comp_msg { + } __packed; + + int htc_init(struct htc_target *target); +-int htc_connect_service(struct htc_target *target, ++int htc_connect_service_hst(struct htc_target *target, + struct htc_service_connreq *service_connreq, + enum htc_endpoint_id *conn_rsp_eid); + int htc_send(struct htc_target *target, struct sk_buff *skb); + int htc_send_epid(struct htc_target *target, struct sk_buff *skb, + enum htc_endpoint_id epid); +-void htc_stop(struct htc_target *target); +-void htc_start(struct htc_target *target); ++void htc_stop_hst(struct htc_target *target); ++void htc_start_hst(struct htc_target *target); + void htc_sta_drain(struct htc_target *target, u8 idx); + + void ath9k_htc_rx_msg(struct htc_target *htc_handle, +diff --git a/drivers/net/wireless/ath/ath9k/wmi.c b/drivers/net/wireless/ath/ath9k/wmi.c +index 64a354fa78ab..6c6d41845f4d 100644 +--- a/drivers/net/wireless/ath/ath9k/wmi.c ++++ b/drivers/net/wireless/ath/ath9k/wmi.c +@@ -261,7 +261,7 @@ int ath9k_wmi_connect(struct htc_target *htc, struct wmi *wmi, + connect.ep_callbacks.rx = ath9k_wmi_ctrl_rx; + connect.service_id = WMI_CONTROL_SVC; + +- ret = htc_connect_service(htc, &connect, &wmi->ctrl_epid); ++ ret = htc_connect_service_hst(htc, &connect, &wmi->ctrl_epid); + if (ret) + return ret; + +-- +2.25.1 + diff --git a/wrapper/modifications/dumplinger/kernel/fix-hci-uart.patch b/wrapper/modifications/dumplinger/4.4/fix-hci-uart.patch similarity index 100% rename from wrapper/modifications/dumplinger/kernel/fix-hci-uart.patch rename to wrapper/modifications/dumplinger/4.4/fix-hci-uart.patch diff --git a/wrapper/modifications/dumplinger/kernel/fix-rt2800-injection-4.04.patch b/wrapper/modifications/dumplinger/4.4/fix-rt2800-injection-4.04.patch similarity index 100% rename from wrapper/modifications/dumplinger/kernel/fix-rt2800-injection-4.04.patch rename to wrapper/modifications/dumplinger/4.4/fix-rt2800-injection-4.04.patch diff --git a/wrapper/modifications/dumplinger/kernel/kernelsu-compat.patch b/wrapper/modifications/dumplinger/4.4/kernelsu-compat.patch similarity index 100% rename from wrapper/modifications/dumplinger/kernel/kernelsu-compat.patch rename to wrapper/modifications/dumplinger/4.4/kernelsu-compat.patch diff --git a/wrapper/modifications/dumplinger/4.4/qcacld_pa.patch b/wrapper/modifications/dumplinger/4.4/qcacld_pa.patch new file mode 100644 index 0000000..07b6236 --- /dev/null +++ b/wrapper/modifications/dumplinger/4.4/qcacld_pa.patch @@ -0,0 +1,216 @@ +diff --git a/drivers/staging/qcacld-3.0/configs/default_defconfig b/drivers/staging/qcacld-3.0/configs/default_defconfig +index 347177cd..c5bb906d 100644 +--- a/drivers/staging/qcacld-3.0/configs/default_defconfig ++++ b/drivers/staging/qcacld-3.0/configs/default_defconfig +@@ -35,6 +35,7 @@ ifeq ($(CONFIG_ICNSS), y) + CONFIG_HELIUMPLUS := y + CONFIG_64BIT_PADDR := y + CONFIG_FEATURE_TSO := y ++ CONFIG_FEATURE_TSO_DEBUG := y + ifeq ($(CONFIG_INET_LRO), y) + CONFIG_WLAN_LRO := y + else +@@ -47,7 +48,6 @@ ifneq ($(WLAN_DISABLE_BUILD_TAG), y) + CONFIG_BUILD_TAG := y + endif + endif +-CONFIG_BUILD_TAG := n + + ifeq ($(CONFIG_ARCH_MDM9630), y) + CONFIG_MOBILE_ROUTER := y +@@ -185,8 +185,9 @@ ifeq ($(CONFIG_ROME_IF),usb) + CONFIG_LINUX_QCMBR :=y + endif + +-CONFIG_MPC_UT_FRAMEWORK := n +-CONFIG_FEATURE_EPPING := n ++CONFIG_MPC_UT_FRAMEWORK := y ++ ++CONFIG_FEATURE_EPPING := y + + #Flag to enable offload packets feature + CONFIG_WLAN_OFFLOAD_PACKETS := y +@@ -299,6 +300,7 @@ CONFIG_DP_INTR_POLL_BASED := y + CONFIG_TX_PER_PDEV_DESC_POOL := y + CONFIG_DP_TRACE := y + CONFIG_FEATURE_TSO := y ++CONFIG_TSO_DEBUG_LOG_ENABLE := y + CONFIG_DP_LFR := y + CONFIG_HTT_PADDR64 := y + CONFIG_RX_OL := y +@@ -306,6 +308,30 @@ CONFIG_TX_TID_OVERRIDE := y + CONFIG_WLAN_CLD_PM_QOS := y + endif + ++# As per target team, build is done as follows: ++# Defconfig : build with default flags ++# Slub : defconfig + CONFIG_SLUB_DEBUG=y + ++# CONFIG_SLUB_DEBUG_ON=y + CONFIG_PAGE_POISONING=y ++# Perf : Using appropriate msmXXXX-perf_defconfig ++# ++# Shipment builds (user variants) should not have any debug feature ++# enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds ++# are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since ++# there is no other way to identify defconfig builds, QCOMs internal ++# representation of perf builds (identified using the string 'perf'), ++# is used to identify if the build is a slub or defconfig one. This ++# way no critical debug feature will be enabled for perf and shipment ++# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT ++# config. ++ifneq ($(TARGET_BUILD_VARIANT),user) ++ ifeq ($(CONFIG_LITHIUM), y) ++ CONFIG_FEATURE_PKTLOG := n ++ else ++ CONFIG_FEATURE_PKTLOG := y ++ endif ++ CONFIG_WLAN_DEBUG_CRASH_INJECT := y ++endif ++ + #Enable WLAN/Power debugfs feature only if debug_fs is enabled + ifeq ($(CONFIG_ANDROID), y) + CONFIG_WLAN_DEBUGFS := y +@@ -321,14 +347,7 @@ endif + BUILD_DEBUG_VERSION := n + + #Enable this flag to build driver in diag version +-BUILD_DIAG_VERSION := n +- +-# Debug specific features +-CONFIG_FEATURE_TSO_DEBUG := n +-CONFIG_WLAN_NAPI_DEBUG := n +-CONFIG_WLAN_FEATURE_P2P_DEBUG := n +-CONFIG_FEATURE_FW_LOG_PARSING := n +-CONFIG_DP_TRACE := n ++BUILD_DIAG_VERSION := y + + ifeq ($(CONFIG_SLUB_DEBUG), y) + PANIC_ON_BUG := y +@@ -346,12 +365,13 @@ CONFIG_WLAN_LOG_FATAL := y + CONFIG_WLAN_LOG_ERROR := y + CONFIG_WLAN_LOG_WARN := y + CONFIG_WLAN_LOG_INFO := y ++CONFIG_WLAN_LOG_DEBUG := y + + #Enable OL debug and wmi unified functions + CONFIG_ATH_PERF_PWR_OFFLOAD := y + + #Disable packet log +-CONFIG_REMOVE_PKT_LOG := y ++CONFIG_REMOVE_PKT_LOG := n + + #Enable 11AC TX + ifeq ($(CONFIG_ROME_IF),pci) +@@ -505,7 +525,7 @@ CONFIG_QCA_SIGNED_SPLIT_BINARY_SUPPORT := n + CONFIG_QCA_SINGLE_BINARY_SUPPORT := n + + #Enable collecting target RAM dump after kernel panic +-CONFIG_TARGET_RAMDUMP_AFTER_KERNEL_PANIC := n ++CONFIG_TARGET_RAMDUMP_AFTER_KERNEL_PANIC := y + + #Flag to enable/disable secure firmware feature + CONFIG_FEATURE_SECURE_FIRMWARE := n +@@ -517,13 +537,22 @@ CONFIG_FEATURE_STATS_EXT := y + CONFIG_FEATURE_HTC_CREDIT_HISTORY := y + + #Flag to enable MTRACE feature +-CONFIG_TRACE_RECORD_FEATURE := n ++CONFIG_TRACE_RECORD_FEATURE := y ++ ++#Flag to enable p2p debug feature ++CONFIG_WLAN_FEATURE_P2P_DEBUG := y + + #Flag to enable DFS Master feature + CONFIG_WLAN_DFS_MASTER_ENABLE := y + ++#Flag to enable/disable MTRACE feature ++CONFIG_ENABLE_MTRACE_LOG := y ++ + #Flag to enable nud tracking feature +-CONFIG_WLAN_NUD_TRACKING := n ++CONFIG_WLAN_NUD_TRACKING := y ++ ++#Flag to enable/Disable Function call trace ++CONFIG_FUNC_CALL_MAP := n + + #Flag to enable wbuff feature + CONFIG_WLAN_WBUFF := y +@@ -543,12 +572,15 @@ ifneq ($(CONFIG_WIFI_POS_CONVERGED), y) + CONFIG_WIFI_POS_LEGACY := y + endif + +-CONFIG_CP_STATS := n ++CONFIG_CP_STATS := y + + CONFIG_FEATURE_WLAN_WAPI := y + + CONFIG_AGEIE_ON_SCAN_RESULTS := y + ++#Flag to enable FW log parsing support feature ++CONFIG_FEATURE_FW_LOG_PARSING := y ++ + CONFIG_PTT_SOCK_SVC_ENABLE := y + CONFIG_SOFTAP_CHANNEL_RANGE := y + CONFIG_FEATURE_WLAN_SCAN_PNO := y +@@ -557,7 +589,7 @@ CONFIG_WLAN_NS_OFFLOAD := y + CONFIG_FEATURE_WLAN_RA_FILTERING:= y + CONFIG_FEATURE_WLAN_LPHB := y + CONFIG_QCA_SUPPORT_TX_THROTTLE := y +-CONFIG_WMI_INTERFACE_EVENT_LOGGING := n ++CONFIG_WMI_INTERFACE_EVENT_LOGGING := y + CONFIG_WLAN_FEATURE_LINK_LAYER_STATS := y + CONFIG_FEATURE_WLAN_EXTSCAN := y + CONFIG_160MHZ_SUPPORT := y +@@ -573,9 +605,7 @@ CONFIG_CONVERGED_TDLS_ENABLE := y + CONFIG_WLAN_CONV_SPECTRAL_ENABLE := y + CONFIG_WLAN_SPECTRAL_ENABLE := y + CONFIG_WMI_CMD_STRINGS := y +-CONFIG_FEATURE_MONITOR_MODE_SUPPORT := n +-CONFIG_DESC_DUP_DETECT_DEBUG := n +-CONFIG_DEBUG_RX_RING_BUFFER := n ++CONFIG_FEATURE_MONITOR_MODE_SUPPORT := y + CONFIG_WLAN_FEATURE_TWT := y + + ifeq ($(CONFIG_HELIUMPLUS), y) +@@ -598,6 +628,9 @@ ifeq ($(CONFIG_LITHIUM), y) + CONFIG_FEATURE_UNIT_TEST_SUSPEND := y + endif + ++#Flag to enable hdd memory dump feature ++CONFIG_FEATURE_MEMDUMP_ENABLE := y ++ + #Flag to enable/disable WLAN D0-WOW + ifeq ($(CONFIG_PCI_MSM), y) + ifeq ($(CONFIG_HIF_PCI), y) +@@ -618,13 +651,18 @@ ifeq ($(CONFIG_ARCH_MSM8996), y) + CONFIG_CHANNEL_HOPPING_ALL_BANDS := y + endif + +-CONFIG_WLAN_LOGGING_SOCK_SVC := n +-CONFIG_FEATURE_BECN_STATS := n ++ifneq ($(CONFIG_HIF_USB), y) ++CONFIG_WLAN_LOGGING_SOCK_SVC := y ++endif + + ifneq ($(TARGET_BUILD_VARIANT),user) + CONFIG_DESC_DUP_DETECT_DEBUG := y + endif + ++CONFIG_DP_TRACE := y ++#Enable Beacon Reception Stats ++CONFIG_FEATURE_BECN_STATS := y ++ + #enable MPTA helper for QCS405 + ifeq ($(CONFIG_ARCH_QCS405), y) + CONFIG_QCACLD_FEATURE_MPTA_HELPER := y +@@ -646,4 +684,10 @@ ifeq ($(CONFIG_ARCH_SDM660), y) + CONFIG_WLAN_FEATURE_PKT_CAPTURE := y + endif + +-CONFIG_WLAN_HANG_EVENT := n ++#Enable RX RING buffers debug ++CONFIG_DEBUG_RX_RING_BUFFER := y ++ ++#Enable Hash debug ++CONFIG_RX_HASH_DEBUG := y ++ ++CONFIG_WLAN_HANG_EVENT := y diff --git a/wrapper/modifications/dumplinger/kernel/v2-2-6-mac80211-refactor-monitor-representation-in-sdata.patch b/wrapper/modifications/dumplinger/4.4/v2-2-6-mac80211-refactor-monitor-representation-in-sdata.patch similarity index 100% rename from wrapper/modifications/dumplinger/kernel/v2-2-6-mac80211-refactor-monitor-representation-in-sdata.patch rename to wrapper/modifications/dumplinger/4.4/v2-2-6-mac80211-refactor-monitor-representation-in-sdata.patch diff --git a/wrapper/tools/fileoperations.py b/wrapper/tools/fileoperations.py index d74f8fb..a78faf0 100644 --- a/wrapper/tools/fileoperations.py +++ b/wrapper/tools/fileoperations.py @@ -44,7 +44,7 @@ def download(url: str) -> None: print(f" URL: {url}") try: # URL for TWRP is weird, have to adjust the query - if "twrp" in url: + if "twrp" in url.lower(): with requests.get(url, stream=True, headers={"referer": url}) as r: r.raise_for_status() with open(fn, 'wb') as f: diff --git a/wrapper/utils/resources.py b/wrapper/utils/resources.py index f55c4eb..076fc5c 100644 --- a/wrapper/utils/resources.py +++ b/wrapper/utils/resources.py @@ -74,8 +74,10 @@ def download(self) -> None: branch = self.paths[e]["branch"] commit = self.paths[e]["commit"] cmd = f"git clone -b {branch} --depth 1 {url} {path}" - # KernelSU defines it's version based on *full* commit history - if e.lower() == "kernelsu": + # full commit history is required in two instances: + # - for KernelSU -- to define it's version based on *full* commit history; + # - for commit checkout -- to checkout a specific commit in the history. + if e.lower() == "kernelsu" or commit: cmd = cmd.replace(" --depth 1", "") if not path.is_dir(): ccmd.launch(cmd)