Latest Entries »

Tutorial – KernelSU-Next with SuSFS integrated in to a GKI (LTS (Generic Kernel Image (Long Term Support))

This is a tutorial to build KernelSU-Next (rifsxd) with SuSFS (simonpunk) integrated in to a GKI LTS (Generic Kernel Image (Long Term Support)). This is used to gain escalation on your mobile device.


This is an addendum to Tutorial – KernelSU-Next with SuSFS integrated in to a GKI (Generic Kernel Image) but using the LTS (Long Term Support) branch, instead of the Monthly releases. Please sort out the pre-requirements, referenced in that tutorial, first.

…..

Create a work area for yourself and enter it:
Note: If you’ve done the first tutorial, you can omit this, but enter in to the root of the workarea directory (cd ~/workarea).
mkdir workarea && cd workarea

Pull down GKI Monthly:
Note: If you’ve done the first tutorial, you can omit this.
mkdir gki-kernel && cd gki-kernel
repo init -u https://android.googlesource.com/kernel/manifest

Grab manifest_xxxxx.xml from a Tagged build (click kernel under ‘kernel artifacts’):
https://source.android.com/docs/core/architecture/kernel/gki-android14-6_1-release-builds
Note: Replace xxxxx with the actual number.
Note2: If you’ve done the first tutorial, you can omit this.

After you click on manifest_xxxxx.xml, right click ‘Download’, copy link:
curl -o .repo/manifests/manifest_xxxxx.xml "LINK"
Note: Replace LINK with the actual session based URL / LINK that was copied in to your buffer.

Synchronize (Note: Replace xxxxx with the actual number):
Note: If you’ve done the first tutorial, you can omit this.
repo init -m manifest_xxxxx.xml
repo sync
cd ..

Pull down LTS:
mkdir gki-lts-kernel && cd gki-lts-kernel
git clone https://android.googlesource.com/kernel/common.git -b android14-6.1-lts

Add Bazel, dependencies and miscellaneous:
rsync -a --del ../gki-kernel/build/ build
rsync -a --del ../gki-kernel/tools/ tools
rsync -a --del ../gki-kernel/prebuilts/ prebuilts
rsync -a --del ../gki-kernel/external/ external
rsync -a --del ../gki-kernel/.repo/ .repo
rsync -a --del ../gki-kernel/kernel/ kernel
rsync -a --del ../gki-kernel/common-modules/ common-modules
ln -s build/kernel/kleaf/bazel.WORKSPACE WORKSPACE
cd ..

Pull down the susfs4ksu repository and target the gki-android14-6.1-lts-dev branch:
Note: If you have done the previous tutorial, then: cd susfs4ksu && git fetch origin gki-android14-6.1-lts-dev && git checkout gki-android14-6.1-lts-dev
git clone https://gitlab.com/pershoot/susfs4ksu.git -b gki-android14-6.1-lts-dev

Create the destination directory for the build:
Note: If you’ve done the first tutorial, you can omit this.
mkdir android-kernel

Create a mirror, which you will work against:
rsync -a --del gki-lts-kernel/ gki-14-lts
cd gki-14-lts

Clear out the android-kernel directory:
rm -rf ../android-kernel/*

…..

Continue on with ‘Copy SuSFS module and patches in’ (omit ‘cd gki-14‘):
Tutorial – KernelSU-Next with SuSFS integrated in to a GKI (Generic Kernel Image)

…..

Sources:
pershoot/KernelSU-Next at next-susfs
pershoot/susfs4ksu/-/tree/gki-android14-6.1-dev
KernelSU-Next/KernelSU-Next: An advanced Kernel based root solution for Android
simonpunk/susfs4ksu/-/tree/gki-android14-6.1
sidex15/susfs4ksu-module: An addon root hiding service for KernelSU
backslashxx/KernelSU

Tutorial – KernelSU-Next with SuSFS integrated in to a GKI (Generic Kernel Image)

This is a tutorial to build KernelSU-Next (rifsxd) with SuSFS (simonpunk) integrated in to a GKI (Generic Kernel Image). This is used to gain escalation on your mobile device.

This tutorial will use Pixel 7a as an example (Pixel 6 / 7 / 8 can be used) and is geared towards using AVB Android14-11. Other interfaces can be used (the tutorial shows how to get this information), but you would need to, perhaps, fix hunks and / or rejects against the source that is applicable to your device, when using the patches. We will build using Ubuntu 24.0.4.2 on WSL2 (this requires virtualization to be on).

…..

Pre-requirements:
You will need adb / fastboot.
Install git (sudo apt-get update && sudo apt-get -y install git)
You will need magiskboot (place the binary from x86-64 (if on Windows using WSL2 Linux) in to the root of the ~/.bin directory (see below; where you are putting the manual install of repo)). Ensure you set execute permissions on it: chmod u+x magiskboot
Install curl (sudo apt-get -y install curl).

You will need to perform a one-time wipe to turn off boot verification so you can boot and flash things you build, to properly test before committal. Please see below but do not remove the -w (wipe USERDATA), but add on the aforementioned flags before it, Thereafter, you will always pass the needed flags when you flash the monthly updates (but remove the -w).
Note: As per Avo and urkiu, leaving it on, doesn’t appear to prevent you from booting and flashing (SPL is being modified). However, antezero ran in to some odd issues which prevented proper back / forth updates and SweBow ran in to a no boot / crash situation, so it is advised to turn it off, which requires a one-time wipe.

Grab the stock boot.img (referenced as boot-stock.img below) from the latest monthly update for your device in to the root of the workarea folder (see below) and name it boot-stock.img (mv boot.img boot-stock.img).

Update to the latest monthly update for your device prior (remove any ramdisk modifications you may have made (Magisk), remove -w after fastboot in flash-all script and replace with –disable-verity –disable-verification):
https://developers.google.com/android/images#xxxxx
Replace xxxxx with the codename for your device.

Repo (Use manual install, its newer).

Put the path to it (repo) in your PATH:
export PATH=PATH_TO_REPO:$PATH
Replace PATH_TO_REPO with the /xxx/xxx/xxx path to repo.
You can make it permanent by adding it in to your shell’s .rc file (i.e. if you use BASH then at the end of ~/.bashrc) and source it after (source ~/.bashrc), so it can reflect in your current shell session.

…..

Create a work area for yourself and enter it:
mkdir workarea && cd workarea

We will use android14-6.1 (Pixel 6 / 7 / 8).
You can get this information by unpacking the stock boot.img (see below) with magiskboot and taking note of the linux version string:
strings kernel | grep -i 'linux version'

…..

Grab manifest_xxxxx.xml from a Tagged build (click kernel under ‘kernel artifacts’):
https://source.android.com/docs/core/architecture/kernel/gki-android14-6_1-release-builds
Note: Replace xxxxx with the actual number.

After you click on manifest_xxxxx.xml, right click ‘Download’, copy link:
curl -o manifest_xxxxx.xml "LINK"
Note: Replace LINK (inside the quotes; retain the quotes (due to special characters in the long link)) with the actual session based URL / LINK that was copied in to your buffer.

Clone susfs4ksu:
git clone https://gitlab.com/pershoot/susfs4ksu.git -b gki-android14-6.1-dev

Create the source folder for the repository and the destination directory for the build:
mkdir gki-kernel
mkdir android-kernel

Pull down the repository (Note: Replace xxxxx with the actual number):
cd gki-kernel
repo init -u https://android.googlesource.com/kernel/manifest
cp -p ../manifest_xxxxx.xml .repo/manifests
repo init -m manifest_xxxxx.xml
repo sync
cd ..


Create a mirror, which you will work against:
rsync -a --del gki-kernel/ gki-14

Copy SuSFS module and patches in:
cd gki-14
cp -p ../susfs4ksu/kernel_patches/fs/* common/fs
cp -p ../susfs4ksu/kernel_patches/include/linux/* common/include/linux
cp -p ../susfs4ksu/kernel_patches/50_add_susfs_in_gki-android14-6.1.patch common
cp -p ../susfs4ksu/kernel_patches/60_scope-minimized_manual_hooks.patch common

Patch:
cd common
patch -p1 < 50_add_susfs_in_gki-android14-6.1.patch
patch -p1 < 60_scope-minimized_manual_hooks.patch
cd ..

Pull down KernelSU-Next and execute setup:
curl -LSs "https://raw.githubusercontent.com/pershoot/KernelSU-Next/refs/heads/next-susfs/kernel/setup.sh" | bash -s next-susfs

Remove protected exports (also the patches) so Wi-Fi and Bluetooth will function:
sed -i '/^[[:space:]]*"protected_exports_list"[[:space:]]*:[[:space:]]*"android\/abi_gki_protected_exports_aarch64",$/d' common/BUILD.bazel
rm common/android/abi_gki_protected_exports_* common/50_add_susfs_in_gki-android14-6.1.patch common/60_scope-minimized_manual_hooks.patch

Commit the changes in to your local repository:
cd common
git add -A
git commit -a -m "Add KernelSU-Next-susfs"
cd ..

Build:
tools/bazel run --config=fast --config=stamp --lto=thin //common:kernel_aarch64_dist -- --dist_dir=../android-kernel

Create a directory where you will use magiskboot to sort out SPL (Security Patch Level) using your stock image:
Note: If you have ~/.bin in your PATH, then you do not have to put a preceding relative path. The below assumes you followed the manual install of repo and put it in that same directory.
mkdir ../android-kernel/kernel
cd ../android-kernel/kernel
cp -p ../boot.img .
../../../.bin/magiskboot unpack boot.img
../../../.bin/magiskboot repack ../../boot-stock.img

…..


Test your boot image (new-boot.img is found in android-kernel/kernel directory you are in):
adb reboot bootloader or vol down and power
fastboot boot new-boot.img


If all looks well:
adb reboot bootloader
fastboot flash boot new-boot.img
fastboot reboot

…..

Install the latest susfs4ksu module (sidex15) through the KernelSU-Next Manager.

Enjoy!

…..

Sources:
pershoot/KernelSU-Next at next-susfs
pershoot/susfs4ksu/-/tree/gki-android14-6.1-dev
KernelSU-Next/KernelSU-Next: An advanced Kernel based root solution for Android
simonpunk/susfs4ksu/-/tree/gki-android14-6.1
sidex15/susfs4ksu-module: An addon root hiding service for KernelSU
backslashxx/KernelSU


Firmware – Asuswrt-Merlin (NG) – 386.11_alpha1 – RT-AC68

This is Merlin’s Asuswrt (NG) 386.11_alpha1 for the ASUS RT-AC68U/R.

-sync latest changes from RMerlin (386_x).

—–

Download (ASUS RT-AC68U/R):
RT-AC68U_386.11_alpha1.trx
Download: RT-AC68U_386.11_alpha1.trx

—–

Source:
https://github.com/pershoot/asuswrt-merlin.ng
https://github.com/RMerl/asuswrt-merlin.ng

——–

Installation instructions:

-Flash the .trx through the UI
-After it is completed and you are returned back to the UI, wait a short while (~30 seconds) then power cycle the router (with the on/off button).

ChatGPT/Ansible – Send queries and receive responses using Infrastructure as Code

ChatGPT is an AI-powered chatbot designed to provide natural language generations and follow-up questions to enable users to have natural, free-flowing conversations. It is powered by OpenAI‘s GPT-3 AI language model, and its goal is to enable people to have natural conversations with AI-driven chatbots.

The above was written using ChatGPT.

In this article we will use Ansible (Infrastructure as Code) to query ChatGPT and receive responses. We will use Elchico2007‘s collection and OpenAI‘s module to accomplish this.

We will use the same base path of ‘dev’ that was previously created, and use ~/.local/bin for certain binaries.

Please Sign up to OpenAI’s ChatGPT here.

–>
Go in to the dev directory/link located within your home directory:

$ cd ~/dev

Install/Upgrade Ansible:

$ pip3 install ansible --upgrade --user && chmod 754 ~/.local/bin/ansible ~/.local/bin/ansible-playbook ~/.local/bin/ansible-galaxy

Install/Upgrade OpenAI’s module:

$ pip3 install openai --upgrade --user

Install/Upgrade JMESPath (so we may use json_query to parse output):

$ pip3 install jmespath --upgrade --user

Create a Ansible work folder and change in to the base path:

$ mkdir -p ansible/chatgpt/inventory && cd ansible/chatgpt

Create an Ansible configuration where we will target the collections install, in to this space:

$ cat << 'EOF' > ansible.cfg
> [defaults]
> collections_paths = ./collections
> EOF

Install Elchico2007’s ChatGPT collection:

$ ansible-galaxy collection install elchico2007.chatgpt

Create an Ansible inventory, which adds a local group, lists your local host and specifies the connection to be local:

$ cat << 'EOF' > inventory/static-hostname
> [local]
> localhost ansible_connection=local
> EOF

Create an Ansible playbook, which will query ChatGPT and print the response from it:

$ cat << 'EOF' > chatgpt.yml
> # Query ChatGPT and receive responses
> ---
> - hosts: local
> 
>   tasks:
>     - name: Query ChatGPT
>       elchico2007.chatgpt.gpt3:
>         api_key: "{{ lookup('env', 'CHATGPT_API_KEY', default='') }}"
>         model: "{{ lang_model | d('text-davinci-003', true) }}"
>         input: "{{ chatgpt_query | d('What is ChatGPT?', true) }}"
>         instruction: "{{ perform_action | d('', true) }}"
>       register: chatgpt
>
>     - name: Output ChatGPT's response
>       debug:
>         msg: "{{ chatgpt.output | json_query('choices[].text') }}"
>       when: chatgpt
> EOF

‘Create a new secret key’ here and take note of it.

Run the default query (replace <API key> with the API key you received from ‘Create a new secret key’):

$ CHATGPT_API_KEY=<API key> ansible-playbook -i inventory/ chatgpt.yml

It should return similarly:

TASK [Output ChatGPT's response] ***************************************************************************************
ok: [localhost] => {
    "msg": [
        "ChatGPT is an AI-powered chatbot designed to provide natural language generations and follow-up questions to enable users to have natural, free-flowing conversations. It is powered by OpenAI's GPT-3 AI language model, and its goal is to enable people to have natural conversations with AI-driven chatbots."
    ]
}

Ask it a question (replace <API key> with the API key you received from ‘Create a new secret key’):

$ CHATGPT_API_KEY=<API key> ansible-playbook -i inventory/ chatgpt.yml -e 'chatgpt_query="What is Droid Basement?"'

It should return similarly:

TASK [Output ChatGPT's response] ***************************************************************************************
ok: [localhost] => {
    "msg": [
        "Droid Basement is an Android enthusiast blog founded in 2012. It provides users with the latest news, reviews and information on Android devices, applications, and accessories. The blog includes tutorials and guides, development resources, and other Android-related content."
    ]
}

Prompt it to perform a correction for you (replace <API key> with the API key you received from ‘Create a new secret key’):

$ CHATGPT_API_KEY=<API key> ansible-playbook -i inventory/ chatgpt.yml -e 'lang_model=text-davinci-edit-001 chatgpt_query="I lick teeching." perform_action="Fix my grammar"'

It should return similarly:

TASK [Output ChatGPT's response] ***************************************************************************************
ok: [localhost] => {
    "msg": [
        "I like teaching."
    ]
}

You can set your API key in an environment variable so it (CHATGPT_API_KEY) does not need to be specified when executing ‘ansible-playbook’ (replace <API key> with the API key you received from ‘Create a new secret key’):

$ export CHATGPT_API_KEY="<API key>"

To unset the environment variable:

$ unset CHATGPT_API_KEY

<–

Source:

elchico2007.chatgpt

ChatGPT/Terraform – Send queries and receive responses using Infrastructure as Code

ChatGPT is an AI-powered chatbot developed by OpenAI. It uses natural language processing technology to generate intelligent, personalized responses to user queries in real-time. It combines the power of a neural network with the natural conversational techniques used by real people.

The above was written using ChatGPT.

In this article we will use Terraform (Infrastructure as Code) to query ChatGPT and receive responses. We will use Develeap‘s provider to accomplish this.

We will use the same base path of ‘dev’ that was previously created and use ~/.local/bin for certain binaries.

Please Sign up to OpenAI’s ChatGPT here.

–>
Go in to the dev directory/link located within your home directory:

$ cd ~/dev

Grab/Update to the latest version of Terraform:

$ wget https://releases.hashicorp.com/terraform/1.4.2/terraform_1.4.2_linux_amd64.zip

Install Unzip if you do not have it installed:

$ sudo apt update && sudo apt -y install unzip

Unzip it to ~/.local/bin and set permissions accordingly on it (type y and hit enter to replace if upgrading, at the prompt):

$ unzip terraform_1.4.2_linux_amd64.zip -d ~/.local/bin && chmod 754 ~/.local/bin/terraform

Create a Terraform work folder and change in to the base path:

$ mkdir -p terraform/chatgpt && cd terraform/chatgpt

Pin the Terraform version to greater then or equal to 1.4:

$ cat << 'EOF' > versions.tf
> terraform {
>   required_version = ">= 1.4.0"
> }
> EOF

Set query as a variable and assign it a default value:

$ cat << 'EOF' > vars.tf
> variable "query" {
>   default = "What is ChatGPT?"
> }
> EOF

Add the ChatGPT provider from Develeap:

$ cat << 'EOF' > provider.tf
> terraform {
>   required_providers {
>     chatgpt = {
>       version = "0.0.1"
>       source  = "develeap/chatgpt"
>     }
>   }
> }
>
> provider "chatgpt" {
>   # CHATGPT_API_KEY="<API key>" terraform apply -auto-approve
> }
> EOF

Add the ChatGPT resource:

$ cat << 'EOF' > chatgpt.tf
> resource "chatgpt_prompt" "query" {
>   max_tokens = 256
>   query      = "${var.query}"
> }
> EOF

Output the response to our query:

$ cat << 'EOF' > output.tf
> output "query_result" {
>   value = chatgpt_prompt.query.result
> }
> EOF

‘Create a new secret key’ here and take note of it.

Initialize the Terraform directory:

$ terraform init

Run the default query (replace <API key> with the API key you received from ‘Create a new secret key’):

$ CHATGPT_API_KEY="<API key>" terraform apply -auto-approve

It should return:

Outputs:

query_result = "ChatGPT is an AI-powered chatbot developed by OpenAI. It uses natural language processing technology to generate intelligent, personalized responses to user queries in real-time. It combines the power of a neural network with the natural conversational techniques used by real people."

Ask it a question (replace <API key> with the API key you received from ‘Create a new secret key’):

$ CHATGPT_API_KEY="<API key>" terraform apply -var "query=What is Droid Basement?" -auto-approve

It should return:

Outputs:

query_result = "Droid Basement is a website dedicated to providing Android users with tutorials on rooting, ROMs and other custom development tasks. The site also offers popular downloads, forums, and articles related to Android development."

You can set your API key in an environment variable so it (CHATGPT_API_KEY) does not need to be specified when executing ‘terraform’ (replace <API key> with the API key you received from ‘Create a new secret key’):

$ export CHATGPT_API_KEY="<API key>"

To unset the environment variable:

$ unset CHATGPT_API_KEY

<–

Source:

terraform-provider-chatgpt

Firmware – Asuswrt-Merlin (NG) – 386.10_0 – RT-AC68

This is Merlin’s Asuswrt (NG) 386.10_0 for the ASUS RT-AC68U/R.

-sync latest changes from RMerlin (386_x).

—–

Download (ASUS RT-AC68U/R):
RT-AC68U_386.10_0.trx
Download: RT-AC68U_386.10_0.trx

—–

Source:
https://github.com/pershoot/asuswrt-merlin.ng
https://github.com/RMerl/asuswrt-merlin.ng

——–

Installation instructions:

-Flash the .trx through the UI
-After it is completed and you are returned back to the UI, wait a short while (~30 seconds) then power cycle the router (with the on/off button).

Firmware – Asuswrt-Merlin (NG) – 386.10_beta1 – RT-AC68

This is Merlin’s Asuswrt (NG) 386.10_beta1 for the ASUS RT-AC68U/R.

-sync latest changes from RMerlin (386_x).

—–

Download (ASUS RT-AC68U/R):
RT-AC68U_386.10_beta1.trx
Download: RT-AC68U_386.10_beta1.trx

—–

Source:
https://github.com/pershoot/asuswrt-merlin.ng
https://github.com/RMerl/asuswrt-merlin.ng

——–

Installation instructions:

-Flash the .trx through the UI
-After it is completed and you are returned back to the UI, wait a short while (~30 seconds) then power cycle the router (with the on/off button).

Firmware – Asuswrt-Merlin (NG) – 386.10_alpha1 – RT-AC68

This is Merlin’s Asuswrt (NG) 386.10_alpha1 for the ASUS RT-AC68U/R.

-sync latest changes from RMerlin (386_x).

—–

Download (ASUS RT-AC68U/R):
RT-AC68U_386.10_alpha1.trx
Download: RT-AC68U_386.10_alpha1.trx

—–

Source:
https://github.com/pershoot/asuswrt-merlin.ng
https://github.com/RMerl/asuswrt-merlin.ng

——–

Installation instructions:

-Flash the .trx through the UI
-After it is completed and you are returned back to the UI, wait a short while (~30 seconds) then power cycle the router (with the on/off button).

Firmware – Asuswrt-Merlin (NG) – 386.5_0 – RT-AC68

This is Merlin’s Asuswrt (NG) 386.5_0 for the ASUS RT-AC68U/R.

-sync latest changes from RMerlin (master).

—–

Download (ASUS RT-AC68U/R):
RT-AC68U_386.5_0.trx
Download: RT-AC68U_386.5_0.trx

—–

Source:
https://github.com/pershoot/asuswrt-merlin.ng
https://github.com/RMerl/asuswrt-merlin.ng

——–

Installation instructions:

-Flash the .trx through the UI
-After it is completed and you are returned back to the UI, wait a short while (~30 seconds) then power cycle the router (with the on/off button).

Firmware – Asuswrt-Merlin (NG) – 386.4_0 – RT-AC68

This is Merlin’s Asuswrt (NG) 386.4_0 for the ASUS RT-AC68U/R.

-sync latest changes from RMerlin (master).

—–

Download (ASUS RT-AC68U/R):
RT-AC68U_386.4_0.trx
Download: RT-AC68U_386.4_0.trx

—–

Source:
https://github.com/pershoot/asuswrt-merlin.ng
https://github.com/RMerl/asuswrt-merlin.ng

——–

Installation instructions:

-Flash the .trx through the UI
-After it is completed and you are returned back to the UI, wait a short while (~30 seconds) then power cycle the router (with the on/off button).