[Android Q&A, Help & Troubleshooting] ivelischt:
[CFW][W_K400][TREBLE] CFW and ROOT, MOSTLY-VANILLA

PART 2 OF THE POST, START WITH PART 1!!!!

2. Preparing your SuperR installation for your Custom AOSP Rom

In the Project Name we enter something identifying. Keep in mind that you may want to add multiple roms on this installation, so you should make it something rather unique. This process corresponds somewhat to Step 2.1, so you can read this one already to find out a good notation for your new project. I have already chosen my Treble image and will call mine

Enter new project name ...
lenny5_aosp8.1_vanilla_su_v32

2.1 Find out which Treble image you need

As you see in the last step, i selected a Version 8.1 "Oreo" image, where Vanilla tells you that theres no gapps at all and the suffix su means that it contains a rooted system. But later more about this. Also i chose v32 from the treble_experimentations releases.

To find your treble image, you need to have some information. First of all, read the information on this link. (phhusson's github wiki for Wiko Lenny 5)

Some informations here are important. First of all the flashing sequence, which will get important to us in a later step

Enable adb and oem unlock in developer options
adb reboot bootloader
fastboot flashing unlock
fastboot oem unlock
fastboot flash system your_gsi_path
fastboot reboot

as well as his testing notice

Flashed using Phh-Treble v18 - arm

as you can read in the Before starting section, there is a bug i could not resolve concerning installing older version ROMS, which could spontaneously start to apply to your device. i cannot "downgrade" my device, because it bootloops.

to select your image of choice, go to this site. (phhusson's treble image release site). to find v18, you will need to scroll down and go a few pages back in history.

some things to consider:

- lenny5 doesn't seem to be able to run AOSP9, so i'd recommend you stick with AOSP8.1

- there are lineageos compilations which might be interesting for some people. (i cannot tell if the root process for lineageos massively differs, as i don't use that one)

we will stick with AOSP8.1 in this guide.

first of all, you must decide if you want to stick with the go apps, install the stock gapps or go vanilla (no gapps at all). i will stick with vanilla. (note that some versions do not have the go version, others do)

then you will want to ask yourself if you want to root your phone, which we assume here to be yes.

as vanilla, like in our case, is not available with preinstalled su, we will stick with the nosu version. (which is a bit of a "hoax", as in fact this version already is rooted, you just have no way of controlling it, yet. we will take care of that in a later step.)

for our wiko lenny 5 we must choose the arm-aonly architecture. also i choose to stick with v32, the newest version per guide release date.

in my decision case, this leaves us with the following ROM:

https://github.com/phhusson/treble_experimentations/releases/tag/v32

system-arm-aonly-vanilla-nosu.img.xz

we will stick with that. if you want to use another rom, you must modify your choice. the overall process stays more or less the same. CONSIDER: It's proves easier to install some missing APK's etc. to your gapps-less system than removing unwanted gapps from your gapps-prebloated system.

click on the link and download the image file.

CONSIDER: Some of the images are in raw flashable format (the older ones), and have the extension *.img . For newer versions, the images are packed and CANNOT BE DIRECTLY FLASHED. these files are namely the ones with the extension *.img.xz

if your file has an extension that differs from *.img i strongly recommend you to use 7zip to extract the contained *.img file. 7-zip handles them all, which makes it the perfect standalone (de-)archiver on your computer. and no, i'm not getting paid by them for the advertising, it's just great and opensource. :)

now, if you didn't already, enter the name identifying your rom into the kitchen and confirm with ENTER.

to allow smb to write to your new project folder, reuse the command

sudo chown -R ~/android

by quitting superr (using the q key) or opening a second terminal (the easier way, in the original CTRL + ALT + T terminal on lubuntu, just doubleclick the top Tab-Bar off any other tabs and a new terminal tab will open) in which you execute this command.

now store the image file to your

host

workfolder and from there, copy it to your

virtual

workfolder's project folder (~/android/superr_<yourprojectname>/).

rename your system-arm-aonly-....img to just system.img for the kitchen to recognize it.

2.2 Extract your Treble image

To extract your Image file, on your

virtual

machines terminal, superr's kitchen should be running in the Main Menu.

if by any means you have stopped it, open a terminal with CTRL + ALT + T and enter

cd ~/android
./superr

press enter to execute and superr should launch. when asked for a project to load, choose the project you just created by pressing the correspondant cipher on the keyboard.

in the kitchen main menu, push cipher 4 on your keyboard to extract your obtained IMG-File. if asked, select your system.img by pressing the correspondant key and confirm the extraction with the "Y" key. wait for the process to finish. if asked, enter your

virtual

machine's user password. the kitchen sometimes needs to elevate some of it's processes during the extraction.

for the name of the zip, when asked, just enter "system_new". this is not so important, just dont simply call it "system", as this might confuse you under some circumstances and in the worst case overwrite your stock system.img.

for the perm type, select set_metadata by typing the "1" key on your keyboard, and you should be back in the main menu.

now your system image is unpacked into your

virtual

machine workfolder (~/android/<yourprojectfoldername>/system/)

2.3 Editing the contents (Rooting, etc.) of the Treble image

The editing in this guide's usecase is quite simple. We will want the following features and packages preinstalled:

- Root, of course

- including Root Management App

- BusyBox

- FDroid

- ...

you can add to this list to your hearts delight. The above will be my initial setup.

First we need to get the Root files.

These are found here

from this thread, get phh's-superuser.zip (the topmost file)

aswell as the phh's SuperUser apk file (top-second)

if you are having issues with the superuser implementation, try the bottommost element called phh's-superuser-aonly.zip instead of phh's-superuser.zip. this should normaly not be required.

copy both, the .zip and the .apk to your

host

workfolder.

now unpack the .zip to your

host

workfolder, which should create a folder "system" with 3 subfolders "bin,etc,xbin" in it.

copy this "system" folder to your

virtual

workfolder and into your project, so it integrates with the existing "system" folder on the virtual machine. if it asks you to overwrite, just allow it.

your

virtual

workfolder's project folder should now contain the following 3 files:

system/bin/phh-su
system/etc/init/su.rc
system/xbin/su

amongst the other system files.

Now download FDroid from here (the F-Droid site was temporarily down at the time of writing this guide)

Download the FDroid APK and store it in your

host

machine's workfolder.

After that, download the BusyBox APK from here

https://www.appsapk.com/busybox-app/

or a source you thrust more. There is a official busybox source, but i did not check which binary i must use for the Lenny 5, so i stick with the simplest method.

Download the BusyBox APK and store it in your

host

machine's workfolder.

Now copy the FDroid, BusyBox, and previously downloaded phh_s_SuperUser APK's from the

host

's workfolder to your

virtual

machine's project folder ~/android/<yourprojectfolder>/system/app/ (or \\<<yourvirtualmachineip\androshare\<yourprojectfolder>\system\app, respectively) to include them in your new ROM.

Thats basically all of the magic done. Your ~/android/<yourprojectfolder> should now contain the following 6 Elements

system/bin/phh-su
system/etc/init/su.rc
system/xbin/su
app/FDroid.apk
app/BusyBox.apk
app/phh_s_SuperUser_vX.X.X.X.apk

amongst the other elements from the Treble ROM.

move the APK app/FDroid.apk to a new Folder like this: app/FDroid/FDroid.apk

move the APK app/BusyBox.apk to a new Folder like this: app/BusyBox/BusyBox.apk

move the APK app/phh_s_SuperUser_vX.X.X.X.apk to a new Folder like this: app/phh/phh_s_SuperUser_vX.X.X.X.apk

as everything is sorted into folders, right?! :)

now we're done with modifying our treble image. lets repack it.

2.4 Repacking the Treble image

on your

virtual

machine terminal, with the kitchen open, go to the main menu if required and select "ROM Tools Menu" with the "8" key. You can check the "Root Menu" by pressing the "3" Key.

The Root/Unroot ROM should read (CURRENT: xbin/su) with Busybox and su.d "Disabled", which is okay, as BusyBox is not recognized, but there. If you want to utilize su.d, you must know yourself, how to do that properly. i don't know if it works as it should when done in the kitchen.

go back to the "ROM Tools Menu" with the "4" key and go to the "Build Menu" with the "7" key. Choose the option to "Build EXT4 img" by the key "2" and after the quick process finishes, in the menu "Which EXT4 img would you like to build?" select "system" by pressing the corresponding key, then select "sparse" by pressing the "2" key. for the file size, select the option to "Assume file size from project folder" by pressing the correspondent key and confirm the warning about this being BETA. Then wait for the process to finish.

The kitchen should say "system_new.img has been created in <yourprojectname>".

Now copy the newly created system_new.img from your

virtual

machine project directory to your

host

machine workfolder and we're done with editing and repacking the Image.

STEP 3 AND ON IN THIRD POST (CHARACTER LIMIT)