[Android Software/Hacking General [Developers Only]] steadfasterX:
FIsH bowels (What's inside)

This is for ppl understanding the basics. I will not explain it for dummies ;)

Ok prepare urself for the naked magic ;)

Actually FIsH is mostly similar to other RAM hijacks around with 3 major differences:

1. FIsH is based and depends on SuperSU.

YES - I make my life EASY. You actually need a rooted devices for the most kind of hijacks.

... and I assume the most ppl using SuperSU as their su binary.

... and SuperSU does not require to modify boot (at least until LL)

With this in mind and reading the SuperSU docs I had read that beginning from version 2.76 SuperSU

comes with a special kind of internal init.d support means: It executes custom scripts very early with full SELinux perms available.

Check out the docs here: https://su.chainfire.eu/#updates-sud

2. FIsH tries to be a generic framework with instructions to bring it on all devices.

The hack here is not device specific due to its nature of just executing a custom script by SuperSU.

I've made all scripts inside as easy portable as possible and given hopefully good descriptions and

porting instructions for EACH variable you may need to adjust.

3. it works for up to LL (when u can met the pre-reqs for MM or N, O or whatever comes then - it will work there as well!)

I found only methods for up to KK (e.g. 2nd init and others) but nothing for LL (sorry if I missed someone!) so I started FIsH.

So in sum FIsH is:

a set of scripts and tools which gets executed by SuperSU on early boot stage which hijacks the boot process to bring up your own ramdisk.

FIsH vs Flashfire

Flashfire is absolutely an AMAZING tool! You can backup, installing ZIPs etc all without an unlocked bootloader.

Due to it's nature it is not possible to do EVERYTHING with it (on a locked device), e.g. restoring your whole system partition.

TWRP-in-FIsH (FIsH plus TWRP as FIsHFOOD ramdisk) can provide this - even with a locked bootloader.

Besides this FIsH can do more like (hopefully) bringing you custom ROMs on locked bootloader devices.

FIsH vs Safestrap

Safestrap is supported up to KK and besides this it actually is some kind of MultiROM pendant (+ the hijack part).

FIsH supports any Android version up to LL (GB, ICS, KK, LL,..) as long as the 2 bloody requirements can be met.

Safestrap is a very customized version of TWRP and so limited to updates from there.

FIsH lets you boot any ordinary TWRP completely unmodified. This makes it easier to get new TWRP features on your device.

Besides this FIsH wants to be easy to port for everyone thats why it uses standard components only.

AFAIK it is not supported anymore anyways.

FIsH vs other RAM hijacks

The main reasons why FIsH exists are described already (LL support, easy portable and easy to use) so if you still feel that this is not different from the others... i dunno what to say :P

FIsHing (Hijacking) means:

FIsH kills all running services, scripts, binaries it can find.

Afterwards it will unmount everything and delete all files left behind from the initial ramdisk.

Now in that more or less clean state it will replace the initrd with the FIsHFOOD - means your own ramdisk like e.g. TWRP.

Some other stuff may happen also but at the end a binary will be started - normally a /init from your own ramdisk

So in sum it is a live replacemnt of the current ramdisk with your own.

Requirement <SuperSU>

It prepares the system to run the FIsH init script and also ensures that SELinux can be run in permissive mode.

Keep in mind that FIsH will enforce permissive mode on boot to do it's job so you do not have to do anything (normally) to let the FIsH boot.

Main components of FIsH:

./install.sh (file)

The installer is the first part you may need to adjust when you want to port FIsH.

This installer is for Linux users only. If you want to have Windows users executing FIsH point them to https://tinyurl.com/FWULatXDA !!

.. but you're free to port the installer to Windows (if u like: bring it back to me so I may include it..)

Your FIsHFOOD (your own ramdisk) has to be compatible to your running STOCK ROM. If you have LL 5.x running your ramdisk has to run / build for it.

important variables:

MINSDK: Adjust this SDK level to match your runnin STOCK ROM which has to be compatible with your FIsHFOOD

MINSU: The minimum SuperSU version required. Do not use anything lower than 279 (means 2.79) because this may not work!

BUSYBOXURI: This is a full URL to a busybox binary compatible with your device. You may have to adjust this but ensure u use a compatible version

because we highly depend on its syntax. The reason why FIsH does not come with busybox bundled is besides license stuff (I do not wanted to provide their

sources :P ) it may be required that you need another binary then me.

fishing/ (directory)

The real FIsH. Means all files which gets copied to the target device.

fishing/busybox (file - will be auto downloaded by the installer)

You should know what it is..

FIsH comes without busybox but the installer will download it automatically and place it here.

FIsH uses busybox to have all commands with the expected syntax in place and we highly depend on this in the hijack process!

fishing/fishfood.gz (file)

The FIsHFOOD is your own ramdisk - in gziped cpio (e.g. TWRP)

This ramdisk has to be compatible to your device's ROM. Means when you have a STOCK ROM 5.1 installed your ramdisk have to be compatible to LL 5.1.

You can ensure this within the installer (see FIsH Installer) where the Android version will be read and compared before FIsH installs actually.

fishing/fishfood.release (file)

The version and content of your FIsHFOOD

I recommend the following naming convention:

[yourFIsHFOOD]-in-FIsH-v[VERSIONNUMBER]_[DEVICE-MODEL]_[Android-Version]

e.g.

TWRP-in-FIsH-v1_LG-G4_LL

You can write in here whatever you like. The content will be send to the fish.log to identify which version the user has installed (helps debugging).

fishing/callmeFIsH (file)

a caller script which gets executed at very first.

The only task callmeFIsH has is to prepare the whole FIsH to get started out of /system and then starting FIsH from /res. After this it immediately exists to not keep open tasks on /system. callmeFIsH will be placed in /system/su.d/ to get autostarted by SuperSU.

fishing/FIsH (file)

The heart of the FIsH.. Get's called by callmeFIsH.

It will be executed by SuperSU on boot and will hijack the process and prepare and setup everything to let your FIsHFOOD coming up.

fishing/FIsH.me (file)

Functions and vars a user/dev normally wouldn't need to change. They are internal stuff only.

fishing/FIsH.porting (file)

As you're trying to port FIsH this file is your main part when it comes to customization for your device.

Here you should find everything required to be adapted and there are very high chances that you HAVE to adjust this to your device.

fishing/gofishing.sh (file)

The remote installer part. It will actually run as root and prepare your system for FIsH.

You normally will never need to touch this.

FIsH target directories

/system/fish/

All the bowels of FIsH like, FIsH, Busybox, fishfood.gz and fishfood.release go here

/system/su.d/

The FIsH caller (callmeFIsH) goes here

/cache/fish/

The most important directory for you: Here you will find all logfiles required for debugging!

.